예제 #1
0
 private void DisplayWelcomeScreen()
 {
     this.projectFilePath = null;
     this.logFilePath = null;
     this.currentBuild = null;
     Title = DefaultTitle;
     var welcomeScreen = new WelcomeScreen();
     SetContent(welcomeScreen);
     welcomeScreen.RecentLogSelected += log => OpenLogFile(log);
     welcomeScreen.RecentProjectSelected += project => BuildProject(project);
     welcomeScreen.OpenProjectRequested += () => OpenProjectOrSolution();
     welcomeScreen.OpenLogFileRequested += () => OpenLogFile();
     UpdateRecentItemsMenu();
 }
예제 #2
0
    public void Start()
    {
        Hardware hardware =
            new Hardware(SCREEN_WIDTH, SCREEN_HEIGHT, 24, false);

        WelcomeScreen welcome = new WelcomeScreen(hardware, this);
        MenuScreen    menu    = new MenuScreen(hardware, this);
        CreditsScreen credits = new CreditsScreen(hardware, this);

        hardware.ClearScreen();
        welcome.Show();

        do
        {
            hardware.ClearScreen();
            menu.Show();
            hardware.ClearScreen();
            credits.Show();
        }while (!menu.GetExit());
        SetLanguaje();
    }
예제 #3
0
        public Invaders()
        {
            m_Graphics            = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            InputManager      inputManager      = new InputManager(this);
            ScreensMananger   screensManager    = new ScreensMananger(this);
            MenuMananger      menuManager       = new MenuMananger(this);
            SoundManager      soundManager      = new SoundManager(this);
            CollisionsManager collisionsManager = new CollisionsManager(this);
            GameManager       gameManager       = new GameManager(this);
            MenuScreen        menuScreen        = new MenuScreen(this);
            GameOverScreen    gameOverScreen;
            WelcomeScreen     welcomeScreen;

            menuScreen.Graphics       = m_Graphics;
            gameOverScreen            = new GameOverScreen(this);
            welcomeScreen             = new WelcomeScreen(this);
            gameOverScreen.MenuScreen = welcomeScreen.MenuScreen = menuScreen;
            screensManager.Push(gameOverScreen);
            screensManager.SetCurrentItem(welcomeScreen);
        }
예제 #4
0
    static void Main()
    {
        Inicialize();

        SdlHardware.Init(1200, 768, 24, FullScreen);
        WelcomeScreen w = new WelcomeScreen();

        os = new OptionsScreen();
        LoadGamesScreen lg = new LoadGamesScreen();
        HelpScreen      hs = new HelpScreen();

        int option;

        do
        {
            option = w.Run();
            switch (option)
            {
            case 0: break;

            case 1: g = new Game();  g.Run();
                break;

            case 2:
                if (lg.Run() == 0)
                {
                    g.Run();
                }
                break;

            case 3: os.Run();
                SaveOptions();
                SdlHardware.Init(1200, 768, 24, FullScreen);
                break;

            case 4: hs.Run();
                break;
            }
        } while (option != 5);
    }
예제 #5
0
    public void Start()
    {
        Hardware         hardware   = new Hardware(840, 755, 24, false);
        WelcomeScreen    welcome    = new WelcomeScreen(hardware);
        SettingScreen    setting    = new SettingScreen(hardware);
        ControllerScreen controller = new ControllerScreen(hardware);
        CreditsScreen    credits    = new CreditsScreen(hardware);

        do
        {
            hardware.ClearScreen();
            if (!welcome.GetExit())
            {
                welcome.Show();
                switch (welcome.GetChosenOption())
                {
                case 1:
                    setting.Show();
                    break;

                case 2:
                    //TO DO
                    break;

                case 3:
                    controller.Show();
                    break;

                case 4:
                    credits.Show();
                    break;

                case 5:
                    welcome.GetExit();
                    break;
                }
            }
        } while (!welcome.GetExit());
    }
예제 #6
0
    public static void Main(string[] args)
    {
        bool fullScreen = false;

        SdlHardware.Init(1024, 768, 24, fullScreen);

        WelcomeScreen w = new WelcomeScreen();

        do
        {
            w.Run();
            if (w.GetChosenOption() == 1)
            {
                Game g = new Game();
                g.Run();
            }
            else if (w.GetChosenOption() == 2)
            {
                CreditsScreen credits = new CreditsScreen();
                credits.Run();
            }
        }while (w.GetChosenOption() != 3);
    }
        static void Main(string[] args)
        {
            bool fullScreen = false;

            Hardware.Init(1024, 768, 24, fullScreen);
            bool finished = false;

            while (!finished)
            {
                WelcomeScreen welcome = new WelcomeScreen();
                welcome.Run();
                CreditsScreen credits = new CreditsScreen();
                HelpScreen    help    = new HelpScreen();
                if (welcome.GetOptionChosen() == WelcomeScreen.options.Play)
                {
                    Game myGame = new Game();
                    myGame.Run();

                    GameOverScreen gameEnd = new GameOverScreen();
                    gameEnd.Run();
                }

                if (welcome.GetOptionChosen() == WelcomeScreen.options.Quit)
                {
                    finished = true;
                }
                if (welcome.GetOptionChosen() == WelcomeScreen.options.Credits)
                {
                    credits.Run();
                }
                if (welcome.GetOptionChosen() == WelcomeScreen.options.Help)
                {
                    Game myGame = new Game();
                    help.Run();
                }
            }
        }
예제 #8
0
    public static void Main(string[] args)
    {
        SdlHardware.Init(1280, 720, 24, false);

        LoadingScreen ls = new LoadingScreen();

        ls.Run();

        WelcomeScreen welcome = new WelcomeScreen();

        do
        {
            welcome.Run();
            if (welcome.GetChosenOption() == WelcomeScreen.OPTION_PLAY)
            {
                Game g = new Game();
                g.Run();
                EndScreen end = new EndScreen();
                end.Run();
            }
            else if (welcome.GetChosenOption() == WelcomeScreen.OPTION_HELP)
            {
                HelpScreen help = new HelpScreen();
                help.Run();
            }
            else if (welcome.GetChosenOption() == WelcomeScreen.OPTION_CREDITS)
            {
                CreditsScreen credits = new CreditsScreen();
                credits.Run();
            }
            else if (welcome.GetChosenOption() == WelcomeScreen.OPTION_CONFIG)
            {
                ConfigScreen config = new ConfigScreen();
                config.Run();
            }
        }while (welcome.GetChosenOption() != WelcomeScreen.OPTION_QUIT);
    }
예제 #9
0
        public void Start()
        {
            Hardware hardware = new Hardware(800, 600, 24, false);

            WelcomeScreen      welcome      = new WelcomeScreen(hardware);
            CreditsScreen      credits      = new CreditsScreen(hardware);
            PlayerSelectScreen playerSelect = new PlayerSelectScreen(hardware);
            GameScreen         game         = new GameScreen(hardware);

            do
            {
                hardware.ClearScreen();
                welcome.Show();
                if (!welcome.GetExit())
                {
                    playerSelect.Show();
                    game.ChosenPlayer = playerSelect.GetChosenPlayer();
                    hardware.ClearScreen();
                    game.Show();
                    hardware.ClearScreen();
                    credits.Show();
                }
            } while (!welcome.GetExit());
        }
예제 #10
0
        public void Run()
        {
            IWelcomeScreen sc = new WelcomeScreen();

            sc.WriteWelcomeMessage();
        }
예제 #11
0
 void Awake()
 {
     g = this;
 }
        public static void FirstTimeRun()
        {
            if (!LauncherUpdateCheck.UpdatePopupStoppedSplashScreen)
            {
                LoadingComplete = true;
                SplashScreen.ThreadStatus("Stop");
            }

            if (!string.IsNullOrWhiteSpace(FileSettingsSave.GameInstallation))
            {
                Log.Core("LAUNCHER: Checking InstallationDirectory: " + FileSettingsSave.GameInstallation);
            }

            Log.Checking("LAUNCHER: Checking Game Installation");
            if (string.IsNullOrWhiteSpace(FileSettingsSave.GameInstallation))
            {
                DiscordLauncherPresence.Status("Start Up", "Doing First Time Run");
                Log.Core("LAUNCHER: First run!");

                try
                {
                    Form         welcome      = new WelcomeScreen();
                    DialogResult welcomereply = welcome.ShowDialog();

                    if (welcomereply != DialogResult.OK)
                    {
                        LauncherForceClose = true;
                    }
                    else
                    {
                        FileSettingsSave.CDN = SelectedCDN.CDNUrl;
                        FileSettingsSave.SaveSettings();
                    }
                }
                catch
                {
                    Log.Warning("LAUNCHER: CDN Source URL was Empty! Setting a Null Safe URL 'http://localhost'");
                    FileSettingsSave.CDN = "http://localhost";
                    Log.Core("LAUNCHER: Installation Directory was Empty! Creating and Setting Directory at " + Locations.GameFilesFailSafePath);
                    FileSettingsSave.GameInstallation = Locations.GameFilesFailSafePath;
                    FileSettingsSave.SaveSettings();
                }

                if (LauncherForceClose)
                {
                    ErrorCloseLauncher("Closing From Welcome Dialog", false);
                }
                else
                {
                    if (string.IsNullOrWhiteSpace(FileSettingsSave.GameInstallation))
                    {
                        DiscordLauncherPresence.Status("Start Up", "User Selecting/Inputting Game Files Folder");

                        try
                        {
                            if (!UnixOS.Detected())
                            {
                                string GameFolderPath = string.Empty;

                                CommonOpenFileDialog FolderDialog = new CommonOpenFileDialog
                                {
                                    EnsurePathExists        = true,
                                    EnsureFileExists        = false,
                                    AllowNonFileSystemItems = false,
                                    Title          = "Select the location to Find or Download NFS:W",
                                    IsFolderPicker = true
                                };

                                if (FolderDialog.ShowDialog() == CommonFileDialogResult.Ok)
                                {
                                    if (!string.IsNullOrWhiteSpace(Strings.Encode(FolderDialog.FileName)))
                                    {
                                        GameFolderPath = Strings.Encode(FolderDialog.FileName);
                                    }
                                }

                                FolderDialog.Dispose();

                                if (!string.IsNullOrWhiteSpace(GameFolderPath))
                                {
                                    DiscordLauncherPresence.Status("Start Up", "Verifying Game Files Folder Location");

                                    if (!HasWriteAccessToFolder(GameFolderPath))
                                    {
                                        Log.Error("FOLDER SELECT DIALOG: Not enough permissions. Exiting.");
                                        string ErrorMessage = "You don't have enough permission to select this path as the Installation folder. " +
                                                              "Please select another directory.";
                                        MessageBox.Show(null, ErrorMessage, "GameLauncher", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                        LauncherForceClose       = true;
                                        LauncherForceCloseReason = ErrorMessage;
                                    }
                                    else
                                    {
                                        if (GameFolderPath.Length == 3)
                                        {
                                            Directory.CreateDirectory("Game Files");
                                            Log.Warning("FOLDER SELECT DIALOG: Installing NFSW in root of the harddisk is not allowed.");
                                            MessageBox.Show(null, string.Format("Installing NFSW in root of the harddisk is not allowed. " +
                                                                                "Instead, we will install it on {0}.", Locations.GameFilesFailSafePath),
                                                            "GameLauncher", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                            FileSettingsSave.GameInstallation = Locations.GameFilesFailSafePath;
                                            FileSettingsSave.SaveSettings();
                                            FileGameSettings.Save("Suppress", "Language Only");
                                        }
                                        else if (GameFolderPath == Locations.LauncherFolder)
                                        {
                                            Directory.CreateDirectory("Game Files");
                                            Log.Warning("FOLDER SELECT DIALOG: Installing NFSW in same location where the GameLauncher resides is NOT allowed.");
                                            MessageBox.Show(null, string.Format("Installing NFSW in same location where the GameLauncher resides is NOT allowed.\n " +
                                                                                "Instead, we will install it on {0}.", Locations.GameFilesFailSafePath),
                                                            "GameLauncher", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                            FileSettingsSave.GameInstallation = Locations.GameFilesFailSafePath;
                                            FileSettingsSave.SaveSettings();
                                            FileGameSettings.Save("Suppress", "Language Only");
                                        }
                                        else
                                        {
                                            Log.Core("FOLDER SELECT DIALOG: Directory Set: " + GameFolderPath);
                                            FileSettingsSave.GameInstallation = GameFolderPath;
                                            FileSettingsSave.SaveSettings();
                                            FileGameSettings.Save("Suppress", "Language Only");
                                        }
                                    }
                                }
                                else
                                {
                                    LauncherForceClose = true;
                                }
                            }
                            else
                            {
                                if (string.IsNullOrWhiteSpace(FileSettingsSave.GameInstallation))
                                {
                                    try
                                    {
                                        FileSettingsSave.GameInstallation = Strings.Encode(Path.GetFullPath("GameFiles"));
                                    }
                                    catch
                                    {
                                        FileSettingsSave.GameInstallation = "GameFiles";
                                    }
                                }
                            }

                            if (!string.IsNullOrWhiteSpace(FileSettingsSave.GameInstallation))
                            {
                                if (!Directory.Exists(FileSettingsSave.GameInstallation))
                                {
                                    Log.Core("FOLDER SELECT DIALOG: Created Game Files Directory: " + FileSettingsSave.GameInstallation);
                                    Directory.CreateDirectory(FileSettingsSave.GameInstallation);
                                }
                            }

                            if (!string.IsNullOrWhiteSpace(FileSettingsSave.GameInstallation))
                            {
                                Log.Checking("CLEANLINKS: Game Path");
                                if (File.Exists(Locations.GameLinksFile))
                                {
                                    ModNetHandler.CleanLinks(Locations.GameLinksFile, FileSettingsSave.GameInstallation);
                                    Log.Completed("CLEANLINKS: Done");
                                }
                                else
                                {
                                    Log.Completed("CLEANLINKS: Not Present");
                                }
                            }
                        }
                        catch (Exception Error)
                        {
                            LauncherForceClose       = true;
                            LauncherForceCloseReason = Error.Message;
                            LogToFileAddons.OpenLog("FOLDER SELECT DIALOG", null, Error, null, true);
                        }
                    }
                }
            }
            Log.Completed("LAUNCHER: Game Installation Path Done");

            if (LauncherForceClose)
            {
                ErrorCloseLauncher("Closing From Folder Dialog", false);
            }
            else
            {
                if (!UnixOS.Detected())
                {
                    Log.Checking("LAUNCHER: Checking Game Path Location");
                    DiscordLauncherPresence.Status("Start Up", "Checking Game Files Folder Location");

                    switch (CheckFolder(FileSettingsSave.GameInstallation))
                    {
                    case FolderType.IsSameAsLauncherFolder:
                        Directory.CreateDirectory("Game Files");
                        Log.Error("LAUNCHER: Installing NFSW in same location where the GameLauncher resides is NOT allowed.");
                        MessageBox.Show(null, string.Format("Installing NFSW in same location where the GameLauncher resides is NOT allowed.\n" +
                                                            "Instead, we will install it at {0}.", Locations.GameFilesFailSafePath),
                                        "GameLauncher", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        FileSettingsSave.GameInstallation = Locations.GameFilesFailSafePath;
                        break;

                    case FolderType.IsTempFolder:
                    case FolderType.IsUsersFolders:
                    case FolderType.IsProgramFilesFolder:
                    case FolderType.IsWindowsFolder:
                    case FolderType.IsRootFolder:
                        String constructMsg = String.Empty;
                        constructMsg += "Using this location for Game Files is not allowed.\n\n";
                        constructMsg += "The following locations are also NOT allowed:\n";
                        constructMsg += "• X:\\nfsw.exe (Root of Drive, such as C:\\ or D:\\, must be in a folder)\n";
                        constructMsg += "• C:\\Program Files\n";
                        constructMsg += "• C:\\Program Files (x86)\n";
                        constructMsg += "• C:\\Users (Includes 'Desktop', 'Documents', 'Downloads')\n";
                        constructMsg += "• C:\\Windows\n\n";
                        constructMsg += "Instead, we will install the NFSW Game at " + Locations.GameFilesFailSafePath;
                        try
                        {
                            if (!Directory.Exists(Locations.GameFilesFailSafePath))
                            {
                                Log.Core("FOLDER SELECT DIALOG: Created Game Files Directory: " + Locations.GameFilesFailSafePath);
                                Directory.CreateDirectory(Locations.GameFilesFailSafePath);
                            }
                        }
                        catch { }
                        MessageBox.Show(null, constructMsg, "GameLauncher", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        Log.Error("LAUNCHER: Installing NFSW in a Restricted Location is not allowed.");
                        FileSettingsSave.GameInstallation = Locations.GameFilesFailSafePath;
                        break;
                    }
                    FileSettingsSave.SaveSettings();
                    Log.Completed("LAUNCHER: Done Checking Game Path Location");
                }

                /* Check If Launcher Failed to Connect to any APIs */
                if (!VisualsAPIChecker.CarbonAPITwo())
                {
                    DiscordLauncherPresence.Status("Start Up", "Launcher Encountered API Errors");

                    DialogResult restartAppNoApis = MessageBox.Show(null, "There is no internet connection, Launcher might crash." +
                                                                    "\n\nClick Yes to Close GameLauncher" +
                                                                    "\nor" +
                                                                    "\nClick No Continue", "GameLauncher has Stopped, Failed To Connect To API", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

                    if (restartAppNoApis == DialogResult.Yes)
                    {
                        LauncherForceClose = true;
                    }
                }

                if (LauncherForceClose)
                {
                    ErrorCloseLauncher("Closing From API Error", false);
                }
                else
                {
                    try
                    {
                        Log.Info("MAINSCREEN: Program Started");
                        Application.Run(new MainScreen());
                    }
                    catch (COMException Error)
                    {
                        LogToFileAddons.OpenLog("Main Screen [Application Run]", "Launcher Encounterd an Error.", Error, "Error", false);
                        ErrorCloseLauncher("Main Screen [Application Run]", false);
                    }
                    catch (Exception Error)
                    {
                        LogToFileAddons.OpenLog("Main Screen [Application Run]", "Launcher Encounterd an Error.", Error, "Error", false);
                        ErrorCloseLauncher("Main Screen [Application Run]", false);
                    }
                }
            }
        }
예제 #13
0
        //Constructors

        public WelcomeScreenController(WelcomeScreen wS)
        {
            _view  = wS;
            _model = new GameEngine();
            _view.SetController(this);
        }
예제 #14
0
        private void UpdateRecentItemsMenu(WelcomeScreen welcomeScreen = null)
        {
            welcomeScreen = welcomeScreen ?? new WelcomeScreen();
            if (welcomeScreen.ShowRecentProjects)
            {
                RecentProjectsMenu.Items.Clear();
                RecentProjectsMenu.Visibility = Visibility.Visible;
                RecentItemsSeparator.Visibility = Visibility.Visible;
                foreach (var recentProjectFile in welcomeScreen.RecentProjects)
                {
                    var menuItem = new MenuItem { Header = recentProjectFile };
                    menuItem.Click += RecentProjectClick;
                    RecentProjectsMenu.Items.Add(menuItem);
                }
            }

            if (welcomeScreen.ShowRecentLogs)
            {
                RecentLogsMenu.Items.Clear();
                RecentLogsMenu.Visibility = Visibility.Visible;
                RecentItemsSeparator.Visibility = Visibility.Visible;
                foreach (var recentLog in welcomeScreen.RecentLogs)
                {
                    var menuItem = new MenuItem { Header = recentLog };
                    menuItem.Click += RecentLogFileClick;
                    RecentLogsMenu.Items.Add(menuItem);
                }
            }
        }
예제 #15
0
    static WelcomeScreenInitializer()
    {
        var userId = ProductPreferenceBase.CreateDefaultUserIdDefinition(WelcomeScreen.ProjectId).GetEditorPersistedValueOrDefault().ToString();

        HandleUnityStartup(WelcomeScreen.Init, WelcomeScreen.GenerateGetUpdatesUrl(userId, WelcomeScreen.VersionId), RunOnWindowOpened);
    }