Exemplo n.º 1
0
        public void Perform()
        {
            Status status = new Status();

            for (; ;)
            {
                using (Game game = new Game())
                {
                    game.Map    = MapLoader.Load(Path.Combine(@"Etoile\G4YokoActTM\Map", this.MapFile));
                    game.Status = status;
                    game.Perform();

                    switch (game.ExitDir)
                    {
                    case 4:
                        this.Move(-1, 0);
                        status.StartPointIndex = 6;
                        break;

                    case 6:
                        this.Move(1, 0);
                        status.StartPointIndex = 4;
                        break;

                    case 8:
                        this.Move(0, -1);
                        status.StartPointIndex = 2;
                        break;

                    case 2:
                        this.Move(0, 1);
                        status.StartPointIndex = 8;
                        break;

                    case 5:
                        goto endLoop;

                    default:
                        throw null;
                    }
                }
            }
endLoop:
            ;
        }
Exemplo n.º 2
0
        public void Perform()
        {
            DDCurtain.SetCurtain();
            DDEngine.FreezeInput();

            //Ground.I.Music.Title.Play();

            string[] items = new string[]
            {
                "ゲームスタート",
                "コンテニュー?",
                "設定",
                "終了",
            };

            int selectIndex = 0;

            this.SimpleMenu = new DDSimpleMenu();

            this.SimpleMenu.WallColor = WALL_COLOR;
            //this.SimpleMenu.WallPicture = Ground.I.Picture.TitleWall;

            for (; ;)
            {
                selectIndex = this.SimpleMenu.Perform("Donut2", items, selectIndex);

                switch (selectIndex)
                {
                case 0:
                {
                    this.LeaveTitleMenu();

                    using (World world = new World())
                    {
                        //world.MapFile = "t0001.txt";
                        world.Perform();
                    }
#if false // old
                    using (Game game = new Game())
                    {
                        game.Map    = MapLoader.Load(@"Map\t0001.txt");
                        game.Status = new Status();
                        game.Perform();
                    }
#endif

                    this.ReturnTitleMenu();
                }
                break;

                case 1:
                    // TODO
                    break;

                case 2:
                    this.Setting();
                    break;

                case 3:
                    goto endMenu;

                default:
                    throw new DDError();
                }
            }
endMenu:
            DDEngine.FreezeInput();
            DDMusicUtils.Fade();
            DDCurtain.SetCurtain(30, -1.0);

            foreach (DDScene scene in DDSceneUtils.Create(40))
            {
                this.DrawWall();
                DDEngine.EachFrame();
            }
        }
Exemplo n.º 3
0
        public static void EachFrame()
        {
            I2Point pt   = Map.ToTablePoint(DDMouse.X + DDGround.ICamera.X, DDMouse.Y + DDGround.ICamera.Y);
            MapCell cell = Game.I.Map.GetCell(pt, null);

            if (cell == null)
            {
                return;
            }

            if (DDUtils.IsOutOfScreen(new D2Point(DDMouse.X, DDMouse.Y)))
            {
                return;
            }

            HideMenu = 1 <= DDKey.GetInput(DX.KEY_INPUT_LCONTROL) || 1 <= DDKey.GetInput(DX.KEY_INPUT_RCONTROL);

            if (HideMenu || DDUtils.IsOut(new D2Point(DDMouse.X, DDMouse.Y), MenuRect))
            {
                if (1 <= DDMouse.L.GetInput())
                {
                    if (InputWallFlag)
                    {
                        cell.Wall = Wall;
                    }
                    if (InputTileFlag)
                    {
                        cell.Tile = MapTileManager.GetTile(MapTileManager.GetNames()[TileIndex]);
                    }
                    if (InputEnemyFlag)
                    {
                        cell.EnemyLoader = EnemyManager.GetEnemyLoader(EnemyManager.GetNames()[EnemyIndex]);
                    }
                }
                if (1 <= DDMouse.R.GetInput())
                {
                    cell.Wall        = false;
                    cell.Tile        = null;
                    cell.EnemyLoader = null;
                }
            }
            else
            {
                int cursorMenuItemIndex = DDMouse.Y / 16;

                bool l = 1 <= DDMouse.L.GetInput();
                bool r = 1 <= DDMouse.R.GetInput();

                if (l || r)
                {
                    bool flag = l;

                    switch (cursorMenuItemIndex)
                    {
                    case 0: InputWallFlag = flag; break;

                    case 1: InputTileFlag = flag; break;

                    case 2: InputEnemyFlag = flag; break;

                    case 3: DisplayWallFlag = flag; break;

                    case 4: DisplayTileFlag = flag; break;

                    case 5: DisplayEnemyFlag = flag; break;

                    case 6: Wall = flag; break;

                    case 7:
                    case 8:
                        IntoInputTileMode();
                        break;

                    case 9:
                    case 10:
                        IntoInputEnemyMode();
                        break;
                    }
                }

                Rot += DDMouse.Rot;

                if (DDMouse.Rot == 0)
                {
                    NoRotFrame++;
                }
                else
                {
                    NoRotFrame = 0;
                }

                if (90 < NoRotFrame)
                {
                    Rot = 0;
                }

                switch (cursorMenuItemIndex)
                {
                case 7:
                case 8:
                    if (MenuItemRot(ref TileIndex, MapTileManager.GetCount()))
                    {
                        IntoInputTileMode();
                    }
                    break;

                case 9:
                case 10:
                    if (MenuItemRot(ref EnemyIndex, EnemyManager.GetCount()))
                    {
                        IntoInputEnemyMode();
                    }
                    break;
                }
            }

            if (DDKey.GetInput(DX.KEY_INPUT_C) == 1)
            {
                if (InputWallFlag)
                {
                    Wall = cell.Wall;
                }
                if (InputTileFlag)
                {
                    TileIndex = cell.Tile == null ? 0 : MapTileManager.GetNames().IndexOf(cell.Tile.Name);
                }
                if (InputEnemyFlag)
                {
                    EnemyIndex = cell.EnemyLoader == null ? 0 : EnemyManager.GetNames().IndexOf(cell.EnemyLoader.Name);
                }

                if (TileIndex == -1)                 // 2bs
                {
                    TileIndex = 0;
                }

                if (EnemyIndex == -1)                 // 2bs
                {
                    EnemyIndex = 0;
                }
            }
            if (DDKey.GetInput(DX.KEY_INPUT_S) == 1)
            {
                MapLoader.SaveToLastLoadedFile(Game.I.Map);
            }
        }