예제 #1
0
        //----------------------------------------------------------------------------
        public TCtrl Register <TCtrl, TBase>(string strAssetID, IMsgPipe pipe, bool bLocal = true, eUIImpower _impower = eUIImpower.Default)
            where TCtrl : UIController, new()
            where TBase : UIBase, new()
        {
            UISystem system = GetUISystem();

            if (system.HasUIClass(strAssetID))
            {
                return(default);
예제 #2
0
        //----------------------------------------------------------------------------
        protected override bool DispatchMsg_Down(IMsg msg, IMsgPipe except = null)
        {
            bool bResult = false;

            bResult = base.DispatchMsg_Down(msg, except);
            if (!bResult && ReferenceEquals(_curSubState, null) && @ReferenceEquals(_curSubState, except))
            {
                bResult = _curSubState.ProcessMsg(msg);
            }
            return(bResult);
        }
예제 #3
0
        //----------------------------------------------------------------------------
        protected bool SwitchMsgUp2Down(IMsg msg, IMsgPipe fromWhere)
        {
            if (msg.m_Direction != MsgDispatchDir.MDD_UP || !m_bSwitchMsgUp2Down)
            {
                return(false);
            }
            bool bResult = false;

            msg.m_Direction = MsgDispatchDir.MDD_Down;
            bResult         = DispatchMsg_Down(msg, fromWhere);
            msg.m_Direction = MsgDispatchDir.MDD_UP;
            return(bResult);
        }
예제 #4
0
 //----------------------------------------------------------------------------
 public override void PlugInMsgPipe(IMsgPipe thePipe)
 {
     itor = SubStateDict.GetEnumerator();
     while (itor.MoveNext())
     {
         if (ReferenceEquals(itor.Current.Value, thePipe))
         {
             Debug.LogWarning("子状态不能插到父亲身上");
             return;
         }
     }
     base.PlugInMsgPipe(thePipe);
 }
예제 #5
0
        //----------------------------------------------------------------------------
        protected bool SwitchMsgUp2Down(int msgId, ref MsgDispatchDir direction, IMsgPipe fromWhere)
        {
            if (direction != MsgDispatchDir.MDD_UP || !m_bSwitchMsgUp2Down)
            {
                return(false);
            }
            bool bResult = false;

            direction = MsgDispatchDir.MDD_Down;
            bResult   = DispatchMsg_Down(msgId, direction, fromWhere);
            direction = MsgDispatchDir.MDD_UP;
            return(bResult);
        }
예제 #6
0
 //----------------------------------------------------------------------------
 public void PullOutMsgPipe(IMsgPipe thePipe)
 {
     if (thePipe == null)
     {
         return;
     }
     if (thePipe.m_pParentPipe != null)
     {
         Debug.LogWarning("not exists");
         return;
     }
     if (m_listChildPipe != null && m_listChildPipe.Contains(thePipe))
     {
         thePipe.m_pParentPipe = null;
         m_listChildPipe.Remove(thePipe);
     }
 }
예제 #7
0
        //function
        //----------------------------------------------------------------------------
        virtual public bool ProcessMsg(IMsg msg, IMsgPipe fromWhere = null)
        {
            bool bResult = false;

            //处理消息
            bResult = ExecuteMsg(msg);
            //上转下
            if (!bResult)
            {
                bResult = SwitchMsgUp2Down(msg, fromWhere);
            }
            //分发
            if (!bResult)
            {
                bResult = DispatchMsg(msg);
                return(bResult);
            }
            return(bResult);
        }
예제 #8
0
 //----------------------------------------------------------------------------
 public virtual void PlugInMsgPipe(IMsgPipe thePipe)
 {
     if (thePipe == null)
     {
         return;
     }
     if (thePipe.m_pParentPipe != null)
     {
         if (thePipe.m_pParentPipe == this)
         {
             Debug.LogWarning("already Plug In!");
             return;
         }
         thePipe.m_pParentPipe.PullOutMsgPipe(thePipe);
     }
     thePipe.m_pParentPipe = this;
     if (m_listChildPipe == null)
     {
         m_listChildPipe = new List <IMsgPipe>();
     }
     m_listChildPipe.Add(thePipe);
 }
예제 #9
0
        protected virtual bool DispatchMsg_Down(int msgId, MsgDispatchDir direction, IMsgPipe except = null)
        {
            bool bResult = false;

            if (m_listChildPipe == null)
            {
                return(bResult);
            }

            for (int i = 0; i < m_listChildPipe.Count; ++i)
            {
                if (m_listChildPipe[i] != except)
                {
                    bResult = m_listChildPipe[i].ProcessMsg(msgId, direction, this);
                    if (bResult)
                    {
                        break;
                    }
                }
            }
            return(bResult);
        }
예제 #10
0
        //----------------------------------------------------------------------------
        protected virtual bool DispatchMsg_Down(IMsg msg, IMsgPipe except = null)
        {
            bool bResult = false;

            if (m_listChildPipe == null)
            {
                return(bResult);
            }
            int nChildNum = m_listChildPipe.Count;

            for (int i = 0; i < nChildNum; i++)
            {
                if (m_listChildPipe[i] != except)
                {
                    bResult = m_listChildPipe[i].ProcessMsg(msg, this);
                    if (bResult)
                    {
                        break;
                    }
                }
            }
            return(bResult);
        }
예제 #11
0
        //----------------------------------------------------------------------------
        virtual public bool ProcessMsg <T>(int msgId, T arg, MsgDispatchDir direction = MsgDispatchDir.MDD_Down, IMsgPipe fromWhere = null)
        {
            bool bResult = false;

            //处理消息
            bResult = ExecuteMsg(msgId, arg);
            //上转下
            if (!bResult)
            {
                bResult = SwitchMsgUp2Down(msgId, arg, ref direction, fromWhere);
            }
            //分发
            if (!bResult)
            {
                bResult = DispatchMsg(msgId, arg, direction);
            }
            return(bResult);
        }