/// <summary> /// 读取字节流(完整版) /// </summary> protected override void toReadBytesFull(BytesReadStream stream) { stream.startReadObj(); if (stream.readBoolean()) { BaseData heroT = stream.readDataFullNotNull(); if (heroT != null) { if (heroT is CharacterUseData) { this.hero = (CharacterUseData)heroT; } else { this.hero = new CharacterUseData(); if (!(heroT.GetType().IsAssignableFrom(typeof(CharacterUseData)))) { stream.throwTypeReadError(typeof(CharacterUseData), heroT.GetType()); } this.hero.shadowCopy(heroT); } } else { this.hero = null; } } else { this.hero = null; } stream.endReadObj(); }
/// <summary> /// 初始化初值 /// </summary> public override void initDefault() { base.initDefault(); this.hero = new CharacterUseData(); this.hero.initDefault(); }
/// <summary> /// 读取字节流(简版) /// </summary> protected override void toReadBytesSimple(BytesReadStream stream) { if (stream.readBoolean()) { this.hero = (CharacterUseData)stream.readDataSimpleNotNull(); } else { this.hero = null; } }
/// <summary> /// 复制(潜拷贝) /// </summary> protected override void toShadowCopy(BaseData data) { if (!(data is SceneServerEnterData)) { return; } SceneServerEnterData mData = (SceneServerEnterData)data; this.hero = mData.hero; }
/// <summary> /// 通过保存数据初始化 /// </summary> public void initCharacterUseLogicBySaveData(CharacterUseLogic logic, CharacterSaveData saveData, bool needFuncTool, bool needBindPlayer, bool isClientDrive) { CharacterUseData useData = createCharacterUseDataBySaveData(saveData); initUseLogicByUseData(logic, useData, needFuncTool, needBindPlayer, isClientDrive); if (saveData.cache != null) { logic.getFightLogic().loadCache(saveData.cache); } }
/// <summary> /// 复制(潜拷贝) /// </summary> protected override void toShadowCopy(BaseData data) { base.toShadowCopy(data); if (!(data is SingleCharacterPartData)) { return; } SingleCharacterPartData mData = (SingleCharacterPartData)data; this.hero = mData.hero; }
/// <summary> /// 通过保存数据,创建使用数据 /// </summary> public CharacterUseData createCharacterUseDataBySaveData(CharacterSaveData saveData) { CharacterUseData data = GameC.factory.createCharacterUseData(); data.initDefault(); //1级 data.level = me.role.getLevel(); initMUnitUseBySave(data, saveData); initCharacterUseBySave(data, saveData); return(data); }
/// <summary> /// 新创建主角 /// </summary> protected void onNewCreateHero(CharacterUseData useData) { useData.initDefault(); CharacterConfig cConfig = CharacterConfig.getCharacterConfigByVocationAndSex(me.role.vocation, me.role.getPartData().sex); if (cConfig == null) { Ctrl.errorLog("找不到单角色配置", me.role.vocation, me.role.getPartData().sex); return; } useData.id = cConfig.id; useData.level = me.role.getLevel(); newCreateUseData(useData); }
/// <summary> /// 复制(深拷贝) /// </summary> protected override void toCopy(BaseData data) { if (!(data is SceneServerEnterData)) { return; } SceneServerEnterData mData = (SceneServerEnterData)data; if (mData.hero != null) { this.hero = (CharacterUseData)mData.hero.clone(); } else { this.hero = null; } }
/// <summary> /// 复制(深拷贝) /// </summary> protected override void toCopy(BaseData data) { base.toCopy(data); if (!(data is SingleCharacterPartData)) { return; } SingleCharacterPartData mData = (SingleCharacterPartData)data; if (mData.hero != null) { this.hero = (CharacterUseData)mData.hero.clone(); } else { this.hero = null; nullObjError("hero"); } }
protected override void initCharacterUseBySave(CharacterUseData uData, CharacterSaveData sData) { if (!_g21) { _m21 = instance.Type.GetMethod("initCharacterUseBySave", 2); _g21 = true; } if (_m21 != null && !_b21) { _b21 = true; _p2[0] = uData; _p2[1] = sData; appdomain.Invoke(_m21, instance, _p2); _p2[0] = null; _p2[1] = null; _b21 = false; } else { base.initCharacterUseBySave(uData, sData); } }
/// <summary> /// 回池 /// </summary> protected override void toRelease(DataPool pool) { this.hero = null; }
/// <summary> /// 读取字节流(简版) /// </summary> protected override void toReadBytesSimple(BytesReadStream stream) { base.toReadBytesSimple(stream); this.hero = (CharacterUseData)stream.readDataSimpleNotNull(); }
/// <summary> /// 构造character部分 /// </summary> protected virtual void initCharacterUseBySave(CharacterUseData uData, CharacterSaveData sData) { }