private int archetypeDropDownSort(IListableOption a, IListableOption b, object targetData) { if (b.Equals("Random")) { return(-1); } return(b.GetProperName().CompareTo(a.GetProperName())); }
private void OnArchetypeEntryClick(IListableOption skill, object data) { if (skill != null) { SkillGroup skillGroup = skill as SkillGroup; guaranteedAptitudeID = skillGroup.Id; selectedArchetypeIcon.sprite = Assets.GetSprite(skillGroup.archetypeIcon); Reshuffle(true); } else { guaranteedAptitudeID = null; selectedArchetypeIcon.sprite = dropdownArrowIcon; Reshuffle(true); } }
private void Build(List <IListableOption> contentKeys) { built = true; for (int num = contentContainer.childCount - 1; num >= 0; num--) { Util.KDestroyGameObject(contentContainer.GetChild(num)); } rowLookup.Clear(); if (addEmptyRow) { emptyRow = Util.KInstantiateUI(rowEntryPrefab, contentContainer.gameObject, true); emptyRow.GetComponent <KButton>().onClick += delegate { onEntrySelectedAction(null, targetData); Close(); }; string text = (emptyRowLabel == null) ? ((string)UI.DROPDOWN.NONE) : emptyRowLabel; emptyRow.GetComponent <DropDownEntry>().label.text = text; if ((UnityEngine.Object)emptyRowSprite != (UnityEngine.Object)null) { emptyRow.GetComponent <DropDownEntry>().image.sprite = emptyRowSprite; } } for (int i = 0; i < contentKeys.Count; i++) { GameObject gameObject = Util.KInstantiateUI(rowEntryPrefab, contentContainer.gameObject, true); IListableOption id = contentKeys[i]; gameObject.GetComponent <DropDownEntry>().entryData = id; gameObject.GetComponent <KButton>().onClick += delegate { onEntrySelectedAction(id, targetData); if (displaySelectedValueWhenClosed) { selectedLabel.text = id.GetProperName(); } Close(); }; rowLookup.Add(id, gameObject); } RefreshEntries(); Close(); scrollRect.gameObject.transform.SetParent(targetDropDownContainer.transform); scrollRect.gameObject.SetActive(false); }
private void OnHatDropEntryClick(IListableOption skill, object data) { MinionIdentity minionIdentity = currentlySelectedMinion as MinionIdentity; if (!((UnityEngine.Object)minionIdentity == (UnityEngine.Object)null)) { MinionResume component = minionIdentity.GetComponent <MinionResume>(); string s = "hat_role_none"; if (skill != null) { selectedHat.sprite = Assets.GetSprite((skill as SkillListable).skillHat); if ((UnityEngine.Object)component != (UnityEngine.Object)null) { s = (skill as SkillListable).skillHat; component.SetHats(component.CurrentHat, s); if (component.OwnsHat(s)) { new PutOnHatChore(component, Db.Get().ChoreTypes.SwitchHat); } } } else { selectedHat.sprite = Assets.GetSprite(s); if ((UnityEngine.Object)component != (UnityEngine.Object)null) { component.SetHats(component.CurrentHat, null); component.ApplyTargetHat(); } } foreach (SkillMinionWidget minionWidget in minionWidgets) { if (minionWidget.minion == currentlySelectedMinion) { minionWidget.RefreshHat(component.TargetHat); } } } }