示例#1
0
文件: NodeMgr.cs 项目: xubingyue/def
 //-------------------------------------------------------------------------
 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();
 }
示例#2
0
文件: NodeSys.cs 项目: cyecp/GF.Core
    //-------------------------------------------------------------------------
    //public void update(float elapsed_tm)
    //{
    //    foreach (var it in mMapNodeMgr)
    //    {
    //        it.Value._update(elapsed_tm);
    //    }
    //}

    //-------------------------------------------------------------------------
    public CNodeMgr createNodeMgr(string player_guid, INodeServerListener server_listener,
                                  INodeClientListener client_listener, Entity et_player)
    {
        if (!mMapNodeMgr.ContainsKey(player_guid))
        {
            CNodeMgr entity_mgr = new CNodeMgr();
            entity_mgr._create(this, server_listener, client_listener, et_player);
            mMapNodeMgr.Add(player_guid, entity_mgr);

            return(entity_mgr);
        }
        else
        {
            return(mMapNodeMgr[player_guid]);
        }
    }
示例#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;
    }
示例#4
0
文件: NodeMgr.cs 项目: yinlei/GF.Core
    //-------------------------------------------------------------------------
    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;
    }
示例#5
0
文件: NodeMgr.cs 项目: yinlei/GF.Core
 //-------------------------------------------------------------------------
 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();
 }
示例#6
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();
    }
示例#7
0
文件: NodeSys.cs 项目: yinlei/Fishing
    //-------------------------------------------------------------------------
    //public void update(float elapsed_tm)
    //{
    //    foreach (var it in mMapNodeMgr)
    //    {
    //        it.Value._update(elapsed_tm);
    //    }
    //}

    //-------------------------------------------------------------------------
    public CNodeMgr createNodeMgr(string player_guid, INodeServerListener server_listener,
        INodeClientListener client_listener, Entity et_player)
    {
        if (!mMapNodeMgr.ContainsKey(player_guid))
        {
            CNodeMgr entity_mgr = new CNodeMgr();
            entity_mgr._create(this, server_listener, client_listener, et_player);
            mMapNodeMgr.Add(player_guid, entity_mgr);

            return entity_mgr;
        }
        else
        {
            return mMapNodeMgr[player_guid];
        }
    }
示例#8
0
文件: Node.cs 项目: yinlei/Fishing
    //-------------------------------------------------------------------------
    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();
    }