public void Init() { Account = Control("Account").GetComponent <InputField>(); Password = Control("Password").GetComponent <InputField>(); Login = Control("Confirm").GetComponent <UIButtonExtended>(); Register = Control("Register").GetComponent <UIButtonExtended>(); QuickRegister = Control("QuickGame").GetComponent <UIButtonExtended>(); AutoLogin = Control("AutoLogin").GetComponent <Toggle>(); RememberPassword = Control("RemPsw").GetComponent <Toggle>(); if (GameStateMgr.Ins.gameStatus.AutoLogin) { GameStateMgr.Ins.gameStatus.RememberPassword = true; } AutoLogin.isOn = GameStateMgr.Ins.gameStatus.AutoLogin; RememberPassword.isOn = GameStateMgr.Ins.gameStatus.RememberPassword; AutoLogin.onValueChanged.AddListener((bool on) => { GameStateMgr.Ins.gameStatus.AutoLogin = on; }); RememberPassword.onValueChanged.AddListener((bool on) => { GameStateMgr.Ins.gameStatus.RememberPassword = on; }); if (!string.IsNullOrEmpty(GameStateMgr.Ins.gameStatus.Account) && GameStateMgr.Ins.gameStatus.AutoLogin) { Account.text = GameStateMgr.Ins.gameStatus.Account; } if (!string.IsNullOrEmpty(GameStateMgr.Ins.gameStatus.Password) && GameStateMgr.Ins.gameStatus.RememberPassword) { Password.text = GameStateMgr.Ins.gameStatus.Password; } if (GameStateMgr.Ins.gameStatus.AutoLogin) { AutoConnect(); } }
protected void DrawColorsAdditional() { UIButtonExtended btn = target as UIButtonExtended; if (btn.additionalTarget != null) { EditorGUI.BeginDisabledGroup(serializedObject.isEditingMultipleObjects); { SerializedObject obj = new SerializedObject(btn.additionalTarget); obj.Update(); NGUIEditorTools.DrawProperty("Normal", obj, "mColor"); obj.ApplyModifiedProperties(); } EditorGUI.EndDisabledGroup(); } NGUIEditorTools.DrawProperty("Hover", serializedObject, "additionalHover"); NGUIEditorTools.DrawProperty("Pressed", serializedObject, "additionalPressed"); NGUIEditorTools.DrawProperty("Disabled", serializedObject, "additionalDisabled"); }
protected override void DrawProperties() { base.DrawProperties(); UIButtonExtended btn = target as UIButtonExtended; if (NGUIEditorTools.DrawHeader("Extension")) { NGUIEditorTools.BeginContents(); EditorGUI.BeginDisabledGroup(serializedObject.isEditingMultipleObjects); { NGUIEditorTools.DrawProperty("Target", serializedObject, "additionalTarget"); if (btn.additionalTarget != null) { this.DrawColorsAdditional(); } } EditorGUI.EndDisabledGroup(); NGUIEditorTools.EndContents(); } }
/// <summary> /// Raises the state change event. /// </summary> /// <param name="state">State.</param> /// <param name="instant">If set to <c>true</c> instant.</param> protected virtual void OnStateChange(UIButtonExtended.VisualState state, bool instant) { // Check if the script is enabled if (!this.isActiveAndEnabled) return; Color color = this.m_Colors.normalColor; Sprite newSprite = null; string triggername = this.m_AnimationTriggers.normalTrigger; // Prepare the transition values switch (state) { case UIButtonExtended.VisualState.Normal: color = this.m_Colors.normalColor; newSprite = null; triggername = this.m_AnimationTriggers.normalTrigger; break; case UIButtonExtended.VisualState.Highlighted: color = this.m_Colors.highlightedColor; newSprite = this.m_SpriteState.highlightedSprite; triggername = this.m_AnimationTriggers.highlightedTrigger; break; case UIButtonExtended.VisualState.Pressed: color = this.m_Colors.pressedColor; newSprite = this.m_SpriteState.pressedSprite; triggername = this.m_AnimationTriggers.pressedTrigger; break; case UIButtonExtended.VisualState.Disabled: color = this.m_Colors.disabledColor; newSprite = this.m_SpriteState.disabledSprite; triggername = this.m_AnimationTriggers.disabledTrigger; break; } // Do the transition switch (this.m_Transition) { case Selectable.Transition.ColorTint: this.StartColorTween(color * this.m_Colors.colorMultiplier, instant); break; case Selectable.Transition.SpriteSwap: this.DoSpriteSwap(newSprite); break; case Selectable.Transition.Animation: this.TriggerAnimation(triggername); break; } }