Example #1
0
        static void LoadJsonShow()
        {
            string            json   = File.ReadAllText(Application.dataPath + "/Editor/data/test.json");
            var               d      = JsonConvert.DeserializeObject <DWindow>(json);
            DescriptionParser parser = new DescriptionParser(d);

            parser.Parse();
            var w = parser.GetWindow();

            if (Window2_instance == null)
            {
                Window2_instance = WindowPlayer.New(w);
            }
            Window2_instance.Show();
        }
Example #2
0
        public static WindowPlayer New(Window w)
        {
            WindowPlayer player = CreateInstance <WindowPlayer>();

            player.renderWindow            = w;
            player.renderWindow.OnRepaint += (widget, arg) =>
            {
                Debug.Log("重绘");
                player.Repaint();
            };
            player.position = new Rect(w.StartPosition.x, w.StartPosition.y, w.Width, w.Height);
            player.minSize  = TypeTools.Point2Vector2(w.MinSize);
            player.maxSize  = TypeTools.Point2Vector2(w.MaxSize);

            player.titleContent = new GUIContent(w.Title);
            player.ShowUtility();
            player.Focus();
            return(player);
        }