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 SetMarchVo(GC_MarchData data, MarchVo vo) { vo.marchId = data.Marchid; vo.playerId = data.Playerid; vo.cityId = data.CityId; vo.fightId = data.Fightid; vo.buildId = data.Buildid; vo.sceneId = data.Sceneid; vo.beginTime = data.Begintime; vo.status = data.Status; vo.speed = data.Speed; vo.hero = new HeroVo(); SetHeroVo(data.Hero, vo.hero); vo.troopList.Clear(); for (int i = 0; i < data.troopCount; i++) { GC_TroopData tData = data.GetTroop(i); TroopVo tVo = new TroopVo(); SetTroopVo(tData, tVo); vo.troopList.Add(tVo); } }