/// <summary> /// 读完所有表后处理 /// </summary> public static void afterReadConfigAll() { if (_dic == null) { return; } SkillStepConfig[] values; SkillStepConfig v; for (int i = (values = _dic.getValues()).Length - 1; i >= 0; --i) { if ((v = values[i]) != null) { //空的 if (v.switchType == null || v.switchType.Length == 0) { //有下一个 if (get(v.id, v.step + 1) != null) { v.switchType = new int[] { SkillStepSwitchType.Auto, v.step + 1 }; } else { if (v.switchType == null) { v.switchType = new int[0]; } } } } } }
/// <summary> /// 读完所有表后处理 /// </summary> public static void afterReadConfigAll() { FightUnitConfig fConfig; FightUnitLevelConfig[] values; FightUnitLevelConfig v; for (int i = (values = _dic.getValues()).Length - 1; i >= 0; --i) { if ((v = values[i]) != null) { if ((fConfig = FightUnitConfig.get(v.id)).levelMax < v.level) { fConfig.levelMax = v.level; } } } }
public override void onFrame(int delay) { base.onFrame(delay); Role[] values; Role v; for (int i = (values = _roleDic.getValues()).Length - 1; i >= 0; --i) { if ((v = values[i]) != null) { try { v.onFrame(delay); } catch (Exception e) { Ctrl.errorLog(e); } } } }
/// <summary> /// 更新社交数据组返回 /// </summary> public void onUpdateRoleSocialDatas(LongObjectMap <RoleSocialData> dic) { if (!dic.isEmpty()) { long[] keys = dic.getKeys(); RoleSocialData[] values = dic.getValues(); long fv = dic.getFreeValue(); long k; RoleSocialData v; for (int i = keys.Length - 1; i >= 0; --i) { if ((k = keys[i]) != fv) { v = values[i]; addPlayerRoleSocial(k, v); } } me.dispatch(GameEventType.UpdateSocialData); } }
/// <summary> /// 读完所有表后处理 /// </summary> public static void afterReadConfigAll() { if (_dic == null) { return; } AttackLevelConfig[] values = _dic.getValues(); AttackLevelConfig v; for (int i = values.Length - 1; i >= 0; --i) { if ((v = values[i]) != null) { v.varConfigT = new SkillVarConfig[v.damages.Length]; v.varNumT = 0; for (int j = v.damages.Length - 1; j >= 0; --j) { v.varNumT += (v.varConfigT[j] = SkillVarConfig.get(v.damages[j][1])).args.Length; } } } }
/// <summary> /// 析构(回池前调用,与init成对) /// </summary> public override void dispose() { clearOneRunning(_runningTaskTypeOneDic.getValues()); clearOneRunning(_runningTaskTypeTwoDic.getValues()); }
/// <summary> /// 转文本输出 /// </summary> protected override void toWriteDataString(DataWriter writer) { writer.writeTabs(); writer.sb.Append("singleChannels"); writer.sb.Append(':'); writer.sb.Append("Map<int,ChatChannelData>"); if (this.singleChannels != null) { writer.sb.Append('('); writer.sb.Append(this.singleChannels.size()); writer.sb.Append(')'); writer.writeEnter(); writer.writeLeftBrace(); if (!this.singleChannels.isEmpty()) { int singleChannelsKFreeValue = this.singleChannels.getFreeValue(); int[] singleChannelsKKeys = this.singleChannels.getKeys(); ChatChannelData[] singleChannelsVValues = this.singleChannels.getValues(); for (int singleChannelsKI = singleChannelsKKeys.Length - 1; singleChannelsKI >= 0; --singleChannelsKI) { int singleChannelsK = singleChannelsKKeys[singleChannelsKI]; if (singleChannelsK != singleChannelsKFreeValue) { ChatChannelData singleChannelsV = singleChannelsVValues[singleChannelsKI]; writer.writeTabs(); writer.sb.Append(singleChannelsK); writer.sb.Append(':'); if (singleChannelsV != null) { singleChannelsV.writeDataString(writer); } else { writer.sb.Append("ChatChannelData=null"); } writer.writeEnter(); } } } writer.writeRightBrace(); } else { writer.sb.Append("=null"); } writer.writeEnter(); writer.writeTabs(); writer.sb.Append("multiChannels"); writer.sb.Append(':'); writer.sb.Append("Map<int,LongObjectMap<ChatChannelData>>"); if (this.multiChannels != null) { writer.sb.Append('('); writer.sb.Append(this.multiChannels.size()); writer.sb.Append(')'); writer.writeEnter(); writer.writeLeftBrace(); if (!this.multiChannels.isEmpty()) { int multiChannelsKFreeValue = this.multiChannels.getFreeValue(); int[] multiChannelsKKeys = this.multiChannels.getKeys(); LongObjectMap <ChatChannelData>[] multiChannelsVValues = this.multiChannels.getValues(); for (int multiChannelsKI = multiChannelsKKeys.Length - 1; multiChannelsKI >= 0; --multiChannelsKI) { int multiChannelsK = multiChannelsKKeys[multiChannelsKI]; if (multiChannelsK != multiChannelsKFreeValue) { LongObjectMap <ChatChannelData> multiChannelsV = multiChannelsVValues[multiChannelsKI]; writer.writeTabs(); writer.sb.Append(multiChannelsK); writer.sb.Append(':'); writer.sb.Append("Map<long,ChatChannelData>"); if (multiChannelsV != null) { writer.sb.Append('('); writer.sb.Append(multiChannelsV.size()); writer.sb.Append(')'); writer.writeEnter(); writer.writeLeftBrace(); if (!multiChannelsV.isEmpty()) { long multiChannelsVKFreeValue = multiChannelsV.getFreeValue(); long[] multiChannelsVKKeys = multiChannelsV.getKeys(); ChatChannelData[] multiChannelsVVValues = multiChannelsV.getValues(); for (int multiChannelsVKI = multiChannelsVKKeys.Length - 1; multiChannelsVKI >= 0; --multiChannelsVKI) { long multiChannelsVK = multiChannelsVKKeys[multiChannelsVKI]; if (multiChannelsVK != multiChannelsVKFreeValue) { ChatChannelData multiChannelsVV = multiChannelsVVValues[multiChannelsVKI]; writer.writeTabs(); writer.sb.Append(multiChannelsVK); writer.sb.Append(':'); if (multiChannelsVV != null) { multiChannelsVV.writeDataString(writer); } else { writer.sb.Append("ChatChannelData=null"); } writer.writeEnter(); } } } writer.writeRightBrace(); } else { writer.sb.Append("=null"); } writer.writeEnter(); } } } writer.writeRightBrace(); } else { writer.sb.Append("=null"); } writer.writeEnter(); writer.writeTabs(); writer.sb.Append("chatSendIndex"); writer.sb.Append(':'); writer.sb.Append(this.chatSendIndex); writer.writeEnter(); }
/// <summary> /// 是否数据一致 /// </summary> protected override bool toDataEquals(BaseData data) { SocialPartData mData = (SocialPartData)data; if (mData.singleChannels != null) { if (this.singleChannels == null) { return(false); } if (this.singleChannels.size() != mData.singleChannels.size()) { return(false); } IntObjectMap <ChatChannelData> singleChannelsR = mData.singleChannels; if (!this.singleChannels.isEmpty()) { int singleChannelsKFreeValue = this.singleChannels.getFreeValue(); int[] singleChannelsKKeys = this.singleChannels.getKeys(); ChatChannelData[] singleChannelsVValues = this.singleChannels.getValues(); for (int singleChannelsKI = singleChannelsKKeys.Length - 1; singleChannelsKI >= 0; --singleChannelsKI) { int singleChannelsK = singleChannelsKKeys[singleChannelsKI]; if (singleChannelsK != singleChannelsKFreeValue) { ChatChannelData singleChannelsV = singleChannelsVValues[singleChannelsKI]; ChatChannelData singleChannelsU = singleChannelsR.get(singleChannelsK); if (singleChannelsU != null) { if (singleChannelsV == null) { return(false); } if (!singleChannelsV.dataEquals(singleChannelsU)) { return(false); } } else { if (singleChannelsV != null) { return(false); } } } } } } else { if (this.singleChannels != null) { return(false); } } if (mData.multiChannels != null) { if (this.multiChannels == null) { return(false); } if (this.multiChannels.size() != mData.multiChannels.size()) { return(false); } IntObjectMap <LongObjectMap <ChatChannelData> > multiChannelsR = mData.multiChannels; if (!this.multiChannels.isEmpty()) { int multiChannelsKFreeValue = this.multiChannels.getFreeValue(); int[] multiChannelsKKeys = this.multiChannels.getKeys(); LongObjectMap <ChatChannelData>[] multiChannelsVValues = this.multiChannels.getValues(); for (int multiChannelsKI = multiChannelsKKeys.Length - 1; multiChannelsKI >= 0; --multiChannelsKI) { int multiChannelsK = multiChannelsKKeys[multiChannelsKI]; if (multiChannelsK != multiChannelsKFreeValue) { LongObjectMap <ChatChannelData> multiChannelsV = multiChannelsVValues[multiChannelsKI]; LongObjectMap <ChatChannelData> multiChannelsU = multiChannelsR.get(multiChannelsK); if (multiChannelsU != null) { if (multiChannelsV == null) { return(false); } if (multiChannelsV.size() != multiChannelsU.size()) { return(false); } LongObjectMap <ChatChannelData> multiChannelsVR = multiChannelsU; if (!multiChannelsV.isEmpty()) { long multiChannelsVKFreeValue = multiChannelsV.getFreeValue(); long[] multiChannelsVKKeys = multiChannelsV.getKeys(); ChatChannelData[] multiChannelsVVValues = multiChannelsV.getValues(); for (int multiChannelsVKI = multiChannelsVKKeys.Length - 1; multiChannelsVKI >= 0; --multiChannelsVKI) { long multiChannelsVK = multiChannelsVKKeys[multiChannelsVKI]; if (multiChannelsVK != multiChannelsVKFreeValue) { ChatChannelData multiChannelsVV = multiChannelsVVValues[multiChannelsVKI]; ChatChannelData multiChannelsVU = multiChannelsVR.get(multiChannelsVK); if (multiChannelsVU != null) { if (multiChannelsVV == null) { return(false); } if (!multiChannelsVV.dataEquals(multiChannelsVU)) { return(false); } } else { if (multiChannelsVV != null) { return(false); } } } } } } else { if (multiChannelsV != null) { return(false); } } } } } } else { if (this.multiChannels != null) { return(false); } } if (this.chatSendIndex != mData.chatSendIndex) { return(false); } return(true); }
/// <summary> /// 复制(深拷贝) /// </summary> protected override void toCopy(BaseData data) { if (!(data is SocialPartData)) { return; } SocialPartData mData = (SocialPartData)data; if (mData.singleChannels != null) { if (this.singleChannels != null) { this.singleChannels.clear(); this.singleChannels.ensureCapacity(mData.singleChannels.size()); } else { this.singleChannels = new IntObjectMap <ChatChannelData>(mData.singleChannels.size()); } IntObjectMap <ChatChannelData> singleChannelsT = this.singleChannels; if (!mData.singleChannels.isEmpty()) { int singleChannelsKFreeValue = mData.singleChannels.getFreeValue(); int[] singleChannelsKKeys = mData.singleChannels.getKeys(); ChatChannelData[] singleChannelsVValues = mData.singleChannels.getValues(); for (int singleChannelsKI = singleChannelsKKeys.Length - 1; singleChannelsKI >= 0; --singleChannelsKI) { int singleChannelsK = singleChannelsKKeys[singleChannelsKI]; if (singleChannelsK != singleChannelsKFreeValue) { ChatChannelData singleChannelsV = singleChannelsVValues[singleChannelsKI]; int singleChannelsW; ChatChannelData singleChannelsU; singleChannelsW = singleChannelsK; if (singleChannelsV != null) { singleChannelsU = (ChatChannelData)singleChannelsV.clone(); } else { singleChannelsU = null; nullObjError("singleChannelsU"); } singleChannelsT.put(singleChannelsW, singleChannelsU); } } } } else { this.singleChannels = null; nullObjError("singleChannels"); } if (mData.multiChannels != null) { if (this.multiChannels != null) { this.multiChannels.clear(); this.multiChannels.ensureCapacity(mData.multiChannels.size()); } else { this.multiChannels = new IntObjectMap <LongObjectMap <ChatChannelData> >(mData.multiChannels.size()); } IntObjectMap <LongObjectMap <ChatChannelData> > multiChannelsT = this.multiChannels; if (!mData.multiChannels.isEmpty()) { int multiChannelsKFreeValue = mData.multiChannels.getFreeValue(); int[] multiChannelsKKeys = mData.multiChannels.getKeys(); LongObjectMap <ChatChannelData>[] multiChannelsVValues = mData.multiChannels.getValues(); for (int multiChannelsKI = multiChannelsKKeys.Length - 1; multiChannelsKI >= 0; --multiChannelsKI) { int multiChannelsK = multiChannelsKKeys[multiChannelsKI]; if (multiChannelsK != multiChannelsKFreeValue) { LongObjectMap <ChatChannelData> multiChannelsV = multiChannelsVValues[multiChannelsKI]; int multiChannelsW; LongObjectMap <ChatChannelData> multiChannelsU; multiChannelsW = multiChannelsK; if (multiChannelsV != null) { multiChannelsU = new LongObjectMap <ChatChannelData>(multiChannelsV.size()); LongObjectMap <ChatChannelData> multiChannelsUT = multiChannelsU; if (!multiChannelsV.isEmpty()) { long multiChannelsUKFreeValue = multiChannelsV.getFreeValue(); long[] multiChannelsUKKeys = multiChannelsV.getKeys(); ChatChannelData[] multiChannelsUVValues = multiChannelsV.getValues(); for (int multiChannelsUKI = multiChannelsUKKeys.Length - 1; multiChannelsUKI >= 0; --multiChannelsUKI) { long multiChannelsUK = multiChannelsUKKeys[multiChannelsUKI]; if (multiChannelsUK != multiChannelsUKFreeValue) { ChatChannelData multiChannelsUV = multiChannelsUVValues[multiChannelsUKI]; long multiChannelsUW; ChatChannelData multiChannelsUU; multiChannelsUW = multiChannelsUK; if (multiChannelsUV != null) { multiChannelsUU = (ChatChannelData)multiChannelsUV.clone(); } else { multiChannelsUU = null; nullObjError("multiChannelsUU"); } multiChannelsUT.put(multiChannelsUW, multiChannelsUU); } } } } else { multiChannelsU = null; nullObjError("multiChannelsU"); } multiChannelsT.put(multiChannelsW, multiChannelsU); } } } } else { this.multiChannels = null; nullObjError("multiChannels"); } this.chatSendIndex = mData.chatSendIndex; }
/// <summary> /// 写入字节流(简版) /// </summary> protected override void toWriteBytesSimple(BytesWriteStream stream) { if (this.singleChannels != null) { stream.writeLen(this.singleChannels.size()); if (!this.singleChannels.isEmpty()) { int singleChannelsKFreeValue = this.singleChannels.getFreeValue(); int[] singleChannelsKKeys = this.singleChannels.getKeys(); ChatChannelData[] singleChannelsVValues = this.singleChannels.getValues(); for (int singleChannelsKI = singleChannelsKKeys.Length - 1; singleChannelsKI >= 0; --singleChannelsKI) { int singleChannelsK = singleChannelsKKeys[singleChannelsKI]; if (singleChannelsK != singleChannelsKFreeValue) { ChatChannelData singleChannelsV = singleChannelsVValues[singleChannelsKI]; stream.writeInt(singleChannelsK); if (singleChannelsV != null) { stream.writeDataSimpleNotNull(singleChannelsV); } else { nullObjError("singleChannelsV"); } } } } } else { nullObjError("singleChannels"); } if (this.multiChannels != null) { stream.writeLen(this.multiChannels.size()); if (!this.multiChannels.isEmpty()) { int multiChannelsKFreeValue = this.multiChannels.getFreeValue(); int[] multiChannelsKKeys = this.multiChannels.getKeys(); LongObjectMap <ChatChannelData>[] multiChannelsVValues = this.multiChannels.getValues(); for (int multiChannelsKI = multiChannelsKKeys.Length - 1; multiChannelsKI >= 0; --multiChannelsKI) { int multiChannelsK = multiChannelsKKeys[multiChannelsKI]; if (multiChannelsK != multiChannelsKFreeValue) { LongObjectMap <ChatChannelData> multiChannelsV = multiChannelsVValues[multiChannelsKI]; stream.writeInt(multiChannelsK); if (multiChannelsV != null) { stream.writeLen(multiChannelsV.size()); if (!multiChannelsV.isEmpty()) { long multiChannelsVKFreeValue = multiChannelsV.getFreeValue(); long[] multiChannelsVKKeys = multiChannelsV.getKeys(); ChatChannelData[] multiChannelsVVValues = multiChannelsV.getValues(); for (int multiChannelsVKI = multiChannelsVKKeys.Length - 1; multiChannelsVKI >= 0; --multiChannelsVKI) { long multiChannelsVK = multiChannelsVKKeys[multiChannelsVKI]; if (multiChannelsVK != multiChannelsVKFreeValue) { ChatChannelData multiChannelsVV = multiChannelsVVValues[multiChannelsVKI]; stream.writeLong(multiChannelsVK); if (multiChannelsVV != null) { stream.writeDataSimpleNotNull(multiChannelsVV); } else { nullObjError("multiChannelsVV"); } } } } } else { nullObjError("multiChannelsV"); } } } } } else { nullObjError("multiChannels"); } stream.writeInt(this.chatSendIndex); }