コード例 #1
0
ファイル: WorldScene.cs プロジェクト: jodigiordano/commander
        public WorldScene GetWorldSelected(Player p)
        {
            CelestialBody c = Simulator.GetSelectedCelestialBody(p);

            return (c != null && c is PinkHole) ? (WorldScene) Visuals.GetScene(Warps[c.Name]) : null;
        }
コード例 #2
0
ファイル: WorldScene.cs プロジェクト: jodigiordano/commander
        public void ShowWarpBlockedMessage(Player p)
        {
            CelestialBody c = Simulator.GetSelectedCelestialBody(p);

            Simulator.MessagesController.ShowMessage(c, Descriptor.WarpBlockedMessage, 5000, -1);
        }
コード例 #3
0
ファイル: WorldScene.cs プロジェクト: jodigiordano/commander
        private LevelDescriptor GetSelectedLevel(Player p)
        {
            CelestialBody c = Simulator.GetSelectedCelestialBody(p);

            return c != null ? LevelsDescriptors[c.Name] : null;
        }
コード例 #4
0
ファイル: WorldScene.cs プロジェクト: jodigiordano/commander
        private void DoSelectAction(Player p)
        {
            // Select a warp
            var world = GetWorldSelected(p);

            if (world != null)
            {
                if (world.Unlocked)
                    TransiteTo(world.Name + "Annunciation");
                else
                    ShowWarpBlockedMessage(p);

                return;
            }

            // Select a level
            var level = GetSelectedLevel(p);

            if (level != null)
            {
                GameScene currentGame = Main.GameInProgress;

                // Resume Game
                if (Main.GamePausedToWorld &&
                    currentGame.Simulator.LevelDescriptor.Infos.Id == level.Infos.Id &&
                    Simulator.PausedGameChoice == PausedGameChoice.Resume)
                {
                    currentGame.Simulator.State = GameState.Running;
                    TransiteTo(currentGame.Name);
                    return;
                }

                // Start a new game
                if (currentGame != null)
                    currentGame.StopMusic();

                currentGame = new GameScene("Game1", level);
                Main.GameInProgress = currentGame;
                currentGame.Simulator.AddNewGameStateListener(DoNewGameState);

                if (Visuals.GetScene(currentGame.Name) == null)
                    Visuals.AddScene(currentGame);
                else
                    Visuals.UpdateScene(currentGame.Name, currentGame);

                TransiteTo(currentGame.Name);

                return;
            }
        }
コード例 #5
0
        private void BeginTransition(Player player)
        {
            CelestialBody c = Simulator.GetSelectedCelestialBody(player);

            if (c == null)
                return;

#if !DEBUG
            if (c.Name == "editor")
                return;
#endif

            switch (c.Name)
            {
                case "save the world":
                    switch (Simulator.NewGameChoice)
                    {
                        case NewGameChoice.None:
                        case NewGameChoice.NewGame:
                            Main.SaveGameController.PlayerSaveGame.ClearAndSave();
                            TransiteTo("Cutscene1");
                            break;
                        case NewGameChoice.Continue:
                            TransiteTo(Main.LevelsFactory.GetWorldAnnounciationStringId(Main.SaveGameController.PlayerSaveGame.CurrentWorld));
                            break;
                        default:
                            TransiteTo(Main.LevelsFactory.GetWorldAnnounciationStringId((int) Simulator.NewGameChoice));
                            break;
                    }
                    break;

                case "how to play": Simulator.ShowPanel(PanelType.Help, true); break;
                case "options": Simulator.ShowPanel(PanelType.Options, true); break;
                case "editor": if (Preferences.Debug) { TransiteTo("Editeur"); } break;
                case "credits": Simulator.ShowPanel(PanelType.Credits, true); break;
                case "quit": Main.Instance.Exit(); break;
            }
        }
コード例 #6
0
 private void ReloadPlayerData(Player p)
 {
     Main.SaveGameController.ReloadPlayerData(p);
     SceneState = State.LoadSaveGame;
 }
コード例 #7
0
 public void ReloadPlayerData(Player p)
 {
     PlayerSaveGame = new SaveGame(p);
     Persistence.SetPlayerData(PlayerSaveGame);
     Persistence.LoadData(PlayerSaveGame.Name);
 }