Пример #1
0
        protected override void OnRegistered()
        {
            base.OnRegistered();

            AddLayer(uiLayer);

            uiLayer.AddObject(
                new asd.GeometryObject2D()
            {
                Shape = new asd.RectangleShape()
                {
                    DrawingArea = new asd.RectF(
                        new asd.Vector2DF(0.0f, 0.0f)
                        , asd.Engine.WindowSize.To2DF()
                        )
                }
                , Color = new asd.Color(0, 100, 150)
            }
                );

            var button1 = CreateButton(1, -100.0f, -100.0f);
            var button2 = CreateButton(2, -100.0f, 100.0f);
            var button3 = CreateButton(3, 100.0f, 100.0f);
            var button4 = CreateButton(4, 100.0f, -100.0f);

            button1
            .Chain(button2, ButtonDirection.Down)
            .Chain(button3, ButtonDirection.Right)
            .Chain(button4, ButtonDirection.Up)
            .Chain(button1, ButtonDirection.Left)
            ;

            uiLayer.AddObject(button1.GetComponent().Owner);
            uiLayer.AddObject(button2.GetComponent().Owner);
            uiLayer.AddObject(button3.GetComponent().Owner);
            uiLayer.AddObject(button4.GetComponent().Owner);

            var selecter = new ControllerButtonSelecter(button1);

            var keyboard = new KeyboardController <ControllerSelect>();

            keyboard
            .BindKey(ControllerSelect.Up, asd.Keys.Up)
            .BindKey(ControllerSelect.Down, asd.Keys.Down)
            .BindKey(ControllerSelect.Right, asd.Keys.Right)
            .BindKey(ControllerSelect.Left, asd.Keys.Left)
            .BindKey(ControllerSelect.Select, asd.Keys.Space)
            .BindKey(ControllerSelect.Cancel, asd.Keys.Escape)
            ;

            selecter.AddController(keyboard);

            uiLayer.AddComponent(selecter, "Selecter");
        }
Пример #2
0
        protected override void OnRegistered()
        {
            base.OnRegistered();

            AddLayer(uiLayer);

            var background = new asd.TextureObject2D();

            background.Texture = asd.Engine.Graphics.CreateTexture2D("Resources/Menu.png");
            uiLayer.AddObject(background);

            var button1 = CreateButton(1, 0.0f, -150.0f);
            var button2 = CreateButton(2, 0.0f, -50.0f);
            var button3 = CreateButton(3, 0.0f, 50.0f);
            var button4 = CreateButton(4, 0.0f, 150.0f);

            button1
            .Chain(button2, ButtonDirection.Down)
            .Chain(button3, ButtonDirection.Down)
            .Chain(button4, ButtonDirection.Down)
            .Chain(button1, ButtonDirection.Down)
            ;

            uiLayer.AddObject(button1.GetComponent().Owner);
            uiLayer.AddObject(button2.GetComponent().Owner);
            uiLayer.AddObject(button3.GetComponent().Owner);
            uiLayer.AddObject(button4.GetComponent().Owner);

            var selecter = new ControllerButtonSelecter(button1);

            var keyboard = new KeyboardController <ControllerSelect>();

            keyboard
            .BindKey(ControllerSelect.Up, asd.Keys.Up)
            .BindKey(ControllerSelect.Down, asd.Keys.Down)
            .BindKey(ControllerSelect.Right, asd.Keys.Right)
            .BindKey(ControllerSelect.Left, asd.Keys.Left)
            .BindKey(ControllerSelect.Select, asd.Keys.Z)
            .BindKey(ControllerSelect.Cancel, asd.Keys.X)
            ;

            selecter.AddController(keyboard);

            uiLayer.AddComponent(selecter, "Selecter");
        }
Пример #3
0
        protected override void OnRegistered()
        {
            base.OnRegistered();

            AddLayer(uiLayer);

            var background = new asd.TextureObject2D();

            background.Texture = asd.Engine.Graphics.CreateTexture2D("Resources/Menu.png");
            uiLayer.AddObject(background);

            // フォントを生成する。
            var font = asd.Engine.Graphics.CreateFont("font.aff");



            // 描画に使うフォントを設定する。
            PlayerSelectText.Font = font;

            // 描画位置を指定する。
            PlayerSelectText.Position = new asd.Vector2DF(0, 0);

            Singleton.Getsingleton();
            // 描画する文字列を指定する。
            PlayerSelectText.Text = "";

            // 文字描画オブジェクトのインスタンスをエンジンへ追加する。
            uiLayer.AddObject(PlayerSelectText);

            var button1 = CreateButton(PlayerType.Normal, -150.0f, 0.0f, typelist);
            var button2 = CreateButton(PlayerType.Speed, -50.0f, 0.0f, typelist);
            var button3 = CreateButton(PlayerType.Sniper, 50.0f, 0.0f, typelist);


            button1
            .Chain(button2, ButtonDirection.Right)
            .Chain(button3, ButtonDirection.Right)
            .Chain(button1, ButtonDirection.Right)
            ;

            uiLayer.AddObject(button1.GetComponent().Owner);
            uiLayer.AddObject(button2.GetComponent().Owner);
            uiLayer.AddObject(button3.GetComponent().Owner);


            var selecter = new ControllerButtonSelecter(button1);

            var keyboard = new KeyboardController <ControllerSelect>();

            keyboard
            .BindKey(ControllerSelect.Up, asd.Keys.Up)
            .BindKey(ControllerSelect.Down, asd.Keys.Down)
            .BindKey(ControllerSelect.Right, asd.Keys.Right)
            .BindKey(ControllerSelect.Left, asd.Keys.Left)
            .BindKey(ControllerSelect.Select, asd.Keys.Z)
            .BindKey(ControllerSelect.Cancel, asd.Keys.X)
            ;

            selecter.AddController(keyboard);

            uiLayer.AddComponent(selecter, "Selecter");
        }