void RPC_S2C_CLN_SetWorkMode(uLink.BitStream stream, uLink.NetworkMessageInfo info) { //--to do: wait int workMode = stream.Read <int>(); //int playID = stream.Read<int>(); //if(playID != PlayerFactory.mMainPlayer.OwnerView.viewID.id) //{ CSCreator creator = MultiColonyManager.GetCreator(TeamId, false); if (creator != null) { CSPersonnel[] personnels = creator.GetNpcs(); foreach (CSPersonnel csp in personnels) { if (csp != null && csp.m_Npc != null) { if (Id == csp.m_Npc.Id) { csp.m_WorkMode = workMode; } } } } //} }
public static List <PeEntity> GetCSNpcs(CSCreator creator) { List <PeEntity> allNpcs = new List <PeEntity>(); foreach (CSPersonnel csp in creator.GetNpcs()) { allNpcs.Add(csp.NPC); } return(allNpcs); }
void RPC_S2C_CLN_SetWorkRoomID(uLink.BitStream stream, uLink.NetworkMessageInfo info) { //--to do: wait int workRoomID = stream.Read <int>(); //int playID = stream.Read<int>(); //if (playID != PlayerFactory.mMainPlayer.OwnerView.viewID.id) //{ CSCreator creator = MultiColonyManager.GetCreator(TeamId, false); if (creator != null) { CSPersonnel[] personnels = creator.GetNpcs(); foreach (CSPersonnel csp in personnels) { if (csp != null && csp.m_Npc != null) { if (Id == csp.m_Npc.Id) { if (workRoomID == 0) { csp.WorkRoom = null; return; } Dictionary <int, CSCommon> commons = creator.GetCommonEntities(); foreach (KeyValuePair <int, CSCommon> kvp in commons) { if (kvp.Value.Assembly != null && kvp.Value.WorkerMaxCount > 0 && kvp.Value.m_Type != CSConst.etFarm) { if (kvp.Value.ID == workRoomID) { csp.WorkRoom = kvp.Value; break; } } } } } } } //} }