示例#1
0
        public TransmogSet(Character _character, List <TransmogItem> _items)
        //public TransmogSet(Character _character)
        {
            // WowExplorer explorer = new WowExplorer(Region.US, Locale.en_US, $"{Program.apikey}");

            // Realm
            Realm = _character.Realm;

            // Character Name
            Name = _character.Name;

            //Spec
            // TO DO

            // Class
            CharacterClass myClass = _character.Class;

            Class = myClass.ToString();

            // Race
            CharacterRace myRace = _character.Race;

            Race = myRace.ToString();

            // Gender
            CharacterGender myGender = _character.Gender;

            Gender = myGender.ToString();

            // Image
            //Image = GetCharacterImageURL(_character.Realm, _character.Name);
            string url          = "http://render-api-us.worldofwarcraft.com/static-render/us";
            string thumbnailUrl = _character.Thumbnail.Replace("avatar", "profilemain");

            Image = $"{url}/{thumbnailUrl}";

            // Items
            Items = _items;

            // Updated
            Updated = DateTime.Now;
        }
示例#2
0
    private void LeftRight()
    {
        GameObject parent;

        if (Constants.LastEndActionClickedName.Contains("Selector"))
        {
            parent = GameObject.Find(Constants.LastEndActionClickedName);
        }
        else
        {
            parent = GameObject.Find(Constants.LastEndActionClickedName).transform.parent.gameObject;
        }
        var bodyPart       = parent.name.Substring(Helper.CharacterAfterString(parent.name, "Selector"));
        var spriteRenderer = parent.transform.Find("Sprite").GetComponent <SpriteRenderer>();

        // GENDER //
        if (bodyPart.Contains("Gender"))
        {
            if (!Constants.LastEndActionClickedName.Contains("Selector"))
            {
                _gender = _gender == CharacterGender.Male ? CharacterGender.Female : CharacterGender.Male;
            }
            spriteRenderer.sprite = Helper.GetSpriteFromSpriteSheet("Sprites/IconsGender_" + _gender.GetHashCode());
            if (!Constants.LastEndActionClickedName.Contains("Selector"))
            {
                UpdateButtons();
            }
            return;
        }
        // RACE //
        if (bodyPart.Contains("Race"))
        {
            var raceId = _race.GetHashCode();
            if (Constants.LastEndActionClickedName.Contains("Right"))
            {
                ++raceId;
            }
            else if (Constants.LastEndActionClickedName.Contains("Left"))
            {
                --raceId;
            }
            if (raceId < 0)
            {
                raceId = Helper.EnumCount <CharacterRace>() - 1;
            }
            else if (raceId >= Helper.EnumCount <CharacterRace>())
            {
                raceId = 0;
            }
            _race = (CharacterRace)raceId;
            _raceTextMesh.text = _race.ToString();
            if (!Constants.LastEndActionClickedName.Contains("Selector"))
            {
                UpdateButtons();
            }
            return;
        }
        int id = 0;

        if (spriteRenderer.sprite != null)
        {
            id = int.Parse(spriteRenderer.sprite.name.Substring(Helper.CharacterAfterString(spriteRenderer.sprite.name, "_")));
        }
        if (Constants.LastEndActionClickedName.Contains("Right"))
        {
            ++id;
        }
        else if (Constants.LastEndActionClickedName.Contains("Left"))
        {
            --id;
        }
        var customGender = "";

        if (bodyPart.Contains("Skin"))
        {
            if (id < 0)
            {
                id = RacesData.NbSkinTemplates - 1;
            }
            else if (id >= RacesData.NbSkinTemplates)
            {
                id = 0;
            }
        }
        else if (bodyPart.Contains("Hair"))
        {
            if (id < 0)
            {
                id = RacesData.NbHairTemplates - 1;
            }
            else if (id >= RacesData.NbHairTemplates)
            {
                id = 0;
            }
            customGender += _gender;
        }
        else
        {
            if (id < 0)
            {
                id = RacesData.NbBodyTemplates - 1;
            }
            else if (id >= RacesData.NbBodyTemplates)
            {
                id = 0;
            }
        }
        var idMesh = GameObject.Find("Id" + bodyPart);

        if (idMesh != null)
        {
            idMesh.GetComponent <TMPro.TextMeshPro>().text = (id + 1).ToString();
        }
        var customPart = "";

        if (bodyPart.Contains("Arm") || bodyPart.Contains("Hand"))
        {
            customPart = "Front";
        }
        var tmpRace = "Human";
        var path    = "Sprites/" + tmpRace + "/" + tmpRace + customGender + customPart + bodyPart + "_" + id;

        spriteRenderer.sprite = Helper.GetSpriteFromSpriteSheet(path);
        // SKIN COLOR //
        if (bodyPart.Contains("Skin"))
        {
            for (int i = 0; i < _skinContainer.transform.childCount; ++i)
            {
                var child = _skinContainer.transform.GetChild(i);
                if (child.name.Contains("Naked"))
                {
                    var childSpriteRenderer = child.GetComponent <SpriteRenderer>();
                    var skinPath            = "Sprites/" + tmpRace + "/" + childSpriteRenderer.sprite.name.Substring(0, childSpriteRenderer.sprite.name.Length - 1) + id;
                    childSpriteRenderer.sprite = Helper.GetSpriteFromSpriteSheet(skinPath);
                }
            }
            return;
        }
        // BODY PART //
        if (customPart == "")
        {
            _skinContainer.transform.Find(bodyPart).GetComponent <SpriteRenderer>().sprite = Helper.GetSpriteFromSpriteSheet(path);
        }
        else
        {
            _skinContainer.transform.Find(customPart + bodyPart).GetComponent <SpriteRenderer>().sprite = Helper.GetSpriteFromSpriteSheet(path);
            customPart = "Back";
            _skinContainer.transform.Find(customPart + bodyPart).GetComponent <SpriteRenderer>().sprite = Helper.GetSpriteFromSpriteSheet("Sprites/" + tmpRace + "/" + tmpRace + customGender + customPart + bodyPart + "_" + id);
        }
    }
示例#3
0
 public override string ToString()
 {
     return("[" + _pseudo + " (" + _race.ToString() + ")]");
 }