Exemple #1
0
        // TODO: とある事情によりmanagerが必要
        public DebugUiWindow(
            DebugUiManager manager,
            string title,
            float headerHeight = DefaultHeaderSize) : base(string.IsNullOrEmpty(title) ? "Window" : title)
        {
            _headerPanel = new DebugUiPanel(
                float.MaxValue,
                float.MaxValue,
                true,
                true,
                true);
            _headerPanel.backgroundColor = new Color32(0, 0, 128, 128);
            _headerPanel.draggable       = true;
            _headerPanel.onDragStart     = () =>
            {
                _prevPointerX = pointerX;
                _prevPointerY = pointerY;
            };
            // このヘッダをタップしたら、windowを手前に持ってくる
            _headerPanel.onEventConsume = () =>
            {
                SetAsLastSibling();
            };

            var closeButton = new DebugUiButton(
                "X",
                DefaultHeaderSize,
                DefaultHeaderSize);

            closeButton.onClick = () =>
            {
                enabled = false;
            };
            _headerPanel.AddChildAuto(closeButton);

            var minimizeButton = new DebugUiButton(
                "_",
                DefaultHeaderSize,
                DefaultHeaderSize);

            minimizeButton.onClick = () =>
            {
                ToggleMinimize();
            };
            _headerPanel.AddChildAuto(minimizeButton);
            var titleText = new DebugUiText(manager, title, DefaultHeaderSize * 0.75f);

            _headerPanel.AddChildAuto(titleText);
            _headerPanel.AdjustSize();
            base.AddChild(_headerPanel);

            _contentPanel = new DebugUiPanel(0f, 0f, false, false);
            base.AddChild(_contentPanel);

            backgroundEnabled = true;
            borderEnabled     = true;

            // とりあえず空でレイアウト
            Layout();
        }
Exemple #2
0
        public SampleWindow(DebugUiManager manager) : base(manager, "SampleWindow")
        {
            _frameTimeWatcher = new FrameTimeWatcher();

            var button = new DebugUiButton("ボタン", 100f);

            button.onClick = () =>
            {
                _log.Add("ボタンが押された!");
            };
            AddAuto(button);

            var toggleGroup = new DebugUiToggleGroup();
            var toggles     = new DebugUiToggle[2];

            toggles[0] = new DebugUiToggle("トグルA", 100f, 50f, toggleGroup);
            toggles[0].onChangeToOn = () =>
            {
                _log.Add("Aが有効になった");
            };
            AddAuto(toggles[0]);
            toggles[1] = new DebugUiToggle("トグルB", 100f, 50f, toggleGroup);
            toggles[1].onChangeToOn = () =>
            {
                _log.Add("Bが有効になった");
            };
            AddAuto(toggles[1]);

            var text = new DebugUiText("テキスト", fontSize: 20f, width: 80f, height: 25f);

            AddAuto(text);

            BreakLine();

            _log = new DebugUiLogWindow(
                fontSize: 20f,
                width: 600f,
                height: 220f,
                borderEnabled: true,
                captureUnityLog: true);                 // Unityのログも出しちゃうよ
            AddAuto(_log);

            _graph = new DebugUiGraph(5, 200f, 220f);
            _graph.AddSeries(new Color32(255, 64, 64, 255));
            AddAuto(_graph);

            BreakLine();

            var frameTimeGauge = new FrameTimeGauge(200f, 30f, _frameTimeWatcher);

            AddAuto(frameTimeGauge);

            var slider = new DebugUiSlider("スライダー", -100f, 100f, 400f);

            slider.onDragEnd = () =>
            {
                _log.Add("スライダーが" + slider.value + "に変更された");
            };
            AddAuto(slider);

            BreakLine();

            var table = new DebugUiTable(
                16f,
                new List <float>()
            {
                80f, 80f, 120f
            },
                3,
                20f);

            table.cells[0, 0] = "列A";
            table.cells[0, 1] = "列B";
            table.cells[0, 2] = "列C";
            table.cells[1, 0] = "データ10";
            table.cells[1, 1] = "データ11";
            table.cells[1, 2] = "データ12";
            table.cells[2, 0] = "データ20";
            table.cells[2, 1] = "データ21";
            table.cells[2, 2] = "データ23";
            AddAuto(table);

            FitSize();
        }
Exemple #3
0
        public SampleWindow(DebugUiManager manager) : base(manager, "SampleWindow")
        {
            var button = new DebugUiButton("ボタン", 100f);

            button.onClick = () =>
            {
                _log.Add("ボタンが押された!");
            };
            AddChildAuto(button);

            var toggleGroup = new DebugUiToggleGroup();
            var toggles     = new DebugUiToggle[2];

            toggles[0] = new DebugUiToggle("トグルA", 100f, 50f, toggleGroup);
            toggles[0].onChangeToOn = () =>
            {
                _log.Add("Aが有効になった");
            };
            AddChildAuto(toggles[0]);
            toggles[1] = new DebugUiToggle("トグルB", 100f, 50f, toggleGroup);
            toggles[1].onChangeToOn = () =>
            {
                _log.Add("Bが有効になった");
            };
            AddChildAuto(toggles[1]);

            var text = new DebugUiText("テキスト", fontSize: 20f, width: 80f, height: 20f);

            AddChildAuto(text);

            BreakLine();

            _log = new DebugUiLogWindow(fontSize: 20f, lineHeight: 22f, lineCount: 10, width: 800f);
            AddChildAuto(_log);

            BreakLine();

            var frameTimeGauge = new FrameTimeGauge(200f, 30f, null);

            AddChildAuto(frameTimeGauge);

            var slider = new DebugUiSlider("スライダー", -100f, 100f, 400f);

            slider.onDragEnd = () =>
            {
                _log.Add("スライダーが" + slider.value + "に変更された");
            };
            AddChildAuto(slider);

            BreakLine();

            var table = new DebugUiTable(
                16f,
                new List <float>()
            {
                80f, 80f, 120f
            },
                3,
                20f);

            table.cells[0, 0] = "列A";
            table.cells[0, 1] = "列B";
            table.cells[0, 2] = "列C";
            table.cells[1, 0] = "データ10";
            table.cells[1, 1] = "データ11";
            table.cells[1, 2] = "データ12";
            table.cells[2, 0] = "データ20";
            table.cells[2, 1] = "データ21";
            table.cells[2, 2] = "データ23";
            AddChildAuto(table);

            AdjustSize();
        }