예제 #1
0
        public DebugUiToggle(
            string text,
            float width              = 80f,
            float height             = 50f,
            DebugUiToggleGroup group = null)
        {
            SetSize(width, height);
            _group = group;
            // グループが与えられて、中身がなければ自分をonにする
            if (_group != null)
            {
                if (_group.selected == null)
                {
                    _group.SetOnToggle(this);
                    on = true;
                }
            }
            this.text = text;
            // イベント取ります
            eventEnabled  = true;
            borderEnabled = true;

            offColor     = new Color32(0, 0, 0, 192);
            onColor      = new Color32(192, 192, 96, 192);
            offTextColor = new Color32(255, 255, 255, 255);
            onTextColor  = new Color32(0, 0, 0, 255);
        }
예제 #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();
        }
예제 #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();
        }