/// <summary> /// 回池 /// </summary> protected override void toRelease(DataPool pool) { this.playerID = 0L; this.showData = null; this.attribute = null; this.force = null; }
/// <summary> /// 复制(深拷贝) /// </summary> protected override void toCopy(BaseData data) { if (!(data is RoleForceData)) { return; } RoleForceData mData = (RoleForceData)data; this.force = mData.force; }
/// <summary> /// 是否数据一致 /// </summary> protected override bool toDataEquals(BaseData data) { RoleForceData mData = (RoleForceData)data; if (this.force != mData.force) { return(false); } return(true); }
/// <summary> /// 复制(潜拷贝) /// </summary> protected override void toShadowCopy(BaseData data) { if (!(data is SceneRoleData)) { return; } SceneRoleData mData = (SceneRoleData)data; this.playerID = mData.playerID; this.showData = mData.showData; this.attribute = mData.attribute; this.force = mData.force; }
/// <summary> /// 复制(深拷贝) /// </summary> protected override void toCopy(BaseData data) { if (!(data is SceneRoleData)) { return; } SceneRoleData mData = (SceneRoleData)data; this.playerID = mData.playerID; if (mData.showData != null) { this.showData = (RoleShowData)mData.showData.clone(); } else { this.showData = null; } if (mData.attribute != null) { this.attribute = (RoleAttributeData)mData.attribute.clone(); } else { this.attribute = null; } if (mData.force != null) { this.force = (RoleForceData)mData.force.clone(); } else { this.force = null; nullObjError("force"); } }
/// <summary> /// 读取字节流(简版) /// </summary> protected override void toReadBytesSimple(BytesReadStream stream) { this.playerID = stream.readLong(); if (stream.readBoolean()) { this.showData = (RoleShowData)stream.readDataSimpleNotNull(); } else { this.showData = null; } if (stream.readBoolean()) { this.attribute = (RoleAttributeData)stream.readDataSimpleNotNull(); } else { this.attribute = null; } this.force = (RoleForceData)stream.readDataSimpleNotNull(); }
/// <summary> /// 读取字节流(完整版) /// </summary> protected override void toReadBytesFull(BytesReadStream stream) { stream.startReadObj(); this.playerID = stream.readLong(); if (stream.readBoolean()) { BaseData showDataT = stream.readDataFullNotNull(); if (showDataT != null) { if (showDataT is RoleShowData) { this.showData = (RoleShowData)showDataT; } else { this.showData = new RoleShowData(); if (!(showDataT.GetType().IsAssignableFrom(typeof(RoleShowData)))) { stream.throwTypeReadError(typeof(RoleShowData), showDataT.GetType()); } this.showData.shadowCopy(showDataT); } } else { this.showData = null; } } else { this.showData = null; } if (stream.readBoolean()) { BaseData attributeT = stream.readDataFullNotNull(); if (attributeT != null) { if (attributeT is RoleAttributeData) { this.attribute = (RoleAttributeData)attributeT; } else { this.attribute = new RoleAttributeData(); if (!(attributeT.GetType().IsAssignableFrom(typeof(RoleAttributeData)))) { stream.throwTypeReadError(typeof(RoleAttributeData), attributeT.GetType()); } this.attribute.shadowCopy(attributeT); } } else { this.attribute = null; } } else { this.attribute = null; } BaseData forceT = stream.readDataFullNotNull(); if (forceT != null) { if (forceT is RoleForceData) { this.force = (RoleForceData)forceT; } else { this.force = new RoleForceData(); if (!(forceT.GetType().IsAssignableFrom(typeof(RoleForceData)))) { stream.throwTypeReadError(typeof(RoleForceData), forceT.GetType()); } this.force.shadowCopy(forceT); } } else { this.force = null; } stream.endReadObj(); }
/// <summary> /// 初始化初值 /// </summary> public override void initDefault() { this.force = new RoleForceData(); this.force.initDefault(); }