protected override void toSetData(FuncToolData data) { base.toSetData(data); _data = (ItemContainerData)data; _list = _data.items; _gridNum = _data.gridNum; }
/// <summary> /// 添加功能插件(数据不在FuncTool存,而是自行维护,也需要funcID) /// </summary> public void addFuncTool(IPlayerFuncTool tool, FuncToolData data) { FuncTool fTool = (FuncTool)tool; fTool.isAdded = true; toRegistFuncTool(tool); fTool.setData(data); tool.afterReadDataSecond(); }
/// <summary> /// 是否数据一致 /// </summary> protected override bool toDataEquals(BaseData data) { FuncToolData mData = (FuncToolData)data; if (this.funcID != mData.funcID) { return(false); } return(true); }
/// <summary> /// 复制(深拷贝) /// </summary> protected override void toCopy(BaseData data) { if (!(data is FuncToolData)) { return; } FuncToolData mData = (FuncToolData)data; this.funcID = mData.funcID; }
protected override void toSetData(FuncToolData data) { base.toSetData(data); RankSimpleData dd = (RankSimpleData)data; _rankData = GameC.factory.createPlayerRankData(); _rankData.key = me.role.playerID; _rankData.showData = me.role.getSelfRoleShowData(); _rankData.rank = dd.rank; _rankData.value = dd.value; }
protected override void toSetData(FuncToolData data) { base.toSetData(data); _data = (ItemDicContainerData)data; _showListDirty = true; _data = (ItemDicContainerData)data; _dic = _data.items; //_gridNum=_data.gridNum; _gridNum = 0; //TODO:之后实现完整gridNum }
protected override FuncToolData createToolData() { if (!_g6) { _m6 = instance.Type.GetMethod("createToolData", 0); _g6 = true; } if (_m6 != null && !_b6) { _b6 = true; FuncToolData re = (FuncToolData)appdomain.Invoke(_m6, instance, null); _b6 = false; return(re); } else { return(base.createToolData()); } }
public override void onNewCreate() { _d.funcTools = new IntObjectMap <IntObjectMap <FuncToolData> >(); SList <FuncTool> list; FuncTool[] values = (list = _funcToolList).getValues(); FuncTool v; for (int i = list.size() - 1; i >= 0; --i) { v = values[i]; FuncToolData toolData = v.getNewCreateData(); if (toolData != null) { _d.funcTools.computeIfAbsent(v.getType(), k => new IntObjectMap <FuncToolData>()).put(v.getFuncID(), toolData); } } }
protected override void toSetData(FuncToolData data) { if (!_g7) { _m7 = instance.Type.GetMethod("toSetData", 1); _g7 = true; } if (_m7 != null && !_b7) { _b7 = true; _p1[0] = data; appdomain.Invoke(_m7, instance, _p1); _p1[0] = null; _b7 = false; } else { base.toSetData(data); } }
protected override void toSetData(FuncToolData data) { base.toSetData(data); SubsectionRankSimpleData dd = (SubsectionRankSimpleData)data; _rankData = GameC.factory.createPlayerRankData(); _rankData.key = me.role.playerID; _rankData.showData = me.role.getSelfRoleShowData(); _rankData.rank = dd.rank; _rankData.value = dd.value; _subsectionIndex = dd.subsectionIndex; _subsectionSubIndex = dd.subsectionSubIndex; if (_pageShowTool != null) { _pageShowTool.setSubsectionIndex(_subsectionIndex, _subsectionSubIndex); } }
/** 设置数据 */ public void setData(FuncToolData data) { if (data != null) { data.funcID = _funcID; toSetData(data); afterReadData(); } else { if (CommonSetting.isSingleGame) { FuncToolData newData = createToolData(); if (newData != null) { newData.funcID = _funcID; toSetData(newData); onNewCreate(); afterReadData(); } } } }
protected override void toSetData(FuncToolData data) { base.toSetData(data); _d = (PlayerRoleGroupClientToolData)data; }
protected virtual void toSetData(FuncToolData data) { _data = data; }
protected override void toSetData(FuncToolData data) { base.toSetData(data); _data = (EquipContainerData)data; }
protected override void toSetData(FuncToolData data) { base.toSetData(data); _rankData = (RankSimpleData)data; }
/// <summary> /// 复制(深拷贝) /// </summary> protected override void toCopy(BaseData data) { if (!(data is FuncPartData)) { return; } FuncPartData mData = (FuncPartData)data; if (mData.funcTools != null) { if (this.funcTools != null) { this.funcTools.clear(); this.funcTools.ensureCapacity(mData.funcTools.size()); } else { this.funcTools = new IntObjectMap <IntObjectMap <FuncToolData> >(mData.funcTools.size()); } IntObjectMap <IntObjectMap <FuncToolData> > funcToolsT = this.funcTools; if (!mData.funcTools.isEmpty()) { int funcToolsKFreeValue = mData.funcTools.getFreeValue(); int[] funcToolsKKeys = mData.funcTools.getKeys(); IntObjectMap <FuncToolData>[] funcToolsVValues = mData.funcTools.getValues(); for (int funcToolsKI = funcToolsKKeys.Length - 1; funcToolsKI >= 0; --funcToolsKI) { int funcToolsK = funcToolsKKeys[funcToolsKI]; if (funcToolsK != funcToolsKFreeValue) { IntObjectMap <FuncToolData> funcToolsV = funcToolsVValues[funcToolsKI]; int funcToolsW; IntObjectMap <FuncToolData> funcToolsU; funcToolsW = funcToolsK; if (funcToolsV != null) { funcToolsU = new IntObjectMap <FuncToolData>(funcToolsV.size()); IntObjectMap <FuncToolData> funcToolsUT = funcToolsU; if (!funcToolsV.isEmpty()) { int funcToolsUKFreeValue = funcToolsV.getFreeValue(); int[] funcToolsUKKeys = funcToolsV.getKeys(); FuncToolData[] funcToolsUVValues = funcToolsV.getValues(); for (int funcToolsUKI = funcToolsUKKeys.Length - 1; funcToolsUKI >= 0; --funcToolsUKI) { int funcToolsUK = funcToolsUKKeys[funcToolsUKI]; if (funcToolsUK != funcToolsUKFreeValue) { FuncToolData funcToolsUV = funcToolsUVValues[funcToolsUKI]; int funcToolsUW; FuncToolData funcToolsUU; funcToolsUW = funcToolsUK; if (funcToolsUV != null) { funcToolsUU = (FuncToolData)funcToolsUV.clone(); } else { funcToolsUU = null; } funcToolsUT.put(funcToolsUW, funcToolsUU); } } } } else { funcToolsU = null; } funcToolsT.put(funcToolsW, funcToolsU); } } } } else { this.funcTools = null; } if (mData.funcOpenSet != null) { if (this.funcOpenSet != null) { this.funcOpenSet.clear(); this.funcOpenSet.ensureCapacity(mData.funcOpenSet.size()); } else { this.funcOpenSet = new IntSet(); } IntSet funcOpenSetT = this.funcOpenSet; if (!mData.funcOpenSet.isEmpty()) { int funcOpenSetVFreeValue = mData.funcOpenSet.getFreeValue(); int[] funcOpenSetVKeys = mData.funcOpenSet.getKeys(); for (int funcOpenSetVI = funcOpenSetVKeys.Length - 1; funcOpenSetVI >= 0; --funcOpenSetVI) { int funcOpenSetV = funcOpenSetVKeys[funcOpenSetVI]; if (funcOpenSetV != funcOpenSetVFreeValue) { int funcOpenSetU; funcOpenSetU = funcOpenSetV; funcOpenSetT.add(funcOpenSetU); } } } } else { this.funcOpenSet = null; nullObjError("funcOpenSet"); } }
/// <summary> /// 读取字节流(完整版) /// </summary> protected override void toReadBytesFull(BytesReadStream stream) { stream.startReadObj(); if (stream.readBoolean()) { int funcToolsLen = stream.readLen(); if (this.funcTools != null) { this.funcTools.clear(); this.funcTools.ensureCapacity(funcToolsLen); } else { this.funcTools = new IntObjectMap <IntObjectMap <FuncToolData> >(funcToolsLen); } IntObjectMap <IntObjectMap <FuncToolData> > funcToolsT = this.funcTools; for (int funcToolsI = funcToolsLen - 1; funcToolsI >= 0; --funcToolsI) { int funcToolsK; IntObjectMap <FuncToolData> funcToolsV; funcToolsK = stream.readInt(); if (stream.readBoolean()) { int funcToolsVLen = stream.readLen(); funcToolsV = new IntObjectMap <FuncToolData>(funcToolsVLen); IntObjectMap <FuncToolData> funcToolsVT = funcToolsV; for (int funcToolsVI = funcToolsVLen - 1; funcToolsVI >= 0; --funcToolsVI) { int funcToolsVK; FuncToolData funcToolsVV; funcToolsVK = stream.readInt(); if (stream.readBoolean()) { BaseData funcToolsVVT = stream.readDataFullNotNull(); if (funcToolsVVT != null) { if (funcToolsVVT is FuncToolData) { funcToolsVV = (FuncToolData)funcToolsVVT; } else { funcToolsVV = new FuncToolData(); if (!(funcToolsVVT.GetType().IsAssignableFrom(typeof(FuncToolData)))) { stream.throwTypeReadError(typeof(FuncToolData), funcToolsVVT.GetType()); } funcToolsVV.shadowCopy(funcToolsVVT); } } else { funcToolsVV = null; } } else { funcToolsVV = null; } funcToolsVT.put(funcToolsVK, funcToolsVV); } } else { funcToolsV = null; } funcToolsT.put(funcToolsK, funcToolsV); } } else { this.funcTools = null; } int funcOpenSetLen = stream.readLen(); if (this.funcOpenSet != null) { this.funcOpenSet.clear(); this.funcOpenSet.ensureCapacity(funcOpenSetLen); } else { this.funcOpenSet = new IntSet(); } IntSet funcOpenSetT = this.funcOpenSet; for (int funcOpenSetI = funcOpenSetLen - 1; funcOpenSetI >= 0; --funcOpenSetI) { int funcOpenSetV; funcOpenSetV = stream.readInt(); funcOpenSetT.add(funcOpenSetV); } stream.endReadObj(); }
/// <summary> /// 转文本输出 /// </summary> protected override void toWriteDataString(DataWriter writer) { writer.writeTabs(); writer.sb.Append("funcTools"); writer.sb.Append(':'); writer.sb.Append("Map<int,IntObjectMap<FuncToolData>>"); if (this.funcTools != null) { writer.sb.Append('('); writer.sb.Append(this.funcTools.size()); writer.sb.Append(')'); writer.writeEnter(); writer.writeLeftBrace(); if (!this.funcTools.isEmpty()) { int funcToolsKFreeValue = this.funcTools.getFreeValue(); int[] funcToolsKKeys = this.funcTools.getKeys(); IntObjectMap <FuncToolData>[] funcToolsVValues = this.funcTools.getValues(); for (int funcToolsKI = funcToolsKKeys.Length - 1; funcToolsKI >= 0; --funcToolsKI) { int funcToolsK = funcToolsKKeys[funcToolsKI]; if (funcToolsK != funcToolsKFreeValue) { IntObjectMap <FuncToolData> funcToolsV = funcToolsVValues[funcToolsKI]; writer.writeTabs(); writer.sb.Append(funcToolsK); writer.sb.Append(':'); writer.sb.Append("Map<int,FuncToolData>"); if (funcToolsV != null) { writer.sb.Append('('); writer.sb.Append(funcToolsV.size()); writer.sb.Append(')'); writer.writeEnter(); writer.writeLeftBrace(); if (!funcToolsV.isEmpty()) { int funcToolsVKFreeValue = funcToolsV.getFreeValue(); int[] funcToolsVKKeys = funcToolsV.getKeys(); FuncToolData[] funcToolsVVValues = funcToolsV.getValues(); for (int funcToolsVKI = funcToolsVKKeys.Length - 1; funcToolsVKI >= 0; --funcToolsVKI) { int funcToolsVK = funcToolsVKKeys[funcToolsVKI]; if (funcToolsVK != funcToolsVKFreeValue) { FuncToolData funcToolsVV = funcToolsVVValues[funcToolsVKI]; writer.writeTabs(); writer.sb.Append(funcToolsVK); writer.sb.Append(':'); if (funcToolsVV != null) { funcToolsVV.writeDataString(writer); } else { writer.sb.Append("FuncToolData=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("funcOpenSet"); writer.sb.Append(':'); writer.sb.Append("Set<int>"); if (this.funcOpenSet != null) { writer.sb.Append('('); writer.sb.Append(this.funcOpenSet.size()); writer.sb.Append(')'); writer.writeEnter(); writer.writeLeftBrace(); if (!this.funcOpenSet.isEmpty()) { int funcOpenSetVFreeValue = this.funcOpenSet.getFreeValue(); int[] funcOpenSetVKeys = this.funcOpenSet.getKeys(); for (int funcOpenSetVI = funcOpenSetVKeys.Length - 1; funcOpenSetVI >= 0; --funcOpenSetVI) { int funcOpenSetV = funcOpenSetVKeys[funcOpenSetVI]; if (funcOpenSetV != funcOpenSetVFreeValue) { writer.writeTabs(); writer.sb.Append(funcOpenSetV); writer.writeEnter(); } } } writer.writeRightBrace(); } else { writer.sb.Append("=null"); } writer.writeEnter(); }
/// <summary> /// 是否数据一致 /// </summary> protected override bool toDataEquals(BaseData data) { FuncPartData mData = (FuncPartData)data; if (mData.funcTools != null) { if (this.funcTools == null) { return(false); } if (this.funcTools.size() != mData.funcTools.size()) { return(false); } IntObjectMap <IntObjectMap <FuncToolData> > funcToolsR = mData.funcTools; if (!this.funcTools.isEmpty()) { int funcToolsKFreeValue = this.funcTools.getFreeValue(); int[] funcToolsKKeys = this.funcTools.getKeys(); IntObjectMap <FuncToolData>[] funcToolsVValues = this.funcTools.getValues(); for (int funcToolsKI = funcToolsKKeys.Length - 1; funcToolsKI >= 0; --funcToolsKI) { int funcToolsK = funcToolsKKeys[funcToolsKI]; if (funcToolsK != funcToolsKFreeValue) { IntObjectMap <FuncToolData> funcToolsV = funcToolsVValues[funcToolsKI]; IntObjectMap <FuncToolData> funcToolsU = funcToolsR.get(funcToolsK); if (funcToolsU != null) { if (funcToolsV == null) { return(false); } if (funcToolsV.size() != funcToolsU.size()) { return(false); } IntObjectMap <FuncToolData> funcToolsVR = funcToolsU; if (!funcToolsV.isEmpty()) { int funcToolsVKFreeValue = funcToolsV.getFreeValue(); int[] funcToolsVKKeys = funcToolsV.getKeys(); FuncToolData[] funcToolsVVValues = funcToolsV.getValues(); for (int funcToolsVKI = funcToolsVKKeys.Length - 1; funcToolsVKI >= 0; --funcToolsVKI) { int funcToolsVK = funcToolsVKKeys[funcToolsVKI]; if (funcToolsVK != funcToolsVKFreeValue) { FuncToolData funcToolsVV = funcToolsVVValues[funcToolsVKI]; FuncToolData funcToolsVU = funcToolsVR.get(funcToolsVK); if (funcToolsVU != null) { if (funcToolsVV == null) { return(false); } if (!funcToolsVV.dataEquals(funcToolsVU)) { return(false); } } else { if (funcToolsVV != null) { return(false); } } } } } } else { if (funcToolsV != null) { return(false); } } } } } } else { if (this.funcTools != null) { return(false); } } if (mData.funcOpenSet != null) { if (this.funcOpenSet == null) { return(false); } if (this.funcOpenSet.size() != mData.funcOpenSet.size()) { return(false); } IntSet funcOpenSetR = mData.funcOpenSet; if (!this.funcOpenSet.isEmpty()) { int funcOpenSetVFreeValue = this.funcOpenSet.getFreeValue(); int[] funcOpenSetVKeys = this.funcOpenSet.getKeys(); for (int funcOpenSetVI = funcOpenSetVKeys.Length - 1; funcOpenSetVI >= 0; --funcOpenSetVI) { int funcOpenSetV = funcOpenSetVKeys[funcOpenSetVI]; if (funcOpenSetV != funcOpenSetVFreeValue) { if (!funcOpenSetR.contains(funcOpenSetV)) { return(false); } } } } } else { if (this.funcOpenSet != null) { return(false); } } return(true); }
/// <summary> /// 写入字节流(完整版) /// </summary> protected override void toWriteBytesFull(BytesWriteStream stream) { stream.startWriteObj(); if (this.funcTools != null) { stream.writeBoolean(true); stream.writeLen(this.funcTools.size()); if (!this.funcTools.isEmpty()) { int funcToolsKFreeValue = this.funcTools.getFreeValue(); int[] funcToolsKKeys = this.funcTools.getKeys(); IntObjectMap <FuncToolData>[] funcToolsVValues = this.funcTools.getValues(); for (int funcToolsKI = funcToolsKKeys.Length - 1; funcToolsKI >= 0; --funcToolsKI) { int funcToolsK = funcToolsKKeys[funcToolsKI]; if (funcToolsK != funcToolsKFreeValue) { IntObjectMap <FuncToolData> funcToolsV = funcToolsVValues[funcToolsKI]; stream.writeInt(funcToolsK); if (funcToolsV != null) { stream.writeBoolean(true); stream.writeLen(funcToolsV.size()); if (!funcToolsV.isEmpty()) { int funcToolsVKFreeValue = funcToolsV.getFreeValue(); int[] funcToolsVKKeys = funcToolsV.getKeys(); FuncToolData[] funcToolsVVValues = funcToolsV.getValues(); for (int funcToolsVKI = funcToolsVKKeys.Length - 1; funcToolsVKI >= 0; --funcToolsVKI) { int funcToolsVK = funcToolsVKKeys[funcToolsVKI]; if (funcToolsVK != funcToolsVKFreeValue) { FuncToolData funcToolsVV = funcToolsVVValues[funcToolsVKI]; stream.writeInt(funcToolsVK); if (funcToolsVV != null) { stream.writeBoolean(true); stream.writeDataFullNotNull(funcToolsVV); } else { stream.writeBoolean(false); } } } } } else { stream.writeBoolean(false); } } } } } else { stream.writeBoolean(false); } if (this.funcOpenSet != null) { stream.writeLen(this.funcOpenSet.size()); if (!this.funcOpenSet.isEmpty()) { int funcOpenSetVFreeValue = this.funcOpenSet.getFreeValue(); int[] funcOpenSetVKeys = this.funcOpenSet.getKeys(); for (int funcOpenSetVI = funcOpenSetVKeys.Length - 1; funcOpenSetVI >= 0; --funcOpenSetVI) { int funcOpenSetV = funcOpenSetVKeys[funcOpenSetVI]; if (funcOpenSetV != funcOpenSetVFreeValue) { stream.writeInt(funcOpenSetV); } } } } else { nullObjError("funcOpenSet"); } stream.endWriteObj(); }