Exemplo n.º 1
0
        static void Main()
        {
            //var controller = new KeyboardController();
            //using (GameEngine game = new GameEngine(controller))
            //{
            //    game.Run();
            //}
            var menu = new MainGameMenu();

            menu.ShowDialog();
        }
Exemplo n.º 2
0
        static void Main()
        {
            var menu = new MainGameMenu();

            menu.ShowDialog();
        }
Exemplo n.º 3
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }

        mSettingAudioManagerBackup = GetComponent<AudioManager> ();

        if (mBackgroundPrefab != null)
        {
            mBackground = GameObject.Instantiate (mBackgroundPrefab);
        }
        else
        {
            mBackground = new GameObject("Menu Background");
        }

        fmodMusic = AudioManager.Instance.GetMusicEvent("MenuMusic/DroneMeny", false);
        fmodSwipe = AudioManager.Instance.GetSoundsEvent("MenuSectionSwipe/MenuSwipeShort", true);

        mGameMenus = GetComponentsInChildren<GameMenu> ();

        mCurrentGameMenu = mGameMenus [0];
    }
Exemplo n.º 4
0
        public bool Initalize(int screenWidth, int screenHeight, DirectoryInfo dataSet, bool showTutorial, Form parentForm, out string reason)
        {
            _parentForm = parentForm;

            Random = new Random();

            MousePos = new Point();

            ScreenWidth  = screenWidth;
            ScreenHeight = screenHeight;
            GameDataSet  = dataSet;

            Galaxy        = new Galaxy();
            EmpireManager = new EmpireManager(this);

            ShipShader = GorgonLibrary.Graphics.FXShader.FromFile("ColorShader.fx", GorgonLibrary.Graphics.ShaderCompileOptions.OptimizationLevel3);
            StarShader = GorgonLibrary.Graphics.FXShader.FromFile("StarShader.fx", GorgonLibrary.Graphics.ShaderCompileOptions.OptimizationLevel3);

            if (!SpriteManager.Initialize(GameDataSet, out reason))
            {
                return(false);
            }
            if (!FontManager.Initialize(GameDataSet, out reason))
            {
                return(false);
            }
            RaceManager = new RaceManager();
            if (!RaceManager.Initialize(GameDataSet, Random, out reason))
            {
                return(false);
            }
            AIManager = new AIManager();
            if (!AIManager.Initialize(GameDataSet, out reason))
            {
                return(false);
            }
            MasterTechnologyManager = new MasterTechnologyManager();
            if (!MasterTechnologyManager.Initialize(this, out reason))
            {
                return(false);
            }
            _mainGameMenu = new MainGameMenu();
            if (!_mainGameMenu.Initialize(this, out reason))
            {
                return(false);
            }

            _screenInterface = _mainGameMenu;
            _currentScreen   = Screen.MainMenu;

            _situationReport = new SituationReport(this);

            Cursor = SpriteManager.GetSprite("Cursor", Random);
            if (Cursor == null)
            {
                reason = "Cursor is not defined in sprites.xml";
                return(false);
            }

            reason = string.Empty;
            return(true);
        }
Exemplo n.º 5
0
        public void ChangeToScreen(Screen whichScreen)
        {
            switch (whichScreen)
            {
            case Screen.MainMenu:
                if (_mainGameMenu == null)
                {
                    _mainGameMenu = new MainGameMenu();
                    string reason;
                    if (!_mainGameMenu.Initialize(this, out reason))
                    {
                        MessageBox.Show("Exception in loading Main Menu. Reason: " + reason);
                        _parentForm.Close();
                    }
                }
                _screenInterface = _mainGameMenu;
                break;

            case Screen.NewGame:
                if (_newGame == null)
                {
                    _newGame = new NewGame();
                    string reason;
                    if (!_newGame.Initialize(this, out reason))
                    {
                        MessageBox.Show("Exception in loading New Game Menu. Reason: " + reason);
                        _parentForm.Close();
                    }
                }
                _screenInterface = _newGame;
                break;

            case Screen.Galaxy:
                if (_galaxyScreen == null)
                {
                    _galaxyScreen = new GalaxyScreen();
                    string reason;
                    if (!_galaxyScreen.Initialize(this, out reason))
                    {
                        MessageBox.Show("Exception in loading Galaxy Screen. Reason: " + reason);
                        _parentForm.Close();
                    }
                }
                _galaxyScreen.CenterScreen();
                _screenInterface = _galaxyScreen;
                break;

            case Screen.Diplomacy:
                if (_diplomacyScreen == null)
                {
                    _diplomacyScreen = new DiplomacyScreen();
                    string reason;
                    if (!_diplomacyScreen.Initialize(this, out reason))
                    {
                        MessageBox.Show("Exception in loading Diplomacy Screen. Reason: " + reason);
                        _parentForm.Close();
                    }
                }
                _diplomacyScreen.SetupScreen();
                _screenInterface = _diplomacyScreen;
                break;

            case Screen.ProcessTurn:
                EmpireManager.CurrentEmpire.ClearTurnData();
                if (_processingTurnScreen == null)
                {
                    _processingTurnScreen = new ProcessingTurnScreen();
                    string reason;
                    if (!_processingTurnScreen.Initialize(this, out reason))
                    {
                        MessageBox.Show("Exception in loading Processing Turn Screen. Reason: " + reason);
                        _parentForm.Close();
                    }
                }
                if (!EmpireManager.ProcessNextEmpire())
                {
                    _situationReport.Refresh();
                    ChangeToScreen(Screen.Galaxy);
                    break;
                }
                _screenInterface = _processingTurnScreen;
                break;

            case Screen.Battle:
                /*if (_spaceCombat == null)
                 * {
                 *      _spaceCombat = new SpaceCombat();
                 *      _spaceCombat.Initialize(this);
                 * }
                 * _spaceCombat.SetupScreen();
                 * _screenInterface = _spaceCombat;*/
                break;
            }
            _currentScreen = whichScreen;
        }