/// <summary> /// 复制(深拷贝) /// </summary> protected override void toCopy(BaseData data) { if (!(data is ApplyAddFriendData)) { return; } ApplyAddFriendData mData = (ApplyAddFriendData)data; this.playerID = mData.playerID; if (mData.data != null) { this.data = (RoleSocialData)mData.data.clone(); } else { this.data = null; nullObjError("data"); } this.applyTime = mData.applyTime; this.type = mData.type; }
/// <summary> /// 读取字节流(完整版) /// </summary> protected override void toReadBytesFull(BytesReadStream stream) { base.toReadBytesFull(stream); stream.startReadObj(); BaseData applyDataT = stream.readDataFullNotNull(); if (applyDataT != null) { if (applyDataT is ApplyAddFriendData) { this.applyData = (ApplyAddFriendData)applyDataT; } else { this.applyData = new ApplyAddFriendData(); if (!(applyDataT.GetType().IsAssignableFrom(typeof(ApplyAddFriendData)))) { stream.throwTypeReadError(typeof(ApplyAddFriendData), applyDataT.GetType()); } this.applyData.shadowCopy(applyDataT); } } else { this.applyData = null; } stream.endReadObj(); }
/// <summary> /// 申请添加好友 /// </summary> public void onApplyAddFriend(ApplyAddFriendData data) { //快捷方式 OtherUtils.putObjInDicWithMax(data.playerID, data, _d.applyDic, Global.applyAddFriendMaxNum, compareApplyAddFriend); me.dispatch(GameEventType.ReceiveApplyFriend, data.playerID); me.dispatch(GameEventType.RefreshApplyFriendList); onApplyAddFriendForG(data); }
/// <summary> /// 复制(潜拷贝) /// </summary> protected override void toShadowCopy(BaseData data) { if (!(data is ApplyAddFriendData)) { return; } ApplyAddFriendData mData = (ApplyAddFriendData)data; this.playerID = mData.playerID; this.data = mData.data; this.applyTime = mData.applyTime; this.type = mData.type; }
/// <summary> /// 拒绝好友申请 /// </summary> public void refuseApplyAddFriend(long playerID) { ApplyAddFriendData data = _d.applyDic.get(playerID); if (data == null) { me.warnLog("拒绝好友申请时,不存在"); return; } _d.applyDic.remove(playerID); RefuseApplyAddFriendRequest.create(playerID).send(); }
private int compareApplyAddFriend(ApplyAddFriendData arg1, ApplyAddFriendData arg2) { if (arg1.applyTime < arg2.applyTime) { return(-1); } if (arg1.applyTime == arg2.applyTime) { return(0); } return(1); }
public override void onApplyAddFriendForG(ApplyAddFriendData data) { if (!_g20) { _m20 = instance.Type.GetMethod("onApplyAddFriendForG", 1); _g20 = true; } if (_m20 != null && !_b20) { _b20 = true; _p1[0] = data; appdomain.Invoke(_m20, instance, _p1); _p1[0] = null; _b20 = false; } else { base.onApplyAddFriendForG(data); } }
/// <summary> /// 是否数据一致 /// </summary> protected override bool toDataEquals(BaseData data) { ApplyAddFriendData mData = (ApplyAddFriendData)data; if (this.playerID != mData.playerID) { return(false); } if (mData.data != null) { if (this.data == null) { return(false); } if (!this.data.dataEquals(mData.data)) { return(false); } } else { if (this.data != null) { return(false); } } if (this.applyTime != mData.applyTime) { return(false); } if (this.type != mData.type) { return(false); } return(true); }
/// <summary> /// 转文本输出 /// </summary> protected override void toWriteDataString(DataWriter writer) { writer.writeTabs(); writer.sb.Append("friends"); writer.sb.Append(':'); writer.sb.Append("Map<long,FriendData>"); if (this.friends != null) { writer.sb.Append('('); writer.sb.Append(this.friends.size()); writer.sb.Append(')'); writer.writeEnter(); writer.writeLeftBrace(); if (!this.friends.isEmpty()) { long friendsKFreeValue = this.friends.getFreeValue(); long[] friendsKKeys = this.friends.getKeys(); FriendData[] friendsVValues = this.friends.getValues(); for (int friendsKI = friendsKKeys.Length - 1; friendsKI >= 0; --friendsKI) { long friendsK = friendsKKeys[friendsKI]; if (friendsK != friendsKFreeValue) { FriendData friendsV = friendsVValues[friendsKI]; writer.writeTabs(); writer.sb.Append(friendsK); writer.sb.Append(':'); if (friendsV != null) { friendsV.writeDataString(writer); } else { writer.sb.Append("FriendData=null"); } writer.writeEnter(); } } } writer.writeRightBrace(); } else { writer.sb.Append("=null"); } writer.writeEnter(); writer.writeTabs(); writer.sb.Append("blackList"); writer.sb.Append(':'); writer.sb.Append("Map<long,ContactData>"); if (this.blackList != null) { writer.sb.Append('('); writer.sb.Append(this.blackList.size()); writer.sb.Append(')'); writer.writeEnter(); writer.writeLeftBrace(); if (!this.blackList.isEmpty()) { long blackListKFreeValue = this.blackList.getFreeValue(); long[] blackListKKeys = this.blackList.getKeys(); ContactData[] blackListVValues = this.blackList.getValues(); for (int blackListKI = blackListKKeys.Length - 1; blackListKI >= 0; --blackListKI) { long blackListK = blackListKKeys[blackListKI]; if (blackListK != blackListKFreeValue) { ContactData blackListV = blackListVValues[blackListKI]; writer.writeTabs(); writer.sb.Append(blackListK); writer.sb.Append(':'); if (blackListV != null) { blackListV.writeDataString(writer); } else { writer.sb.Append("ContactData=null"); } writer.writeEnter(); } } } writer.writeRightBrace(); } else { writer.sb.Append("=null"); } writer.writeEnter(); writer.writeTabs(); writer.sb.Append("applyDic"); writer.sb.Append(':'); writer.sb.Append("Map<long,ApplyAddFriendData>"); if (this.applyDic != null) { writer.sb.Append('('); writer.sb.Append(this.applyDic.size()); writer.sb.Append(')'); writer.writeEnter(); writer.writeLeftBrace(); if (!this.applyDic.isEmpty()) { long applyDicKFreeValue = this.applyDic.getFreeValue(); long[] applyDicKKeys = this.applyDic.getKeys(); ApplyAddFriendData[] applyDicVValues = this.applyDic.getValues(); for (int applyDicKI = applyDicKKeys.Length - 1; applyDicKI >= 0; --applyDicKI) { long applyDicK = applyDicKKeys[applyDicKI]; if (applyDicK != applyDicKFreeValue) { ApplyAddFriendData applyDicV = applyDicVValues[applyDicKI]; writer.writeTabs(); writer.sb.Append(applyDicK); writer.sb.Append(':'); if (applyDicV != null) { applyDicV.writeDataString(writer); } else { writer.sb.Append("ApplyAddFriendData=null"); } writer.writeEnter(); } } } writer.writeRightBrace(); } else { writer.sb.Append("=null"); } writer.writeEnter(); }
/// <summary> /// 是否数据一致 /// </summary> protected override bool toDataEquals(BaseData data) { FriendPartData mData = (FriendPartData)data; if (mData.friends != null) { if (this.friends == null) { return(false); } if (this.friends.size() != mData.friends.size()) { return(false); } LongObjectMap <FriendData> friendsR = mData.friends; if (!this.friends.isEmpty()) { long friendsKFreeValue = this.friends.getFreeValue(); long[] friendsKKeys = this.friends.getKeys(); FriendData[] friendsVValues = this.friends.getValues(); for (int friendsKI = friendsKKeys.Length - 1; friendsKI >= 0; --friendsKI) { long friendsK = friendsKKeys[friendsKI]; if (friendsK != friendsKFreeValue) { FriendData friendsV = friendsVValues[friendsKI]; FriendData friendsU = friendsR.get(friendsK); if (friendsU != null) { if (friendsV == null) { return(false); } if (!friendsV.dataEquals(friendsU)) { return(false); } } else { if (friendsV != null) { return(false); } } } } } } else { if (this.friends != null) { return(false); } } if (mData.blackList != null) { if (this.blackList == null) { return(false); } if (this.blackList.size() != mData.blackList.size()) { return(false); } LongObjectMap <ContactData> blackListR = mData.blackList; if (!this.blackList.isEmpty()) { long blackListKFreeValue = this.blackList.getFreeValue(); long[] blackListKKeys = this.blackList.getKeys(); ContactData[] blackListVValues = this.blackList.getValues(); for (int blackListKI = blackListKKeys.Length - 1; blackListKI >= 0; --blackListKI) { long blackListK = blackListKKeys[blackListKI]; if (blackListK != blackListKFreeValue) { ContactData blackListV = blackListVValues[blackListKI]; ContactData blackListU = blackListR.get(blackListK); if (blackListU != null) { if (blackListV == null) { return(false); } if (!blackListV.dataEquals(blackListU)) { return(false); } } else { if (blackListV != null) { return(false); } } } } } } else { if (this.blackList != null) { return(false); } } if (mData.applyDic != null) { if (this.applyDic == null) { return(false); } if (this.applyDic.size() != mData.applyDic.size()) { return(false); } LongObjectMap <ApplyAddFriendData> applyDicR = mData.applyDic; if (!this.applyDic.isEmpty()) { long applyDicKFreeValue = this.applyDic.getFreeValue(); long[] applyDicKKeys = this.applyDic.getKeys(); ApplyAddFriendData[] applyDicVValues = this.applyDic.getValues(); for (int applyDicKI = applyDicKKeys.Length - 1; applyDicKI >= 0; --applyDicKI) { long applyDicK = applyDicKKeys[applyDicKI]; if (applyDicK != applyDicKFreeValue) { ApplyAddFriendData applyDicV = applyDicVValues[applyDicKI]; ApplyAddFriendData applyDicU = applyDicR.get(applyDicK); if (applyDicU != null) { if (applyDicV == null) { return(false); } if (!applyDicV.dataEquals(applyDicU)) { return(false); } } else { if (applyDicV != null) { return(false); } } } } } } else { if (this.applyDic != null) { return(false); } } return(true); }
/// <summary> /// 写入字节流(完整版) /// </summary> protected override void toWriteBytesFull(BytesWriteStream stream) { stream.startWriteObj(); if (this.friends != null) { stream.writeLen(this.friends.size()); if (!this.friends.isEmpty()) { FriendData[] friendsVValues = this.friends.getValues(); for (int friendsVI = friendsVValues.Length - 1; friendsVI >= 0; --friendsVI) { FriendData friendsV = friendsVValues[friendsVI]; if (friendsV != null) { if (friendsV != null) { stream.writeDataFullNotNull(friendsV); } else { nullObjError("friendsV"); } } } } } else { nullObjError("friends"); } if (this.blackList != null) { stream.writeLen(this.blackList.size()); if (!this.blackList.isEmpty()) { ContactData[] blackListVValues = this.blackList.getValues(); for (int blackListVI = blackListVValues.Length - 1; blackListVI >= 0; --blackListVI) { ContactData blackListV = blackListVValues[blackListVI]; if (blackListV != null) { if (blackListV != null) { stream.writeDataFullNotNull(blackListV); } else { nullObjError("blackListV"); } } } } } else { nullObjError("blackList"); } if (this.applyDic != null) { stream.writeLen(this.applyDic.size()); if (!this.applyDic.isEmpty()) { ApplyAddFriendData[] applyDicVValues = this.applyDic.getValues(); for (int applyDicVI = applyDicVValues.Length - 1; applyDicVI >= 0; --applyDicVI) { ApplyAddFriendData applyDicV = applyDicVValues[applyDicVI]; if (applyDicV != null) { if (applyDicV != null) { stream.writeDataFullNotNull(applyDicV); } else { nullObjError("applyDicV"); } } } } } else { nullObjError("applyDic"); } stream.endWriteObj(); }
/// <summary> /// 读取字节流(完整版) /// </summary> protected override void toReadBytesFull(BytesReadStream stream) { stream.startReadObj(); int friendsLen = stream.readLen(); if (this.friends != null) { this.friends.clear(); this.friends.ensureCapacity(friendsLen); } else { this.friends = new LongObjectMap <FriendData>(friendsLen); } LongObjectMap <FriendData> friendsT = this.friends; for (int friendsI = friendsLen - 1; friendsI >= 0; --friendsI) { FriendData friendsV; BaseData friendsVT = stream.readDataFullNotNull(); if (friendsVT != null) { if (friendsVT is FriendData) { friendsV = (FriendData)friendsVT; } else { friendsV = new FriendData(); if (!(friendsVT.GetType().IsAssignableFrom(typeof(FriendData)))) { stream.throwTypeReadError(typeof(FriendData), friendsVT.GetType()); } friendsV.shadowCopy(friendsVT); } } else { friendsV = null; } friendsT.put(friendsV.playerID, friendsV); } int blackListLen = stream.readLen(); if (this.blackList != null) { this.blackList.clear(); this.blackList.ensureCapacity(blackListLen); } else { this.blackList = new LongObjectMap <ContactData>(blackListLen); } LongObjectMap <ContactData> blackListT = this.blackList; for (int blackListI = blackListLen - 1; blackListI >= 0; --blackListI) { ContactData blackListV; BaseData blackListVT = stream.readDataFullNotNull(); if (blackListVT != null) { if (blackListVT is ContactData) { blackListV = (ContactData)blackListVT; } else { blackListV = new ContactData(); if (!(blackListVT.GetType().IsAssignableFrom(typeof(ContactData)))) { stream.throwTypeReadError(typeof(ContactData), blackListVT.GetType()); } blackListV.shadowCopy(blackListVT); } } else { blackListV = null; } blackListT.put(blackListV.playerID, blackListV); } int applyDicLen = stream.readLen(); if (this.applyDic != null) { this.applyDic.clear(); this.applyDic.ensureCapacity(applyDicLen); } else { this.applyDic = new LongObjectMap <ApplyAddFriendData>(applyDicLen); } LongObjectMap <ApplyAddFriendData> applyDicT = this.applyDic; for (int applyDicI = applyDicLen - 1; applyDicI >= 0; --applyDicI) { ApplyAddFriendData applyDicV; BaseData applyDicVT = stream.readDataFullNotNull(); if (applyDicVT != null) { if (applyDicVT is ApplyAddFriendData) { applyDicV = (ApplyAddFriendData)applyDicVT; } else { applyDicV = new ApplyAddFriendData(); if (!(applyDicVT.GetType().IsAssignableFrom(typeof(ApplyAddFriendData)))) { stream.throwTypeReadError(typeof(ApplyAddFriendData), applyDicVT.GetType()); } applyDicV.shadowCopy(applyDicVT); } } else { applyDicV = null; } applyDicT.put(applyDicV.playerID, applyDicV); } stream.endReadObj(); }
/// <summary> /// 复制(深拷贝) /// </summary> protected override void toCopy(BaseData data) { if (!(data is FriendPartData)) { return; } FriendPartData mData = (FriendPartData)data; if (mData.friends != null) { if (this.friends != null) { this.friends.clear(); this.friends.ensureCapacity(mData.friends.size()); } else { this.friends = new LongObjectMap <FriendData>(mData.friends.size()); } LongObjectMap <FriendData> friendsT = this.friends; if (!mData.friends.isEmpty()) { FriendData[] friendsVValues = mData.friends.getValues(); for (int friendsVI = friendsVValues.Length - 1; friendsVI >= 0; --friendsVI) { FriendData friendsV = friendsVValues[friendsVI]; if (friendsV != null) { FriendData friendsU; if (friendsV != null) { friendsU = (FriendData)friendsV.clone(); } else { friendsU = null; nullObjError("friendsU"); } friendsT.put(friendsU.playerID, friendsU); } } } } else { this.friends = null; nullObjError("friends"); } if (mData.blackList != null) { if (this.blackList != null) { this.blackList.clear(); this.blackList.ensureCapacity(mData.blackList.size()); } else { this.blackList = new LongObjectMap <ContactData>(mData.blackList.size()); } LongObjectMap <ContactData> blackListT = this.blackList; if (!mData.blackList.isEmpty()) { ContactData[] blackListVValues = mData.blackList.getValues(); for (int blackListVI = blackListVValues.Length - 1; blackListVI >= 0; --blackListVI) { ContactData blackListV = blackListVValues[blackListVI]; if (blackListV != null) { ContactData blackListU; if (blackListV != null) { blackListU = (ContactData)blackListV.clone(); } else { blackListU = null; nullObjError("blackListU"); } blackListT.put(blackListU.playerID, blackListU); } } } } else { this.blackList = null; nullObjError("blackList"); } if (mData.applyDic != null) { if (this.applyDic != null) { this.applyDic.clear(); this.applyDic.ensureCapacity(mData.applyDic.size()); } else { this.applyDic = new LongObjectMap <ApplyAddFriendData>(mData.applyDic.size()); } LongObjectMap <ApplyAddFriendData> applyDicT = this.applyDic; if (!mData.applyDic.isEmpty()) { ApplyAddFriendData[] applyDicVValues = mData.applyDic.getValues(); for (int applyDicVI = applyDicVValues.Length - 1; applyDicVI >= 0; --applyDicVI) { ApplyAddFriendData applyDicV = applyDicVValues[applyDicVI]; if (applyDicV != null) { ApplyAddFriendData applyDicU; if (applyDicV != null) { applyDicU = (ApplyAddFriendData)applyDicV.clone(); } else { applyDicU = null; nullObjError("applyDicU"); } applyDicT.put(applyDicU.playerID, applyDicU); } } } } else { this.applyDic = null; nullObjError("applyDic"); } }
/// <summary> /// 读取字节流(简版) /// </summary> protected override void toReadBytesSimple(BytesReadStream stream) { base.toReadBytesSimple(stream); this.applyData = (ApplyAddFriendData)stream.readDataSimpleNotNull(); }
/// <summary> /// 回池 /// </summary> protected override void toRelease(DataPool pool) { base.toRelease(pool); this.applyData = null; }
/// <summary> /// 申请添加好友 /// </summary> public virtual void onApplyAddFriendForG(ApplyAddFriendData data) { }