private void SetProxy(GC_LOGIN_RET packet) { PlayerProxy proxy = GameFacade.GetProxy <PlayerProxy>(); proxy.userid = packet.Userid; proxy.oid = packet.Oid; proxy.accesstoken = packet.Accesstoken; proxy.playername = packet.Playername; proxy.level = packet.Level; //城市数据 proxy.city.cityId = packet.City.CityId; proxy.city.tileId = packet.City.TileId; proxy.city.level = packet.City.Level; proxy.city.food = packet.City.Food; proxy.city.stone = packet.City.Stone; proxy.city.iron = packet.City.Iron; proxy.city.WorldPos = new Coord(packet.City.Posx, packet.City.Posz); proxy.city.buildList.Clear(); for (int i = 0; i < packet.City.buildlistCount; i++) { GC_BuildingData data = packet.City.GetBuildlist(i); BuildingVo vo = new BuildingVo(); PlayerProxy.SetBuildVo(data, vo); proxy.city.buildList.Add(vo); } proxy.city.trainList.Clear(); for (int i = 0; i < packet.City.trainListCount; i++) { GC_TrainData data = packet.City.GetTrainList(i); TrainVo vo = new TrainVo(); PlayerProxy.SetTrainVo(data, vo); proxy.city.trainList.Add(vo); } //英雄数据 proxy.heroList.Clear(); for (int i = 0; i < packet.HeroList.heroListCount; i++) { GC_HeroData data = packet.HeroList.GetHeroList(i); HeroVo vo = new HeroVo(); PlayerProxy.SetHeroVo(data, vo); proxy.heroList.Add(vo); } //队伍数据 proxy.marchList.Clear(); for (int i = 0; i < packet.Marchlist.marchlistCount; i++) { GC_MarchData data = packet.Marchlist.GetMarchlist(i); MarchVo vo = new MarchVo(); PlayerProxy.SetMarchVo(data, vo); proxy.marchList.Add(vo); } }
static public void SetTrainVo(GC_TrainData data, TrainVo vo) { vo.queueid = data.Queueid; vo.buildId = data.Buildid; vo.troopType = data.Trooptype; vo.health = data.Hp; vo.beginTime = data.Begintime; vo.endTime = data.Completime; vo.queueIndex = data.Queueindex; }
public uint Execute(PacketDistributed ipacket) { GC_Troop_Train packet = (GC_Troop_Train )ipacket; if (null == packet) { return((uint)PACKET_EXE.PACKET_EXE_ERROR); } //enter your logic if (packet.Ret == 0) { PlayerProxy playerProxy = GameFacade.GetProxy <PlayerProxy> (); bool find = false; for (int i = 0; i < playerProxy.city.trainList.Count; i++) { if (playerProxy.city.trainList[i].queueid == packet.Data.Queueid) { find = true; PlayerProxy.SetTrainVo(packet.Data, playerProxy.city.trainList [i]); } } if (!find) { TrainVo train = new TrainVo(); PlayerProxy.SetTrainVo(packet.Data, train); playerProxy.city.trainList.Add(train); } find = false; MarchVo march = null; for (int i = 0; i < playerProxy.marchList.Count; i++) { if (playerProxy.marchList [i].buildId == packet.Data.Buildid) { march = playerProxy.marchList [i]; for (int j = 0; j < playerProxy.marchList [i].troopList.Count; j++) { TroopVo vo = playerProxy.marchList [i].troopList [j]; if (vo.queueIndex == packet.Data.Queueindex) { find = true; } } } } if (!find) { TroopVo troop = new TroopVo(); troop.type = packet.Data.Trooptype; troop.health = 0; troop.level = 1; troop.queueIndex = packet.Data.Queueindex; march.troopList.Add(troop); } EventManager.GetInstance().SendEvent(EventId.TroopTrain, null); } else { UnityEngine.Debug.Log("数据包报错了!!!"); } return((uint)PACKET_EXE.PACKET_EXE_CONTINUE); }
/// <summary>tg_role 实体转换 RoleInfoVo</summary> /// <param name="model">武将实体</param> /// <param name="equips">武将装备集合</param> /// <param name="fightskillvos">战斗技能Vo集合</param> /// <param name="lifetskillvos">生活技能Vo集合</param> /// <param name="genres">可学流派集合</param> /// <param name="trainvo">武将修行Vo</param> /// <param name="titles">武将称号集合</param> /// <returns>前端RoleInfoVo</returns> public static RoleInfoVo ToRoleVo(tg_role model, List <double> equips, List <FightSkillVo> fightskillvos, List <LifeSkillVo> lifetskillvos, List <int> genres, TrainVo trainvo, List <double> titles) { return(new RoleInfoVo() { id = model.id, baseId = model.role_id, state = model.role_state, level = model.role_level, experience = model.role_exp, power = tg_role.GetTotalPower(model), rolePower = model.power, identityId = model.role_identity, captain = Math.Round(tg_role.GetSingleTotal(RoleAttributeType.ROLE_CAPTAIN, model), 2), //单项属性点总值 force = Math.Round(tg_role.GetSingleTotal(RoleAttributeType.ROLE_FORCE, model), 2), brains = Math.Round(tg_role.GetSingleTotal(RoleAttributeType.ROLE_BRAINS, model), 2), charm = Math.Round(tg_role.GetSingleTotal(RoleAttributeType.ROLE_CHARM, model), 2), govern = Math.Round(tg_role.GetSingleTotal(RoleAttributeType.ROLE_GOVERN, model), 2), captainBase = Math.Round(tg_role.GetSingleFixed(RoleAttributeType.ROLE_CAPTAIN, model), 2), //固定基础属性点 forceBase = Math.Round(tg_role.GetSingleFixed(RoleAttributeType.ROLE_FORCE, model), 2), brainsBase = Math.Round(tg_role.GetSingleFixed(RoleAttributeType.ROLE_BRAINS, model), 2), charmBase = Math.Round(tg_role.GetSingleFixed(RoleAttributeType.ROLE_CHARM, model), 2), governBase = Math.Round(tg_role.GetSingleFixed(RoleAttributeType.ROLE_GOVERN, model), 2), life = model.att_life, attack = Math.Round(tg_role.GetTotalAttack(model), 2), defense = Math.Round(model.att_defense, 2), hurtIncrease = Math.Round(model.att_sub_hurtIncrease, 2), hurtReduce = Math.Round(model.att_sub_hurtReduce, 2), mysteryId = (int)model.art_mystery, cheatCodeId = (int)model.art_cheat_code, genre = model.role_genre, ninja = model.role_ninja, honor = model.role_honor, critAddition = Math.Round(tg_role.GetTotalCritAddition(model), 2), critProbability = Math.Round(tg_role.GetTotalCritProbability(model), 2), dodgeProbability = Math.Round(tg_role.GetTotalDodgeProbability(model), 2), mysteryProbability = Math.Round(tg_role.GetTotalMysteryProbability(model), 2), equipArray = equips, //武将装备集合 fightSkillArrVo = fightskillvos, //战斗技能Vo集合 lifeSkillArrVo = lifetskillvos, //生活技能Vo集合 genreTypeArr = genres, //可学流派,忍者众技能 trainVo = trainvo, //武将修行Vo roleTitleIdList = titles, //武将称号集合 }); }