/// <summary> /// Paste the specified sprite's style. /// </summary> static void PasteSprite(UISprite sp, bool fully) { if (fully) { sp.atlas = NGUIEditorTools.GUIDToObject <UIAtlas>(GetString("Atlas", null)); } sp.spriteName = GetString("Sprite", sp.spriteName); sp.type = GetEnum <UISprite.Type>("Sprite Type", sp.type); sp.fillAmount = GetFloat("Fill", sp.fillAmount); sp.fillCenter = GetBool("FCenter", sp.fillCenter); sp.fillDirection = GetEnum <UISprite.FillDirection>("FDir", sp.fillDirection); }
/// <summary> /// Paste the specified sprite's style. /// </summary> static void PasteSprite(UISprite sp, bool fully) { if (fully) { sp.atlas = NGUIEditorTools.GUIDToObject <UIAtlas>(GetString("Atlas", null)); } sp.spriteName = GetString("Sprite", sp.spriteName); sp.type = GetEnum <UISprite.Type>("Sprite Type", sp.type); sp.leftType = GetEnum <UISprite.AdvancedType>("Left Type", UISprite.AdvancedType.Sliced); sp.rightType = GetEnum <UISprite.AdvancedType>("Right Type", UISprite.AdvancedType.Sliced); sp.topType = GetEnum <UISprite.AdvancedType>("Top Type", UISprite.AdvancedType.Sliced); sp.bottomType = GetEnum <UISprite.AdvancedType>("Bottom Type", UISprite.AdvancedType.Sliced); sp.centerType = GetEnum <UISprite.AdvancedType>("Center Type", UISprite.AdvancedType.Sliced); sp.fillAmount = GetFloat("Fill", sp.fillAmount); sp.fillDirection = GetEnum <UISprite.FillDirection>("FDir", sp.fillDirection); }
/// <summary> /// Paste the specified label's style. /// </summary> static void PasteLabel(UILabel lbl, bool fully) { if (fully) { Object obj = NGUIEditorTools.GUIDToObject(GetString("Font", null)); if (obj != null) { if (obj.GetType() == typeof(Font)) { lbl.ambigiousFont = obj as Font; } else if (obj.GetType() == typeof(GameObject)) { lbl.ambigiousFont = (obj as GameObject).GetComponent <UIFont>(); } } lbl.fontSize = GetInt("Font Size", lbl.fontSize); lbl.fontStyle = GetEnum <FontStyle>("Font Style", lbl.fontStyle); } lbl.overflowMethod = GetEnum <UILabel.Overflow>("Overflow", lbl.overflowMethod); lbl.useFloatSpacing = GetBool("UseFloatSpacing", lbl.useFloatSpacing); lbl.floatSpacingX = GetFloat("FloatSpacingX", lbl.floatSpacingX); lbl.floatSpacingY = GetFloat("FloatSpacingY", lbl.floatSpacingY); lbl.spacingX = GetInt("SpacingX", lbl.spacingX); lbl.spacingY = GetInt("SpacingY", lbl.spacingY); lbl.maxLineCount = GetInt("MaxLines", lbl.maxLineCount); lbl.supportEncoding = GetBool("Encoding", lbl.supportEncoding); lbl.applyGradient = GetBool("Gradient", lbl.applyGradient); lbl.gradientBottom = GetColor("Gradient B", lbl.gradientBottom); lbl.gradientTop = GetColor("Gradient T", lbl.gradientTop); lbl.effectStyle = GetEnum <UILabel.Effect>("Effect", lbl.effectStyle); lbl.effectColor = GetColor("Effect C", lbl.effectColor); float x = GetFloat("Effect X", lbl.effectDistance.x); float y = GetFloat("Effect Y", lbl.effectDistance.y); lbl.effectDistance = new Vector2(x, y); NGUITools.SetDirty(lbl); }
/// <summary> /// Add a new item to the list. /// </summary> Item AddGUID(string guid, int index) { GameObject go = NGUIEditorTools.GUIDToObject <GameObject>(guid); if (go != null) { Item ent = new Item(); ent.prefab = go; ent.guid = guid; GeneratePreview(ent, null); if (index < mItems.size) { mItems.Insert(index, ent); } else { mItems.Add(ent); } return(ent); } return(null); }