Exemple #1
0
        public static void BuildMenu(GameObject canvas)
        {
            panel = new CanvasPanel(canvas, new Texture2D(1, 1), new Vector2(0, 0), Vector2.zero, new Rect(0, 0, 1, 1));

            //panel.AddText("Panel Label", "Pick", new Vector2(0f, -20f), Vector2.zero, GUIController.Instance.trajanBold, 30);
            //pickupBorder

            var img_pickborder  = GUIController.Instance.images["pickupBorder"];
            var img_itemborder  = GUIController.Instance.images["itemBorder"];
            var img_selected    = GUIController.Instance.images["selected"];
            var img_defaultIcon = GUIController.Instance.images["defaultIcon"];
            var img_savedborder = GUIController.Instance.images["savedBorder"];

            panel.AddPanel("Border", img_pickborder, new Vector2((1920f - img_pickborder.width) / 2, 0), Vector2.zero, new Rect(0, 0, img_pickborder.width, img_pickborder.height));
            Vector2 itemborderOffset = Vector2.zero;

            for (int i = 1; i <= ItemManager.GroupMax; i++)
            {
                var itemPanel = panel.GetPanel("Border").AddPanel($"ItemBorder{i}", img_itemborder, itemborderOffset, Vector2.zero, new Rect(0, 0, img_itemborder.width, img_itemborder.height));
                itemPanel.AddButton($"Item_{i}", img_defaultIcon, Vector2.zero, Vector2.zero, ItemClicked, new Rect(0, 0, img_defaultIcon.width, img_defaultIcon.height), GUIController.Instance.arial, $"Item_{i}");
                itemborderOffset.x += img_itemborder.width + 3f;
            }
            itemborderOffset.x += img_savedborder.width + 3f;
            var prefabPanel = panel.GetPanel("Border").AddPanel($"PrefabBorder{1}", img_savedborder, itemborderOffset, Vector2.zero, new Rect(0, 0, img_savedborder.width, img_savedborder.height));

            prefabPanel.AddButton($"Prefab_{1}", img_defaultIcon, Vector2.zero, Vector2.zero, PrefabClicked, new Rect(0, 0, img_defaultIcon.width, img_defaultIcon.height), GUIController.Instance.arial, $"Prefab_{1}");

            selected = panel.GetPanel("Border").AddImage("selected", img_selected, Vector2.zero, Vector2.zero, new Rect(0, 0, img_selected.width, img_selected.height));

            ItemManager.Instance.GroupSwitchEventHandler += UpdateItemList;
            LogDebug("PickPanel Built");
        }
Exemple #2
0
        public static void BuildMenu(GameObject canvas)
        {
            panel = new CanvasPanel(canvas, new Texture2D(1, 1), new Vector2(0, 0), Vector2.zero, new Rect(0, 0, 1, 1));
            var tex = GUIController.Instance.images["hidebtnbg"];

            panel.AddButton("hide", tex, new Vector2((1920 - 790) / 2, 10), Vector2.zero, HideClicked, new Rect(0, 0, tex.width, tex.height), GUIController.Instance.arial, "<", 25);

            desc_panel = panel.AddPanel("DescArea", new Texture2D(1, 1), new Vector2(0, 300), new Vector2(1, 1), new Rect(0, 0, 1, 1));

            desc = desc_panel.AddText("Desc", "This is a Description", Vector2.zero, Vector2.zero, GUIController.Instance.arial, 26);
            ItemManager.Instance.OnChanged += ChangeDesc;
            Logger.LogDebug("DescPanel Built");
        }