Esempio n. 1
0
 protected override void OnSpawn()
 {
     base.OnSpawn();
     detailsScreen = Util.KInstantiateUI(detailsScreenPrefab, base.gameObject, true).GetComponent <DetailsScreen>();
     detailsScreen.gameObject.SetActive(true);
     userMenuParent = detailsScreen.UserMenuPanel.gameObject;
     userMenu       = Util.KInstantiateUI(userMenuPrefab.gameObject, userMenuParent, false).GetComponent <UserMenuScreen>();
     detailsScreen.gameObject.SetActive(false);
     userMenu.gameObject.SetActive(false);
 }
            public static void Postfix(string newName, DetailsScreen __instance, EditableTitleBar ___TabTitle)
            {
                var notificationTrigger = __instance.target.gameObject.GetComponent <NotificationTrigger>();

                if (notificationTrigger == null)
                {
                    return;
                }

                //notificationTrigger.SetName(newName);
            }
Esempio n. 3
0
        static void Postfix(string newName, DetailsScreen __instance)
        {
            GameObject target = __instance.target;
            KPrefabID  prefab = target?.GetComponent <KPrefabID>();

            if (prefab != null && prefab.HasTag(GameTags.Creature))
            {
                target.AddOrGet <CritterName>().SetName(newName);
                __instance.SetTitle(0);
            }
        }
Esempio n. 4
0
 private static void Postfix(DetailsScreen __instance, string newName)
 {
     if (!string.IsNullOrEmpty(newName))
     {
         var alarm = __instance.target.GetComponent <Alarm>();
         if (alarm != null)
         {
             alarm.SetName(newName);
         }
     }
 }
Esempio n. 5
0
 private static void Postfix(DetailsScreen __instance, EditableTitleBar ___TabTitle)
 {
     if (___TabTitle != null)
     {
         var alarm = __instance.target.GetComponent <Alarm>();
         if (alarm != null)
         {
             ___TabTitle.SetUserEditable(editable: true);
         }
     }
 }
 protected override void OnPrefabInit()
 {
     base.OnPrefabInit();
     SortScreenOrder();
     ConsumeMouseScroll = true;
     Debug.Assert((UnityEngine.Object)Instance == (UnityEngine.Object)null);
     Instance = this;
     UIRegistry.detailsScreen = this;
     DeactivateSideContent();
     Show(false);
     Subscribe(Game.Instance.gameObject, -1503271301, OnSelectObject);
 }
Esempio n. 7
0
    protected override void OnCleanUp()
    {
        DetailsScreen componentInParent = GetComponentInParent <DetailsScreen>();

        if ((bool)componentInParent)
        {
            DetailsScreen detailsScreen = componentInParent;
            detailsScreen.pointerEnterActions = (KScreen.PointerEnterActions)Delegate.Remove(detailsScreen.pointerEnterActions, new KScreen.PointerEnterActions(OnPointerEnterGrandparent));
            DetailsScreen detailsScreen2 = componentInParent;
            detailsScreen2.pointerExitActions = (KScreen.PointerExitActions)Delegate.Remove(detailsScreen2.pointerExitActions, new KScreen.PointerExitActions(OnPointerExitGrandparent));
        }
        base.OnCleanUp();
    }
            public static void Postfix(DetailsScreen __instance, EditableTitleBar ___TabTitle)
            {
                var target = __instance.target;
                var notificationTrigger = target.gameObject.GetComponent <NotificationTrigger>();

                if (notificationTrigger == null)
                {
                    return;
                }

                ___TabTitle.SetUserEditable(true);
                ___TabTitle.SetSubText(string.Empty);

                if (UI.StripLinkFormatting(target.GetProperName()) != NotificationTriggerConfig.DisplayName)
                {
                    ___TabTitle.SetSubText(NotificationTriggerConfig.DisplayName);
                }
            }
Esempio n. 9
0
        /// <summary>
        /// Enables or disables side screens to match the selected object, and selects an
        /// appropriate default tab.
        /// </summary>
        /// <param name="ds">The details screen being spawned.</param>
        /// <param name="target">The selected target.</param>
        /// <param name="screens">The side screens to show or hide.</param>
        /// <returns>The number of tabs that are active.</returns>
        private static int EnableScreens(DetailsScreen ds, GameObject target,
                                         DetailsScreen.Screens[] screens)
        {
            int n = screens.Length, activeIndex = -1, enabledTabs = 0, lastActive =
                ds.previouslyActiveTab;
            // Vanilla checks the details screen itself to see if it is dead!?!? But no
            // side screens are set to check this so the bug goes by unnoticed
            bool isDead = target != null && target.TryGetComponent(out KPrefabID id) && id.
                          HasTag(GameTags.Dead);
            string lastActiveName = null;

            // Find the last selected active screen
            if (lastActive >= 0 && lastActive < n)
            {
                lastActiveName = screens[lastActive].name;
            }
            for (int i = 0; i < n; i++)
            {
                ref var screen  = ref screens[i];
                bool    enabled = screen.screen.IsValidForTarget(target) && !(isDead && screen.
                                                                              hideWhenDead);
                ds.SetTabEnabled(screen.tabIdx, enabled);
                if (enabled)
                {
                    enabledTabs++;
                    if (activeIndex < 0)
                    {
                        var mode = SimDebugView.Instance.GetMode();
                        if (mode != OverlayModes.None.ID)
                        {
                            // Is it related to the current overlay mode?
                            if (mode == screen.focusInViewMode)
                            {
                                activeIndex = i;
                            }
                        }
                        else if (lastActiveName != null && screen.name == lastActiveName)
                        {
                            // Is it the screen that was last selected?
                            activeIndex = screen.tabIdx;
                        }
                    }
                }
            }
Esempio n. 10
0
        static void Postfix(int selectedTabIndex, DetailsScreen __instance, EditableTitleBar ___TabTitle)
        {
            GameObject target = __instance.target;
            KPrefabID  prefab = target?.GetComponent <KPrefabID>();

            if (prefab != null && prefab.HasTag(GameTags.Creature))
            {
                ___TabTitle.SetUserEditable(true);

                string properName = UI.StripLinkFormatting(target.GetProperName());

                ___TabTitle.SetTitle(properName);
                ___TabTitle.SetSubText("");

                string originalProperName = TagManager.GetProperName(prefab.PrefabTag, stripLink: true);
                if (properName != originalProperName)
                {
                    ___TabTitle.SetSubText(originalProperName);
                }
            }
        }
 public static void DestroyInstance()
 {
     Instance = null;
 }