/// <summary> /// 读取字节流(完整版) /// </summary> protected override void toReadBytesFull(BytesReadStream stream) { base.toReadBytesFull(stream); stream.startReadObj(); BaseData resultT = stream.readDataFullNotNull(); if (resultT != null) { if (resultT is QueryPlayerResultData) { this.result = (QueryPlayerResultData)resultT; } else { this.result = new QueryPlayerResultData(); if (!(resultT.GetType().IsAssignableFrom(typeof(QueryPlayerResultData)))) { stream.throwTypeReadError(typeof(QueryPlayerResultData), resultT.GetType()); } this.result.shadowCopy(resultT); } } else { this.result = null; } stream.endReadObj(); }
/// <summary> /// 复制(深拷贝) /// </summary> protected override void toCopy(BaseData data) { if (!(data is QueryPlayerResultData)) { return; } QueryPlayerResultData mData = (QueryPlayerResultData)data; this.queryPlayerID = mData.queryPlayerID; this.queryType = mData.queryType; if (mData.queryArgs != null) { int[] queryArgsR = mData.queryArgs; int queryArgsLen = queryArgsR.Length; if (this.queryArgs == null || this.queryArgs.Length != queryArgsLen) { this.queryArgs = new int[queryArgsLen]; } BytesControl.arrayCopy(mData.queryArgs, this.queryArgs, queryArgsLen); } else { this.queryArgs = null; } this.isSuccess = mData.isSuccess; }
/// <summary> /// 接收到查询角色事务结果 /// </summary> public void onQueryPlayerResult(QueryPlayerResultData result) { Action <QueryPlayerResultData> func = _reQueryPlayerFuncDic.get(result.queryType); if (func == null) { me.errorLog("接收到查询角色事务结果时,未注册事务类型:" + result.queryType); return; } func(result); }
/// <summary> /// 是否数据一致 /// </summary> protected override bool toDataEquals(BaseData data) { QueryPlayerResultData mData = (QueryPlayerResultData)data; if (this.queryPlayerID != mData.queryPlayerID) { return(false); } if (this.queryType != mData.queryType) { return(false); } if (mData.queryArgs != null) { if (this.queryArgs == null) { return(false); } if (this.queryArgs.Length != mData.queryArgs.Length) { return(false); } int[] queryArgsT = this.queryArgs; int[] queryArgsR = mData.queryArgs; int queryArgsLen = queryArgsT.Length; for (int queryArgsI = 0; queryArgsI < queryArgsLen; ++queryArgsI) { int queryArgsU = queryArgsT[queryArgsI]; int queryArgsV = queryArgsR[queryArgsI]; if (queryArgsU != queryArgsV) { return(false); } } } else { if (this.queryArgs != null) { return(false); } } if (this.isSuccess != mData.isSuccess) { return(false); } return(true); }
/// <summary> /// 复制(潜拷贝) /// </summary> protected override void toShadowCopy(BaseData data) { if (!(data is QueryPlayerResultData)) { return; } QueryPlayerResultData mData = (QueryPlayerResultData)data; this.queryPlayerID = mData.queryPlayerID; this.queryType = mData.queryType; this.queryArgs = mData.queryArgs; this.isSuccess = mData.isSuccess; }
/// <summary> /// 读取字节流(简版) /// </summary> protected override void toReadBytesSimple(BytesReadStream stream) { base.toReadBytesSimple(stream); this.result = (QueryPlayerResultData)stream.readDataSimpleNotNull(); }
/// <summary> /// 回池 /// </summary> protected override void toRelease(DataPool pool) { base.toRelease(pool); this.result = null; }