zp-figma-converter
Version:
Convert Figma designs to various code formats
239 lines • 6.51 kB
TypeScript
import { Size, Position, Scale, Color, AnchorPoint, BlendFunc, FileData, ColorVector, PrePosition, PreSize, Vector2 } from './common';
/**
* Interface for common node data
*/
export interface BaseNodeData {
Name: string;
ctype: string;
Tag?: number;
ActionTag?: number;
Size?: Size;
Position?: Position;
Scale?: Scale;
RotationSkewX?: number;
RotationSkewY?: number;
CColor?: Color;
IconVisible?: boolean;
PrePosition?: PrePosition;
PreSize?: PreSize;
Alpha?: number;
HorizontalEdge?: string;
VerticalEdge?: string;
LeftMargin?: number;
RightMargin?: number;
TopMargin?: number;
BottomMargin?: number;
AnchorPoint?: AnchorPoint;
FlipX?: boolean;
FlipY?: boolean;
Children?: BaseNodeData[];
}
export interface WidgetData extends BaseNodeData {
ctype: string;
TouchEnable?: boolean;
}
/**
* Interface for SingleNodeObjectData (cc.Node)
*/
export interface SingleNodeData extends BaseNodeData {
ctype: 'SingleNodeObjectData';
}
/**
* Interface for SpriteObjectData (cc.Sprite)
*/
export interface SpriteData extends BaseNodeData {
ctype: 'SpriteObjectData';
FileData: FileData;
BlendFunc?: BlendFunc;
FlipX?: boolean;
FlipY?: boolean;
}
/**
* Interface for ButtonObjectData (ccui.Button)
*/
export interface ButtonData extends WidgetData {
ctype: 'ButtonObjectData';
FontSize?: number;
ButtonText?: string;
FontResource?: FileData;
TextColor?: Color;
DisabledFileData?: FileData;
PressedFileData?: FileData;
NormalFileData?: FileData;
Scale9Enable?: boolean;
Scale9OriginX?: number;
Scale9OriginY?: number;
Scale9Width?: number;
Scale9Height?: number;
OutlineColor?: Color;
ShadowColor?: Color;
ShadowOffsetX?: number;
ShadowOffsetY?: number;
}
/**
* Interface for ImageViewObjectData (ccui.ImageView)
*/
export interface ImageViewData extends WidgetData {
ctype: 'ImageViewObjectData';
FileData: FileData;
Scale9Enable?: boolean;
Scale9OriginX?: number;
Scale9OriginY?: number;
Scale9Width?: number;
Scale9Height?: number;
}
/**
* Interface for TextObjectData (ccui.Text)
*/
export interface TextData extends WidgetData {
ctype: 'TextObjectData';
FontSize?: number;
LabelText?: string;
FontResource?: FileData;
HorizontalAlignmentType?: string;
OutlineEnabled?: boolean;
OutlineColor?: Color;
ShadowColor?: Color;
ShadowOffsetX?: number;
ShadowOffsetY?: number;
ShadowEnabled?: boolean;
}
/**
* Interface for CheckBoxObjectData (ccui.CheckBox)
*/
export interface CheckBoxData extends WidgetData {
ctype: 'CheckBoxObjectData';
DisplayState?: boolean;
SelectedState?: boolean;
CheckedState?: boolean;
BackGroundBoxData?: FileData;
BackGroundBoxDisabledData?: FileData;
FrontCrossData?: FileData;
FrontCrossDisabledData?: FileData;
NormalBackFileData?: FileData;
PressedBackFileData?: FileData;
DisableBackFileData?: FileData;
NodeNormalFileData?: FileData;
NodeDisableFileData?: FileData;
}
/**
* Interface for TextAtlasObjectData (ccui.TextAtlas)
*/
export interface TextAtlasData extends WidgetData {
ctype: 'TextAtlasObjectData';
LabelText?: string;
CharWidth?: number;
CharHeight?: number;
StartChar?: string;
LabelAtlasFileImage_CNB?: FileData;
}
/**
* Interface for TextBMFontObjectData (ccui.TextBMFont)
*/
export interface TextBMFontData extends WidgetData {
ctype: 'TextBMFontObjectData';
LabelText?: string;
FileNameData?: FileData;
}
/**
* Interface for LoadingBarObjectData (ccui.LoadingBar)
*/
export interface LoadingBarData extends WidgetData {
ctype: 'LoadingBarObjectData';
ProgressInfo?: number;
Direction?: number;
ImageFileData?: FileData;
}
/**
* Interface for SliderObjectData (ccui.Slider)
*/
export interface SliderData extends WidgetData {
ctype: 'SliderObjectData';
PercentInfo?: number;
BackGroundData?: FileData;
ProgressBarData?: FileData;
BallNormalData?: FileData;
BallPressedData?: FileData;
BallDisabledData?: FileData;
DisplayState?: boolean;
}
/**
* Interface for TextFieldObjectData (ccui.TextField)
*/
export interface TextFieldData extends WidgetData {
ctype: 'TextFieldObjectData';
FontSize?: number;
IsCustomSize?: boolean;
LabelText?: string;
PlaceHolderText?: string;
MaxLengthEnable?: boolean;
MaxLengthText?: number;
PasswordEnable?: boolean;
FontResource?: FileData;
TextColor?: Color;
PlaceHolderColor?: Color;
OutlineEnabled?: boolean;
OutlineColor?: Color;
ShadowEnabled?: boolean;
ShadowColor?: Color;
}
/**
* Common properties for PanelObjectData and ScrollViewObjectData
*/
export interface PanelBaseData extends WidgetData {
ClipAble?: boolean;
BackColorAlpha?: number;
FileData?: FileData;
ComboBoxIndex?: number;
SingleColor?: Color;
FirstColor?: Color;
EndColor?: Color;
ColorVector?: ColorVector;
Scale9Enable?: boolean;
Scale9OriginX?: number;
Scale9OriginY?: number;
Scale9Width?: number;
Scale9Height?: number;
}
/**
* Interface for PanelObjectData (ccui.Layout)
*/
export interface PanelData extends PanelBaseData {
ctype: 'PanelObjectData' | string;
}
/**
* Interface for ScrollViewObjectData (ccui.ScrollView)
*/
export interface ScrollViewData extends PanelData {
ctype: 'ScrollViewObjectData' | string;
IsBounceEnabled?: boolean;
InnerNodeSize?: Vector2;
ScrollDirectionType?: string;
DirectionType?: string;
}
/**
* Interface for ListViewObjectData (ccui.ListView)
*/
export interface ListViewData extends ScrollViewData {
ctype: 'ListViewObjectData';
ItemMargin?: number;
VerticalType?: string;
}
/**
* Interface for PageViewObjectData (ccui.PageView)
*/
export interface PageViewData extends ScrollViewData {
ctype: 'PageViewObjectData';
}
/**
* Interface for GameNodeObjectData (scene root)
*/
export interface GameNodeData extends BaseNodeData {
ctype: 'GameNodeObjectData';
Children: BaseNodeData[];
}
/**
* Interface for other node types
*/
export type NodeData = SingleNodeData | SpriteData | ButtonData | ImageViewData | TextData | PanelData | CheckBoxData | TextAtlasData | TextBMFontData | LoadingBarData | SliderData | TextFieldData | ScrollViewData | PageViewData | ListViewData | GameNodeData;
//# sourceMappingURL=nodes.d.ts.map