Exemplo n.º 1
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);
 }
 public virtual void Populate(MinionIdentity _identity)
 {
     identity = _identity;
     if ((Object)portrait == (Object)null)
     {
         GameObject parent = (!((Object)crewPortraitParent != (Object)null)) ? base.gameObject : crewPortraitParent;
         portrait = Util.KInstantiateUI <CrewPortrait>(PortraitPrefab.gameObject, parent, false);
         if ((Object)crewPortraitParent == (Object)null)
         {
             portrait.transform.SetSiblingIndex(2);
         }
     }
     portrait.SetIdentityObject(_identity, true);
 }
 /// <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();
 }
Exemplo n.º 4
0
 public void ActivateIndicator(GameObject target, GameObject iconSource)
 {
     if (!targets.ContainsKey(target))
     {
         MinionIdentity component = iconSource.GetComponent <MinionIdentity>();
         if ((Object)component != (Object)null)
         {
             GameObject gameObject = Util.KInstantiateUI(IndicatorPrefab, IndicatorContainer, true);
             Image      reference  = gameObject.GetComponent <HierarchyReferences>().GetReference <Image>("icon");
             reference.gameObject.SetActive(false);
             CrewPortrait reference2 = gameObject.GetComponent <HierarchyReferences>().GetReference <CrewPortrait>("Portrait");
             reference2.gameObject.SetActive(true);
             reference2.SetIdentityObject(component, true);
             targets.Add(target, gameObject);
         }
     }
 }
Exemplo n.º 5
0
 public void Open()
 {
     base.gameObject.SetActive(true);
     buttonPool.ClearAll();
     foreach (MinionIdentity item in Components.MinionIdentities.Items)
     {
         KButton      btn = buttonPool.GetFreeElement(buttonParent, true);
         CrewPortrait componentInChildren = btn.GetComponentInChildren <CrewPortrait>();
         componentInChildren.SetIdentityObject(item, true);
         portraitList.Add(componentInChildren);
         btn.ClearOnClick();
         btn.onClick += delegate
         {
             SelectDuplicant(btn);
         };
         buttonIdentityMap.Add(btn, item);
     }
 }
Exemplo n.º 6
0
    public void Setup(Schedulable schedulable)
    {
        this.schedulable = schedulable;
        IAssignableIdentity component = schedulable.GetComponent <IAssignableIdentity>();

        portrait.SetIdentityObject(component, true);
        label.text = component.GetProperName();
        MinionIdentity minionIdentity = (MinionIdentity)component;
        Traits         component2     = minionIdentity.GetComponent <Traits>();

        if (component2.HasTrait("NightOwl"))
        {
            nightOwlIcon.SetActive(true);
        }
        else if (component2.HasTrait("EarlyBird"))
        {
            earlyBirdIcon.SetActive(true);
        }
        dropDown.Initialize(ScheduleManager.Instance.GetSchedules().Cast <IListableOption>(), OnDropEntryClick, null, DropEntryRefreshAction, false, schedulable);
    }
Exemplo n.º 7
0
 public void SetMinionContent(MinionAssignablesProxy identity, AccessControl.Permission permission, bool isDefault, Action <MinionAssignablesProxy, AccessControl.Permission> onPermissionChange, Action <MinionAssignablesProxy, bool> onDefaultClick)
 {
     SetContent(permission, onPermissionChange);
     if ((UnityEngine.Object)identity == (UnityEngine.Object)null)
     {
         Debug.LogError("Invalid data received.");
     }
     else
     {
         if ((UnityEngine.Object)portraitInstance == (UnityEngine.Object)null)
         {
             portraitInstance = Util.KInstantiateUI <CrewPortrait>(crewPortraitPrefab.gameObject, defaultButton.gameObject, false);
             portraitInstance.SetAlpha(1f);
         }
         targetIdentity = identity;
         portraitInstance.SetIdentityObject(identity, false);
         portraitInstance.SetSubTitle((!isDefault) ? UI.UISIDESCREENS.ACCESS_CONTROL_SIDE_SCREEN.USING_CUSTOM : UI.UISIDESCREENS.ACCESS_CONTROL_SIDE_SCREEN.USING_DEFAULT);
         defaultClickedCallback = null;
         defaultButton.isOn     = !isDefault;
         defaultClickedCallback = onDefaultClick;
     }
 }
Exemplo n.º 8
0
 public void SetMinon(IAssignableIdentity identity)
 {
     minion = identity;
     portrait.SetIdentityObject(minion, true);
 }