Beispiel #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));
            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");
        }
        public ErrorPanel(string msg)
        {
            GUIController.Instance.LoadResources();
            var canvas = new GameObject();

            canvas.AddComponent <Canvas>().renderMode = RenderMode.ScreenSpaceOverlay;
            CanvasScaler scaler = canvas.AddComponent <CanvasScaler>();

            scaler.uiScaleMode         = CanvasScaler.ScaleMode.ScaleWithScreenSize;
            scaler.referenceResolution = new Vector2(1920f, 1080f);
            canvas.AddComponent <GraphicRaycaster>();
            panel = new CanvasPanel(canvas, new Texture2D(1, 1), new Vector2(0, 0), Vector2.zero, new Rect(0, 0, 1, 1));
            panel.AddText("Desc", $"DecorationMaster Load Json data Error:\n{msg}", new Vector2(300, 0), Vector2.zero, GUIController.Instance.arial, 28);
            panel.SetActive(true, true);

            Logger.LogError(msg);
        }