Exemple #1
0
    private string HoverChangeRowPriorityButton(object widget_go_obj, int delta)
    {
        GameObject widget_go  = widget_go_obj as GameObject;
        LocString  locString  = null;
        LocString  locString2 = null;
        string     text       = null;
        TableRow   widgetRow  = GetWidgetRow(widget_go);

        switch (widgetRow.rowType)
        {
        case TableRow.RowType.Header:
            Debug.Assert(false);
            return(null);

        case TableRow.RowType.Default:
            locString  = UI.JOBSSCREEN.INCREASE_ROW_PRIORITY_NEW_MINION_TOOLTIP;
            locString2 = UI.JOBSSCREEN.DECREASE_ROW_PRIORITY_NEW_MINION_TOOLTIP;
            break;

        case TableRow.RowType.Minion:
            locString  = UI.JOBSSCREEN.INCREASE_ROW_PRIORITY_MINION_TOOLTIP;
            locString2 = UI.JOBSSCREEN.DECREASE_ROW_PRIORITY_MINION_TOOLTIP;
            text       = widgetRow.GetIdentity().GetProperName();
            break;

        case TableRow.RowType.StoredMinon:
        {
            StoredMinionIdentity storedMinionIdentity = widgetRow.GetIdentity() as StoredMinionIdentity;
            if ((UnityEngine.Object)storedMinionIdentity != (UnityEngine.Object)null)
            {
                return(string.Format(UI.JOBSSCREEN.CANNOT_ADJUST_PRIORITY, storedMinionIdentity.GetProperName(), storedMinionIdentity.GetStorageReason()));
            }
            break;
        }
        }
        LocString locString3 = (delta <= 0) ? locString2 : locString;
        string    text2      = locString3.ToString();

        if (text != null)
        {
            text2 = text2.Replace("{Name}", text);
        }
        return(text2);
    }
Exemple #2
0
    public void Refresh(string skillID)
    {
        Skill skill = Db.Get().Skills.Get(skillID);

        if (skill == null)
        {
            Debug.LogWarning("DbSkills is missing skillId " + skillID);
        }
        else
        {
            Name.text = skill.Name;
            LocText name = Name;
            name.text    = name.text + "\n(" + Db.Get().SkillGroups.Get(skill.skillGroup).Name + ")";
            this.skillID = skillID;
            tooltip.SetSimpleTooltip(SkillTooltip(skill));
            MinionIdentity       minionIdentity       = skillsScreen.CurrentlySelectedMinion as MinionIdentity;
            StoredMinionIdentity storedMinionIdentity = skillsScreen.CurrentlySelectedMinion as StoredMinionIdentity;
            MinionResume         minionResume         = null;
            if ((UnityEngine.Object)minionIdentity != (UnityEngine.Object)null)
            {
                minionResume = minionIdentity.GetComponent <MinionResume>();
                MinionResume.SkillMasteryConditions[] skillMasteryConditions = minionResume.GetSkillMasteryConditions(skillID);
                bool flag = minionResume.CanMasterSkill(skillMasteryConditions);
                if (!((UnityEngine.Object)minionResume == (UnityEngine.Object)null) && (minionResume.HasMasteredSkill(skillID) || flag))
                {
                    TitleBarBG.color  = ((!minionResume.HasMasteredSkill(skillID)) ? header_color_can_assign : header_color_has_skill);
                    hatImage.material = defaultMaterial;
                }
                else
                {
                    TitleBarBG.color  = header_color_disabled;
                    hatImage.material = desaturatedMaterial;
                }
            }
            else if ((UnityEngine.Object)storedMinionIdentity != (UnityEngine.Object)null)
            {
                if (storedMinionIdentity.HasMasteredSkill(skillID))
                {
                    TitleBarBG.color  = header_color_has_skill;
                    hatImage.material = defaultMaterial;
                }
                else
                {
                    TitleBarBG.color  = header_color_disabled;
                    hatImage.material = desaturatedMaterial;
                }
            }
            hatImage.sprite = Assets.GetSprite(skill.badge);
            bool active = false;
            if ((UnityEngine.Object)minionResume != (UnityEngine.Object)null)
            {
                minionResume.AptitudeBySkillGroup.TryGetValue(skill.skillGroup, out float value);
                active = (value > 0f);
            }
            aptitudeBox.SetActive(active);
            traitDisabledIcon.SetActive((UnityEngine.Object)minionResume != (UnityEngine.Object)null && !minionResume.IsAbleToLearnSkill(skill.Id));
            string        text = string.Empty;
            List <string> list = new List <string>();
            foreach (MinionIdentity item in Components.LiveMinionIdentities.Items)
            {
                MinionResume component = item.GetComponent <MinionResume>();
                if ((UnityEngine.Object)component != (UnityEngine.Object)null && component.HasMasteredSkill(skillID))
                {
                    list.Add(component.GetProperName());
                }
            }
            foreach (MinionStorage item2 in Components.MinionStorages.Items)
            {
                foreach (MinionStorage.Info item3 in item2.GetStoredMinionInfo())
                {
                    MinionStorage.Info current3 = item3;
                    if (current3.serializedMinion != null)
                    {
                        StoredMinionIdentity storedMinionIdentity2 = current3.serializedMinion.Get <StoredMinionIdentity>();
                        if ((UnityEngine.Object)storedMinionIdentity2 != (UnityEngine.Object)null && storedMinionIdentity2.HasMasteredSkill(skillID))
                        {
                            list.Add(storedMinionIdentity2.GetProperName());
                        }
                    }
                }
            }
            masteryCount.gameObject.SetActive(list.Count > 0);
            foreach (string item4 in list)
            {
                text = text + "\n    • " + item4;
            }
            masteryCount.SetSimpleTooltip((list.Count <= 0) ? UI.ROLES_SCREEN.WIDGET.NO_MASTERS_TOOLTIP.text : string.Format(UI.ROLES_SCREEN.WIDGET.NUMBER_OF_MASTERS_TOOLTIP, text));
            masteryCount.GetComponentInChildren <LocText>().text = list.Count.ToString();
        }
    }
    private void StoredMinionTooltip(IAssignableIdentity minion, ToolTip tooltip)
    {
        StoredMinionIdentity storedMinionIdentity = minion as StoredMinionIdentity;

        if ((UnityEngine.Object)storedMinionIdentity != (UnityEngine.Object)null)
        {
            tooltip.AddMultiStringTooltip(string.Format(UI.TABLESCREENS.INFORMATION_NOT_AVAILABLE_TOOLTIP, storedMinionIdentity.GetStorageReason(), storedMinionIdentity.GetProperName()), null);
        }
    }