public void Load(UXMLElement element) { Id = element.GetString("id"); Count = element.GetInt("count"); Tier = element.GetInt("tier"); RewardTier = element.GetInt("reward_tier"); }
public void Load(UXMLElement element) { roomLevel = element.GetEnum <RoomLevel>("level", RoomLevel.Beginner); roomProgress = element.GetInt("progress", 0); searchObjectCount = element.GetInt("search_object_count", 5); searchTime = element.GetInt("search_time"); health = element.GetInt("health"); }
public override void Load(UXMLElement element) { base.Load(element); price = new PriceData(element); Value = element.GetInt("value"); SpecialValue = element.GetInt("special"); }
public void Load(UXMLElement element) { id = element.GetString("id"); CacheData(); state = element.GetEnum <QuestState>("state"); startTime = element.GetInt("start_time", 0); endTime = element.GetInt("end_time", 0); }
public void Load(UXMLElement element) { if (element != null) { lastRewardTime = element.GetInt("last_reward_time"); lastDay = element.GetInt("last_day"); isLoaded = true; } else { InitSave(); } }
public void Load(UXMLElement element) { if (element == null) { return; } id = element.GetString("id"); isUnlocked = element.GetBool("is_unlocked"); roomLevel = element.GetEnum("level", RoomLevel.Beginner); roomProgress = element.GetInt("progress", 0); searchMode = element.GetEnum("search_mode", SearchMode.Day); recordSearchTime = element.GetInt("record_time", int.MaxValue); }
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 void Load(UXMLElement element) { string curid = element.GetString("id", string.Empty); InventoryItemType type = element.GetEnum <InventoryItemType>("type"); count = element.GetInt("count", 0); //Debug.Log($"loaded item {curid}-{type}-{count}".Colored(ColorType.green)); if (string.IsNullOrEmpty(curid)) { InitSave(); } else { data = resourceService.GetInventoryItemData(type, curid); if (data == null) { //Debug.Log($"item data is null {curid}-{type}".Colored(ColorType.fuchsia)); InitSave(); } else { //Debug.Log($"item data not null {curid}-{type}".Colored(ColorType.grey)); } } }
public static Condition FromXml(UXMLElement element) { ConditionType type = element.GetEnum <ConditionType>("type"); switch (type) { case ConditionType.has_collectable: { return(new HasCollectableCondition(element.GetString("id"))); } case ConditionType.has_collection: { return(new HasCollectionCondition(element.GetString("id"))); } case ConditionType.has_story_collection: { return(new HasStoryCollectionCondition(element.GetString("id"))); } case ConditionType.last_search_room: { return(new LastSearchRoomCondition(element.GetString("id"))); } case ConditionType.level_ge: { return(new LevelGeCondition(element.GetInt("value"))); } case ConditionType.quest_completed: { return(new QuestCompletedCondition(element.GetString("id"))); } case ConditionType.random: { return(new RandomCondition(element.GetFloat("value"))); } case ConditionType.room_mode: { return(new RoomModeCondition(element.GetEnum <RoomMode>("value"))); } case ConditionType.search_counter_ge: { return(new SearchCounterGeCondition(element.GetInt("value"))); } default: { return(new NoneCondition()); } } }
public override void Load(UXMLElement element) { base.Load(element); level = element.GetInt("level", 1); price.Load(element); //energy = element.GetInt("energy", 0); roomType = element.GetEnum <RoomType>("type", RoomType.hallway); scaryIconPath = element.GetString("sicon"); silverReward = element.GetInt("reward_silver", 0); expReward = element.GetInt("reward_exp", 0); scaryScene = element.GetString("sscene"); scene = element.GetString("scene"); isSpecial = element.GetBool("special", false); floor = element.GetInt("floor", 0); linkedRooms.Clear(); linkedRooms.AddRange(element.GetStringArray("linked")); }
public void Load(UXMLElement element) { id = element.GetString("id"); itemId = element.GetString("item_id"); itemType = element.GetEnum <InventoryItemType>("item_type"); count = element.GetInt("count"); price = new PriceData(); price.Load(element); }
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 void Load(UXMLElement element) { if (element != null) { id = element.GetString("id"); name = element.GetString("name"); avatarId = element.GetString("avatar"); level = element.GetInt("level"); isValid = element.GetBool("is_valid"); } }
public void Load(UXMLElement element) { switchTimer = element.GetFloat("timer"); int saveTime = element.GetInt("save_time"); int nowTime = Utility.unixTime; int sleepInterval = nowTime - saveTime; switchTimer -= sleepInterval; CorrentSwitcherTimerToRange(); isLoaded = true; }
public DropItem(UXMLElement element) { this.type = element.GetEnum <DropType>("type"); this.count = element.GetInt("count"); if (this.type == DropType.item) { string itemId = element.GetString("item_id"); InventoryItemType itemType = element.GetEnum <InventoryItemType>("item_type"); this.itemData = resourceService.GetInventoryItemData(itemType, itemId); } }
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 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 void Load(UXMLElement element) { tier = element.GetInt("index"); count = element.GetInt("count"); rewardItem = new DropItem(element.Element("rewards").Element("reward")); }
public void Load(UXMLElement element) { silver = element.GetInt("silver", 0); gold = element.GetInt("gold", 0); }
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); }