예제 #1
0
        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);
                }
            }
        }
예제 #2
0
 public override void Load(UXMLElement element)
 {
     base.Load(element);
     startTextId = element.GetString("start_text");
     endTextId   = element.GetString("end_text");
     hintTextId  = element.GetString("hint_text");
     type        = element.GetEnum <JournalEntryType>("type");
 }
예제 #3
0
 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);
 }
예제 #4
0
 public void Load(UXMLElement element)
 {
     if (element != null)
     {
         id            = element.GetString("id");
         oldPrice      = element.GetString("old_price");
         oldIosStoreId = element.GetString("old_ios_store_id");
         iconPath      = element.GetString("icon");
     }
 }
예제 #5
0
 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");
     }
 }
예제 #6
0
 public override void Load(UXMLElement element)
 {
     base.Load(element);
     price = new PriceData(element);
     prob  = element.GetFloat("prob");
     rooms.Clear();
     foreach (string roomId in element.GetString("drop_rooms").Split(new char[] { ',' }, System.StringSplitOptions.RemoveEmptyEntries))
     {
         rooms.Add(roomId);
     }
     bonusId = element.GetString("bonus_id");
 }
예제 #7
0
 public override void Load(UXMLElement element)
 {
     base.Load(element);
     collectionId = element.GetString("collection");
     rooms.Clear();
     foreach (string roomId in element.GetString("room").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
     {
         rooms.Add(roomId);
     }
     roomLevel = element.GetEnum <RoomLevel>("rank");
     prob      = element.GetFloat("prob");
 }
예제 #8
0
        public virtual void Load(UXMLElement element)
        {
            id     = element.GetString("id");
            nameId = element.GetString("name");
            if (element.HasAttribute("description"))
            {
                descriptionId = element.GetString("description");
            }
            else
            {
                descriptionId = string.Empty;
            }

            iconPath = element.GetString("icon");
        }
예제 #9
0
 public void Load(UXMLElement element)
 {
     Id         = element.GetString("id");
     Count      = element.GetInt("count");
     Tier       = element.GetInt("tier");
     RewardTier = element.GetInt("reward_tier");
 }
예제 #10
0
        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));
                }
            }
        }
예제 #11
0
 public override void Load(UXMLElement element)
 {
     base.Load(element);
     price        = new PriceData(element);
     prob         = element.GetFloat("prob");
     invitationId = element.GetString("invitation");
 }
예제 #12
0
        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());
            }
            }
        }
예제 #13
0
 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);
 }
예제 #14
0
 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"));
 }
예제 #15
0
 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");
 }
예제 #16
0
 public override void Load(UXMLElement element)
 {
     base.Load(element);
     rankDescriptionId = element.GetString("rank_description");
     tiers             = new List <AchievmentTierData>();
     element.Elements("rank").ForEach(rankElement => {
         AchievmentTierData tierData = new AchievmentTierData();
         tierData.Load(rankElement);
         tiers.Add(tierData);
     });
 }
예제 #17
0
 public void Load(UXMLElement element)
 {
     if (element == null)
     {
         InitSave();
     }
     else
     {
         roomId = element.GetString("room_id");
         string npcId = element.GetString("npc_id");
         if (npcId.IsValid())
         {
             data = resourceService.GetNpc(npcId);
             Debug.Log($"Loaded npc {roomId}: {data.id}");
         }
         else
         {
             InitSave();
         }
     }
 }
예제 #18
0
        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);
            }
        }
예제 #19
0
 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 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);
        }
예제 #21
0
        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));
            });
        }
예제 #22
0
        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);
            });
        }
예제 #23
0
 public void Load(UXMLElement element)
 {
     id     = element.GetString("id");
     textId = element.GetString("text_id");
 }
예제 #24
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);
        }
예제 #25
0
 public void Load(UXMLElement element)
 {
     id             = element.GetString("id");
     streamingAsset = element.GetString("streaming_asset");
     resourceAsset  = element.GetString("resource_asset");
 }
예제 #26
0
 public void Load(UXMLElement element)
 {
     Id = element.GetString("id");
     IsEndTextOpened = element.GetBool("is_end_text_opened");
 }
예제 #27
0
 public override void Load(UXMLElement element)
 {
     base.Load(element);
     price       = new PriceData(element);
     storeItemId = element.GetString("store_item_id");
 }
예제 #28
0
 public void Load(UXMLElement element)
 {
     Id         = element.GetString("id");
     RemainTime = element.GetFloat("time");
     data       = resourceService.GetBonus(Id);
 }
예제 #29
0
 public override void Load(UXMLElement element)
 {
     base.Load(element);
     iconScary = element.GetString("icon_scary");
 }
예제 #30
0
 public override void Load(UXMLElement element)
 {
     base.Load(element);
     giftIconPath = element.GetString("gift_icon");
 }