//------------------------------------------------------------------------- // 更新队列中所有Node操作 public void updateQueNodeOp() { while (mQueNodeOp.Count > 0) { _tNodeOp node_op = mQueNodeOp.Dequeue(); switch ((_eNodeOp)node_op.op) { case _eNodeOp.CreateNode: { if (!mIsClient) { mQueNodeOpRemote.Enqueue(node_op); } if (!mMapAllNode.ContainsKey(node_op.id)) { CNode node = new CNode(); node.create(node_op.id, (_eNodeState)node_op.state, node_op.list_param, mpNodeServerListener, mpNodeClientListener, mNodeSys, this); mMapAllNode[node.getNodeId()] = node; } } break; case _eNodeOp.DestroyNode: { if (!mIsClient) { mQueNodeOpRemote.Enqueue(node_op); } if (mMapAllNode.ContainsKey(node_op.id)) { CNode node = mMapAllNode[node_op.id]; mMapAllNode.Remove(node_op.id); node.Dispose(); } } break; case _eNodeOp.EnterState: { if (!mIsClient) { // Server mQueNodeOpRemote.Enqueue(node_op); } else if (mMapAllNode.ContainsKey(node_op.id)) { // Client CNode node = mMapAllNode[node_op.id]; node.setNodeSate(node_op); } } break; } } }
//------------------------------------------------------------------------- // 更新队列中所有Node操作 public void updateQueNodeOp(Queue<_tNodeOp> que_node_op) { if (!mIsClient) { mQueNodeOpRemote.Clear(); } if (que_node_op == null) return; while (que_node_op.Count > 0) { _tNodeOp node_op = que_node_op.Dequeue(); switch (node_op.op) { case _eNodeOp.CreateNode: { if (!mMapAllNode.ContainsKey(node_op.id)) { CNode node = new CNode(); node.create(node_op.id, node_op.state, node_op.list_param, mpNodeServerListener, mpNodeClientListener, mNodeSys, this); mMapAllNode[node.getNodeId()] = node; if (!mIsClient) { mQueNodeOpRemote.Enqueue(node_op); } } else { EbLog.Error("CNodeMgr.updateQueNodeOp() _eNodeOp.CreateNode exist node_id=" + node_op.id); } } break; case _eNodeOp.DestroyNode: { if (mMapAllNode.ContainsKey(node_op.id)) { CNode node = mMapAllNode[node_op.id]; mMapAllNode.Remove(node_op.id); node.Dispose(); } else { EbLog.Error("CNodeMgr.updateQueNodeOp() _eNodeOp.DestroyNode not exist node_id=" + node_op.id); } } break; case _eNodeOp.EnterState: { if (mMapAllNode.ContainsKey(node_op.id)) { CNode node = mMapAllNode[node_op.id]; node.setNodeSate(node_op); if (!mIsClient) { mQueNodeOpRemote.Enqueue(node_op); } } else { EbLog.Error("CNodeMgr.updateQueNodeOp() _eNodeOp.EnterState not exist node_id=" + node_op.id); } } break; } } }