Ejemplo 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();
 }
Ejemplo n.º 2
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();
 }
Ejemplo n.º 3
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();
    }
Ejemplo n.º 4
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();
    }