private static bool Prefix(SideScreenContent __instance, ref string __result) { Logger.LogFormat(" === FluidWarpMod_SideScreenContent_GetTitle Postfix === "); if (!(__instance is ValveSideScreen)) { return(true); } ConduitType type = FluidWarpMod_Utils.GetConduitType((ValveSideScreen)__instance); if (type == LiquidWarpConfig.CONDUIT_TYPE || type == GasWarpConfig.CONDUIT_TYPE) { __result = "Channel"; return(false); } else { return(true); } }
private static bool Prefix(SideScreenContent __instance, ref string __result) { Debug.Log(" === FluidWarpMod_SideScreenContent_GetTitle Postfix === "); if (!(__instance is ValveSideScreen)) { return(true); } ConduitType type = FluidWarpMod_Utils.GetConduitType((ValveSideScreen)__instance); if (type == (ConduitType)100 || type == (ConduitType)101) { __result = "Channel"; return(false); } else { return(true); } }
public void Refresh(GameObject go) { if (screens != null) { target = go; CellSelectionObject component = target.GetComponent <CellSelectionObject>(); if ((bool)component) { component.OnObjectSelected(null); } if (!HasActivated) { if (screens != null) { for (int i = 0; i < screens.Length; i++) { GameObject gameObject = null; gameObject = KScreenManager.Instance.InstantiateScreen(screens[i].screen.gameObject, body.gameObject).gameObject; screens[i].screen = gameObject.GetComponent <TargetScreen>(); screens[i].tabIdx = AddTab(screens[i].icon, Strings.Get(screens[i].displayName), screens[i].screen, Strings.Get(screens[i].tooltip)); } } base.onTabActivated += OnTabActivated; HasActivated = true; } int num = -1; int num2 = 0; for (int j = 0; j < screens.Length; j++) { bool flag = screens[j].screen.IsValidForTarget(go); bool flag2 = screens[j].hideWhenDead && base.gameObject.HasTag(GameTags.Dead); bool flag3 = flag && !flag2; SetTabEnabled(screens[j].tabIdx, flag3); if (flag3) { num2++; if (num == -1) { if (SimDebugView.Instance.GetMode() != OverlayModes.None.ID) { if (SimDebugView.Instance.GetMode() == screens[j].focusInViewMode) { num = j; } } else if (flag3 && previouslyActiveTab >= 0 && previouslyActiveTab < screens.Length && screens[j].name == screens[previouslyActiveTab].name) { num = screens[j].tabIdx; } } } } if (num != -1) { ActivateTab(num); } else { ActivateTab(0); } tabHeaderContainer.gameObject.SetActive((CountTabs() > 1) ? true : false); if (sideScreens != null && sideScreens.Count > 0) { sideScreens.ForEach(delegate(SideScreenRef scn) { if (scn.screenPrefab.IsValidForTarget(target)) { if ((UnityEngine.Object)scn.screenInstance == (UnityEngine.Object)null) { scn.screenInstance = Util.KInstantiateUI <SideScreenContent>(scn.screenPrefab.gameObject, sideScreenContentBody, false); } if (!sideScreen.activeInHierarchy) { sideScreen.SetActive(true); } scn.screenInstance.transform.SetAsFirstSibling(); scn.screenInstance.SetTarget(target); scn.screenInstance.Show(true); currentSideScreen = scn.screenInstance; RefreshTitle(); } }); } } }
public GridSelectControl(bool disableIcons = false) { DisableIcons = disableIcons; // Select/deselect all types var allCheckBox = new PCheckBox("SelectAll") { Text = STRINGS.UI.UISIDESCREENS.TREEFILTERABLESIDESCREEN.ALLBUTTON, CheckSize = ROW_SIZE, InitialState = PCheckBox.STATE_CHECKED, OnChecked = OnCheck, TextStyle = PUITuning.Fonts.TextDarkStyle }; allCheckBox.OnRealize += (obj) => { allItems = obj; }; var cp = new PPanel("Categories") { Direction = PanelDirection.Vertical, Alignment = TextAnchor.UpperLeft, Spacing = ROW_SPACING }; cp.OnRealize += (obj) => { childPanel = obj; }; RootPanel = new PPanel("Border") { // 1px dark border for contrast Margin = new RectOffset(1, 1, 1, 1), Direction = PanelDirection.Vertical, Alignment = TextAnchor.MiddleCenter, Spacing = 1 }.AddChild(new PLabel("Title") { // Title bar TextAlignment = TextAnchor.MiddleCenter, Text = "Title with some title", FlexSize = new Vector2(1.0f, 0.0f), DynamicSize = true, Margin = new RectOffset(1, 1, 1, 1) }.SetKleiPinkColor()).AddChild(new PPanel("TypeSelectControl") { // White background for scroll bar Direction = PanelDirection.Vertical, Margin = OUTER_MARGIN, Alignment = TextAnchor.MiddleCenter, Spacing = 0, BackColor = PUITuning.Colors.BackgroundLight, FlexSize = Vector2.one }.AddChild(new PScrollPane("Scroll") { // Scroll to select elements Child = new PPanel("SelectType") { Direction = PanelDirection.Vertical, Margin = ELEMENT_MARGIN, FlexSize = new Vector2(1.0f, 0.0f), Alignment = TextAnchor.UpperLeft }.AddChild(allCheckBox).AddChild(cp), ScrollHorizontal = false, ScrollVertical = true, AlwaysShowVertical = true, TrackSize = 8.0f, FlexSize = Vector2.one, BackColor = PUITuning.Colors.BackgroundLight, })).SetKleiBlueColor().BuildWithFixedSize(PANEL_SIZE); // Cache the vertical scroll bar var vst = RootPanel.transform.Find("TypeSelectControl/Scroll/Viewport/SelectType"); #pragma warning disable IDE0031 // Use null propagation vScroll = (vst == null) ? null : vst.gameObject; #pragma warning restore IDE0031 // Use null propagation children = new SortedList <Tag, TypeSelectCategory>(16, TagAlphabetComparer. INSTANCE); position = Vector3.zero; Screen = RootPanel.AddComponent <GridFilterableSideScreen>(); }