Ejemplo n.º 1
0
    private void DoAddStatusItem(StatusItemGroup.Entry status_item, StatusItemCategory category, bool show_immediate = false)
    {
        GameObject       gameObject      = statusItemsFolder;
        Color            color           = (status_item.item.notificationType != NotificationType.BadMinor && status_item.item.notificationType != NotificationType.Bad && status_item.item.notificationType != NotificationType.DuplicantThreatening) ? statusItemTextColor_regular : statusItemTextColor_bad;
        TextStyleSetting style           = (category != Db.Get().StatusItemCategories.Main) ? StatusItemStyle_Other : StatusItemStyle_Main;
        StatusItemEntry  statusItemEntry = new StatusItemEntry(status_item, category, StatusItemPrefab, gameObject.transform, ToolTipStyle_Property, color, style, show_immediate, OnStatusItemDestroy);

        statusItemEntry.SetSprite(status_item.item.sprite);
        if (category != null)
        {
            int num = -1;
            List <StatusItemEntry> list = oldStatusItems.FindAll((StatusItemEntry e) => e.category == category);
            foreach (StatusItemEntry item in list)
            {
                num = item.GetIndex();
                item.Destroy(true);
                oldStatusItems.Remove(item);
            }
            if (category == Db.Get().StatusItemCategories.Main)
            {
                num = 0;
            }
            if (num != -1)
            {
                statusItemEntry.SetIndex(num);
            }
        }
        statusItems.Add(statusItemEntry);
    }
Ejemplo n.º 2
0
 public StatusItemEntry(StatusItemGroup.Entry item, StatusItemCategory category, GameObject status_item_prefab, Transform parent, TextStyleSetting tooltip_style, Color color, TextStyleSetting style, bool skip_fade, Action <StatusItemEntry> onDestroy)
 {
     this.item      = item;
     this.category  = category;
     tooltipStyle   = tooltip_style;
     this.onDestroy = onDestroy;
     this.color     = color;
     this.style     = style;
     widget         = Util.KInstantiateUI(status_item_prefab, parent.gameObject, false);
     text           = widget.GetComponentInChildren <LocText>(true);
     SetTextStyleSetting.ApplyStyle(text, style);
     toolTip = widget.GetComponentInChildren <ToolTip>(true);
     image   = widget.GetComponentInChildren <Image>(true);
     item.SetIcon(image);
     widget.SetActive(true);
     toolTip.OnToolTip = OnToolTip;
     button            = widget.GetComponentInChildren <KButton>();
     if (item.item.statusItemClickCallback != null)
     {
         button.onClick += OnClick;
     }
     else
     {
         button.enabled = false;
     }
     fadeStage = (skip_fade ? FadeStage.WAIT : FadeStage.IN);
     SimAndRenderScheduler.instance.Add(this, false);
     Refresh();
     SetColor(1f);
 }
Ejemplo n.º 3
0
    public override void OnSelectTarget(GameObject target)
    {
        base.OnSelectTarget(target);
        Subscribe(target, -1697596308, onStorageChangeDelegate);
        Subscribe(target, -1197125120, onStorageChangeDelegate);
        RefreshStorage();
        Subscribe(target, 1059811075, OnBreedingChanceChanged);
        RefreshBreedingChance();
        vitalsPanel.SetTitle((!((UnityEngine.Object)target.GetComponent <WiltCondition>() == (UnityEngine.Object)null)) ? UI.DETAILTABS.SIMPLEINFO.GROUPNAME_REQUIREMENTS : UI.DETAILTABS.SIMPLEINFO.GROUPNAME_CONDITION);
        KSelectable component = target.GetComponent <KSelectable>();

        if ((UnityEngine.Object)component != (UnityEngine.Object)null)
        {
            StatusItemGroup statusItemGroup = component.GetStatusItemGroup();
            if (statusItemGroup != null)
            {
                StatusItemGroup statusItemGroup2 = statusItemGroup;
                statusItemGroup2.OnAddStatusItem = (Action <StatusItemGroup.Entry, StatusItemCategory>)Delegate.Combine(statusItemGroup2.OnAddStatusItem, new Action <StatusItemGroup.Entry, StatusItemCategory>(OnAddStatusItem));
                StatusItemGroup statusItemGroup3 = statusItemGroup;
                statusItemGroup3.OnRemoveStatusItem = (Action <StatusItemGroup.Entry, bool>)Delegate.Combine(statusItemGroup3.OnRemoveStatusItem, new Action <StatusItemGroup.Entry, bool>(OnRemoveStatusItem));
                foreach (StatusItemGroup.Entry item in statusItemGroup)
                {
                    StatusItemGroup.Entry current = item;
                    if (current.category != null && current.category.Id == "Main")
                    {
                        DoAddStatusItem(current, current.category, false);
                    }
                }
                foreach (StatusItemGroup.Entry item2 in statusItemGroup)
                {
                    StatusItemGroup.Entry current2 = item2;
                    if (current2.category == null || current2.category.Id != "Main")
                    {
                        DoAddStatusItem(current2, current2.category, false);
                    }
                }
            }
        }
        statusItemPanel.gameObject.SetActive(true);
        statusItemPanel.scalerMask.UpdateSize();
        Refresh(true);
    }
Ejemplo n.º 4
0
    private void DoRemoveStatusItem(StatusItemGroup.Entry status_item, bool destroy_immediate = false)
    {
        int num = 0;

        while (true)
        {
            if (num >= statusItems.Count)
            {
                return;
            }
            if (statusItems[num].item.item == status_item.item)
            {
                break;
            }
            num++;
        }
        StatusItemEntry statusItemEntry = statusItems[num];

        statusItems.RemoveAt(num);
        oldStatusItems.Add(statusItemEntry);
        statusItemEntry.Destroy(destroy_immediate);
    }
Ejemplo n.º 5
0
 private static void ExportStatus(StatusItemGroup.Entry entry) => Export(entry.item.Id, entry.data);
Ejemplo n.º 6
0
 private void OnRemoveStatusItem(StatusItemGroup.Entry status_item, bool immediate = false)
 {
     DoRemoveStatusItem(status_item, immediate);
 }
Ejemplo n.º 7
0
 private void OnAddStatusItem(StatusItemGroup.Entry status_item, StatusItemCategory category)
 {
     DoAddStatusItem(status_item, category, false);
 }
Ejemplo n.º 8
0
        internal bool IsStatusItemWarning(StatusItemGroup.Entry item)
        {
            MethodInfo method = type.GetMethod("IsStatusItemWarning", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.InvokeMethod);

            return((bool)method.Invoke(original, new object[] { item }));
        }