internal SelectBoxElement(string name, IPsdLayer layer, ElementType type, IPsdLayer[] childs) : base(name, layer, type, childs) { normal = FindChildElement(normalSuffix); if (normal != null) { normalPiece = new TexturePiece(name + normalSuffix, GetTexture2D(normal)); } else { canShow = false; P2UUtil.AddError("勾选框:" + name + "需要有一张未选择态的图"); } select = FindChildElement(selectSuffix); if (select != null) { selectPiece = new TexturePiece(name + selectSuffix, GetTexture2D(select)); } else { canShow = false; P2UUtil.AddError("勾选框:" + name + "需要有一张选择态的图"); } }
//初始化 internal ButtonElement(string name, IPsdLayer layer, ElementType type, IPsdLayer[] childs) : base(name, layer, type, childs) { var normalSuffix = "@normal"; var pressedSuffix = "@pressed"; var disabledSuffix = "@disabled"; normal = FindChildElement(normalSuffix); if (normal != null && normal.HasImage) { normalPiece = new TexturePiece(name + normalSuffix, GetTexture2D(normal)); } else { canShow = false; P2UUtil.AddError("按钮:" + name + "至少要有一张正常态的图片"); } pressed = FindChildElement(pressedSuffix); if (pressed != null && pressed.HasImage) { pressedPiece = new TexturePiece(name + pressedSuffix, GetTexture2D(pressed)); } disabled = FindChildElement(disabledSuffix); if (disabled != null && disabled.HasImage) { disabledPiece = new TexturePiece(name + disabledSuffix, GetTexture2D(disabled)); } }
public Image9Element(string name, IPsdLayer layer, ElementType type, IPsdLayer[] childs) : base(name, layer, type, childs) { Png9 = FindChildElement(png9Suffix); if (Png9 != null) { Png9Piece = new TexturePiece(name, GetTexture2D(Png9), true); } else { canShow = false; P2UUtil.AddError("九宫格图:" + name + "需要有一张九宫格大小的图"); } Preview = FindChildElement(previewSuffix); if (Preview != null) { PreviewPiece = new TexturePiece(name + previewSuffix, GetTexture2D(Preview), false); } else { canShow = false; P2UUtil.AddError("九宫格图:" + name + "需要有一张预览图来决定其大小"); } }
internal ListElement(string name, IPsdLayer layer, ElementType type, IPsdLayer[] childs) : base(name, layer, type, childs) { Background = FindChildElement(backgroundSuffix); if (Background != null && Background.HasImage) { BackgroundPiece = new TexturePiece(name + backgroundSuffix, GetTexture2D(Background)); } else { canShow = false; P2UUtil.AddError("列表:" + name + "需要有一张背景图来确定列表区域"); } }
internal ImageElement(string name, IPsdLayer layer, ElementType type, IPsdLayer[] childs) : base(name, layer, type, childs) { Texture = layer; TexturePiece = new TexturePiece(name, GetTexture2D(layer), false); }
internal TextElement(string name, IPsdLayer layer, ElementType type, IPsdLayer[] childs) : base(name, layer, type, childs) { text = layer; textPiece = new TexturePiece(name, GetTexture2D(layer), type == ElementType.Image9); }