public AssignableSlotInstance Lookup(GameObject go)
    {
        Assignables component = go.GetComponent <Assignables>();

        if ((UnityEngine.Object)component != (UnityEngine.Object)null)
        {
            return(component.GetSlot(this));
        }
        return(null);
    }
    private void ShowAssignables(Assignables assignables, GameObject panel)
    {
        bool flag = false;

        foreach (AssignableSlotInstance slot in assignables.Slots)
        {
            if (slot.slot.showInUI)
            {
                GameObject gameObject = AddOrGetLabel(labels, panel, slot.slot.Name);
                if (slot.IsAssigned())
                {
                    gameObject.SetActive(true);
                    flag = true;
                    string text = (!slot.IsAssigned()) ? UI.DETAILTABS.PERSONALITY.EQUIPMENT.NO_ASSIGNABLES.text : slot.assignable.GetComponent <KSelectable>().GetName();
                    gameObject.GetComponent <LocText>().text    = $"{slot.slot.Name}: {text}";
                    gameObject.GetComponent <ToolTip>().toolTip = string.Format(UI.DETAILTABS.PERSONALITY.EQUIPMENT.ASSIGNED_TOOLTIP, text, GetAssignedEffectsString(slot), SelectedMinion.name);
                }
                else
                {
                    gameObject.SetActive(false);
                    gameObject.GetComponent <LocText>().text    = UI.DETAILTABS.PERSONALITY.EQUIPMENT.NO_ASSIGNABLES;
                    gameObject.GetComponent <ToolTip>().toolTip = UI.DETAILTABS.PERSONALITY.EQUIPMENT.NO_ASSIGNABLES_TOOLTIP;
                }
            }
        }
        if (assignables is Ownables)
        {
            if (!flag)
            {
                GameObject gameObject2 = AddOrGetLabel(labels, panel, "NothingAssigned");
                labels["NothingAssigned"].SetActive(true);
                gameObject2.GetComponent <LocText>().text    = UI.DETAILTABS.PERSONALITY.EQUIPMENT.NO_ASSIGNABLES;
                gameObject2.GetComponent <ToolTip>().toolTip = string.Format(UI.DETAILTABS.PERSONALITY.EQUIPMENT.NO_ASSIGNABLES_TOOLTIP, SelectedMinion.name);
            }
            else if (labels.ContainsKey("NothingAssigned"))
            {
                labels["NothingAssigned"].SetActive(false);
            }
        }
        if (assignables is Equipment)
        {
            if (!flag)
            {
                GameObject gameObject3 = AddOrGetLabel(labels, panel, "NoSuitAssigned");
                labels["NoSuitAssigned"].SetActive(true);
                gameObject3.GetComponent <LocText>().text    = UI.DETAILTABS.PERSONALITY.EQUIPMENT.NOEQUIPMENT;
                gameObject3.GetComponent <ToolTip>().toolTip = string.Format(UI.DETAILTABS.PERSONALITY.EQUIPMENT.NOEQUIPMENT_TOOLTIP, SelectedMinion.name);
            }
            else if (labels.ContainsKey("NoSuitAssigned"))
            {
                labels["NoSuitAssigned"].SetActive(false);
            }
        }
    }
    public ChoreConsumerState(ChoreConsumer consumer)
    {
        this.consumer       = consumer;
        navigator           = consumer.GetComponent <Navigator>();
        prefabid            = consumer.GetComponent <KPrefabID>();
        ownable             = consumer.GetComponent <Ownable>();
        gameObject          = consumer.gameObject;
        solidTransferArm    = consumer.GetComponent <SolidTransferArm>();
        hasSolidTransferArm = ((Object)solidTransferArm != (Object)null);
        resume        = consumer.GetComponent <MinionResume>();
        choreDriver   = consumer.GetComponent <ChoreDriver>();
        schedulable   = consumer.GetComponent <Schedulable>();
        traits        = consumer.GetComponent <Traits>();
        choreProvider = consumer.GetComponent <ChoreProvider>();
        MinionIdentity component = consumer.GetComponent <MinionIdentity>();

        if ((Object)component != (Object)null)
        {
            if (component.assignableProxy == null)
            {
                component.assignableProxy = MinionAssignablesProxy.InitAssignableProxy(component.assignableProxy, component);
            }
            assignables = component.GetSoleOwner();
            equipment   = component.GetEquipment();
        }
        else
        {
            assignables = consumer.GetComponent <Assignables>();
            equipment   = consumer.GetComponent <Equipment>();
        }
        storage            = consumer.GetComponent <Storage>();
        consumableConsumer = consumer.GetComponent <ConsumableConsumer>();
        worker             = consumer.GetComponent <Worker>();
        selectable         = consumer.GetComponent <KSelectable>();
        if ((Object)schedulable != (Object)null)
        {
            int blockIdx = Schedule.GetBlockIdx();
            scheduleBlock = schedulable.GetSchedule().GetBlock(blockIdx);
        }
    }
    public List <Assignable> GetPreferredAssignables(Assignables owner, AssignableSlot slot)
    {
        PreferredAssignableResults.Clear();
        int num = 2147483647;

        foreach (Assignable assignable in assignables)
        {
            if (assignable.slot == slot && assignable.assignee != null)
            {
                List <Ownables> owners = assignable.assignee.GetOwners();
                if (owners.Count > 0)
                {
                    foreach (Ownables item in owners)
                    {
                        if ((Object)item.gameObject == (Object)owner.gameObject)
                        {
                            if (assignable.assignee is Room && (assignable.assignee as Room).roomType.priority_building_use)
                            {
                                PreferredAssignableResults.Clear();
                                PreferredAssignableResults.Add(assignable);
                                return(PreferredAssignableResults);
                            }
                            if (owners.Count == num)
                            {
                                PreferredAssignableResults.Add(assignable);
                            }
                            else if (owners.Count < num)
                            {
                                num = owners.Count;
                                PreferredAssignableResults.Clear();
                                PreferredAssignableResults.Add(assignable);
                            }
                        }
                    }
                }
            }
        }
        return(PreferredAssignableResults);
    }
 public EquipmentSlotInstance(Assignables assignables, EquipmentSlot slot)
     : base(assignables, slot)
 {
 }
예제 #6
0
 public AssignableSlotInstance(Assignables assignables, AssignableSlot slot)
 {
     this.slot        = slot;
     this.assignables = assignables;
 }
예제 #7
0
 public OwnableSlotInstance(Assignables assignables, OwnableSlot slot)
     : base(assignables, slot)
 {
 }