/// <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> 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); }