示例#1
0
        public override void Draw2()
        {
            spriteBatch.Draw(SK.texture_background_tetris, SK.Position_DisplayEdge() + SK.Position_Tetris_Field(), Color.White);
            spriteBatch.Draw(SK.texture_static_tetris_next, SK.Position_DisplayEdge() + SK.Position_Tetris_Next(), Color.White);
            if (0 < FM.purchased[FM.Convert("hold")])
            {
                spriteBatch.Draw(SK.texture_static_tetris_hold, SK.Position_DisplayEdge() + SK.Position_Tetris_Hold(), Color.White);
            }
            spriteBatch.Draw(SK.texture_static_tetris_left, SK.Position_DisplayEdge() + SK.Position_Tetris_Left(), Color.White);
            spriteBatch.Draw(SK.texture_static_tetris_right, SK.Position_DisplayEdge() + SK.Position_Tetris_Right(), Color.White);

            for (int y = 0; y < 20; y++)
            {
                for (int x = 0; x < 10; x++)
                {
                    if (grid_base[x, y])
                    {
                        if (y == line1 || y == line2 || y == line3 || y == line4)
                        {
                            spriteBatch.Draw(SK.texture_spritesheet_minos_32x, SK.Position_DisplayEdge() + SK.Position_Tetris_Field() + new Vector2(32 * x, 32 * y), Get_Mino_Texture(TetroToMino(grid_color[x, y]), 0, 32), new Color(alpha, alpha, alpha));
                        }
                        else
                        {
                            spriteBatch.Draw(SK.texture_spritesheet_minos_32x, SK.Position_DisplayEdge() + SK.Position_Tetris_Field() + new Vector2(32 * x, 32 * y), Get_Mino_Texture(TetroToMino(grid_color[x, y]), 0, 32), Color.White);
                        }
                    }
                }
            }

            if (alpha == 255)
            {
                spriteBatch.Draw(SK.texture_spritesheet_minos_32x, SK.Position_DisplayEdge() + SK.Position_Tetris_Field() + tetromino[0] * 32, Get_Mino_Texture(TetroToMino(container_current), 0, 32), Color.White);
                spriteBatch.Draw(SK.texture_spritesheet_minos_32x, SK.Position_DisplayEdge() + SK.Position_Tetris_Field() + tetromino[1] * 32, Get_Mino_Texture(TetroToMino(container_current), 0, 32), Color.White);
                spriteBatch.Draw(SK.texture_spritesheet_minos_32x, SK.Position_DisplayEdge() + SK.Position_Tetris_Field() + tetromino[2] * 32, Get_Mino_Texture(TetroToMino(container_current), 0, 32), Color.White);
                spriteBatch.Draw(SK.texture_spritesheet_minos_32x, SK.Position_DisplayEdge() + SK.Position_Tetris_Field() + tetromino[3] * 32, Get_Mino_Texture(TetroToMino(container_current), 0, 32), Color.White);
            }

            if (container_next != "empty")
            {
                Get_Tetromino(SK.Position_DisplayEdge() + SK.Position_Tetris_Next() + new Vector2(16, 16), container_next);
            }
            if (container_hold != "empty" && 0 < FM.purchased[FM.Convert("hold")])
            {
                Get_Tetromino(SK.Position_DisplayEdge() + SK.Position_Tetris_Hold() + new Vector2(16, 16), container_hold);
            }
        }
示例#2
0
        public override string Update2()
        {
            if (alpha == 255)
            {
                if (ButtonPressed(GhostKey.button_function_P1) == GhostState.pressed)
                {
                    Command_Hold(); pressed_response = true;
                }
                if (ButtonPressed(GhostKey.button_ok_P1) == GhostState.pressed && !pressed_event_touch)
                {
                    Command_Hold(); pressed_response = true;
                }
                if (ButtonPressed(GhostKey.arrow_up_P1) == GhostState.pressed)
                {
                    Tetromino_Drop();
                }
                if (ButtonPressed(GhostKey.arrow_down_P1) == GhostState.hold)
                {
                    Tetromino_Fall();
                }
                if (ButtonPressed(GhostKey.arrow_left_P1) == GhostState.pressed)
                {
                    Command_Strafe("left"); pressed_response = true;
                }
                if (ButtonPressed(GhostKey.arrow_right_P1) == GhostState.pressed)
                {
                    Command_Strafe("right"); pressed_response = true;
                }
                if (ButtonPressed(GhostKey.button_left_P1) == GhostState.pressed)
                {
                    Command_Turn("right"); pressed_response = true;
                }
                if (ButtonPressed(GhostKey.button_right_P1) == GhostState.pressed)
                {
                    Command_Turn("left"); pressed_response = true;
                }
                //if(control_keyboard_new.IsKeyDown(Keys.Down)) { Tetromino_Fall(); };
                //if(control_gamepad_new.IsConnected) {
                //    if(control_gamepad_new.DPad.Down == ButtonState.Pressed) { Tetromino_Fall(); }
                //    if(control_gamepad_new.Buttons.LeftShoulder == ButtonState.Pressed && control_gamepad_old.Buttons.LeftShoulder == ButtonState.Released) { Command_Turn("right"); }
                //    if(control_gamepad_new.Buttons.RightShoulder == ButtonState.Pressed && control_gamepad_old.Buttons.RightShoulder == ButtonState.Released) { Command_Turn("left"); }
                //}
                //if(control_keyboard_new.IsKeyDown(Keys.N) && control_keyboard_old.IsKeyUp(Keys.N)) { Command_Turn("right"); };
                //if(control_keyboard_new.IsKeyDown(Keys.M) && control_keyboard_old.IsKeyUp(Keys.M)) { Command_Turn("left"); };

                if (pressed_event_touch)
                {
                    if (Collision_Button(false, new Rectangle((int)SK.Position_DisplayEdge().X + (int)SK.Position_Tetris_Hold().X, (int)SK.Position_DisplayEdge().Y + (int)SK.Position_Tetris_Hold().Y, 160, 160)))
                    {
                        pressed_response = true; Command_Hold();
                    }
                    if (Collision_Button(false, new Rectangle((int)SK.Position_DisplayEdge().X + (int)SK.Position_Tetris_Left().X, (int)SK.Position_DisplayEdge().Y + (int)SK.Position_Tetris_Left().Y, 160, 160)))
                    {
                        pressed_response = true; Command_Turn("left");
                    }
                    if (Collision_Button(false, new Rectangle((int)SK.Position_DisplayEdge().X + (int)SK.Position_Tetris_Right().X, (int)SK.Position_DisplayEdge().Y + (int)SK.Position_Tetris_Right().Y, 160, 160)))
                    {
                        pressed_response = true; Command_Turn("right");
                    }
                }
            }
            return("null");
        }