Ejemplo n.º 1
0
        private void SetUpWardrobeCollectionDropdown(Transform childGO, Dropdown thisDD)
        {
            var thisSlot = "WardrobeCollection";

            thisDD.options.Clear();
            thisDD.onValueChanged.RemoveAllListeners();
            var wardrobeOptions = new List <UMATextRecipe>(characterSystem.Recipes[thisRace][thisSlot]);
            var thisUnsetThumb  = Avatar.activeRace.racedata.raceThumbnails.GetThumbFor(thisSlot);
            var thisDummyOption = new Dropdown.OptionData();

            thisDummyOption.text  = "Dummy";
            thisDummyOption.image = thisUnsetThumb;
            thisDD.options.Add(thisDummyOption);
            var thisUnsetOption = new Dropdown.OptionData();

            thisUnsetOption.text  = "Remove All";
            thisUnsetOption.image = thisUnsetThumb;
            thisDD.options.Add(thisUnsetOption);
            int activeWCs  = 0;
            int appliedWCs = 0;

            for (int i = 0; i < wardrobeOptions.Count; i++)
            {
                var thisddOption = new Dropdown.OptionData();
                thisddOption.text  = wardrobeOptions[i].DisplayValue != "" ? wardrobeOptions[i].DisplayValue : wardrobeOptions[i].name;
                thisddOption.image = wardrobeOptions[i].GetWardrobeRecipeThumbFor(thisRace);
                thisDD.options.Add(thisddOption);
                if (Avatar.GetWardrobeCollection(wardrobeOptions[i].name))
                {
                    activeWCs++;
                    if (Avatar.IsCollectionApplied(wardrobeOptions[i].name))
                    {
                        appliedWCs++;
                    }
                }
            }
            thisDD.value = 0;
            thisDD.transform.Find("SlotLabel").GetComponent <Text>().text = "";
            thisDD.captionImage.sprite  = thisUnsetThumb;
            thisDD.captionImage.enabled = true;
            if (thisDD.gameObject.GetComponent <EventTrigger>() == null)
            {
                var trigger = thisDD.gameObject.AddComponent <EventTrigger>();
                EventTrigger.Entry entry = new EventTrigger.Entry();
                entry.eventID = EventTriggerType.PointerClick;
                entry.callback.AddListener(UpdateWardrobeCollectionDropdownOpts);
                trigger.triggers.Add(entry);
            }
            thisDD.onValueChanged.AddListener(childGO.GetComponent <CSWardrobeSlotChangerDD>().ChangeWardrobeSlot);
            var thisSuppressedTextGO = thisDD.gameObject.transform.Find("ActiveWSlot").Find("SuppressedIndicator");

            thisDD.interactable = true;
            if (thisSuppressedTextGO)
            {
                thisSuppressedTextGO.GetComponent <Image>().enabled = true;
                var activeString  = activeWCs > 0 ? "\r\n(" + activeWCs + " ACTIVE)" : "";
                var appliedString = activeWCs > 0 ? "\r\n(" + appliedWCs + " APPLIED)" : "";
                thisSuppressedTextGO.GetComponentInChildren <Text>().text      = "WARDROBE COLLECTIONS " + activeString + appliedString;
                thisSuppressedTextGO.GetComponentInChildren <Text>().fontStyle = FontStyle.Bold;
            }
        }