public FarmerRenderer(string textureName, Farmer farmer)
     : this()
 {
     eyes.Set(farmer.newEyeColor.Value);
     this.textureName.Set(textureName);
     _spriteDirty      = true;
     _baseTextureDirty = true;
 }
Example #2
0
        public void LoadData(bool initialize_color = false)
        {
            if (_loadedData)
            {
                return;
            }
            int item_index = base.ParentSheetIndex;

            base.Category = -100;
            if (Game1.clothingInformation.ContainsKey(item_index))
            {
                string[] data2 = Game1.clothingInformation[item_index].Split('/');
                Name        = data2[0];
                price.Value = Convert.ToInt32(data2[5]);
                indexInTileSheetMale.Value   = Convert.ToInt32(data2[3]);
                indexInTileSheetFemale.Value = Convert.ToInt32(data2[4]);
                dyeable.Value = Convert.ToBoolean(data2[7]);
                if (initialize_color)
                {
                    string[] rgb_string = data2[6].Split(' ');
                    clothesColor.Value = new Color(Convert.ToInt32(rgb_string[0]), Convert.ToInt32(rgb_string[1]), Convert.ToInt32(rgb_string[2]));
                }
                displayName = data2[1];
                description = data2[2];
                switch (data2[8].ToLower().Trim())
                {
                case "pants":
                    clothesType.Set(1);
                    break;

                case "shirt":
                    clothesType.Set(0);
                    break;

                case "accessory":
                    clothesType.Set(2);
                    break;
                }
                if (data2.Length >= 10)
                {
                    otherData.Set(data2[9]);
                }
                else
                {
                    otherData.Set("");
                }
                if (GetOtherData().Contains("Prismatic"))
                {
                    isPrismatic.Set(newValue: true);
                }
            }
            else
            {
                base.ParentSheetIndex = item_index;
                string[] data = Game1.clothingInformation[-1].Split('/');
                clothesType.Set(1);
                if (item_index >= 1000)
                {
                    data = Game1.clothingInformation[-2].Split('/');
                    clothesType.Set(0);
                    item_index -= 1000;
                }
                if (initialize_color)
                {
                    clothesColor.Set(new Color(1f, 1f, 1f));
                }
                if (clothesType.Value == 1)
                {
                    dyeable.Set(newValue: true);
                }
                else
                {
                    dyeable.Set(newValue: false);
                }
                displayName = data[1];
                description = data[2];
                indexInTileSheetMale.Set(item_index);
                indexInTileSheetFemale.Set(-1);
            }
            if (dyeable.Value)
            {
                description = description + Environment.NewLine + Environment.NewLine + Game1.content.LoadString("Strings\\UI:Clothes_Dyeable");
            }
            _loadedData = true;
        }