public virtual void Deserialize(PBuildInfo data) { EntityID = data.buildId; ConfigID = data.cfgId; Level = data.level; LevelUpRemainTime.SetTimeMilliseconds(data.nextStatusTime); }
public virtual void Deserialize(PPlayerMapInfo data) { MapPosition = data.mapPos; if (data.mapType == eWorldMapType.PLAYER_CITY_MAP) { IsNpc = false; if (data.simRoleAttr != null) { UserEntityID = data.simRoleAttr.playerId; UserName = data.simRoleAttr.roleName; UserIcon = data.simRoleAttr.headImage; UserLevel = data.simRoleAttr.level; UserPalaceLevel = data.simRoleAttr.mainBuildLevel; UserFightScore = data.simRoleAttr.fighting; } } else if (data.mapType == eWorldMapType.NPC_CITY_MAP) { IsNpc = true; if (data.simRoleAttr != null) { UserEntityID = data.simRoleAttr.playerId; WorldMapConfig cfg = WorldMapConfigLoader.GetConfig((int)UserEntityID); UserName = cfg.CityName; UserIcon = data.simRoleAttr.headImage; if (data.getAssertInfo != null) { // 已经侦查 UserLevel = cfg.PlayerLevel; UserPalaceLevel = cfg.CityLevel; UserFightScore = cfg.BattlePower; HeroInfoList.Clear(); AddNpcHero(cfg.DefenseHero1); AddNpcHero(cfg.DefenseHero2); AddNpcHero(cfg.DefenseHero3); } else { // 尚未侦查 UserLevel = 0; UserPalaceLevel = 0; UserFightScore = -1; } } } if (data.getAssertInfo != null) { RewardMoney = data.getAssertInfo.gold; RewardWood = data.getAssertInfo.wood; RewardStone = data.getAssertInfo.stone; RewardGold = data.getAssertInfo.yuanbao; } else { // 尚未侦查 RewardMoney = -1; RewardWood = -1; RewardStone = -1; RewardGold = -1; } if (data.heroInfos != null) { foreach (var item in data.heroInfos) { WorldCityHeroInfo info = new WorldCityHeroInfo(); info.heroCfgID = item.heroCfgId; info.heroLevel = item.level; info.heroQuality = item.jinjie; info.heroStar = item.heroStar; info.heroFightScore = item.fighting; HeroInfoList.Add(info); } } RefreshRemainTime.SetTimeMilliseconds(data.refreshLeftTime); }