private void OnBuildingSelected(BuildingDef def) { if (!selecting) { selecting = true; selectedBuilding = def; buildingsScreen.SetHasFocus(false); foreach (KeyValuePair <HashedString, BuildMenuCategoriesScreen> submenu in submenus) { BuildMenuCategoriesScreen value = submenu.Value; value.SetHasFocus(false); } ToolMenu.Instance.ClearSelection(); if ((UnityEngine.Object)def != (UnityEngine.Object)null) { Vector2 anchoredPosition = productInfoScreen.rectTransform().anchoredPosition; RectTransform rectTransform = buildingsScreen.rectTransform(); Vector2 anchoredPosition2 = rectTransform.anchoredPosition; anchoredPosition.y = anchoredPosition2.y; Vector2 anchoredPosition3 = rectTransform.anchoredPosition; float x = anchoredPosition3.x; Vector2 sizeDelta = rectTransform.sizeDelta; anchoredPosition.x = x + sizeDelta.x + 10f; productInfoScreen.rectTransform().anchoredPosition = anchoredPosition; productInfoScreen.ClearProduct(false); productInfoScreen.Show(true); productInfoScreen.ConfigureScreen(def); } else { productInfoScreen.Close(); } selecting = false; } }
public void OnSelectBuilding(GameObject button_go, BuildingDef def) { if ((UnityEngine.Object)button_go == (UnityEngine.Object)null) { Debug.Log("Button gameObject is null", base.gameObject); } else if ((UnityEngine.Object)button_go == (UnityEngine.Object)selectedBuildingGameObject) { CloseRecipe(true); } else { ignoreToolChangeMessages++; selectedBuildingGameObject = button_go; currentlySelectedToggle = button_go.GetComponent <KToggle>(); KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Click", false)); HashedString category = tagCategoryMap[def.Tag]; if (GetToggleEntryForCategory(category, out ToggleEntry toggleEntry) && toggleEntry.pendingResearchAttentions.Contains(def.Tag)) { toggleEntry.pendingResearchAttentions.Remove(def.Tag); button_go.GetComponent <PlanCategoryNotifications>().ToggleAttention(false); if (toggleEntry.pendingResearchAttentions.Count == 0) { toggleEntry.toggleInfo.toggle.GetComponent <PlanCategoryNotifications>().ToggleAttention(false); } } productInfoScreen.ClearProduct(false); ToolMenu.Instance.ClearSelection(); PrebuildTool.Instance.Activate(def, BuildableState(def)); productInfoScreen.Show(true); productInfoScreen.ConfigureScreen(def); ignoreToolChangeMessages--; } }