public static void ParseData(byte[] data, CSTrainData recordData) { using (MemoryStream ms = new MemoryStream(data)) using (BinaryReader reader = new BinaryReader(ms)) { int iCount = BufferHelper.ReadInt32(reader); recordData.instructors = new List <int>(); for (int i = 0; i < iCount; i++) { recordData.instructors.Add(BufferHelper.ReadInt32(reader)); } int tCount = BufferHelper.ReadInt32(reader); recordData.trainees = new List <int>(); for (int i = 0; i < tCount; i++) { recordData.trainees.Add(BufferHelper.ReadInt32(reader)); } recordData.instructorNpcId = BufferHelper.ReadInt32(reader); recordData.traineeNpcId = BufferHelper.ReadInt32(reader); recordData.trainingType = BufferHelper.ReadInt32(reader); int lCount = BufferHelper.ReadInt32(reader); recordData.LearningSkillIds = new List <int>(); for (int i = 0; i < lCount; i++) { recordData.LearningSkillIds.Add(BufferHelper.ReadInt32(reader)); } recordData.m_CurTime = BufferHelper.ReadSingle(reader); recordData.m_Time = BufferHelper.ReadSingle(reader); } }
void RPC_S2C_InitDataTrain(uLink.BitStream stream, uLink.NetworkMessageInfo info) { CSTrainData recordData = (CSTrainData)_ColonyObj._RecordData; recordData.m_CurDeleteTime = stream.Read <float>(); recordData.m_CurRepairTime = stream.Read <float>(); recordData.m_DeleteTime = stream.Read <float>(); recordData.m_Durability = stream.Read <float>(); recordData.m_RepairTime = stream.Read <float>(); recordData.m_RepairValue = stream.Read <float>(); byte[] dataArray = stream.Read <byte[]>(); CSTraining.ParseData(dataArray, recordData); }
//CSTrainData _MyData; public ColonyTrain(ColonyNetwork network) { SetNetwork(network); _RecordData = new CSTrainData(); //_MyData = (CSTrainData)_RecordData; }
public bool AssignData(int id, int type, ref CSDefaultData refData, ColonyBase _colony) { if (_colony != null && _colony._RecordData != null) { refData = _colony._RecordData; return(false); } else { switch (type) { case CSConst.dtAssembly: refData = new CSAssemblyData(); break; case CSConst.dtStorage: refData = new CSStorageData(); break; case CSConst.dtEngineer: refData = new CSEngineerData(); break; case CSConst.dtEnhance: refData = new CSEnhanceData(); break; case CSConst.dtRepair: refData = new CSRepairData(); break; case CSConst.dtRecyle: refData = new CSRecycleData(); break; case CSConst.dtppCoal: refData = new CSPPCoalData(); break; case CSConst.dtppSolar: refData = new CSPPSolarData(); break; case CSConst.dtDwelling: refData = new CSDwellingsData(); break; case CSConst.dtFarm: refData = new CSFarmData(); break; case CSConst.dtFactory: refData = new CSFactoryData(); break; case CSConst.dtProcessing: refData = new CSProcessingData(); break; case CSConst.dtTrade: refData = new CSTradeData(); break; case CSConst.dtTrain: refData = new CSTrainData(); break; case CSConst.dtCheck: refData = new CSCheckData(); break; case CSConst.dtTreat: refData = new CSTreatData(); break; case CSConst.dtTent: refData = new CSTentData(); break; case CSConst.dtppFusion: refData = new CSPPFusionData(); break; default: refData = new CSDefaultData(); break; } refData.ID = id; return(true); } }