示例#1
0
    public void LoadPetsFromString(string data, PetManager petManager)
    {
        string[] lines = data.Split((char)17)[0].Split((char)16);
        foreach (string line in lines)
        {
            if (line.Length > 1)
            {
                Pet      newPet = new Pet();
                string[] info   = line.Split((char)15)[0].Split((char)14);
                newPet.Name        = info[0];
                newPet.Description = petManager.GetPetDescription(newPet.Name);
                newPet.Nickname    = info[2];

                newPet.MinLevel = int.Parse(info[3]);

                newPet.Affinity = info[4];

                newPet.Identifier = info[5];
                string skillString = line.Split((char)15)[1];

                newPet.SetSkills(Extensions.GetSkillsFromString(skillString), skills);
                if (Pets.Find(x => x.Name == info[0]) == null)
                {
                    Pets.Add(newPet);
                }
            }
        }
        if (data.Split((char)17).Length > 1)
        {
            if (data.Split((char)17)[1] == "None")
            {
                return;
            }
            activePet = Pets.Find(x => x.Name == data.Split((char)17)[1]);
        }
    }