示例#1
0
 public override void Load(UXMLElement element)
 {
     base.Load(element);
     price        = new PriceData(element);
     prob         = element.GetFloat("prob");
     invitationId = element.GetString("invitation");
 }
示例#2
0
        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;
        }
示例#3
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");
 }
示例#4
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");
 }
示例#5
0
        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;
            });
        }
示例#6
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());
            }
            }
        }
示例#7
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");
 }
示例#8
0
 public override void Load(UXMLElement element)
 {
     base.Load(element);
     Value = element.GetFloat("value");
 }
示例#9
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);
        }
示例#10
0
 public void Load(UXMLElement element)
 {
     Id         = element.GetString("id");
     RemainTime = element.GetFloat("time");
     data       = resourceService.GetBonus(Id);
 }
示例#11
0
 public override void Load(UXMLElement element)
 {
     base.Load(element);
     price = new PriceData(element);
     prob  = element.GetFloat("prob");
 }