コード例 #1
0
 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;
     }
 }
コード例 #2
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);
        }
    }
コード例 #3
0
 protected override void OnPrefabInit()
 {
     if (BuildMenu.UseHotkeyBuildMenu())
     {
         base.gameObject.SetActive(false);
     }
     else
     {
         base.OnPrefabInit();
         productInfoScreen = Util.KInstantiateUI <ProductInfoScreen>(productInfoScreenPrefab, recipeInfoScreenParent, true);
         productInfoScreen.rectTransform().pivot = new Vector2(0f, 0f);
         productInfoScreen.rectTransform().SetLocalPosition(new Vector3(280f, 0f, 0f));
         productInfoScreen.onElementsFullySelected = OnRecipeElementsFullySelected;
         Game.Instance.Subscribe(-107300940, OnResearchComplete);
         Game.Instance.Subscribe(1174281782, OnActiveToolChanged);
     }
     buildingGroupsRoot.gameObject.SetActive(false);
 }
コード例 #4
0
 private void PositionTooltip(KToggle toggle, ToolTip tip)
 {
     tip.overrideParentObject = ((!productInfoScreen.gameObject.activeSelf) ? buildingGroupsRoot : productInfoScreen.rectTransform());
 }