Ejemplo n.º 1
0
        internal override void RegisterUIControlEvent(string uiControlsName, UIBehaviour uIBehaviour)
        {
            switch (uiControlsName)
            {
            case "Background":
                uIBehaviour.OnEventTrigger(UnityEngine.EventSystems.EventTriggerType.Drag,
                                           new UnityEngine.Events.UnityAction <UnityEngine.EventSystems.BaseEventData>((baseEvent) =>
                                                                                                                       DragWindow(this.currentWindow)
                                                                                                                       ));
                break;

            case "Seting":
                uIBehaviour.OnButtonClick(new UnityEngine.Events.UnityAction(() =>
                                                                             UIManager.Instance.OpenPanel("SetingPanel")
                                                                             ));
                break;

            case "Minimize":
                uIBehaviour.OnButtonClick(new UnityEngine.Events.UnityAction(() => {
                    //最小化
                    ShowWindow(GetForegroundWindow(), SW_SHOWMINIMIZED);
                }));
                break;

            case "Maximize":
                uIBehaviour.OnButtonClick(new UnityEngine.Events.UnityAction(() => {
                    if (isMax)
                    {
                        //还原
                        ShowWindow(GetForegroundWindow(), SW_SHOWRESTORE);
                        this.isMax = false;
                    }
                    else
                    {
                        //最大化
                        ShowWindow(GetForegroundWindow(), SW_SHOWMAXIMIZED);
                        this.isMax = true;
                    }
                }));
                break;

            case "Close":
                uIBehaviour.OnButtonClick(new UnityEngine.Events.UnityAction(() => {
                    if (UnityEngine.Application.isEditor)
                    {
                        return;
                    }
                    UnityEngine.Application.Quit();
                }));
                break;

            default:
                break;
            }
        }