private void RebuildUGCButtons() { if (!((UnityEngine.Object)SteamUGCService.Instance == (UnityEngine.Object)null)) { foreach (Mod mod in Global.Instance.modManager.mods) { if ((mod.available_content & Content.Translation) != 0 && mod.status == Mod.Status.Installed) { GameObject gameObject = Util.KInstantiateUI(languageButtonPrefab, ugcLanguagesContainer, false); gameObject.name = mod.title + "_button"; HierarchyReferences component = gameObject.GetComponent <HierarchyReferences>(); PublishedFileId_t file_id = new PublishedFileId_t(ulong.Parse(mod.label.id)); TMP_FontAsset fontForLangage = GetFontForLangage(file_id); LocText reference = component.GetReference <LocText>("Title"); reference.SetText(string.Format(UI.FRONTEND.TRANSLATIONS_SCREEN.UGC_MOD_TITLE_FORMAT, mod.title)); reference.font = fontForLangage; Texture2D texture2D = SteamUGCService.Instance.FindMod(file_id)?.previewImage; if ((UnityEngine.Object)texture2D != (UnityEngine.Object)null) { Image reference2 = component.GetReference <Image>("Image"); reference2.sprite = Sprite.Create(texture2D, new Rect(Vector2.zero, new Vector2((float)texture2D.width, (float)texture2D.height)), Vector2.one * 0.5f); } KButton component2 = gameObject.GetComponent <KButton>(); component2.onClick += delegate { ConfirmLanguageChoiceDialog(string.Empty, file_id); }; buttons.Add(gameObject); } } } }
private void RebuildPreinstalledButtons() { foreach (string preinstalledLanguage in Localization.PreinstalledLanguages) { if (!(preinstalledLanguage != Localization.DEFAULT_LANGUAGE_CODE) || File.Exists(Localization.GetPreinstalledLocalizationFilePath(preinstalledLanguage))) { GameObject gameObject = Util.KInstantiateUI(languageButtonPrefab, preinstalledLanguagesContainer, false); gameObject.name = preinstalledLanguage + "_button"; HierarchyReferences component = gameObject.GetComponent <HierarchyReferences>(); LocText reference = component.GetReference <LocText>("Title"); reference.text = Localization.GetPreinstalledLocalizationTitle(preinstalledLanguage); reference.enabled = false; reference.enabled = true; Texture2D preinstalledLocalizationImage = Localization.GetPreinstalledLocalizationImage(preinstalledLanguage); if ((UnityEngine.Object)preinstalledLocalizationImage != (UnityEngine.Object)null) { Image reference2 = component.GetReference <Image>("Image"); reference2.sprite = Sprite.Create(preinstalledLocalizationImage, new Rect(Vector2.zero, new Vector2((float)preinstalledLocalizationImage.width, (float)preinstalledLocalizationImage.height)), Vector2.one * 0.5f); } KButton component2 = gameObject.GetComponent <KButton>(); component2.onClick += delegate { ConfirmLanguageChoiceDialog((!(preinstalledLanguage != Localization.DEFAULT_LANGUAGE_CODE)) ? string.Empty : preinstalledLanguage, PublishedFileId_t.Invalid); }; buttons.Add(gameObject); } } }
/// <summary> /// Updates the graphs for the entire category. /// </summary> internal void UpdateCharts() { const float HISTORY = CritterInventoryUtils.CYCLES_TO_CHART * Constants.SECONDS_PER_CYCLE; float currentTime = GameClock.Instance.GetTime(); var tracker = CritterInventoryUtils.GetTracker <AllCritterTracker>(ClusterManager. Instance.activeWorldId, CritterType); var chart = refs.GetReference <SparkLayer>("Chart"); var chartableData = tracker.ChartableData(HISTORY); var xAxis = chart.graph.axis_x; if (chartableData.Length > 0) { xAxis.max_value = chartableData[chartableData.Length - 1].first; } else { xAxis.max_value = 0f; } xAxis.min_value = currentTime - HISTORY; chart.RefreshLine(chartableData, "resourceAmount"); foreach (var resource in resources) { resource.Value.UpdateChart(currentTime); } }
protected override void OnSpawn() { base.OnSpawn(); HierarchyReferences component = survivalButton.GetComponent <HierarchyReferences>(); survivalButtonHeader = component.GetReference <RectTransform>("HeaderBackground").GetComponent <Image>(); survivalButtonSelectionFrame = component.GetReference <RectTransform>("SelectionFrame").GetComponent <Image>(); MultiToggle multiToggle = survivalButton; multiToggle.onEnter = (System.Action)Delegate.Combine(multiToggle.onEnter, new System.Action(OnHoverEnterSurvival)); MultiToggle multiToggle2 = survivalButton; multiToggle2.onExit = (System.Action)Delegate.Combine(multiToggle2.onExit, new System.Action(OnHoverExitSurvival)); MultiToggle multiToggle3 = survivalButton; multiToggle3.onClick = (System.Action)Delegate.Combine(multiToggle3.onClick, new System.Action(OnClickSurvival)); HierarchyReferences component2 = nosweatButton.GetComponent <HierarchyReferences>(); nosweatButtonHeader = component2.GetReference <RectTransform>("HeaderBackground").GetComponent <Image>(); nosweatButtonSelectionFrame = component2.GetReference <RectTransform>("SelectionFrame").GetComponent <Image>(); MultiToggle multiToggle4 = nosweatButton; multiToggle4.onEnter = (System.Action)Delegate.Combine(multiToggle4.onEnter, new System.Action(OnHoverEnterNosweat)); MultiToggle multiToggle5 = nosweatButton; multiToggle5.onExit = (System.Action)Delegate.Combine(multiToggle5.onExit, new System.Action(OnHoverExitNosweat)); MultiToggle multiToggle6 = nosweatButton; multiToggle6.onClick = (System.Action)Delegate.Combine(multiToggle6.onClick, new System.Action(OnClickNosweat)); closeButton.onClick += base.NavigateBackward; SetAnimScale(); }
private void RefreshOverlayIcon(object data = null) { if ((UnityEngine.Object)HarvestWhenReadyOverlayIcon != (UnityEngine.Object)null) { if (Grid.IsVisible(Grid.PosToCell(base.gameObject)) || ((UnityEngine.Object)CameraController.Instance != (UnityEngine.Object)null && CameraController.Instance.FreeCameraEnabled)) { if (!HarvestWhenReadyOverlayIcon.gameObject.activeSelf) { HarvestWhenReadyOverlayIcon.gameObject.SetActive(true); } } else if (HarvestWhenReadyOverlayIcon.gameObject.activeSelf) { HarvestWhenReadyOverlayIcon.gameObject.SetActive(false); } HierarchyReferences component = HarvestWhenReadyOverlayIcon.GetComponent <HierarchyReferences>(); if (harvestWhenReady) { component.GetReference("On").gameObject.SetActive(true); component.GetReference("Off").gameObject.SetActive(false); } else { component.GetReference("On").gameObject.SetActive(false); component.GetReference("Off").gameObject.SetActive(true); } } }
public override GameObject GetHeaderWidget(GameObject parent) { ToolTip tooltip = null; GameObject widget_go = Util.KInstantiateUI(prefab_header_portrait_checkbox, parent, true); tooltip = widget_go.GetComponent <ToolTip>(); HierarchyReferences component = widget_go.GetComponent <HierarchyReferences>(); if ((UnityEngine.Object)tooltip == (UnityEngine.Object)null && (UnityEngine.Object)component != (UnityEngine.Object)null && component.HasReference("ToolTip")) { tooltip = (component.GetReference("ToolTip") as ToolTip); } tooltip.OnToolTip = (() => GetTooltip(tooltip)); MultiToggle obj = component.GetReference("Toggle") as MultiToggle; obj.onClick = (System.Action)Delegate.Combine(obj.onClick, (System.Action) delegate { on_press_action(widget_go); }); MultiToggle componentInChildren = widget_go.GetComponentInChildren <MultiToggle>(); MultiToggle multiToggle = componentInChildren; multiToggle.onClick = (System.Action)Delegate.Combine(multiToggle.onClick, (System.Action) delegate { screen.SetSortComparison(sort_comparer, this); screen.SortRows(); }); ToolTip sort_tooltip = componentInChildren.GetComponent <ToolTip>(); sort_tooltip.OnToolTip = (() => GetSortTooltip(sort_tooltip)); column_sort_toggle = widget_go.GetComponentInChildren <MultiToggle>(); return(widget_go); }
private void DisplayBuildings(RetiredColonyData data, GameObject container) { for (int num = container.transform.childCount - 1; num >= 0; num--) { UnityEngine.Object.Destroy(container.transform.GetChild(num).gameObject); } data.buildings.Sort(delegate(Tuple <string, int> a, Tuple <string, int> b) { if (a.second > b.second) { return(1); } if (a.second == b.second) { return(0); } return(-1); }); data.buildings.Reverse(); foreach (Tuple <string, int> building in data.buildings) { GameObject prefab = Assets.GetPrefab(building.first); GameObject gameObject = Util.KInstantiateUI(buildingPrefab, container, true); HierarchyReferences component = gameObject.GetComponent <HierarchyReferences>(); component.GetReference <LocText>("NameLabel").SetText(GameUtil.ApplyBoldString(prefab.GetProperName())); component.GetReference <LocText>("CountLabel").SetText(string.Format(UI.RETIRED_COLONY_INFO_SCREEN.BUILDING_COUNT, building.second.ToString())); Tuple <Sprite, Color> uISprite = Def.GetUISprite(prefab, "ui", false); component.GetReference <Image>("Portrait").sprite = uISprite.first; } }
private void Initialize(List <Event> events) { foreach (Event @event in events) { Event current = @event; HierarchyReferences hierarchyReferences = Util.KInstantiateUI <HierarchyReferences>(entryPrefab, entryParent.gameObject, true); LocText reference = hierarchyReferences.GetReference <LocText>("Title"); LocText reference2 = hierarchyReferences.GetReference <LocText>("Description"); KButton reference3 = hierarchyReferences.GetReference <KButton>("Details"); Event.GetUIStrings(current.event_type, out string title, out string title_tooltip); reference.text = title; reference.GetComponent <ToolTip>().toolTip = title_tooltip; reference2.text = current.mod.title; ToolTip component = reference2.GetComponent <ToolTip>(); if ((Object)component != (Object)null) { component.toolTip = current.mod.ToString(); } reference3.isInteractable = false; Mod mod = Global.Instance.modManager.FindMod(current.mod); if (mod != null) { if ((Object)component != (Object)null && !string.IsNullOrEmpty(mod.description)) { component.toolTip = mod.description; } if (mod.on_managed != null) { reference3.onClick += mod.on_managed; reference3.isInteractable = true; } } } }
private void PopulateAchievements() { foreach (ColonyAchievement resource in Db.Get().ColonyAchievements.resources) { GameObject gameObject = Util.KInstantiateUI((!resource.isVictoryCondition) ? achievementsPrefab : victoryAchievementsPrefab, achievementsContainer, true); HierarchyReferences component = gameObject.GetComponent <HierarchyReferences>(); component.GetReference <LocText>("nameLabel").SetText(resource.Name); component.GetReference <LocText>("descriptionLabel").SetText(resource.description); if (string.IsNullOrEmpty(resource.icon) || (UnityEngine.Object)Assets.GetSprite(resource.icon) == (UnityEngine.Object)null) { if ((UnityEngine.Object)Assets.GetSprite(resource.Name) != (UnityEngine.Object)null) { component.GetReference <Image>("icon").sprite = Assets.GetSprite(resource.Name); } else { component.GetReference <Image>("icon").sprite = Assets.GetSprite("check"); } } else { component.GetReference <Image>("icon").sprite = Assets.GetSprite(resource.icon); } if (resource.isVictoryCondition) { gameObject.transform.SetAsFirstSibling(); } gameObject.GetComponent <MultiToggle>().ChangeState(2); achievementEntries.Add(resource.Id, gameObject); } UpdateAchievementData(null, null); }
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); } } }
private void RefreshQueueCountDisplay(GameObject entryGO, ComplexFabricator fabricator) { HierarchyReferences component = entryGO.GetComponent <HierarchyReferences>(); bool flag = fabricator.GetRecipeQueueCount(recipeMap[entryGO]) == ComplexFabricator.QUEUE_INFINITE; component.GetReference <LocText>("CountLabel").text = ((!flag) ? fabricator.GetRecipeQueueCount(recipeMap[entryGO]).ToString() : string.Empty); component.GetReference <RectTransform>("InfiniteIcon").gameObject.SetActive(flag); }
private void RebuildUGCButtons() { ListPool <SteamUGCService.Mod, ScenariosMenu> .PooledList pooledList = ListPool <SteamUGCService.Mod, ScenariosMenu> .Allocate(); bool flag = pooledList.Count > 0; noScenariosText.gameObject.SetActive(!flag); contentRoot.gameObject.SetActive(flag); bool flag2 = true; if (pooledList.Count != 0) { for (int i = 0; i < pooledList.Count; i++) { GameObject gameObject = Util.KInstantiateUI(ugcButtonPrefab, ugcContainer, false); gameObject.name = pooledList[i].title + "_button"; gameObject.gameObject.SetActive(true); HierarchyReferences component = gameObject.GetComponent <HierarchyReferences>(); TMP_FontAsset fontForLangage = LanguageOptionsScreen.GetFontForLangage(pooledList[i].fileId); LocText reference = component.GetReference <LocText>("Title"); reference.SetText(pooledList[i].title); reference.font = fontForLangage; Texture2D previewImage = pooledList[i].previewImage; if ((UnityEngine.Object)previewImage != (UnityEngine.Object)null) { Image reference2 = component.GetReference <Image>("Image"); reference2.sprite = Sprite.Create(previewImage, new Rect(Vector2.zero, new Vector2((float)previewImage.width, (float)previewImage.height)), Vector2.one * 0.5f); } KButton component2 = gameObject.GetComponent <KButton>(); int index = i; PublishedFileId_t item = pooledList[index].fileId; component2.onClick += delegate { ShowDetails(item); }; component2.onDoubleClick += delegate { LoadScenario(item); }; buttons.Add(gameObject); if (item == activeItem) { flag2 = false; } } } if (flag2) { HideDetails(); } pooledList.Recycle(); }
private void AddExistingSaveFile(string filename) { KButton kButton = Util.KInstantiateUI <KButton>(oldSaveButtonPrefab.gameObject, oldSavesRoot.gameObject, true); HierarchyReferences component = kButton.GetComponent <HierarchyReferences>(); LocText component2 = component.GetReference <RectTransform>("Title").GetComponent <LocText>(); LocText component3 = component.GetReference <RectTransform>("Date").GetComponent <LocText>(); System.DateTime lastWriteTime = File.GetLastWriteTime(filename); component2.text = $"{Path.GetFileNameWithoutExtension(filename)}"; component3.text = string.Format("{0:H:mm:ss}" + Localization.GetFileDateFormat(0), lastWriteTime); kButton.onClick += delegate { Save(filename); }; }
public override GameObject GetHeaderWidget(GameObject parent) { GameObject widget_go = Util.KInstantiateUI(Assets.UIPrefabs.TableScreenWidgets.DropDownHeader, parent, true); HierarchyReferences component = widget_go.GetComponent <HierarchyReferences>(); Component reference = component.GetReference("Label"); MultiToggle multiToggle = column_sort_toggle = reference.GetComponentInChildren <MultiToggle>(true); MultiToggle multiToggle2 = multiToggle; multiToggle2.onClick = (System.Action)Delegate.Combine(multiToggle2.onClick, (System.Action) delegate { screen.SetSortComparison(sort_comparer, this); screen.SortRows(); }); ToolTip tt = reference.GetComponent <ToolTip>(); tt.enabled = true; tt.OnToolTip = delegate { callbacks.headerTooltip(null, widget_go, tt); return(string.Empty); }; ToolTip tt2 = multiToggle.transform.GetComponent <ToolTip>(); tt2.OnToolTip = delegate { callbacks.headerSortTooltip(null, widget_go, tt2); return(string.Empty); }; Component reference2 = component.GetReference("DropDown"); TMP_Dropdown componentInChildren = reference2.GetComponentInChildren <TMP_Dropdown>(); componentInChildren.options = options; componentInChildren.onValueChanged.AddListener(delegate(int new_value) { set_value_action(widget_go, new_value); }); ToolTip tt3 = reference2.GetComponent <ToolTip>(); tt3.OnToolTip = delegate { callbacks.headerDropdownTooltip(null, widget_go, tt3); return(string.Empty); }; LayoutElement component2 = widget_go.GetComponentInChildren <LocText>().GetComponent <LayoutElement>(); float num3 = component2.preferredWidth = (component2.minWidth = 83f); return(widget_go); }
private void SetRow(int idx, string name, Sprite icon, LaunchConditionManager target) { GameObject gameObject = (idx >= rowContainer.childCount) ? Util.KInstantiateUI(rowPrefab, rowContainer.gameObject, true) : rowContainer.GetChild(idx).gameObject; HierarchyReferences component = gameObject.GetComponent <HierarchyReferences>(); component.GetReference <LocText>("label").text = name; component.GetReference <Image>("icon").sprite = icon; MultiToggle component2 = gameObject.GetComponent <MultiToggle>(); component2.ChangeState(((Object)detector.GetTargetCraft() == (Object)target) ? 1 : 0); component2.onClick = delegate { detector.SetTargetCraft(target); RefreshOptions(); }; }
private void RefreshIngredientAvailabilityVis() { foreach (KeyValuePair <GameObject, ComplexRecipe> item in recipeMap) { HierarchyReferences component = item.Key.GetComponent <HierarchyReferences>(); bool flag = HasAllRecipeRequirements(item.Value); KToggle component2 = item.Key.GetComponent <KToggle>(); if (flag) { if (selectedRecipe == item.Value) { component2.ActivateFlourish(true, ImageToggleState.State.Active); } else { component2.ActivateFlourish(false, ImageToggleState.State.Inactive); } } else if (selectedRecipe == item.Value) { component2.ActivateFlourish(true, ImageToggleState.State.DisabledActive); } else { component2.ActivateFlourish(false, ImageToggleState.State.Disabled); } component.GetReference <LocText>("Label").color = ((!flag) ? new Color(0.22f, 0.22f, 0.22f, 1f) : Color.black); } }
public static void Postfix(Transform ___entryParent) { string currentPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); for (int i = 0; i < Global.Instance.modManager.mods.Count; ++i) { KMod.Mod mod = Global.Instance.modManager.mods[i]; if ((mod.loaded_content & KMod.Content.DLL) == KMod.Content.DLL) { if (string.Equals(Path.GetFullPath(mod.label.install_path), currentPath)) { string modTitle = mod.label.title; for (int j = 0; j < ___entryParent.childCount; ++j) { Transform modSpecificTransform = ___entryParent.GetChild(j); HierarchyReferences hierarchyReferences = modSpecificTransform.GetComponent <HierarchyReferences>(); LocText titleReference = hierarchyReferences.GetReference <LocText>("Title"); if (titleReference != null && titleReference.text == modTitle) { Version version = Assembly.GetExecutingAssembly().GetName().Version; titleReference.text = $"<align=left>{titleReference.text}\n" + $"<size=65%>Last updated {FormatDay(version.Build)} {months[version.Minor-1]} {version.Major} - Revision {version.Revision}"; titleReference.autoSizeTextContainer = false; break; } } break; } } } }
public static void Postfix(Transform ___entryParent) { string currentPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); for (int i = 0; i < Global.Instance.modManager.mods.Count; ++i) { KMod.Mod mod = Global.Instance.modManager.mods[i]; if ((mod.loaded_content & KMod.Content.DLL) == KMod.Content.DLL) { if (string.Equals(Path.GetFullPath(mod.label.install_path), currentPath)) { string modTitle = mod.label.title; for (int j = 0; j < ___entryParent.childCount; ++j) { Transform modSpecificTransform = ___entryParent.GetChild(j); HierarchyReferences hierarchyReferences = modSpecificTransform.GetComponent <HierarchyReferences>(); LocText titleReference = hierarchyReferences.GetReference <LocText>("Title"); if (titleReference != null && titleReference.text == modTitle) { titleReference.text = "<align=left>" + titleReference.text + " <line-height=0.000000001>\n<align=right>(" + Assembly.GetExecutingAssembly().GetName().Version + ")"; titleReference.autoSizeTextContainer = false; break; } } break; } } } }
public void RefreshConditions() { bool flag = false; List <RocketLaunchCondition> launchConditionList = target.GetLaunchConditionList(); foreach (RocketLaunchCondition item in launchConditionList) { if (!conditionTable.ContainsKey(item)) { flag = true; break; } GameObject gameObject = conditionTable[item]; HierarchyReferences component = gameObject.GetComponent <HierarchyReferences>(); if (item.GetParentCondition() != null && item.GetParentCondition().EvaluateLaunchCondition() == RocketLaunchCondition.LaunchStatus.Failure) { gameObject.SetActive(false); } else if (!gameObject.activeSelf) { gameObject.SetActive(true); } bool flag2 = item.EvaluateLaunchCondition() != RocketLaunchCondition.LaunchStatus.Failure; component.GetReference <LocText>("Label").text = item.GetLaunchStatusMessage(flag2); component.GetReference <LocText>("Label").color = ((!flag2) ? Color.red : Color.black); component.GetReference <Image>("Box").color = ((!flag2) ? Color.red : Color.black); component.GetReference <Image>("Check").gameObject.SetActive(flag2); gameObject.GetComponent <ToolTip>().SetSimpleTooltip(item.GetLaunchStatusTooltip(flag2)); } foreach (KeyValuePair <RocketLaunchCondition, GameObject> item2 in conditionTable) { if (!launchConditionList.Contains(item2.Key)) { flag = true; break; } } if (flag) { ClearConditions(); ConfigureConditions(); } destinationButton.onClick = delegate { ManagementMenu.Instance.ToggleStarmap(); }; }
private void SetIcon(Sprite sprite, Color color, HierarchyReferences refs) { Image reference = refs.GetReference <Image>("Icon"); reference.sprite = sprite; reference.color = color; reference.gameObject.SetActive(true); }
public void SetAchievedNow() { MultiToggle component = GetComponent <MultiToggle>(); component.ChangeState(1); HierarchyReferences component2 = GetComponent <HierarchyReferences>(); component2.GetReference <Image>("iconBG").color = color_dark_red; component2.GetReference <Image>("iconBorder").color = color_gold; component2.GetReference <Image>("icon").color = color_gold; LocText[] componentsInChildren = GetComponentsInChildren <LocText>(); foreach (LocText locText in componentsInChildren) { locText.color = Color.white; } ConfigureToolTip(GetComponent <ToolTip>(), COLONY_ACHIEVEMENTS.ACHIEVED_THIS_COLONY_TOOLTIP); }
private void LoadExplorer() { if (!((UnityEngine.Object)SaveGame.Instance != (UnityEngine.Object)null)) { ToggleExplorer(true); this.retiredColonyData = RetireColonyUtility.LoadRetiredColonies(false); RetiredColonyData[] array = this.retiredColonyData; foreach (RetiredColonyData retiredColonyData in array) { RetiredColonyData data = retiredColonyData; GameObject gameObject = Util.KInstantiateUI(colonyButtonPrefab, explorerGrid, true); HierarchyReferences component = gameObject.GetComponent <HierarchyReferences>(); string text = RetireColonyUtility.StripInvalidCharacters(data.colonyName); Sprite sprite = RetireColonyUtility.LoadRetiredColonyPreview(text); Image reference = component.GetReference <Image>("ColonyImage"); RectTransform reference2 = component.GetReference <RectTransform>("PreviewUnavailableText"); if ((UnityEngine.Object)sprite != (UnityEngine.Object)null) { reference.enabled = true; reference.sprite = sprite; reference2.gameObject.SetActive(false); } else { reference.enabled = false; reference2.gameObject.SetActive(true); } component.GetReference <LocText>("ColonyNameLabel").SetText(retiredColonyData.colonyName); component.GetReference <LocText>("CycleCountLabel").SetText(string.Format(UI.RETIRED_COLONY_INFO_SCREEN.CYCLE_COUNT, retiredColonyData.cycleCount.ToString())); component.GetReference <LocText>("DateLabel").SetText(retiredColonyData.date); gameObject.GetComponent <KButton>().onClick += delegate { LoadColony(data); }; string key = retiredColonyData.colonyName; int num = 0; while (explorerColonyWidgets.ContainsKey(key)) { num++; key = retiredColonyData.colonyName + "_" + num; } explorerColonyWidgets.Add(key, gameObject); } } }
private void SetRow(int idx, string name, Sprite icon, LaunchConditionManager target) { GameObject gameObject = idx >= this.rowContainer.childCount ? Util.KInstantiateUI(this.rowPrefab, this.rowContainer.gameObject, true) : this.rowContainer.GetChild(idx).gameObject; HierarchyReferences component1 = gameObject.GetComponent <HierarchyReferences>(); component1.GetReference <LocText>("label").text = name; component1.GetReference <Image>(nameof(icon)).sprite = icon; MultiToggle component2 = gameObject.GetComponent <MultiToggle>(); component2.ChangeState((UnityEngine.Object) this.detector.GetTargetCraft() == (UnityEngine.Object)target ? 1 : 0); LaunchConditionManager _target = target; component2.onClick = (System.Action)(() => { this.detector.SetTargetCraft(_target); this.RefreshOptions(); }); }
private void RefreshCharts() { float time = GameClock.Instance.GetTime(); float num = 3000f; foreach (KeyValuePair <Tag, GameObject> categoryRow in categoryRows) { HierarchyReferences component = categoryRow.Value.GetComponent <HierarchyReferences>(); ResourceTracker resourceStatistic = TrackerTool.Instance.GetResourceStatistic(ClusterManager.Instance.activeWorldId, categoryRow.Key); if (resourceStatistic != null) { SparkLayer reference = component.GetReference <SparkLayer>("Chart"); Tuple <float, float>[] array = resourceStatistic.ChartableData(num); if (array.Length != 0) { reference.graph.axis_x.max_value = array[array.Length - 1].first; } else { reference.graph.axis_x.max_value = 0f; } reference.graph.axis_x.min_value = time - num; reference.RefreshLine(array, "resourceAmount"); } else { DebugUtil.DevLogError("DevError: No tracker found for resource category " + categoryRow.Key); } } foreach (KeyValuePair <Tag, GameObject> resourceRow in resourceRows) { HierarchyReferences component = resourceRow.Value.GetComponent <HierarchyReferences>(); ResourceTracker resourceStatistic2 = TrackerTool.Instance.GetResourceStatistic(ClusterManager.Instance.activeWorldId, resourceRow.Key); if (resourceStatistic2 != null) { SparkLayer reference2 = component.GetReference <SparkLayer>("Chart"); Tuple <float, float>[] array2 = resourceStatistic2.ChartableData(num); if (array2.Length != 0) { reference2.graph.axis_x.max_value = array2[array2.Length - 1].first; } else { reference2.graph.axis_x.max_value = 0f; } reference2.graph.axis_x.min_value = time - num; reference2.RefreshLine(array2, "resourceAmount"); } else { DebugUtil.DevLogError("DevError: No tracker found for resource " + resourceRow.Key); } } }
private void InitializeHeader(ChoreGroup chore_group, GameObject widget_go) { HierarchyReferences component = widget_go.GetComponent <HierarchyReferences>(); HierarchyReferences hierarchyReferences = component.GetReference("PrioritizationWidget") as HierarchyReferences; GameObject items_root = hierarchyReferences.GetReference("ItemPanel").gameObject; if (items_root.transform.childCount <= 0) { items_root.SetActive(false); LocText locText = component.GetReference("Label") as LocText; locText.text = chore_group.Name; KButton kButton = component.GetReference("PrioritizeButton") as KButton; Selectable selectable = items_root.GetComponent <Selectable>(); kButton.onClick += delegate { selectable.Select(); items_root.SetActive(true); }; GameObject gameObject = hierarchyReferences.GetReference("ItemTemplate").gameObject; for (int num = 5; num >= 0; num--) { PriorityInfo priorityInfo = GetPriorityInfo(num); if (priorityInfo.name != null) { GameObject gameObject2 = Util.KInstantiateUI(gameObject, items_root, true); KButton component2 = gameObject2.GetComponent <KButton>(); HierarchyReferences component3 = gameObject2.GetComponent <HierarchyReferences>(); KImage kImage = component3.GetReference("Icon") as KImage; LocText locText2 = component3.GetReference("Label") as LocText; int new_priority = num; component2.onClick += delegate { ChangeColumnPriority(widget_go, new_priority); UnityEngine.EventSystems.EventSystem.current.SetSelectedGameObject(null); }; kImage.sprite = priorityInfo.sprite; locText2.text = priorityInfo.name; } } } }
private void DisplayDuplicants(RetiredColonyData data, GameObject container, int range_min = -1, int range_max = -1) { for (int num = container.transform.childCount - 1; num >= 0; num--) { UnityEngine.Object.DestroyImmediate(container.transform.GetChild(num).gameObject); } for (int i = 0; i < data.Duplicants.Length; i++) { if (i < range_min || (i > range_max && range_max != -1)) { GameObject gameObject = new GameObject(); gameObject.transform.SetParent(container.transform); } else { RetiredColonyData.RetiredDuplicantData retiredDuplicantData = data.Duplicants[i]; GameObject gameObject2 = Util.KInstantiateUI(duplicantPrefab, container, true); HierarchyReferences component = gameObject2.GetComponent <HierarchyReferences>(); component.GetReference <LocText>("NameLabel").SetText(retiredDuplicantData.name); component.GetReference <LocText>("AgeLabel").SetText(string.Format(UI.RETIRED_COLONY_INFO_SCREEN.DUPLICANT_AGE, retiredDuplicantData.age.ToString())); component.GetReference <LocText>("SkillLabel").SetText(string.Format(UI.RETIRED_COLONY_INFO_SCREEN.SKILL_LEVEL, retiredDuplicantData.skillPointsGained.ToString())); SymbolOverrideController reference = component.GetReference <SymbolOverrideController>("SymbolOverrideController"); reference.RemoveAllSymbolOverrides(0); KBatchedAnimController componentInChildren = gameObject2.GetComponentInChildren <KBatchedAnimController>(); componentInChildren.SetSymbolVisiblity("snapTo_neck", false); componentInChildren.SetSymbolVisiblity("snapTo_goggles", false); componentInChildren.SetSymbolVisiblity("snapTo_hat", false); componentInChildren.SetSymbolVisiblity("snapTo_hat_hair", false); foreach (KeyValuePair <string, string> accessory in retiredDuplicantData.accessories) { KAnim.Build.Symbol symbol = Db.Get().Accessories.Get(accessory.Value).symbol; AccessorySlot accessorySlot = Db.Get().AccessorySlots.Get(accessory.Key); reference.AddSymbolOverride(accessorySlot.targetSymbolId, symbol, 0); gameObject2.GetComponentInChildren <KBatchedAnimController>().SetSymbolVisiblity(accessory.Key, true); } reference.ApplyOverrides(); } } StartCoroutine(ActivatePortraitsWhenReady(container)); }
public void SetFailed() { MultiToggle component = GetComponent <MultiToggle>(); component.ChangeState(2); HierarchyReferences component2 = GetComponent <HierarchyReferences>(); component2.GetReference <Image>("iconBG").color = color_dark_grey; component2.GetReference <Image>("iconBG").SetAlpha(0.5f); component2.GetReference <Image>("iconBorder").color = color_grey; component2.GetReference <Image>("iconBorder").SetAlpha(0.5f); component2.GetReference <Image>("icon").color = color_grey; component2.GetReference <Image>("icon").SetAlpha(0.5f); LocText[] componentsInChildren = GetComponentsInChildren <LocText>(); foreach (LocText locText in componentsInChildren) { LocText locText2 = locText; Color color = locText.color; float r = color.r; Color color2 = locText.color; float g = color2.g; Color color3 = locText.color; locText2.color = new Color(r, g, color3.b, 0.25f); } ConfigureToolTip(GetComponent <ToolTip>(), COLONY_ACHIEVEMENTS.FAILED_THIS_COLONY); }
public void Setup(Schedule schedule, Dictionary <string, ColorStyleSetting> paintStyles, Action <ScheduleScreenEntry, float> onPaintDragged) { this.schedule = schedule; base.gameObject.name = "Schedule_" + schedule.name; title.SetTitle(schedule.name); title.OnNameChanged += OnNameChanged; blockButtonContainer.Setup(delegate(float f) { onPaintDragged(this, f); }); int num = 0; blockButtons = new List <ScheduleBlockButton>(); List <ScheduleBlock> blocks = schedule.GetBlocks(); int count = blocks.Count; foreach (ScheduleBlock block in schedule.GetBlocks()) { ScheduleBlockButton scheduleBlockButton = Util.KInstantiateUI <ScheduleBlockButton>(blockButtonPrefab.gameObject, blockButtonContainer.gameObject, true); scheduleBlockButton.Setup(num++, paintStyles, count); scheduleBlockButton.SetBlockTypes(block.allowed_types); blockButtons.Add(scheduleBlockButton); } minionWidgets = new List <ScheduleMinionWidget>(); blankMinionWidget = Util.KInstantiateUI <ScheduleMinionWidget>(minionWidgetPrefab.gameObject, minionWidgetContainer, false); blankMinionWidget.SetupBlank(schedule); RebuildMinionWidgets(); RefreshNotes(); RefreshAlarmButton(); optionsButton.onClick += OnOptionsClicked; HierarchyReferences component = optionsPanel.GetComponent <HierarchyReferences>(); MultiToggle reference = component.GetReference <MultiToggle>("AlarmButton"); reference.onClick = (System.Action)Delegate.Combine(reference.onClick, new System.Action(OnAlarmClicked)); component.GetReference <KButton>("ResetButton").onClick += OnResetClicked; component.GetReference <KButton>("DeleteButton").onClick += OnDeleteClicked; schedule.onChanged = (Action <Schedule>)Delegate.Combine(schedule.onChanged, new Action <Schedule>(OnScheduleChanged)); }
public override GameObject GetHeaderWidget(GameObject parent) { GameObject widget_go = Util.KInstantiateUI(Assets.UIPrefabs.TableScreenWidgets.PriorityGroupSelectorHeader, parent, true); HierarchyReferences component = widget_go.GetComponent <HierarchyReferences>(); LayoutElement component2 = widget_go.GetComponentInChildren <LocText>().GetComponent <LayoutElement>(); float num3 = component2.preferredWidth = (component2.minWidth = 63f); Component reference = component.GetReference("Label"); LocText component3 = reference.GetComponent <LocText>(); component3.raycastTarget = true; ToolTip component4 = reference.GetComponent <ToolTip>(); if ((UnityEngine.Object)component4 != (UnityEngine.Object)null) { component4.OnToolTip = (() => onHoverWidget(widget_go)); } MultiToggle multiToggle = column_sort_toggle = widget_go.GetComponentInChildren <MultiToggle>(true); MultiToggle multiToggle2 = multiToggle; multiToggle2.onClick = (System.Action)Delegate.Combine(multiToggle2.onClick, (System.Action) delegate { onSortClicked(widget_go); }); ToolTip component5 = multiToggle.GetComponent <ToolTip>(); if ((UnityEngine.Object)component5 != (UnityEngine.Object)null) { component5.OnToolTip = (() => onSortHovered(widget_go)); } KButton kButton = component.GetReference("PrioritizeButton") as KButton; ToolTip component6 = kButton.GetComponent <ToolTip>(); if ((UnityEngine.Object)component6 != (UnityEngine.Object)null) { component6.OnToolTip = (() => onHoverHeaderOptionSelector(widget_go)); } return(widget_go); }
public void ConfigureItem(bool disabled, DisplayOptionInfo display_info) { KImage kImage = selectedItem; HierarchyReferences component = kImage.GetComponent <HierarchyReferences>(); KImage kImage2 = component.GetReference("BG") as KImage; if (display_info.bgOptions == null) { kImage2.gameObject.SetActive(false); } else { kImage2.sprite = display_info.bgOptions[display_info.bgIndex]; } KImage kImage3 = component.GetReference("FG") as KImage; if (display_info.fgOptions == null) { kImage3.gameObject.SetActive(false); } else { kImage3.sprite = display_info.fgOptions[display_info.fgIndex]; } KImage kImage4 = component.GetReference("Fill") as KImage; if ((UnityEngine.Object)kImage4 != (UnityEngine.Object)null) { kImage4.enabled = !disabled; kImage4.color = display_info.fillColour; } KImage kImage5 = component.GetReference("Outline") as KImage; if ((UnityEngine.Object)kImage5 != (UnityEngine.Object)null) { kImage5.enabled = !disabled; } }