public override void SubReset() { Name = "Label"; Font_Type = UILabelInspector.FontType.NGUI; UI_Font = null; //Dyn_Font = null; Font_Size = -1; Overflow_Width = -1; Max_Lines = -1; Font_Style = FontStyle.Normal; Overflow_Method = UILabel.Overflow.ResizeFreely; Crisp = UILabel.Crispness.Never; Modifier_Type = UILabel.Modifier.None; Alig_Type = NGUIText.Alignment.Automatic; Symbol_Style = NGUIText.SymbolStyle.Normal; Effect_Type = UILabel.Effect.None; UseEllipsis = false; Gradient = false; BBCode = true; Gradient_Top_Color = Color.white; Gradient_Bottom_Color = new Color(0.7f, 0.7f, 0.7f); Effect_Color = Color.black; Effect_Distance = new Vector2(-1, -1); }
static int set_keepCrispWhenShrunk(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UILabel obj = (UILabel)o; UILabel.Crispness arg0 = (UILabel.Crispness)ToLua.CheckObject(L, 2, typeof(UILabel.Crispness)); obj.keepCrispWhenShrunk = arg0; return 0; } catch(Exception e) { return LuaDLL.toluaL_exception(L, e, o, "attempt to index keepCrispWhenShrunk on a nil value"); } }
static int get_keepCrispWhenShrunk(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UILabel obj = (UILabel)o; UILabel.Crispness ret = obj.keepCrispWhenShrunk; ToLua.Push(L, ret); return 1; } catch(Exception e) { return LuaDLL.toluaL_exception(L, e, o, "attempt to index keepCrispWhenShrunk on a nil value"); } }
public override void DrawSubProperty() { state = UIModifierUtils.DrawContentHeader("UILabel", state); if (state) { #region Font EditorGUILayout.HelpBox("暂时只支持Dynamic Fonts替换", MessageType.Warning); GUILayout.BeginHorizontal(); EditorGUI.BeginDisabledGroup(true); Font_Type = (UILabelInspector.FontType)EditorGUILayout.EnumPopup(Font_Type, "DropDown", GUILayout.Width(74f)); EditorGUI.EndDisabledGroup(); if (GUILayout.Button("Font", "DropDown", GUILayout.Width(64f))) { ComponentSelector.Show <UIFont>(OnNGUIFont); } EditorGUILayout.ObjectField(UI_Font, typeof(UIFont), false); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); { GUILayout.Label("Font Size", GUILayout.Width(66)); Font_Size = EditorGUILayout.IntField("", Font_Size, GUILayout.Width(142f)); Font_Style = (FontStyle)EditorGUILayout.EnumPopup(Font_Style); GUILayout.Space(18f); } GUILayout.EndHorizontal(); #endregion GUILayout.BeginHorizontal(); GUILayout.Label("Modifier", GUILayout.Width(66)); Modifier_Type = (UILabel.Modifier)EditorGUILayout.EnumPopup(Modifier_Type); GUILayout.Space(18f); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Alignment", GUILayout.Width(66)); Alig_Type = (NGUIText.Alignment)EditorGUILayout.EnumPopup(Alig_Type); GUILayout.Space(18f); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Effect", GUILayout.Width(66)); Effect_Type = (UILabel.Effect)EditorGUILayout.EnumPopup(Effect_Type); if (Effect_Type != UILabel.Effect.None) { Effect_Color = EditorGUILayout.ColorField(Effect_Color, GUILayout.MinWidth(10f)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); { GUILayout.Label(" ", GUILayout.Width(66)); EditorGUIUtility.labelWidth = 20f; Effect_Distance.x = EditorGUILayout.FloatField("X", Effect_Distance.x, GUILayout.MinWidth(40f)); Effect_Distance.y = EditorGUILayout.FloatField("Y", Effect_Distance.y, GUILayout.MinWidth(40f)); EditorGUIUtility.labelWidth = 70; } } GUILayout.Space(18f); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Overflow", GUILayout.Width(66)); Overflow_Method = (UILabel.Overflow)EditorGUILayout.EnumPopup(Overflow_Method); GUILayout.Space(18f); GUILayout.EndHorizontal(); //EditorGUI.indentLevel++; if (Overflow_Method == UILabel.Overflow.ClampContent) { GUILayout.BeginHorizontal(); GUILayout.Label(" ", GUILayout.Width(66)); UseEllipsis = EditorGUILayout.ToggleLeft("Use Ellipsis", UseEllipsis); GUILayout.EndHorizontal(); } else if (Overflow_Method == UILabel.Overflow.ResizeFreely) { GUILayout.BeginHorizontal(); GUILayout.Label(" ", GUILayout.Width(66)); Overflow_Width = EditorGUILayout.IntField("Max Width", Overflow_Width, GUILayout.MinWidth(100)); if (Overflow_Width < 1) { GUILayout.Label("unlimited"); } GUILayout.Space(18f); GUILayout.EndHorizontal(); } //EditorGUI.indentLevel--; GUILayout.BeginHorizontal(); Gradient = EditorGUILayout.Toggle("Gradient", Gradient, GUILayout.Width(80)); EditorGUI.BeginDisabledGroup(!Gradient); { EditorGUIUtility.labelWidth = 40; Gradient_Top_Color = EditorGUILayout.ColorField("Top", Gradient_Top_Color, GUILayout.MinWidth(60)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(" ", GUILayout.Width(80)); Gradient_Bottom_Color = EditorGUILayout.ColorField("Bottom", Gradient_Bottom_Color, GUILayout.MinWidth(60)); EditorGUIUtility.labelWidth = 70; } EditorGUI.EndDisabledGroup(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); BBCode = EditorGUILayout.Toggle("BBCode", BBCode, GUILayout.Width(80)); EditorGUI.BeginDisabledGroup(!BBCode); Symbol_Style = (NGUIText.SymbolStyle)EditorGUILayout.EnumPopup("Symbols", Symbol_Style); EditorGUI.EndDisabledGroup(); GUILayout.Space(18); GUILayout.EndHorizontal(); Max_Lines = EditorGUILayout.IntField("Max Lines", Max_Lines, GUILayout.Width(120)); EditorGUILayout.HelpBox("依据官方文档,强制修改Keep Crisp为Never", MessageType.Warning); EditorGUI.BeginDisabledGroup(true); Crisp = UILabel.Crispness.Never; GUILayout.BeginHorizontal(); GUILayout.Label("Keep Crisp", GUILayout.Width(66)); Crisp = (UILabel.Crispness)EditorGUILayout.EnumPopup(Crisp); GUILayout.Space(18f); GUILayout.EndHorizontal(); EditorGUI.EndDisabledGroup(); } }
void UpdateHTML() { if (html != null && Compiler_ != null) { currentRoot = NGUITools.FindInParents<UIRoot>(transform); currentDefaultFont = defaultFont; // we have new html text, so compile it Compiler_.Compile(html, maxLineWidth > 0 ? maxLineWidth : Screen.width); // destroy old widgets. Transform[] childs = new Transform[transform.childCount]; for (int i = 0; i < transform.childCount; ++i) childs[i] = transform.GetChild(i); foreach (Transform childTr in childs) { GameObject go; if (!gameobjs.TryGetValue(childTr.gameObject.name, out go)) { childTr.gameObject.transform.parent = null; Destroy(childTr.gameObject); } } // generate the widgets. currentDepth = depth; currentLabelOverflow = labelOverflow; currentLabelCrispness = labelCrispness; Compiler_.Draw(Time.deltaTime, transform); IDictionaryEnumerator e = gameobjs.GetEnumerator(); while (e.MoveNext()) { string id = (string)e.Key; if (!gameobjinuse.ContainsKey(id)) { Destroy((GameObject)e.Value); gameobjs.Remove(id); } } gameobjinuse.Clear(); height = Compiler_.Height(); width = Compiler_.Width(); //Debug.LogWarning("width:" + width + ",height:" + height); UpdateTarget(); if (autoScroll != AutoScrollType.MANUAL && (NGUITools.GetActive(this))) { StartCoroutine(updateAutoScroll()); } } }