public void Load(UXMLElement element) { id = element.GetString("id"); nameId = element.GetString("name"); iosStoreId = element.GetString("ios_store_id"); price = new PriceData(element); bonus = element.GetInt("bonus"); realPrice = element.GetString("real_price"); isBest = element.GetBool("is_best"); isPopular = element.GetBool("is_popular"); isBank = element.GetBool("is_bank"); discountData = new DiscountData(); var discountElement = element.Element("discount_info"); if (discountElement != null) { discountData.Load(discountElement); } rewards = new List <DropItem>(); var rewardsElement = element.Element("rewards"); if (rewardsElement != null) { foreach (UXMLElement rewardElement in rewardsElement.Elements("reward")) { DropItem dropItem = new DropItem(rewardElement); rewards.Add(dropItem); } } }
public bool Load(string saveStr) { if (string.IsNullOrEmpty(saveStr)) { InitSave(); } else { UXMLDocument document = new UXMLDocument(); document.Parse(saveStr); UXMLElement gameModeElement = document.Element(saveId); roomMode = gameModeElement?.GetEnum <RoomMode>("room_mode") ?? RoomMode.normal; UXMLElement roomsElement = gameModeElement.Element("rooms"); if (roomsElement != null) { roomManager.Load(roomsElement); } else { roomManager.InitSave(); } UXMLElement dailyRewardElement = gameModeElement.Element("daily_reward"); if (dailyRewardElement != null) { dailyRewardManager.Load(dailyRewardElement); } else { dailyRewardManager.InitSave(); } searchCounter = gameModeElement.GetInt("search_counter", 0); lastSearchRoomId = gameModeElement.GetString("last_search_room", string.Empty); UXMLElement roomModeSwitcherElement = gameModeElement.Element("room_mode_switcher"); if (roomModeSwitcherElement != null) { RoomModeSwitcher.Load(roomModeSwitcherElement); } else { RoomModeSwitcher.InitSave(); } isLoaded = true; } return(true); }
public void Load(UXMLElement element) { day = element.GetInt("day"); rewards = new List <DropItem>(); element.Element("rewards").Elements("reward").ForEach(rewardElement => { DropItem dropItem = new DropItem(rewardElement); rewards.Add(dropItem); }); }
public override void Load(UXMLElement element) { base.Load(element); collectableIds.Clear(); chargers.Clear(); rewards.Clear(); foreach (string collectableId in element.GetString("collectables").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) { collectableIds.Add(collectableId); } element.Element("chargers").Elements("charger").ForEach(chargerElement => { CollectionChargeData collectionChargeData = new CollectionChargeData(); collectionChargeData.Load(chargerElement); chargers.Add(collectionChargeData); }); element.Element("rewards").Elements("reward").ForEach(rewardElement => { DropItem dropItem = new DropItem(rewardElement); rewards.Add(dropItem); }); }
public override void Load(UXMLElement element) { base.Load(element); type = element.GetEnum <QuestType>("type"); ownerId = element.GetString("owner"); startTextId = element.GetString("start_text"); hintTextId = element.GetString("hint_text"); endTextId = element.GetString("end_text"); journalId = element.GetString("journal"); startConditions = new List <Condition>(); UXMLElement scParentElement = element.Element("start_conditions"); if (scParentElement != null) { scParentElement.Elements("condition").ForEach(e => { startConditions.Add(Condition.FromXml(e)); }); } completeConditions = new List <Condition>(); UXMLElement ccParentElement = element.Element("complete_conditions"); if (ccParentElement != null) { ccParentElement.Elements("condition").ForEach(e => { completeConditions.Add(Condition.FromXml(e)); }); } rewards = new List <DropItem>(); UXMLElement rewardsParentElement = element.Element("rewards"); rewardsParentElement.Elements("reward").ForEach(e => { rewards.Add(new DropItem(e)); }); }
public override void Load(UXMLElement element) { base.Load(element); price = new PriceData(element); ingredients = new Dictionary <string, int>(); value = element.GetFloat("value"); interval = element.GetInt("time"); bonusType = element.GetEnum <BonusType>("type"); element.Element("formula").Elements("ingredient").ForEach(ingredientElement => { string ingredientId = ingredientElement.GetString("id"); int count = ingredientElement.GetInt("count"); ingredients[ingredientId] = count; }); }
public override void Load(UXMLElement element) { base.Load(element); type = element.GetEnum <NpcType>("type"); prob = element.GetFloat("prob"); rewards.Clear(); element.Element("rewards").Elements("reward").ForEach(rewardEleent => { rewards.Add(new DropItem(rewardEleent)); }); if (element.HasAttribute("buff")) { buffId = element.GetString("buff"); } if (element.HasAttribute("weapon")) { weaponId = element.GetString("weapon"); } largeIconPath = element.GetString("large_icon"); }
public bool Load(string saveStr) { UXMLDocument document = UXMLDocument.FromXml(saveStr); UXMLElement root = document.Element(saveId); if (root != null) { UXMLElement localPlayerELement = root.Element("local_player"); if (localPlayerELement != null) { localPlayer = new NetPlayer(); localPlayer.Load(localPlayerELement); } else { localPlayer = new NetPlayer(); localPlayer.InitSave(); } } isLoaded = true; return(isLoaded); }
public bool Load(string saveStr) { if (string.IsNullOrEmpty(saveStr)) { InitSave(); } else { //Debug.Log($"LOAD PLAYER {saveStr}"); UXMLDocument document = UXMLDocument.FromXml(saveStr); UXMLElement playerElement = document.Element(saveId); exp = playerElement.GetInt("exp", 0); pname = playerElement.GetString("name", string.Empty); avatarId = playerElement.GetString("avatar", "Avatar1"); silver = playerElement.GetInt("silver", 0); gold = playerElement.GetInt("gold", 0); health = playerElement.GetFloat("health", kBaseMaxHealth); maxHealth = playerElement.GetInt("maxhealth", kBaseMaxHealth); int time = playerElement.GetInt("time", 0); if (time > 0) { int interval = Utility.unixTime - time; if (interval < 0) { interval = 0; } float restoreSpeed = 1.0f / (float)kHealthRestoreInterval; float restoreCount = restoreSpeed * interval; health += restoreCount; health = Mathf.Clamp(health, 0, maxHealth); } var inventoryElement = playerElement.Element("inventory"); if (inventoryElement != null) { inventory.Load(inventoryElement); } else { inventory.InitSave(); } var wishlistElement = playerElement.Element("wishlist"); if (wishlistElement != null) { wishlist.Load(wishlistElement); } else { wishlist.InitSave(); } var buffsElement = playerElement.Element("buffs"); if (buffsElement != null) { buffs.Load(buffsElement); } else { buffs.InitSave(); } //Debug.Log($"Player Loaded: exp-{exp}, name-{playerName}, avatar-{avatarId}, silver-{silver}, gold-{gold}"); isLoaded = true; } return(true); }
public void Load(UXMLElement element) { tier = element.GetInt("index"); count = element.GetInt("count"); rewardItem = new DropItem(element.Element("rewards").Element("reward")); }