Esempio n. 1
0
    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);
        }
    }
Esempio n. 2
0
        protected override void OnActivateTool()
        {
            var menu = ToolMenu.Instance.toolParameterMenu;

            base.OnActivateTool();
            // Reuse the "Product Info" asset from BuildMenu to allow resource selection
            if (infoScreen == null)
            {
                infoScreen = Util.KInstantiateUI <ProductInfoScreen>(Traverse.Create(
                                                                         PlanScreen.Instance).GetField <GameObject>("productInfoScreenPrefab"),
                                                                     gameObject, false);
                infoScreen.Show(false);
            }
            ToolMenu.Instance.PriorityScreen.Show(true);
            // Default to "sweep all"
            optionState = PToolMode.PopulateMenu(menu, toolOptions);
            menu.onParametersChanged += UpdateViewMode;
            UpdateViewMode();
        }
Esempio n. 3
0
 private void CloseProductInfoScreen()
 {
     productInfoScreen.ClearProduct(true);
     productInfoScreen.Show(false);
 }
Esempio n. 4
0
 protected override void OnCmpEnable()
 {
     Refresh();
     productInfoScreen.Show(false);
 }