protected override void OnSpawn() { base.OnSpawn(); ConsumeMouseScroll = true; initTime = KTime.Instance.UnscaledGameTime; bool flag = UseHotkeyBuildMenu(); if (flag) { Instance = this; productInfoScreen = Util.KInstantiateUI <ProductInfoScreen>(productInfoScreenPrefab, base.gameObject, true); productInfoScreen.rectTransform().pivot = new Vector2(0f, 0f); productInfoScreen.onElementsFullySelected = OnRecipeElementsFullySelected; productInfoScreen.Show(false); buildingsScreen = Util.KInstantiateUI <BuildMenuBuildingsScreen>(buildingsMenuPrefab.gameObject, base.gameObject, true); BuildMenuBuildingsScreen buildMenuBuildingsScreen = buildingsScreen; buildMenuBuildingsScreen.onBuildingSelected = (Action <BuildingDef>)Delegate.Combine(buildMenuBuildingsScreen.onBuildingSelected, new Action <BuildingDef>(OnBuildingSelected)); buildingsScreen.Show(false); Game.Instance.Subscribe(288942073, OnUIClear); Game.Instance.Subscribe(-1190690038, OnBuildToolDeactivated); Initialize(); this.rectTransform().anchoredPosition = Vector2.zero; } else { base.gameObject.SetActive(flag); } }
protected override void OnShow(bool show) { if (buildingInfos != null) { if (show) { buildingsScreen.Configure(category, buildingInfos); buildingsScreen.Show(true); } else { buildingsScreen.Close(); } } base.OnShow(show); }