コード例 #1
0
    private void SetupUpGui()
    {
        // Initialize the loaders
        GuiModule.Initialize(this);
//        NetModule.Initialize(this);

        TweenSharkUnity3D.Initialize(this);

        _guiStage = GlobalGui.GetInstance();

        _guiStage.AddChild(
            _btn = new Button(new Rect(10, 10, 100, 25), "Click Me1")
                   .AddClickHandler(e => TweenButton())
                   .AddMouseOverHandler(e => Debug.Log("Over"))
                   .AddMouseOutHandler(e => Debug.Log("Out"))
            );
        _guiStage.AddChild(
            _btn2 = new Button(new Rect(100, 200, 100, 25), "Klick mich!")
                    .AddClickHandler(e => TweenButton2())
                    .AddMouseOverHandler(e => Debug.Log("Over"))
                    .AddMouseOutHandler(e => Debug.Log("Out"))
            );
    }
コード例 #2
0
    private void SetupUpGui()
    {
        // Initialize the loaders
        GuiModule.Initialize(this);
//        NetModule.Initialize(this);

        TweenSharkUnity3D.Initialize(this);

        _guiStage = GlobalGui.GetInstance();

        _guiStage.AddChild(
            new VGroup()
            .SetPos(10, 10)
            .SetPadding(5)
            .SetSpacing(5)
            .AddChild(
                new Box(new Rect(20, 50, 300, 300), "TweenShark")
                .SetAutoAdjustSize(true)
                .AddChild(
                    new VGroup()
                    .SetPos(0, 20)
                    .SetPadding(5)
                    .AddChild(
                        new Button(new Rect(5, 20, 100, 25), "SpinCube-X")
                        .AddClickHandler((e) => SpinCubeAroundX())
                        )
                    .AddChild(
                        new Button(new Rect(5, 20, 100, 25), "SpinCube-Y")
                        .AddClickHandler((e) => SpinCubeAroundY())
                        )
                    .AddChild(
                        new Button(new Rect(5, 20, 100, 25), "SpinCube-Z")
                        .AddClickHandler((e) => SpinCubeAroundZ())
                        )
                    )
                .AddChild(
                    // first column
                    new VGroup()
                    .SetPos(120, 20)
                    .SetPadding(5)
                    .AddChild(
                        new Button(new Rect(5, 20, 40, 25), "\\")
                        .AddClickHandler(e => BringCubeTo(_cube, 3, -3, 0, false))
                        )
                    .AddChild(
                        new Button(new Rect(5, 20, 40, 25), "-")
                        .AddClickHandler(e => BringCubeTo(_cube, 0, -3, 0, false))
                        )
                    .AddChild(
                        new Button(new Rect(5, 20, 40, 25), "/")
                        .AddClickHandler(e => BringCubeTo(_cube, -3, -3, 0, false))
                        )
                    )
                .AddChild(
                    // second column
                    new VGroup()
                    .SetPos(160, 20)
                    .SetPadding(5)
                    .AddChild(
                        new Button(new Rect(5, 20, 40, 25), "|")
                        .AddClickHandler((e) => BringCubeTo(_cube, 3, 0, 0, false))
                        )
                    .AddChild(
                        new Button(new Rect(5, 20, 40, 25), "+")
                        .AddClickHandler((e) => BringCubeTo(_cube, 0, 0, 0, false))
                        )
                    .AddChild(
                        new Button(new Rect(5, 20, 40, 25), "|")
                        .AddClickHandler((e) => BringCubeTo(_cube, -3, 0, 0, false))
                        )
                    )
                .AddChild(
                    // third column
                    new VGroup()
                    .SetPos(200, 20)
                    .SetPadding(5)
                    .AddChild(
                        new Button(new Rect(5, 20, 40, 25), "/")
                        .AddClickHandler((e) => BringCubeTo(_cube, 3, 3, 0, false))
                        )
                    .AddChild(
                        new Button(new Rect(5, 20, 40, 25), "-")
                        .AddClickHandler((e) => BringCubeTo(_cube, 0, 3, 0, false))
                        )
                    .AddChild(
                        new Button(new Rect(5, 20, 40, 25), "\\")
                        .AddClickHandler((e) => BringCubeTo(_cube, -3, 3, 0, false))
                        )
                    )
                .AddChild(
                    // 4th column
                    new VGroup()
                    .SetPos(250, 20)
                    .SetPadding(5)
                    .AddChild(
                        new Button(new Rect(5, 20, 40, 25), "/\\")
                        .AddClickHandler((e) => BringCubeVertical(0.5f))
                        )
                    .AddChild(
                        new Button(new Rect(5, 20, 40, 25), "-")
                        .AddClickHandler((e) => BringCubeVertical(0))
                        )
                    .AddChild(
                        new Button(new Rect(5, 20, 40, 25), "\\/")
                        .AddClickHandler((e) => BringCubeVertical(-0.5f))
                        )
                    )
                )
            .AddChild(
                _progressTextField = new TextField(new Rect(0, 0, 300, 20), "")
                )
            .AddChild(
                new Box(new Rect(20, 85, 300, 200), "Madness")
                .SetAutoAdjustSize(true)
                .SetPadding(5)
                .AddChild(
                    new Button(new Rect(0, 20, 290, 30), "Action!")
                    .AddClickHandler(e => StartTheMaddness())
                    )
                .AddChild(
                    _cubeCountTextField = new TextField(new Rect(0, 60, 290, 20), "")
                    )
                .AddChild(
                    _tweenerSelection = new SelectionGrid(new Rect(0, 90, 290, 25), new string[] { "TweenShark", "iTween" }, 2)
                    )
                )
            .AddChild(
                new Box(new Rect(20, 50, 350, 300), "Easing")
                .SetAutoAdjustSize(true)
                .SetPadding(5)
                .AddChild(
                    new Label(new Rect(0, 20, 140, 18), "Tween Duration in sec")
                    )
                .AddChild(
                    _tweenDuration = new TextField(new Rect(150, 20, 100, 20), "5")
                    )
                .AddChild(
                    _easingSelection = new SelectionGrid(new Rect(0, 50, 300, 200), _easingNames, 3).SetSelection(5)
                    )
                )
            .AddChild(
                new Box(new Rect(20, 50, 350, 300), "Material")
                .SetAutoAdjustSize(true)
                .SetPadding(5)
                .AddChild(
                    new Button(new Rect(0, 25, 100, 25), "Tween Mat")
                    .AddClickHandler(e => TweenMaterial())
                    )
                )

            );
    }
コード例 #3
0
    private void SetupUpGui()
    {
        // Initialize the loaders
        GuiModule.Initialize(this);
//        NetModule.Initialize(this);

        TweenSharkUnity3D.Initialize(this);

        _guiStage = GlobalGui.GetInstance();

        _guiStage.AddChild(
            new Button(new Rect(20, 20, 100, 20), "BUTTON")
            .AddClickHandler(OnButtonInListClicked)
            );

        _guiStage.AddChild(
            _youtubeBox = new Box(new Rect(600, 50, 20, 20), "Youtube Search")
                          .SetAutoAdjustSize(true)
                          .AddChild(
                _searchField = new TextField(new Rect(0, 30, 400, 20))
                               .AddMouseOverHandler(e => Debug.Log("mouse over on SearchField"))
                               .AddMouseOutHandler(e => Debug.Log("mouse out on SearchField"))
                               .AddLeftMouseDownHandler(e => Debug.Log("Left mouse down on SearchField"))
                               .AddLeftMouseUpHandler(e => Debug.Log("Left mouse up on SearchField"))
                )

                          .AddChild(
                new Button(new Rect(480, 30, 100, 20), "Search")
                .AddClickHandler(OnButton1)
                .AddMouseOverHandler(e => Debug.Log("MouseOver search " + e.Target + " " + e.CurrentTarget))
                .AddMouseOutHandler(e => Debug.Log("MouseOut search " + e.Target + " " + e.CurrentTarget))
                )

                          .AddChild(
                new ScrollView(new Rect(0, 100, 580, 350))
                .AddChild(
                    _listView = new VGroup()
                                .AddChild(new Label(new Rect(0, 0, 100, 20), "Text1"))
                                .AddChild(new Label(new Rect(0, 30, 100, 20), "Text2"))
                                .AddChild(new Label(new Rect(0, 60, 100, 20), "Text3"))
                                .AddChild(new Label(new Rect(0, 90, 100, 20), "Text4"))
                                .AddChild(new Label(new Rect(0, 120, 100, 20), "Text5"))
                                .AddChild(new Label(new Rect(0, 150, 100, 20), "Text6"))
                                .AddChild(new Label(new Rect(0, 180, 100, 20), "Text7"))
                                .AddChild(new Label(new Rect(0, 210, 100, 20), "Text8"))
                                .AddChild(new Label(new Rect(0, 240, 100, 20), "Text9"))
                                .SetPadding(20)
                    )
                )
            );

        _listView
        .AddLeftMouseDownHandler(e => Debug.Log("Left mouse down on ListView"))
        .AddLeftMouseUpHandler(e => Debug.Log("Left mouse up on ListView"))
        .AddRightMouseDownHandler(e => Debug.Log("Right mouse down on ListView"))
        .AddRightMouseUpHandler(e => Debug.Log("Right mouse up on ListView"))
        .AddMiddleMouseDownHandler(e => Debug.Log("Middle mouse down on ListView"))
        .AddMiddleMouseUpHandler(e => Debug.Log("Middle mouse up on ListView"))
        ;


        if (_youtubeBox != null)
        {
            _guiStage.AddChild(
                new Button(new Rect(200, 20, 100, 20), "Start Tween")
                .AddClickHandler((e) =>
            {
                var random = new System.Random();
                var opt    = new TweenOps(Ease.OutQuad)
                             .PropTo("X", random.Next(800))
                             .PropTo("Y", random.Next(500))
                             .PropTo("PaddingTop", random.Next(100))
                ;
                TweenShark.To(_youtubeBox, 1f + random.Next(2), opt);

                opt = new TweenOps(Ease.InOutQuad)
                      .PropTo("_sbyte", 100)
                      .PropTo("_byte", 100)
                      .PropTo("_short", 100)
                      .PropTo("_ushort", 100)
                      .PropTo("_int", 100)
                      .PropTo("_uint", 100)
                      .PropTo("_long", 100)
                      .PropTo("_ulong", 100)
                      .PropTo("_float", 100)
                      .PropTo("_double", 100)
                ;

                TweenShark.To(_tweenedObject, 10, opt);
            })
                );

            _youtubeBox.AddClickHandler(onBox1Clicked);
        }

        _guiStage.AddClickHandler(onStageClick);
    }