/// <summary> /// 此函数用于获取背景按钮对象,并绑定按钮事件,又皮肤框架调用 /// </summary> protected override void ProcessUserButtons() { base.ProcessUserButtons(); //获取背景按钮对象 if (this.Layout.ButtonManager["btHorizontal"] != null) { btHorizontal1 = this.Layout.ButtonManager["btHorizontal"]["btHorizontal1"]; btHorizontal2 = this.Layout.ButtonManager["btHorizontal"]["btHorizontal2"]; btHorizontal3 = this.Layout.ButtonManager["btHorizontal"]["btHorizontal3"]; btHorizontal4 = this.Layout.ButtonManager["btHorizontal"]["btHorizontal4"]; } //绑定按钮事件 if (btHorizontal1 != null) { btHorizontal1.SetClickEventHandler(OnbtHorizontalClick); } if (btHorizontal2 != null) { btHorizontal2.SetClickEventHandler(OnbtHorizontalClick); } if (btHorizontal3 != null) { btHorizontal3.SetClickEventHandler(OnbtHorizontalClick); } if (btHorizontal4 != null) { btHorizontal4.SetClickEventHandler(OnbtHorizontalClick); } }
private void OnbtHorizontalClick(DUIButton sender) { //MessageBox.Show("You click close button!这是一个Hold住的按钮!"); //将同组的所有按钮置为非按下状态 sender.OwnerGroup.ResetAllButtonHoldDownStatus(); //将当前按钮置为按下状态 sender.HoldDown = true; this.Update(); //此处调用一次窗口刷新函数,导致一次重绘,使按钮状态及时更新,提高用户体验 this.mainContentHolder1.SwitchToForm(sender.Name.Substring(12, 1)); }
/// <summary> /// 此函数用于获取背景按钮对象,并绑定按钮事件,又皮肤框架调用 /// </summary> protected override void ProcessUserButtons() { base.ProcessUserButtons(); //获取背景按钮对象 if (this.Layout.ButtonManager["Menu"] != null) { btMenuButton1 = this.Layout.ButtonManager["Menu"]["btMenu1"]; btMenuButton2 = this.Layout.ButtonManager["Menu"]["btMenu2"]; btMenuButton3 = this.Layout.ButtonManager["Menu"]["btMenu3"]; btMenuButton4 = this.Layout.ButtonManager["Menu"]["btMenu4"]; btMenuButton5 = this.Layout.ButtonManager["Menu"]["btMenu5"]; btMenuButton6 = this.Layout.ButtonManager["Menu"]["btMenu6"]; btMenuButton7 = this.Layout.ButtonManager["Menu"]["btMenu7"]; btMenuButton8 = this.Layout.ButtonManager["Menu"]["btMenu8"]; } //绑定按钮事件 if (btMenuButton1 != null) { btMenuButton1.SetClickEventHandler(OnMenuButtonClick); } if (btMenuButton2 != null) { btMenuButton2.SetClickEventHandler(OnMenuButtonClick); } if (btMenuButton3 != null) { btMenuButton3.SetClickEventHandler(OnMenuButtonClick); } if (btMenuButton4 != null) { btMenuButton4.SetClickEventHandler(OnMenuButtonClick); } if (btMenuButton5 != null) { btMenuButton5.SetClickEventHandler(OnMenuButtonClick); } if (btMenuButton6 != null) { btMenuButton6.SetClickEventHandler(OnMenuButtonClick); } if (btMenuButton7 != null) { btMenuButton7.SetClickEventHandler(OnMenuButtonClick); } if (btMenuButton8 != null) { btMenuButton8.SetClickEventHandler(OnMenuButtonClick); } }
private void Awake() { gameObject.SetActive(Settings.ORBITALS); m_anchor = GetComponent <DUIAnchor>(); m_button = GetComponent <DUIButton>(); m_collider = GetComponent <BoxCollider>(); m_button.OnDrag += (Vector2 drag) => { root.RotateAround(Vector3.up, drag.x * DRAG_SPEED); root.RotateAround(Vector3.right, -drag.y * DRAG_SPEED); }; }
protected virtual void Awake() { //find components PhysicsObj = GetComponent <PhysicsObject>(); sphereButton = GetComponent <DUIButton>(); //set spherebutton to have same radius as particle //sphereButton.Radius = Mathf.Max(0.5f, Radius); //get the satic reference to the atom if (atom == null) { atom = FindObjectOfType <Atom>(); if (atom == null) { throw new System.Exception("An Atom class is needed"); } } //hook up events sphereButton.OnClick.AddListener(Select); OnSelect.AddListener(Select); OnDeselect.AddListener(Deselect); }