Example #1
0
        public override void OnEnter(XUIWindow obj)
        {
            XDebug.Log(XUIConst.Tag, $"XUIWindowTask_Show enter {obj.name}");
            //设置数据
            obj.mono.ShowController(obj.initParam);
            //处理缓存消息
            foreach (var msg in obj.msgCacheList)
            {
                obj.MsgManager.SendMsg(msg);
            }
            obj.msgCacheList.Clear();

            if (obj.canvas == null)
            {
                //将窗口消息器挂入总消息器
                XMsgManager.Append(obj.uiManager.MsgManager, obj.MsgManager);
                //加入canvas排序
                obj.layer = obj.mono.layerData.GetValue();
                int index = obj.uiManager.GetSort(obj);
                obj.uiManager.AddSort(obj, index);
                obj.canvas = obj.uiManager.uiRoot.uiCanvasManager.AppendClone(index);
                obj.gameObject.transform.SetParent(obj.canvas.transform, false);
                obj.gameObject.SetActive(true);
            }
            if (obj.mono.showAnim != null)
            {
                obj.mono.showAnim.Play(delegate { m_complete = true; });
                m_complete = false;
            }
            else
            {
                m_complete = true;
            }
            obj.isShowAnimating = true;
        }
Example #2
0
 public void SetParent(IXUIController parent)
 {
     if (m_parent == parent)
     {
         return;
     }
     if (m_parent != null)
     {
         XMsgManager.Remove(m_parent.MsgManager, MsgManager);
         m_parent = null;
     }
     if (parent != null)
     {
         m_parent = parent;
         XMsgManager.Append(m_parent.MsgManager, MsgManager);
     }
 }
    void Start()
    {
        XService.AddService <XEventManager>();

        var aa = XService.AddService <XMsgManager>();
        var bb = XService.AddService <XMsgManager>("bb");

        XMsgManager.Append(aa, bb);

        aa.Register <XSampleMsg1>(OnHandleMsg1aa);
        bb.Register <XSampleMsg1>(OnHandleMsg1bb);

        //
        m_EventManager = XService.GetService <XEventManager>();
        m_EventManager.AddListener <int>("test1", (param1) => { Debug.Log(param1); });
        m_EventManager.AddListener <int, int>("test2", (param1, param2) => { Debug.Log($"{param1},{param2}"); });
        m_EventManager.AddListener <int, int, int>("test3", (param1, param2, param3) => { Debug.Log($"{param1},{param2},{param3}"); });
        m_EventManager.AddListener <XSampleEvent1>("test4", (evt) => { Debug.Log(evt.value); });
    }