protected void on_tooltip_qualityoflife_expectations(IAssignableIdentity minion, GameObject widget_go, ToolTip tooltip)
    {
        tooltip.ClearMultiStringTooltip();
        TableRow widgetRow = GetWidgetRow(widget_go);

        switch (widgetRow.rowType)
        {
        case TableRow.RowType.Header:
            break;

        case TableRow.RowType.Default:
            break;

        case TableRow.RowType.Minion:
        {
            MinionIdentity minionIdentity = minion as MinionIdentity;
            if ((UnityEngine.Object)minionIdentity != (UnityEngine.Object)null)
            {
                tooltip.AddMultiStringTooltip(Db.Get().Attributes.QualityOfLife.Lookup(minionIdentity).GetAttributeValueTooltip(), null);
            }
            break;
        }

        case TableRow.RowType.StoredMinon:
            StoredMinionTooltip(minion, tooltip);
            break;
        }
    }
    private void on_tooltip_consumable_info_super(IAssignableIdentity minion, GameObject widget_go, ToolTip tooltip)
    {
        tooltip.ClearMultiStringTooltip();
        TableRow widgetRow = GetWidgetRow(widget_go);

        switch (widgetRow.rowType)
        {
        case TableRow.RowType.StoredMinon:
            break;

        case TableRow.RowType.Header:
            tooltip.AddMultiStringTooltip(UI.CONSUMABLESSCREEN.TOOLTIP_TOGGLE_ALL.text, null);
            break;

        case TableRow.RowType.Default:
            tooltip.AddMultiStringTooltip(UI.CONSUMABLESSCREEN.NEW_MINIONS_TOOLTIP_TOGGLE_ROW, null);
            break;

        case TableRow.RowType.Minion:
            if ((UnityEngine.Object)(minion as MinionIdentity) != (UnityEngine.Object)null)
            {
                tooltip.AddMultiStringTooltip(string.Format(UI.CONSUMABLESSCREEN.TOOLTIP_TOGGLE_ROW.text, (minion as MinionIdentity).gameObject.GetProperName()), null);
            }
            break;
        }
    }
Esempio n. 3
0
    private void LoadValue(IAssignableIdentity minion, GameObject widget_go)
    {
        if (!((UnityEngine.Object)widget_go == (UnityEngine.Object)null))
        {
            PrioritizationGroupTableColumn prioritizationGroupTableColumn = GetWidgetColumn(widget_go) as PrioritizationGroupTableColumn;
            ChoreGroup choreGroup = prioritizationGroupTableColumn.userData as ChoreGroup;
            TableRow   widgetRow  = GetWidgetRow(widget_go);
            switch (widgetRow.rowType)
            {
            case TableRow.RowType.Header:
                InitializeHeader(choreGroup, widget_go);
                break;

            case TableRow.RowType.Default:
            case TableRow.RowType.Minion:
            case TableRow.RowType.StoredMinon:
            {
                IPersonalPriorityManager priorityManager = GetPriorityManager(widgetRow);
                bool flag = priorityManager.IsChoreGroupDisabled(choreGroup);
                HierarchyReferences component = widget_go.GetComponent <HierarchyReferences>();
                KImage kImage = component.GetReference("FG") as KImage;
                kImage.raycastTarget = flag;
                ToolTip toolTip = component.GetReference("FGToolTip") as ToolTip;
                toolTip.enabled = flag;
                break;
            }
            }
            IPersonalPriorityManager priorityManager2 = GetPriorityManager(widgetRow);
            if (priorityManager2 != null)
            {
                UpdateWidget(widget_go, choreGroup, priorityManager2);
            }
        }
    }
 public override void Assign(IAssignableIdentity new_assignee)
 {
     if (new_assignee != assignee)
     {
         if (base.slot != null && new_assignee is MinionIdentity)
         {
             new_assignee = (new_assignee as MinionIdentity).assignableProxy.Get();
         }
         if (base.slot != null && new_assignee is StoredMinionIdentity)
         {
             new_assignee = (new_assignee as StoredMinionIdentity).assignableProxy.Get();
         }
         if (new_assignee is MinionAssignablesProxy)
         {
             Ownables soleOwner          = new_assignee.GetSoleOwner();
             Ownables component          = soleOwner.GetComponent <Ownables>();
             AssignableSlotInstance slot = component.GetSlot(base.slot);
             if (slot != null)
             {
                 Assignable assignable = slot.assignable;
                 if ((Object)assignable != (Object)null)
                 {
                     assignable.Unassign();
                 }
             }
         }
         base.Assign(new_assignee);
     }
 }
 public void RestoreTargetFromInstanceID()
 {
     if (target_instance_id != -1 && target == null)
     {
         KPrefabID instance = KPrefabIDTracker.Get().GetInstance(target_instance_id);
         if ((bool)instance)
         {
             IAssignableIdentity component = instance.GetComponent <IAssignableIdentity>();
             if (component != null)
             {
                 SetTarget(component, instance.gameObject);
             }
             else
             {
                 Debug.LogWarningFormat("RestoreTargetFromInstanceID target ID {0} was found but it wasn't an IAssignableIdentity, destroying proxy object.", target_instance_id);
                 Util.KDestroyGameObject(base.gameObject);
             }
         }
         else
         {
             Debug.LogWarningFormat("RestoreTargetFromInstanceID target ID {0} was not found, destroying proxy object.", target_instance_id);
             Util.KDestroyGameObject(base.gameObject);
         }
     }
 }
Esempio n. 6
0
 public void SetContent(IAssignableIdentity identity_object, Action <IAssignableIdentity> selectionCallback, AssignableSideScreen assignableSideScreen)
 {
     if (refreshHandle == -1)
     {
         Game.Instance.Unsubscribe(refreshHandle);
     }
     refreshHandle = Game.Instance.Subscribe(-2146166042, delegate
     {
         if ((UnityEngine.Object) this != (UnityEngine.Object)null && (UnityEngine.Object)base.gameObject != (UnityEngine.Object)null && base.gameObject.activeInHierarchy)
         {
             Refresh(null);
         }
     });
     toggle         = GetComponent <MultiToggle>();
     sideScreen     = assignableSideScreen;
     targetIdentity = identity_object;
     if ((UnityEngine.Object)portraitInstance == (UnityEngine.Object)null)
     {
         portraitInstance = Util.KInstantiateUI <CrewPortrait>(crewPortraitPrefab.gameObject, base.gameObject, false);
         portraitInstance.transform.SetSiblingIndex(1);
         portraitInstance.SetAlpha(1f);
     }
     toggle.onClick = delegate
     {
         selectionCallback(targetIdentity);
     };
     portraitInstance.SetIdentityObject(identity_object, false);
     GetComponent <ToolTip>().OnToolTip = GetTooltip;
     Refresh(null);
 }
 private void CheckTarget()
 {
     if (target == null)
     {
         KPrefabID instance = KPrefabIDTracker.Get().GetInstance(target_instance_id);
         if ((Object)instance != (Object)null)
         {
             target = instance.GetComponent <IAssignableIdentity>();
             if (target != null)
             {
                 MinionIdentity minionIdentity = target as MinionIdentity;
                 if ((bool)minionIdentity)
                 {
                     minionIdentity.ValidateProxy();
                 }
                 else
                 {
                     StoredMinionIdentity storedMinionIdentity = target as StoredMinionIdentity;
                     if ((bool)storedMinionIdentity)
                     {
                         storedMinionIdentity.ValidateProxy();
                     }
                 }
             }
         }
     }
 }
Esempio n. 8
0
 private void BuildMinions()
 {
     for (int num = minionWidgets.Count - 1; num >= 0; num--)
     {
         minionWidgets[num].DeleteObject();
     }
     minionWidgets.Clear();
     foreach (MinionIdentity item in Components.LiveMinionIdentities.Items)
     {
         GameObject gameObject = Util.KInstantiateUI(Prefab_minion, Prefab_minionLayout, true);
         gameObject.GetComponent <SkillMinionWidget>().SetMinon(item);
         minionWidgets.Add(gameObject.GetComponent <SkillMinionWidget>());
     }
     foreach (MinionStorage item2 in Components.MinionStorages.Items)
     {
         foreach (MinionStorage.Info item3 in item2.GetStoredMinionInfo())
         {
             MinionStorage.Info current3 = item3;
             if (current3.serializedMinion != null)
             {
                 StoredMinionIdentity minon       = current3.serializedMinion.Get <StoredMinionIdentity>();
                 GameObject           gameObject2 = Util.KInstantiateUI(Prefab_minion, Prefab_minionLayout, true);
                 gameObject2.GetComponent <SkillMinionWidget>().SetMinon(minon);
                 minionWidgets.Add(gameObject2.GetComponent <SkillMinionWidget>());
             }
         }
     }
     if (CurrentlySelectedMinion == null && Components.LiveMinionIdentities.Count > 0)
     {
         CurrentlySelectedMinion = Components.LiveMinionIdentities.Items[0];
     }
 }
Esempio n. 9
0
 public virtual void Unassign()
 {
     if (assignee != null)
     {
         GetComponent <KPrefabID>().RemoveTag(GameTags.Assigned);
         if (slot != null)
         {
             Ownables soleOwner = assignee.GetSoleOwner();
             if ((bool)soleOwner)
             {
                 soleOwner.GetSlot(slot)?.Unassign(true);
                 Equipment component = soleOwner.GetComponent <Equipment>();
                 if ((UnityEngine.Object)component != (UnityEngine.Object)null)
                 {
                     component.GetSlot(slot)?.Unassign(true);
                 }
             }
         }
         assignee = null;
         if (canBePublic)
         {
             Assign(Game.Instance.assignmentManager.assignment_groups["public"]);
         }
         assignee_identityRef.Set(null);
         assignee_groupID = string.Empty;
         if (this.OnAssign != null)
         {
             this.OnAssign(null);
         }
         Trigger(684616645, null);
     }
 }
Esempio n. 10
0
 public void AddMember(IAssignableIdentity member)
 {
     if (!members.Contains(member))
     {
         members.Add(member);
     }
 }
Esempio n. 11
0
 private void ChangeAssignment(IAssignableIdentity new_identity)
 {
     targetAssignable.Unassign();
     if (new_identity != null)
     {
         targetAssignable.Assign(new_identity);
     }
 }
	private void Assign(IAssignableIdentity new_assignee)
	{
		CancelChore();
		if (new_assignee != null)
		{
			ActivateChore();
		}
	}
Esempio n. 13
0
		/// <summary>
		/// Configures the row's content, only adding widgets that are new.
		/// </summary>
		/// <param name="row">The row being configured.</param>
		/// <param name="minion">The Duplicant for this row.</param>
		/// <param name="columns">The columns to display.</param>
		/// <param name="screen">The parent table screen.</param>
		private static void ConfigureContent(TableRow row, IAssignableIdentity minion,
				IDictionary<string, TableColumn> columns, TableScreen screen) {
			bool def = row.isDefault;
			var go = row.gameObject;
			row.minion = minion;
			ConfigureImage(row, minion);
			foreach (var pair in columns) {
				var column = pair.Value;
				var widgets = row.widgets;
				string id = column.scrollerID;
				// Columns cannot be deleted in vanilla
				if (!widgets.TryGetValue(column, out GameObject widget)) {
					// Create a new one
					if (minion == null) {
						if (def)
							widget = column.GetDefaultWidget(go);
						else
							widget = column.GetHeaderWidget(go);
					} else
						widget = column.GetMinionWidget(go);
					widgets.Add(column, widget);
					column.widgets_by_row.Add(row, widget);
				}
				// Update the scroller if needed
				if (!string.IsNullOrEmpty(id) && column.screen.column_scrollers.Contains(id))
					ConfigureScroller(row, go, id, widget, screen);
			}
			// Run events after the update is complete
			foreach (var pair in columns) {
				var column = pair.Value;
				if (column.widgets_by_row.TryGetValue(row, out GameObject widget)) {
					string id = column.scrollerID;
					column.on_load_action?.Invoke(minion, widget);
					// Apparently the order just... works out? <shrug>
				}
			}
			if (minion != null)
				go.name = minion.GetProperName();
			else if (def)
				go.name = "defaultRow";
			// "Click to go to Duplicant"
			if (row.selectMinionButton != null)
				row.selectMinionButton.transform.SetAsLastSibling();
			// Update the border sizes
			foreach (var pair in row.scrollerBorders) {
				var border = pair.Value;
				var rt = border.rectTransform();
				float width = rt.rect.width;
				border.transform.SetParent(go.transform);
				rt.anchorMin = rt.anchorMax = Vector2.up;
				rt.sizeDelta = new Vector2(width, 374.0f);
				var scrollRT = row.scrollers[pair.Key].transform.parent.rectTransform();
				Vector3 a = scrollRT.GetLocalPosition();
				a.x -= scrollRT.sizeDelta.x * 0.5f;
				a.y = rt.GetLocalPosition().y - rt.anchoredPosition.y;
				rt.SetLocalPosition(a);
			}
		}
Esempio n. 14
0
    private void RestoreAssignee()
    {
        IAssignableIdentity savedAssignee = GetSavedAssignee();

        if (savedAssignee != null)
        {
            Assign(savedAssignee);
        }
    }
    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);
        }
    }
Esempio n. 16
0
 private void OnRemoveMinionIdentity(MinionIdentity remove)
 {
     if (CurrentlySelectedMinion == remove)
     {
         CurrentlySelectedMinion = null;
     }
     BuildMinions();
     RefreshAll();
 }
Esempio n. 17
0
		/// <summary>
		/// Configures the portrait for each row.
		/// </summary>
		/// <param name="row">The row being configured.</param>
		/// <param name="minion">The Duplicant for this row.</param>
		private static void ConfigureImage(TableRow row, IAssignableIdentity minion) {
			var img = row.GetComponentInChildren<KImage>(true);
			img.colorStyleSetting = (minion == null) ? row.style_setting_default :
				row.style_setting_minion;
			img.ColorState = KImage.ColorSelector.Inactive;
			// Dim out Duplicants in rockets
			if (row.TryGetComponent(out CanvasGroup component) && (minion as
					StoredMinionIdentity) != null)
				component.alpha = 0.6f;
		}
Esempio n. 18
0
        /// <summary>
        /// Compares two rows by the current allow state.
        /// </summary>
        private int CompareByAllowed(IAssignableIdentity id1, IAssignableIdentity id2)
        {
            int result = allowRows[id1].currentState.CompareTo(allowRows[id2].
                                                               currentState);

            if (result == 0)
            {
                result = id1.GetProperName().CompareTo(id2.GetProperName());
            }
            return(result * (sortReversed ? -1 : 1));
        }
Esempio n. 19
0
    private GameObject GetTargetGameObject()
    {
        IAssignableIdentity    assignableIdentity     = GetAssignableIdentity();
        MinionAssignablesProxy minionAssignablesProxy = (MinionAssignablesProxy)assignableIdentity;

        if ((bool)minionAssignablesProxy)
        {
            return(minionAssignablesProxy.GetTargetGameObject());
        }
        return(null);
    }
Esempio n. 20
0
 private void OnRowClicked(IAssignableIdentity identity)
 {
     if (targetAssignable.assignee != identity)
     {
         ChangeAssignment(identity);
     }
     else if (CanDeselect(identity))
     {
         ChangeAssignment(null);
     }
 }
 public void SetTarget(IAssignableIdentity target, GameObject targetGO)
 {
     Debug.Assert(target != null, "target was null");
     if ((Object)targetGO == (Object)null)
     {
         Debug.LogWarningFormat("{0} MinionAssignablesProxy.SetTarget {1}, {2}, {3}. DESTROYING", GetInstanceID(), target_instance_id, target, targetGO);
         Util.KDestroyGameObject(base.gameObject);
     }
     this.target          = target;
     target_instance_id   = targetGO.GetComponent <KPrefabID>().InstanceID;
     base.gameObject.name = "Minion Assignables Proxy : " + targetGO.name;
 }
Esempio n. 22
0
 private void OnAssign(IAssignableIdentity obj)
 {
     if (obj != null)
     {
         CreateChore();
     }
     else if (chore != null)
     {
         chore.Cancel("Unassigned");
         chore = null;
     }
 }
Esempio n. 23
0
 protected override void OnShow(bool show)
 {
     if (show)
     {
         if (CurrentlySelectedMinion == null && Components.LiveMinionIdentities.Count > 0)
         {
             CurrentlySelectedMinion = Components.LiveMinionIdentities.Items[0];
         }
         RefreshAll();
     }
     base.OnShow(show);
 }
    private void on_load_qualityoflife_expectations(IAssignableIdentity minion, GameObject widget_go)
    {
        TableRow widgetRow           = GetWidgetRow(widget_go);
        LocText  componentInChildren = widget_go.GetComponentInChildren <LocText>(true);

        if (minion != null)
        {
            componentInChildren.text = (GetWidgetColumn(widget_go) as LabelTableColumn).get_value_action(minion, widget_go);
        }
        else
        {
            componentInChildren.text = ((!widgetRow.isDefault) ? UI.VITALSSCREEN.QUALITYOFLIFE_EXPECTATIONS.ToString() : string.Empty);
        }
    }
 /// <summary>
 /// Initializes the row with a specific Duplicant/group and the parent side screen.
 /// </summary>
 /// <param name="minion">The Duplicant to display.</param>
 /// <param name="parent">The parent of this side screen row.</param>
 public void SetContent(IAssignableIdentity minion, WorkshopProfileSideScreen parent)
 {
     sideScreen     = parent;
     targetIdentity = minion;
     // Create the picture of the Duplicant's head
     if (portraitInstance == null)
     {
         portraitInstance = Util.KInstantiateUI <CrewPortrait>(crewPortraitPrefab.
                                                               gameObject, gameObject, false);
         portraitInstance.transform.SetSiblingIndex(1);
         portraitInstance.SetAlpha(1f);
     }
     portraitInstance.SetIdentityObject(minion, false);
     Refresh();
 }
    private string get_value_qualityoflife_label(IAssignableIdentity minion, GameObject widget_go)
    {
        string   result    = string.Empty;
        TableRow widgetRow = GetWidgetRow(widget_go);

        if (widgetRow.rowType == TableRow.RowType.Minion)
        {
            result = Db.Get().Attributes.QualityOfLife.Lookup(minion as MinionIdentity).GetFormattedValue();
        }
        else if (widgetRow.rowType == TableRow.RowType.StoredMinon)
        {
            result = UI.TABLESCREENS.NA;
        }
        return(result);
    }
    private static void RefreshHat(IAssignableIdentity identityObject, KBatchedAnimController controller)
    {
        string         hat_id         = string.Empty;
        MinionIdentity minionIdentity = identityObject as MinionIdentity;

        if ((UnityEngine.Object)minionIdentity != (UnityEngine.Object)null)
        {
            MinionResume component = minionIdentity.GetComponent <MinionResume>();
            hat_id = component.CurrentHat;
        }
        else if ((UnityEngine.Object)(identityObject as StoredMinionIdentity) != (UnityEngine.Object)null)
        {
            hat_id = (identityObject as StoredMinionIdentity).currentHat;
        }
        MinionResume.ApplyHat(hat_id, controller);
    }
 public void SetIdentityObject(IAssignableIdentity identity, bool jobEnabled = true)
 {
     UnregisterEvents();
     identityObject = identity;
     RegisterEvents();
     targetImage.enabled = true;
     if (identityObject != null)
     {
         targetImage.enabled = false;
     }
     if (useLabels && (identity is MinionIdentity || identity is MinionAssignablesProxy))
     {
         SetDuplicantJobTitleActive(jobEnabled);
     }
     requiresRefresh = true;
 }
Esempio n. 29
0
 private void RefreshSingleMinionRow(IAssignableIdentity id)
 {
     foreach (KeyValuePair <string, TableColumn> column in columns)
     {
         if (column.Value != null && column.Value.on_load_action != null)
         {
             foreach (KeyValuePair <TableRow, GameObject> item in column.Value.widgets_by_row)
             {
                 if (!((UnityEngine.Object)item.Value == (UnityEngine.Object)null) && item.Key.GetIdentity() == id)
                 {
                     column.Value.on_load_action(id, item.Value);
                 }
             }
             column.Value.on_load_action(null, rows[0].GetWidget(column.Value));
         }
     }
 }
Esempio n. 30
0
 private void RefreshChore(IAssignableIdentity target)
 {
     if (chore != null)
     {
         chore.Cancel("Equipment Reassigned");
         chore = null;
     }
     if (target != null)
     {
         Ownables  soleOwner = target.GetSoleOwner();
         Equipment component = soleOwner.GetComponent <Equipment>();
         if (!component.IsEquipped(equippable))
         {
             CreateChore();
         }
     }
 }