Esempio n. 1
0
    public void OnPointerDown(PointerEventData eventData)
    {
        MinionIdentity minionIdentity = skillsScreen.CurrentlySelectedMinion as MinionIdentity;
        MinionResume   component      = minionIdentity.GetComponent <MinionResume>();

        MinionResume.SkillMasteryConditions[] skillMasteryConditions = component.GetSkillMasteryConditions(skillID);
        bool flag = component.CanMasterSkill(skillMasteryConditions);

        if ((UnityEngine.Object)component != (UnityEngine.Object)null && !component.HasMasteredSkill(skillID) && flag)
        {
            KFMOD.PlayOneShot(GlobalAssets.GetSound("HUD_Click", false));
        }
        else
        {
            KFMOD.PlayOneShot(GlobalAssets.GetSound("Negative", false));
        }
    }
Esempio n. 2
0
    public void OnPointerClick(PointerEventData eventData)
    {
        MinionIdentity minionIdentity = skillsScreen.CurrentlySelectedMinion as MinionIdentity;

        if ((UnityEngine.Object)minionIdentity != (UnityEngine.Object)null)
        {
            MinionResume component = minionIdentity.GetComponent <MinionResume>();
            if (DebugHandler.InstantBuildMode && component.AvailableSkillpoints < 1)
            {
                component.ForceAddSkillPoint();
            }
            MinionResume.SkillMasteryConditions[] skillMasteryConditions = component.GetSkillMasteryConditions(skillID);
            bool flag = component.CanMasterSkill(skillMasteryConditions);
            if ((UnityEngine.Object)component != (UnityEngine.Object)null && !component.HasMasteredSkill(skillID) && flag)
            {
                component.MasterSkill(skillID);
                skillsScreen.RefreshAll();
            }
        }
    }
Esempio n. 3
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();
        }
    }
Esempio n. 4
0
    public string DuplicantSkillString(Skill skill)
    {
        string         text           = string.Empty;
        MinionIdentity minionIdentity = skillsScreen.CurrentlySelectedMinion as MinionIdentity;

        if ((UnityEngine.Object)minionIdentity != (UnityEngine.Object)null)
        {
            MinionResume component = minionIdentity.GetComponent <MinionResume>();
            if ((UnityEngine.Object)component == (UnityEngine.Object)null)
            {
                return(string.Empty);
            }
            LocString cAN_MASTER = UI.SKILLS_SCREEN.ASSIGNMENT_REQUIREMENTS.MASTERY.CAN_MASTER;
            if (!component.HasMasteredSkill(skill.Id))
            {
                MinionResume.SkillMasteryConditions[] skillMasteryConditions = component.GetSkillMasteryConditions(skill.Id);
                if (!component.CanMasterSkill(skillMasteryConditions))
                {
                    bool flag = false;
                    text      += "\n";
                    cAN_MASTER = UI.SKILLS_SCREEN.ASSIGNMENT_REQUIREMENTS.MASTERY.CANNOT_MASTER;
                    text      += string.Format(cAN_MASTER, minionIdentity.GetProperName(), skill.Name);
                    if (Array.Exists(skillMasteryConditions, (MinionResume.SkillMasteryConditions element) => element == MinionResume.SkillMasteryConditions.UnableToLearn))
                    {
                        flag = true;
                        Trait  trait        = null;
                        string choreGroupID = Db.Get().SkillGroups.Get(skill.skillGroup).choreGroupID;
                        if (!string.IsNullOrEmpty(choreGroupID))
                        {
                            Traits component2 = minionIdentity.GetComponent <Traits>();
                            foreach (Trait trait2 in component2.TraitList)
                            {
                                if (trait2.disabledChoreGroups != null)
                                {
                                    ChoreGroup[] disabledChoreGroups = trait2.disabledChoreGroups;
                                    foreach (ChoreGroup choreGroup in disabledChoreGroups)
                                    {
                                        if (choreGroup.Id == choreGroupID && trait == null)
                                        {
                                            trait = trait2;
                                        }
                                    }
                                }
                            }
                        }
                        text      += "\n";
                        cAN_MASTER = UI.SKILLS_SCREEN.ASSIGNMENT_REQUIREMENTS.MASTERY.PREVENTED_BY_TRAIT;
                        text      += string.Format(cAN_MASTER, trait.Name);
                    }
                    if (!flag && Array.Exists(skillMasteryConditions, (MinionResume.SkillMasteryConditions element) => element == MinionResume.SkillMasteryConditions.MissingPreviousSkill))
                    {
                        text      += "\n";
                        cAN_MASTER = UI.SKILLS_SCREEN.ASSIGNMENT_REQUIREMENTS.MASTERY.REQUIRES_PREVIOUS_SKILLS;
                        text      += string.Format(cAN_MASTER);
                    }
                    if (!flag && Array.Exists(skillMasteryConditions, (MinionResume.SkillMasteryConditions element) => element == MinionResume.SkillMasteryConditions.NeedsSkillPoints))
                    {
                        text      += "\n";
                        cAN_MASTER = UI.SKILLS_SCREEN.ASSIGNMENT_REQUIREMENTS.MASTERY.REQUIRES_MORE_SKILL_POINTS;
                        text      += string.Format(cAN_MASTER);
                    }
                }
                else
                {
                    if (Array.Exists(skillMasteryConditions, (MinionResume.SkillMasteryConditions element) => element == MinionResume.SkillMasteryConditions.StressWarning))
                    {
                        text      += "\n";
                        cAN_MASTER = UI.SKILLS_SCREEN.ASSIGNMENT_REQUIREMENTS.MASTERY.STRESS_WARNING_MESSAGE;
                        text      += string.Format(cAN_MASTER, skill.Name, minionIdentity.GetProperName());
                    }
                    if (Array.Exists(skillMasteryConditions, (MinionResume.SkillMasteryConditions element) => element == MinionResume.SkillMasteryConditions.SkillAptitude))
                    {
                        text      += "\n";
                        cAN_MASTER = UI.SKILLS_SCREEN.ASSIGNMENT_REQUIREMENTS.MASTERY.SKILL_APTITUDE;
                        text      += string.Format(cAN_MASTER, minionIdentity.GetProperName(), skill.Name);
                    }
                }
            }
        }
        return(text);
    }