/// <summary> /// Load all items from Editor Prefs. /// </summary> void Load() { mTab = NGUISettings.GetInt("NGUI Prefab Tab", 0); mMode = NGUISettings.GetEnum <Mode>("NGUI Prefab Mode", mMode); foreach (Item item in mItems) { DestroyTexture(item); } mItems.Clear(); string data = NGUISettings.GetString(saveKey, ""); if (string.IsNullOrEmpty(data)) { Reset(); } else { if (string.IsNullOrEmpty(data)) { return; } string[] guids = data.Split('|'); foreach (string s in guids) { AddGUID(s, -1); } RectivateLights(); } }
/// <summary> /// Load all items from Editor Prefs. /// </summary> void Load() { mTab = NGUISettings.GetInt("NGUI Prefab Tab", 0); mMode = NGUISettings.GetEnum <Mode>("NGUI Prefab Mode", mMode); { // foreach(var item in mItems) var __enumerator5 = (mItems).GetEnumerator(); while (__enumerator5.MoveNext()) { var item = (Item)__enumerator5.Current; DestroyTexture(item); } } mItems.Clear(); string data = NGUISettings.GetString(saveKey, ""); if (string.IsNullOrEmpty(data)) { Reset(); } else { if (string.IsNullOrEmpty(data)) { return; } string[] guids = data.Split('|'); { var __array6 = guids; var __arrayLength6 = __array6.Length; for (int __i6 = 0; __i6 < __arrayLength6; ++__i6) { var s = (string)__array6[__i6]; AddGUID(s, -1); } } RectivateLights(); } }
static public void AddLabel() { GameObject go = NGUIEditorTools.SelectedRoot(true); if (go != null) { #if UNITY_3_5 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2 Undo.RegisterSceneUndo("Add a Label"); #endif TextFxNGUI w = NGUITools.AddWidget <TextFxNGUI>(go); w.name = NEW_INSTANCE_NAME; w.ambigiousFont = NGUISettings.ambigiousFont; w.text = "New Label"; w.pivot = NGUISettings.pivot; w.width = 120; w.height = Mathf.Max(20, NGUISettings.GetInt("NGUI Font Height", 16)); w.fontStyle = NGUISettings.fontStyle; w.fontSize = NGUISettings.fontSize; w.applyGradient = true; w.gradientBottom = new Color(0.7f, 0.7f, 0.7f); w.AssumeNaturalSize(); // return w; if (w.bitmapFont == null && w.trueTypeFont == null) { w.trueTypeFont = Resources.GetBuiltinResource(typeof(Font), "Arial.ttf") as Font; } Selection.activeGameObject = w.gameObject; } else { Debug.Log("You must select a game object first."); } }