/** 帧同步开始 */ public void onFrameStart(SList <FrameSyncData> list) { //去掉头三帧 list.forEach(k => { _cacheQueue.offer(k); }); _scene.setFrameSync(true); }
/// <summary> /// 读取字节流(简版) /// </summary> protected override void toReadBytesSimple(BytesReadStream stream) { this.id = stream.readInt(); this.price = stream.readInt(); int daysLen = stream.readLen(); if (this.days != null) { this.days.clear(); this.days.ensureCapacity(daysLen); } else { this.days = new SQueue <CountData>(); } SQueue <CountData> daysT = this.days; for (int daysI = daysLen - 1; daysI >= 0; --daysI) { CountData daysV; daysV = (CountData)stream.readDataSimpleNotNull(); daysT.offer(daysV); } }
/// <summary> /// 复制(深拷贝) /// </summary> protected override void toCopy(BaseData data) { if (!(data is AuctionItemRecordData)) { return; } AuctionItemRecordData mData = (AuctionItemRecordData)data; this.id = mData.id; this.price = mData.price; if (mData.days != null) { if (this.days != null) { this.days.clear(); this.days.ensureCapacity(mData.days.size()); } else { this.days = new SQueue <CountData>(); } SQueue <CountData> daysT = this.days; if (!mData.days.isEmpty()) { CountData[] daysVValues = mData.days.getValues(); int daysVMark = mData.days.getMark(); int daysVStart = mData.days.getStart(); for (int daysVI = 0, daysVLen = mData.days.length(); daysVI < daysVLen; ++daysVI) { CountData daysV = daysVValues[(daysVI + daysVStart) & daysVMark]; CountData daysU; if (daysV != null) { daysU = (CountData)daysV.clone(); } else { daysU = null; nullObjError("daysU"); } daysT.offer(daysU); } } } else { this.days = null; nullObjError("days"); } }
/// <summary> /// 读取字节流(完整版) /// </summary> protected override void toReadBytesFull(BytesReadStream stream) { stream.startReadObj(); this.id = stream.readInt(); this.price = stream.readInt(); int daysLen = stream.readLen(); if (this.days != null) { this.days.clear(); this.days.ensureCapacity(daysLen); } else { this.days = new SQueue <CountData>(); } SQueue <CountData> daysT = this.days; for (int daysI = daysLen - 1; daysI >= 0; --daysI) { CountData daysV; BaseData daysVT = stream.readDataFullNotNull(); if (daysVT != null) { if (daysVT is CountData) { daysV = (CountData)daysVT; } else { daysV = new CountData(); if (!(daysVT.GetType().IsAssignableFrom(typeof(CountData)))) { stream.throwTypeReadError(typeof(CountData), daysVT.GetType()); } daysV.shadowCopy(daysVT); } } else { daysV = null; } daysT.offer(daysV); } stream.endReadObj(); }
/// <summary> /// 复制(深拷贝) /// </summary> protected override void toCopy(BaseData data) { if (!(data is ChatChannelData)) { return; } ChatChannelData mData = (ChatChannelData)data; if (mData.queue != null) { if (this.queue != null) { this.queue.clear(); this.queue.ensureCapacity(mData.queue.size()); } else { this.queue = new SQueue <RoleChatData>(); } SQueue <RoleChatData> queueT = this.queue; if (!mData.queue.isEmpty()) { RoleChatData[] queueVValues = mData.queue.getValues(); int queueVMark = mData.queue.getMark(); int queueVStart = mData.queue.getStart(); for (int queueVI = 0, queueVLen = mData.queue.length(); queueVI < queueVLen; ++queueVI) { RoleChatData queueV = queueVValues[(queueVI + queueVStart) & queueVMark]; RoleChatData queueU; if (queueV != null) { queueU = (RoleChatData)queueV.clone(); } else { queueU = null; nullObjError("queueU"); } queueT.offer(queueU); } } } else { this.queue = null; nullObjError("queue"); } }
/// <summary> /// 读取字节流(完整版) /// </summary> protected override void toReadBytesFull(BytesReadStream stream) { stream.startReadObj(); int queueLen = stream.readLen(); if (this.queue != null) { this.queue.clear(); this.queue.ensureCapacity(queueLen); } else { this.queue = new SQueue <RoleChatData>(); } SQueue <RoleChatData> queueT = this.queue; for (int queueI = queueLen - 1; queueI >= 0; --queueI) { RoleChatData queueV; BaseData queueVT = stream.readDataFullNotNull(); if (queueVT != null) { if (queueVT is RoleChatData) { queueV = (RoleChatData)queueVT; } else { queueV = new RoleChatData(); if (!(queueVT.GetType().IsAssignableFrom(typeof(RoleChatData)))) { stream.throwTypeReadError(typeof(RoleChatData), queueVT.GetType()); } queueV.shadowCopy(queueVT); } } else { queueV = null; } queueT.offer(queueV); } stream.endReadObj(); }
/** 输出 */ public void onPrint(string str) { _printQueue.offer(str.Length + 1); _printSb.Append(str); _printSb.Append('\n'); while (_printSb.Length > _printMaxCacheLength) { _printSb.Remove(0, _printQueue.poll()); } if (!_isShow) { return; } refreshPrintShow(); }
/// <summary> /// 读取字节流(简版) /// </summary> protected override void toReadBytesSimple(BytesReadStream stream) { int queueLen = stream.readLen(); if (this.queue != null) { this.queue.clear(); this.queue.ensureCapacity(queueLen); } else { this.queue = new SQueue <RoleChatData>(); } SQueue <RoleChatData> queueT = this.queue; for (int queueI = queueLen - 1; queueI >= 0; --queueI) { RoleChatData queueV; queueV = (RoleChatData)stream.readDataSimpleNotNull(); queueT.offer(queueV); } }
/// <summary> /// 读取字节流(完整版) /// </summary> protected override void toReadBytesFull(BytesReadStream stream) { stream.startReadObj(); BaseData versionT = stream.readDataFullNotNull(); if (versionT != null) { if (versionT is SaveVersionData) { this.version = (SaveVersionData)versionT; } else { this.version = new SaveVersionData(); if (!(versionT.GetType().IsAssignableFrom(typeof(SaveVersionData)))) { stream.throwTypeReadError(typeof(SaveVersionData), versionT.GetType()); } this.version.shadowCopy(versionT); } } else { this.version = null; } this.serverTime = stream.readLong(); this.isBlock = stream.readBoolean(); this.flowStep = stream.readInt(); this.keepSave = (KeepSaveData)stream.createData(KeepSaveData.dataID); this.keepSave.readBytesFull(stream); if (stream.readBoolean()) { int clientRandomSeedsLen = stream.readLen(); if (this.clientRandomSeeds == null || this.clientRandomSeeds.Length != clientRandomSeedsLen) { this.clientRandomSeeds = new int[clientRandomSeedsLen]; } int[] clientRandomSeedsT = this.clientRandomSeeds; for (int clientRandomSeedsI = 0; clientRandomSeedsI < clientRandomSeedsLen; ++clientRandomSeedsI) { int clientRandomSeedsV; clientRandomSeedsV = stream.readInt(); clientRandomSeedsT[clientRandomSeedsI] = clientRandomSeedsV; } } else { this.clientRandomSeeds = null; } this.clientRandomSeedIndex = stream.readInt(); this.clientOfflineWorkReceiveIndex = stream.readInt(); if (stream.readBoolean()) { int gmCommandSetLen = stream.readLen(); if (this.gmCommandSet != null) { this.gmCommandSet.clear(); this.gmCommandSet.ensureCapacity(gmCommandSetLen); } else { this.gmCommandSet = new SSet <string>(); } SSet <string> gmCommandSetT = this.gmCommandSet; for (int gmCommandSetI = gmCommandSetLen - 1; gmCommandSetI >= 0; --gmCommandSetI) { string gmCommandSetV; gmCommandSetV = stream.readUTF(); gmCommandSetT.add(gmCommandSetV); } } else { this.gmCommandSet = null; } this.gmType = stream.readInt(); this.serverBornCode = stream.readInt(); this.serverStartTime = stream.readLong(); int logQueueLen = stream.readLen(); if (this.logQueue != null) { this.logQueue.clear(); this.logQueue.ensureCapacity(logQueueLen); } else { this.logQueue = new SQueue <InfoLogData>(); } SQueue <InfoLogData> logQueueT = this.logQueue; for (int logQueueI = logQueueLen - 1; logQueueI >= 0; --logQueueI) { InfoLogData logQueueV; BaseData logQueueVT = stream.readDataFullNotNull(); if (logQueueVT != null) { if (logQueueVT is InfoLogData) { logQueueV = (InfoLogData)logQueueVT; } else { logQueueV = new InfoLogData(); if (!(logQueueVT.GetType().IsAssignableFrom(typeof(InfoLogData)))) { stream.throwTypeReadError(typeof(InfoLogData), logQueueVT.GetType()); } logQueueV.shadowCopy(logQueueVT); } } else { logQueueV = null; } logQueueT.offer(logQueueV); } this.nextDailyTime = stream.readLong(); this.createDate = (DateData)stream.createData(DateData.dataID); this.createDate.readBytesFull(stream); this.clientRandomSeedKey = stream.readInt(); stream.endReadObj(); }
/// <summary> /// 复制(深拷贝) /// </summary> protected override void toCopy(BaseData data) { if (!(data is SystemPartData)) { return; } SystemPartData mData = (SystemPartData)data; if (mData.version != null) { this.version = (SaveVersionData)mData.version.clone(); } else { this.version = null; nullObjError("version"); } this.serverTime = mData.serverTime; this.isBlock = mData.isBlock; this.flowStep = mData.flowStep; if (mData.keepSave != null) { this.keepSave = (KeepSaveData)BytesControl.createData(KeepSaveData.dataID); this.keepSave.copy(mData.keepSave); } else { this.keepSave = null; nullObjError("keepSave"); } if (mData.clientRandomSeeds != null) { int[] clientRandomSeedsR = mData.clientRandomSeeds; int clientRandomSeedsLen = clientRandomSeedsR.Length; if (this.clientRandomSeeds == null || this.clientRandomSeeds.Length != clientRandomSeedsLen) { this.clientRandomSeeds = new int[clientRandomSeedsLen]; } BytesControl.arrayCopy(mData.clientRandomSeeds, this.clientRandomSeeds, clientRandomSeedsLen); } else { this.clientRandomSeeds = null; } this.clientRandomSeedIndex = mData.clientRandomSeedIndex; this.clientOfflineWorkReceiveIndex = mData.clientOfflineWorkReceiveIndex; if (mData.gmCommandSet != null) { if (this.gmCommandSet != null) { this.gmCommandSet.clear(); this.gmCommandSet.ensureCapacity(mData.gmCommandSet.size()); } else { this.gmCommandSet = new SSet <string>(); } SSet <string> gmCommandSetT = this.gmCommandSet; if (!mData.gmCommandSet.isEmpty()) { string[] gmCommandSetVKeys = mData.gmCommandSet.getKeys(); for (int gmCommandSetVI = gmCommandSetVKeys.Length - 1; gmCommandSetVI >= 0; --gmCommandSetVI) { if (gmCommandSetVKeys[gmCommandSetVI] != null) { string gmCommandSetV = gmCommandSetVKeys[gmCommandSetVI]; string gmCommandSetU; gmCommandSetU = gmCommandSetV; gmCommandSetT.add(gmCommandSetU); } } } } else { this.gmCommandSet = null; } this.gmType = mData.gmType; this.serverBornCode = mData.serverBornCode; this.serverStartTime = mData.serverStartTime; if (mData.logQueue != null) { if (this.logQueue != null) { this.logQueue.clear(); this.logQueue.ensureCapacity(mData.logQueue.size()); } else { this.logQueue = new SQueue <InfoLogData>(); } SQueue <InfoLogData> logQueueT = this.logQueue; if (!mData.logQueue.isEmpty()) { InfoLogData[] logQueueVValues = mData.logQueue.getValues(); int logQueueVMark = mData.logQueue.getMark(); int logQueueVStart = mData.logQueue.getStart(); for (int logQueueVI = 0, logQueueVLen = mData.logQueue.length(); logQueueVI < logQueueVLen; ++logQueueVI) { InfoLogData logQueueV = logQueueVValues[(logQueueVI + logQueueVStart) & logQueueVMark]; InfoLogData logQueueU; if (logQueueV != null) { logQueueU = (InfoLogData)logQueueV.clone(); } else { logQueueU = null; nullObjError("logQueueU"); } logQueueT.offer(logQueueU); } } } else { this.logQueue = null; nullObjError("logQueue"); } this.nextDailyTime = mData.nextDailyTime; if (mData.createDate != null) { this.createDate = (DateData)BytesControl.createData(DateData.dataID); this.createDate.copy(mData.createDate); } else { this.createDate = null; nullObjError("createDate"); } this.clientRandomSeedKey = mData.clientRandomSeedKey; }
/// <summary> /// 读取字节流(简版) /// </summary> protected override void toReadBytesSimple(BytesReadStream stream) { this.version = (SaveVersionData)stream.readDataSimpleNotNull(); this.serverTime = stream.readLong(); this.isBlock = stream.readBoolean(); this.flowStep = stream.readInt(); this.keepSave = (KeepSaveData)stream.createData(KeepSaveData.dataID); this.keepSave.readBytesSimple(stream); if (stream.readBoolean()) { int clientRandomSeedsLen = stream.readLen(); if (this.clientRandomSeeds == null || this.clientRandomSeeds.Length != clientRandomSeedsLen) { this.clientRandomSeeds = new int[clientRandomSeedsLen]; } int[] clientRandomSeedsT = this.clientRandomSeeds; for (int clientRandomSeedsI = 0; clientRandomSeedsI < clientRandomSeedsLen; ++clientRandomSeedsI) { int clientRandomSeedsV; clientRandomSeedsV = stream.readInt(); clientRandomSeedsT[clientRandomSeedsI] = clientRandomSeedsV; } } else { this.clientRandomSeeds = null; } this.clientRandomSeedIndex = stream.readInt(); this.clientOfflineWorkReceiveIndex = stream.readInt(); if (stream.readBoolean()) { int gmCommandSetLen = stream.readLen(); if (this.gmCommandSet != null) { this.gmCommandSet.clear(); this.gmCommandSet.ensureCapacity(gmCommandSetLen); } else { this.gmCommandSet = new SSet <string>(); } SSet <string> gmCommandSetT = this.gmCommandSet; for (int gmCommandSetI = gmCommandSetLen - 1; gmCommandSetI >= 0; --gmCommandSetI) { string gmCommandSetV; gmCommandSetV = stream.readUTF(); gmCommandSetT.add(gmCommandSetV); } } else { this.gmCommandSet = null; } this.gmType = stream.readInt(); this.serverBornCode = stream.readInt(); this.serverStartTime = stream.readLong(); int logQueueLen = stream.readLen(); if (this.logQueue != null) { this.logQueue.clear(); this.logQueue.ensureCapacity(logQueueLen); } else { this.logQueue = new SQueue <InfoLogData>(); } SQueue <InfoLogData> logQueueT = this.logQueue; for (int logQueueI = logQueueLen - 1; logQueueI >= 0; --logQueueI) { InfoLogData logQueueV; logQueueV = (InfoLogData)stream.readDataSimpleNotNull(); logQueueT.offer(logQueueV); } this.nextDailyTime = stream.readLong(); this.createDate = (DateData)stream.createData(DateData.dataID); this.createDate.readBytesSimple(stream); this.clientRandomSeedKey = stream.readInt(); }