GetInstance() public static method

public static GetInstance ( ) : EventDispatcher
return EventDispatcher
Beispiel #1
0
        /// <summary>
        /// Calculate right depth with windowType
        /// </summary>
        /// <param name="baseWindow"></param>
        private void AdjustBaseWindowDepth(UIBaseWindow baseWindow)
        {
            UIWindowType windowType = baseWindow.windowData.windowType;
            int          needDepth  = 1;

            if (windowType == UIWindowType.Normal)
            {
                needDepth = Mathf.Clamp(GameUtility.GetMaxTargetDepth(UINormalWindowRoot.gameObject, false) + 1, normalWindowDepth, int.MaxValue);
                Debuger.Log(string.Format("<color=cyan>[UIWindowType.Normal] maxDepth is {0} , {1}.</color>", needDepth.ToString(), baseWindow.ID.ToString()));
            }
            else if (windowType == UIWindowType.PopUp)
            {
                needDepth = Mathf.Clamp(GameUtility.GetMaxTargetDepth(UIPopUpWindowRoot.gameObject) + 1, popUpWindowDepth, int.MaxValue);
                Debuger.Log(string.Format("<color=cyan>[UIWindowType.PopUp] maxDepth is {0} , {1}.</color>", needDepth.ToString(), baseWindow.ID.ToString()));
            }
            else if (windowType == UIWindowType.Fixed)
            {
                needDepth = Mathf.Clamp(GameUtility.GetMaxTargetDepth(UIFixedWidowRoot.gameObject) + 1, fixedWindowDepth, int.MaxValue);
                Debuger.Log(string.Format("<color=cyan>[UIWindowType.Fixed] maxDepth is {0} , {1}.</color>", needDepth.ToString(), baseWindow.ID.ToString()));
            }
            if (baseWindow.MinDepth != needDepth)
            {
                GameUtility.SetTargetMinPanelDepth(baseWindow.gameObject, needDepth);
            }

            // send window added message to game client
            if (baseWindow.windowData.windowType == UIWindowType.PopUp)
            {
                // trigger the window PopRoot added window event
                EventDispatcher.GetInstance().UIFrameWorkEventManager.TriggerEvent(EventSystemDefine.EventUIFrameWorkPopRootWindowAdded);
            }
            baseWindow.MinDepth = needDepth;
        }
Beispiel #2
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space))
     {
         // trigger the event.
         EventDispatcher.GetInstance().MainEventManager.TriggerEvent <string>(EventSystemDefine.EventTestUserInput, "Hello World!");
     }
 }
Beispiel #3
0
 /// <summary>
 /// unregister the target event message.
 /// </summary>
 public void UnRegisterEvent()
 {
     EventDispatcher.GetInstance().MainEventManager.RemoveEventListener <string>(EventSystemDefine.EventTestUserInput, this.OnUserInput);
 }
 /// <summary>
 /// register the target event message, set the call back method with params and event name.
 /// </summary>
 public void RegisterEvent()
 {
     EventDispatcher.GetInstance().MainEventManager.AddEventListener <string>(EventId.TestUserInput, this.OnUserInput);
 }