//------------------------------------------------------------------------- public override void enter() { EbLog.Note("CNodeStateStart.enter() NodeType=" + mNode.getNodeType() + " NodeId=" + mNode.getNodeId()); mNodeServerScript = mNode._getNodeServerScript(); mNodeClientScript = mNode._getNodeClientScript(); mNode._setNodeState(_eNodeState.Start); // 广播NodeEnterStart消息 if (!mNode.getNodeSys().isClient()) { List <object> list_param = new List <object>(); list_param.Add(mNode.getNodeType()); list_param.Add(mNode.getNodeId()); mNode._getNodeServerListener().nodeSendMsg((int)_eNodeMsg.NodeEnterStart, list_param); } // 执行脚本函数 if (mNodeServerScript != null) { mNodeServerScript.onEnterStartState(mNode); } else if (mNodeClientScript != null) { mNodeClientScript.onEnterStartState(mNode); } }
//------------------------------------------------------------------------- public override void exit() { // 广播NodeStop消息 if (!mNode.getNodeSys().isClient()) { List <object> list_param = new List <object>(); list_param.Add(mNode.getNodeType()); list_param.Add(mNode.getNodeId()); list_param.Add(mNode.getExitId()); mNode._getNodeServerListener().nodeSendMsg((int)_eNodeMsg.NodeLeaveStop, list_param); } }
//------------------------------------------------------------------------- public override void enter() { if (mNode.getNodeMgr().EnableLog) { StringBuilder sb = new StringBuilder(512); sb.Append("EtPlayer et_guid="); sb.Append(mNode.getNodeMgr().EtPlayer.Guid); sb.Append(" NodeType="); sb.Append(mNode.getNodeType()); sb.Append(" NodeId="); sb.Append(mNode.getNodeId()); sb.Append(" Start"); EbLog.Note(sb.ToString()); } mNodeServerScript = mNode._getNodeServerScript(); mNodeClientScript = mNode._getNodeClientScript(); mNode._setNodeState(_eNodeState.Start); // 生成NodeOp if (!mNode.getNodeSys().isClient()) { mNode.getNodeMgr()._opEnterState(mNode.getNodeId(), mNode.getNodeState()); } // 广播NodeEnterStart消息 if (!mNode.getNodeSys().isClient()) { List <object> list_param = new List <object>(); list_param.Add(mNode.getNodeType()); list_param.Add(mNode.getNodeId()); mNode._getNodeServerListener().nodeSendMsg((int)_eNodeMsg.NodeEnterStart, list_param); } // 执行脚本函数 if (mNodeServerScript != null) { mNodeServerScript.onEnterStartState(mNode); } else if (mNodeClientScript != null) { mNodeClientScript.onEnterStartState(mNode); } }
//------------------------------------------------------------------------- public override void enter() { if (mNode.getNodeMgr().EnableLog) { StringBuilder sb = new StringBuilder(512); sb.Append("EtPlayer et_guid="); sb.Append(mNode.getNodeMgr().EtPlayer.Guid); sb.Append(" NodeType="); sb.Append(mNode.getNodeType()); sb.Append(" NodeId="); sb.Append(mNode.getNodeId()); sb.Append(" Run"); EbLog.Note(sb.ToString()); } mNodeServerScript = mNode._getNodeServerScript(); mNodeClientScript = mNode._getNodeClientScript(); mNode._setNodeState(_eNodeState.Run); // 生成NodeOp if (!mNode.getNodeSys().isClient()) { mNode.getNodeMgr()._opEnterState(mNode.getNodeId(), mNode.getNodeState()); } // 决策是否需要创建子Node { CNodeMgr node_mgr = mNode.getNodeMgr(); int node_id = mNode.getNodeId(); EventDef node_def = mNode.getDefXml(); if (mNode.hasChildNodeDef() && mNode._getChildNodeCount() == 0) { bool ok = false; var group = node_def.GetGroup("LinkedToChild"); if (group != null) { ok = true; Property p_entity_def_uid = group.GetValue("UID"); int this_child_entity_id = int.Parse(p_entity_def_uid.Value); if (this_child_entity_id != 0) { node_mgr._opCreateNode(this_child_entity_id, _eNodeState.Init, node_id); } } if (!ok) { var groups = node_def.GetGroupArray("LinkedToChild"); if (groups != null) { foreach (int i in groups.Keys) { Property p_entity_def_uid = groups[i].GetValue("UID"); int this_child_entity_id = int.Parse(p_entity_def_uid.Value); if (this_child_entity_id != 0) { node_mgr._opCreateNode(this_child_entity_id, _eNodeState.Init, node_id); } } } } } } // 广播NodeRun消息 if (!mNode.getNodeSys().isClient()) { List <object> list_param = new List <object>(); list_param.Add(mNode.getNodeType()); list_param.Add(mNode.getNodeId()); mNode._getNodeServerListener().nodeSendMsg((int)_eNodeMsg.NodeEnterRun, list_param); } // 执行脚本函数 if (mNodeServerScript != null) { mNodeServerScript.onEnterRunState(mNode); } else if (mNodeClientScript != null) { mNodeClientScript.onEnterRunState(mNode); } }