예제 #1
0
 // params 可变数组 参数
 // 去掉一个脚本的若干的消息
 public void UnRegisterMsg(QMonoBehaviour monoBase, params ushort[] msgs)
 {
     for (int i = 0; i < msgs.Length; i++)
     {
         UnRegistMsg(msgs[i], monoBase);
     }
 }
예제 #2
0
 public void RegisterSelf(QMonoBehaviour mono, ushort[] msgs = null)
 {
     if (null != msgs)
     {
         mMsgIds = msgs;
     }
     mCurMgr.RegisterMsg(mono, mMsgIds);
 }
예제 #3
0
        // mono:要注册的脚本
        // msgs:每个脚本可以注册多个脚本
        public void RegisterMsg(QMonoBehaviour behaviour, ushort[] msgs)
        {
            for (int i = 0; i < msgs.Length; i++)
            {
                QMsgNode msgNode = new QMsgNode(behaviour);

                RegisterMsg(msgs[i], msgNode);
            }
        }
예제 #4
0
        // 释放 中间,尾部。
        public void UnRegistMsg(ushort msgId, QMonoBehaviour behaviour)
        {
            if (!msgDic.ContainsKey(msgId))
            {
                Debug.LogWarning("not contain id ==" + msgId);
                return;
            }
            else
            {
                QMsgNode msgNode = msgDic[msgId];

                if (msgNode.behaviour == behaviour)                 // 去掉头部 包含两种情况
                {
                    QMsgNode header = msgNode;

                    // 已经存在这个消息
                    // 头部
                    if (header.next != null)
                    {
                        msgDic [msgId] = msgNode.next;                         // 直接指向下一个
                        header.next    = null;

                        header.behaviour = msgNode.next.behaviour;
                        header.next      = msgNode.next.next;
                    }
                    else                     // 后面没有节点的情况
                    {
                        header.next = null;
                        msgDic.Remove(msgId);
                    }
                }
                else                                                                    // 去掉尾部 和中间的节点
                {
                    while (msgNode.next != null && msgNode.next.behaviour != behaviour) // 下一个不是我要找的 node 就一直遍历
                    {
                        msgNode = msgNode.next;
                    }                     // 表示已经找到了 该节点

                    // 没有引用 会自动释放
                    if (msgNode.next.next != null)                     // 去掉中间的
                    {
                        QMsgNode curNode = msgNode.next;               // 保存一下

                        msgNode.next = curNode.next;
                        //					tmp.next = tmp.next.next;
                        curNode.next = null; // 把相关联的指针释放
                    }
                    else                     // 去掉尾部的
                    {
                        // tmp表示要找的节点的上一个节点
                        msgNode.next = null;
                    }
                }
            }
        }
예제 #5
0
 public void RegisterSelf(QMonoBehaviour behaviour, ushort[] msgs = null)
 {
     if (null != msgs)
     {
         mMsgIds = msgs;
         QUIManager.Instance.RegisterMsg(behaviour, msgs);
     }
     else
     {
         QUIManager.Instance.RegisterMsg(behaviour, mMsgIds);
     }
 }
 static int Hide(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         QFramework.QMonoBehaviour obj = (QFramework.QMonoBehaviour)ToLua.CheckObject <QFramework.QMonoBehaviour>(L, 1);
         obj.Hide();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int SendEvent(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         QFramework.QMonoBehaviour obj = (QFramework.QMonoBehaviour)ToLua.CheckObject <QFramework.QMonoBehaviour>(L, 1);
         object arg0 = ToLua.ToVarObject(L, 2);
         obj.SendEvent((IConvertible)arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int SendMsg(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         QFramework.QMonoBehaviour obj  = (QFramework.QMonoBehaviour)ToLua.CheckObject <QFramework.QMonoBehaviour>(L, 1);
         QFramework.QMsg           arg0 = (QFramework.QMsg)ToLua.CheckObject <QFramework.QMsg>(L, 2);
         obj.SendMsg(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int Process(IntPtr L)
 {
     try
     {
         int count = LuaDLL.lua_gettop(L);
         QFramework.QMonoBehaviour obj = (QFramework.QMonoBehaviour)ToLua.CheckObject <QFramework.QMonoBehaviour>(L, 1);
         int      arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
         object[] arg1 = ToLua.ToParamsObject(L, 3, count - 2);
         obj.Process(arg0, arg1);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
    static int get_Manager(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            QFramework.QMonoBehaviour obj = (QFramework.QMonoBehaviour)o;
            QFramework.IManager       ret = obj.Manager;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index Manager on a nil value"));
        }
    }
예제 #11
0
 public void UnRegisterSelf(QMonoBehaviour behaviour)
 {
     QUIManager.Instance.UnRegisterMsg(behaviour, mMsgIds);
 }
예제 #12
0
 public void addTo(QMonoBehaviour parent)
 {
     this.transform.parent = parent.trans;
     this.parent           = parent;
 }
예제 #13
0
 public void addChild(QMonoBehaviour child)
 {
     child.parent       = this;
     child.trans.parent = this.trans;
 }
예제 #14
0
 public void UnRegisterSelf(QMonoBehaviour mono, ushort[] msg)
 {
     mCurMgr.UnRegisterMsg(mono, mMsgIds);
 }
예제 #15
0
 public QMsgNode(QMonoBehaviour behaviour)
 {
     this.behaviour = behaviour;
     this.next      = null;
 }
예제 #16
0
 public void RegisterSelf(QMonoBehaviour mono, ushort[] msgs)
 {
     mCurMgr.RegisterMsg(mono, msgIds);
 }