Esempio n. 1
0
 //-------------------------------------------------------------------------
 internal void _create(CNodeSys node_sys, INodeServerListener server_listener, INodeClientListener client_listener, Entity et_player)
 {
     mNodeSys = node_sys;
     mpNodeServerListener = server_listener;
     mpNodeClientListener = client_listener;
     mEtPlayer = et_player;
     mIsClient = mNodeSys.isClient();
 }
Esempio n. 2
0
    //-------------------------------------------------------------------------
    internal void _destroy()
    {
        // 保存List<_tNodeInfo>
        if (mpNodeServerListener != null)
        {
            List <_tNodeInfo> list_nodeinfo = getListNodeInfo();
            mpNodeServerListener.nodeSaveNodeInfoList(list_nodeinfo);
        }

        // 销毁NodeList中所有元素
        foreach (var i in mMapAllNode)
        {
            i.Value.Dispose();
        }
        mMapAllNode.Clear();
        mQueNodeOp.Clear();

        // 销毁其他对象
        mNodeSys             = null;
        mpNodeServerListener = null;
        mpNodeClientListener = null;
    }
Esempio n. 3
0
    //-------------------------------------------------------------------------
    internal void _destroy()
    {
        // 保存List<_tNodeInfo>
        if (mpNodeServerListener != null)
        {
            List<_tNodeInfo> list_nodeinfo = getListNodeInfo();
            mpNodeServerListener.nodeSaveNodeInfoList(list_nodeinfo);
        }

        // 销毁NodeList中所有元素
        foreach (var i in mMapAllNode)
        {
            i.Value.Dispose();
        }
        mMapAllNode.Clear();
        mQueNodeOp.Clear();

        // 销毁其他对象
        mNodeSys = null;
        mpNodeServerListener = null;
        mpNodeClientListener = null;
    }
Esempio n. 4
0
 //-------------------------------------------------------------------------
 internal void _create(CNodeSys node_sys, INodeServerListener server_listener, INodeClientListener client_listener, Entity et_player)
 {
     EnableLog = false;
     mNodeSys = node_sys;
     mpNodeServerListener = server_listener;
     mpNodeClientListener = client_listener;
     mEtPlayer = et_player;
     mIsClient = mNodeSys.isClient();
 }
Esempio n. 5
0
    //-------------------------------------------------------------------------
    public void create(int node_id, _eNodeState state, List <_tNodeParamPair> list_param,
                       INodeServerListener server_listener, INodeClientListener client_listener, CNodeSys node_sys, CNodeMgr node_mgr)
    {
        mNodeServerListener = server_listener;
        mNodeClientListener = client_listener;
        mNodeSys            = node_sys;
        mNodeMgr            = node_mgr;

        // 初始化NodeInfo
        mNodeId    = node_id;
        mNodeState = state;
        if (list_param != null)
        {
            foreach (var i in list_param)
            {
                if (i.k == (byte)_eNodeParam.PreNodeId || i.k == (byte)_eNodeParam.ExitId)
                {
                    mMapParam[i.k] = int.Parse(i.v.ToString());
                }
                else
                {
                    mMapParam[i.k] = i.v;
                }
            }
        }

        // 加载DefXml数据
        _loadDefXml();

        // 设置该Node的父Node
        string str_parent_node_id = getDefXml().GetValue("Parent").Value;

        if (str_parent_node_id != string.Empty && str_parent_node_id != "0")
        {
            int   parent_node_id = Convert.ToInt32(str_parent_node_id);
            CNode node_parent    = getNodeMgr().findNode(parent_node_id);
            if (node_parent != null)
            {
                mParentNode = node_parent;
                node_parent._addChildNode(this);
            }
        }

        // 从xml中解析所有trigger
        _parseTriggerXml();

        // 初始化脚本
        if (mNodeSys.isClient())
        {
            INodeClientScriptFactory factory = mNodeSys.getNodeClientScriptFactory(getNodeType());
            if (factory != null)
            {
                mNodeClientScript = factory.createScript(this);
            }
        }
        else
        {
            INodeServerScriptFactory factory = mNodeSys.getNodeServerScriptFactory(getNodeType());
            if (factory != null)
            {
                mNodeServerScript = factory.createScript(this, getEtPlayer());
            }
        }

        // 创建Fsm
        addState(new CNodeStateInit(this));
        addState(new CNodeStateStart(this));
        addState(new CNodeStateRun(this));
        addState(new CNodeStateStop(this));
        addState(new CNodeStateRelease(this));
        setupFsm();
    }
Esempio n. 6
0
    List <_tTriggerMsg> mListTriggerMsg = new List <_tTriggerMsg>(); // 存贮自定义触发器消息注册信息

    //-------------------------------------------------------------------------
    public CMsgMgr(CNodeSys node_sys, CNodeMgr node_mgr)
    {
        mNodeSys = node_sys;
        mNodeMgr = node_mgr;
    }
Esempio n. 7
0
    //-------------------------------------------------------------------------
    public void create(int node_id, _eNodeState state, List<_tNodeParamPair> list_param,
        INodeServerListener server_listener, INodeClientListener client_listener, CNodeSys node_sys, CNodeMgr node_mgr)
    {
        mNodeServerListener = server_listener;
        mNodeClientListener = client_listener;
        mNodeSys = node_sys;
        mNodeMgr = node_mgr;

        // 初始化NodeInfo
        mNodeId = node_id;
        mNodeState = state;
        if (list_param != null)
        {
            foreach (var i in list_param)
            {
                if (i.k == (byte)_eNodeParam.PreNodeId || i.k == (byte)_eNodeParam.ExitId)
                {
                    mMapParam[i.k] = int.Parse(i.v.ToString());
                }
                else
                {
                    mMapParam[i.k] = i.v;
                }
            }
        }

        // 加载DefXml数据
        _loadDefXml();

        // 设置该Node的父Node
        string str_parent_node_id = getDefXml().GetValue("Parent").Value;
        if (str_parent_node_id != string.Empty && str_parent_node_id != "0")
        {
            int parent_node_id = Convert.ToInt32(str_parent_node_id);
            CNode node_parent = getNodeMgr().findNode(parent_node_id);
            if (node_parent != null)
            {
                mParentNode = node_parent;
                node_parent._addChildNode(this);
            }
        }

        // 从xml中解析所有trigger
        _parseTriggerXml();

        // 初始化脚本
        if (mNodeSys.isClient())
        {
            INodeClientScriptFactory factory = mNodeSys.getNodeClientScriptFactory(getNodeType());
            if (factory != null)
            {
                mNodeClientScript = factory.createScript(this);
            }
        }
        else
        {
            INodeServerScriptFactory factory = mNodeSys.getNodeServerScriptFactory(getNodeType());
            if (factory != null)
            {
                mNodeServerScript = factory.createScript(this, getEtPlayer());
            }
        }

        // 创建Fsm
        addState(new CNodeStateInit(this));
        addState(new CNodeStateStart(this));
        addState(new CNodeStateRun(this));
        addState(new CNodeStateStop(this));
        addState(new CNodeStateRelease(this));
        setupFsm();
    }