Пример #1
0
    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);
                }
            }
        }
    }
Пример #2
0
    private void OnHatDropEntryClick(IListableOption skill, object data)
    {
        MinionIdentity minionIdentity = minion as MinionIdentity;

        if (!((Object)minionIdentity == (Object)null))
        {
            MinionResume component = minionIdentity.GetComponent <MinionResume>();
            if (skill != null)
            {
                HierarchyReferences component2 = GetComponent <HierarchyReferences>();
                component2.GetReference("selectedHat").GetComponent <Image>().sprite = Assets.GetSprite((skill as SkillListable).skillHat);
                if ((Object)component != (Object)null)
                {
                    string skillHat = (skill as SkillListable).skillHat;
                    component.SetHats(component.CurrentHat, skillHat);
                    if (component.OwnsHat(skillHat))
                    {
                        new PutOnHatChore(component, Db.Get().ChoreTypes.SwitchHat);
                    }
                }
            }
            else
            {
                HierarchyReferences component3 = GetComponent <HierarchyReferences>();
                component3.GetReference("selectedHat").GetComponent <Image>().sprite = Assets.GetSprite("hat_role_none");
                if ((Object)component != (Object)null)
                {
                    component.SetHats(component.CurrentHat, null);
                    component.ApplyTargetHat();
                }
            }
            if (minion == skillsScreen.CurrentlySelectedMinion)
            {
                skillsScreen.selectedHat.sprite = Assets.GetSprite((!string.IsNullOrEmpty(component.TargetHat)) ? component.TargetHat : "hat_role_none");
            }
        }
    }
Пример #3
0
    protected override void OnCompleteWork(Worker worker)
    {
        base.OnCompleteWork(worker);
        assignable.Unassign();
        MinionResume component = worker.GetComponent <MinionResume>();

        if ((Object)component != (Object)null)
        {
            component.ResetSkillLevels(true);
            component.SetHats(component.CurrentHat, null);
            component.ApplyTargetHat();
            notification = new Notification(MISC.NOTIFICATIONS.RESETSKILL.NAME, NotificationType.Good, HashedString.Invalid, (List <Notification> notificationList, object data) => MISC.NOTIFICATIONS.RESETSKILL.TOOLTIP + notificationList.ReduceMessages(false), null, true, 0f, null, null, null);
            worker.GetComponent <Notifier>().Add(notification, string.Empty);
        }
    }
Пример #4
0
    private static void CopyMinion(StoredMinionIdentity src_id, MinionIdentity dest_id)
    {
        dest_id.SetName(src_id.storedName);
        dest_id.nameStringKey   = src_id.nameStringKey;
        dest_id.gender          = src_id.gender;
        dest_id.genderStringKey = src_id.genderStringKey;
        dest_id.arrivalTime     = src_id.arrivalTime;
        dest_id.voiceIdx        = src_id.voiceIdx;
        dest_id.bodyData        = src_id.bodyData;
        if (src_id.traitIDs != null)
        {
            Traits component = dest_id.GetComponent <Traits>();
            component.SetTraitIds(src_id.traitIDs);
        }
        if (src_id.accessories != null)
        {
            Accessorizer component2 = dest_id.GetComponent <Accessorizer>();
            component2.SetAccessories(src_id.accessories);
        }
        ConsumableConsumer component3 = dest_id.GetComponent <ConsumableConsumer>();

        if (src_id.forbiddenTags != null)
        {
            component3.forbiddenTags = src_id.forbiddenTags.ToArray();
        }
        if (src_id.MasteryBySkillID != null)
        {
            MinionResume component4 = dest_id.GetComponent <MinionResume>();
            component4.RestoreResume(src_id.MasteryBySkillID, src_id.AptitudeBySkillGroup, src_id.TotalExperienceGained);
            component4.SetHats(src_id.currentHat, src_id.targetHat);
        }
        if (src_id.choreGroupPriorities != null)
        {
            ChoreConsumer component5 = dest_id.GetComponent <ChoreConsumer>();
            component5.SetChoreGroupPriorities(src_id.choreGroupPriorities);
        }
        AttributeLevels component6 = dest_id.GetComponent <AttributeLevels>();

        if (src_id.attributeLevels != null)
        {
            component6.SaveLoadLevels = src_id.attributeLevels.ToArray();
            component6.OnDeserialized();
        }
        dest_id.GetComponent <Accessorizer>().ApplyAccessories();
        dest_id.assignableProxy = new Ref <MinionAssignablesProxy>();
        dest_id.assignableProxy.Set(src_id.assignableProxy.Get());
        dest_id.assignableProxy.Get().SetTarget(dest_id, dest_id.gameObject);
        Equipment equipment = dest_id.GetEquipment();

        foreach (AssignableSlotInstance slot in equipment.Slots)
        {
            Equippable equippable = slot.assignable as Equippable;
            if ((UnityEngine.Object)equippable != (UnityEngine.Object)null)
            {
                equipment.Equip(equippable);
            }
        }
        Schedulable component7 = src_id.GetComponent <Schedulable>();
        Schedule    schedule   = component7.GetSchedule();

        if (schedule != null)
        {
            schedule.Unassign(component7);
            Schedulable component8 = dest_id.GetComponent <Schedulable>();
            schedule.Assign(component8);
        }
    }