Esempio n. 1
0
        private void StartGame()
        {
            var gameLoaderObject = _gameLoaderEditor.CreateInstance();

            // Test if the user inputted the a valid amount of years
            if (gameLoaderObject.GameRuleType == GameRuleType.Retirement && (gameLoaderObject.AgeCounterTarget < MinAge || gameLoaderObject.AgeCounterTarget > MaxAge))
            {
                ControlManager.Add(new Alert(ControlManager.Manager,
                                             String.Format("Sorry, the world target age must be between\n{0} and {1}!", MinAge, MaxAge),
                                             "Invalid Target World Age", icon: "Images/AlertIcons/Fail"));
                SwitchToTab(0);
            }
            else
            {
                if (gameLoaderObject.LoadingWorld == Constants.Locations.DefaultWorldName)
                {
                    WorldLoader.instance.LoadWorld(Constants.Locations.DefaultWorldPath, worldObjects => WorldReady(worldObjects, gameLoaderObject));
                }
                else if (gameLoaderObject.LoadingWorld == Constants.Locations.TestWorldName)
                {
                    WorldLoader.instance.LoadWorld(Constants.Locations.TestWorldPath, worldObjects => WorldReady(worldObjects, gameLoaderObject));
                }
                else
                {
                    WorldLoader.instance.LoadCustomWorld(gameLoaderObject.LoadingWorld, worldObjects => WorldReady(worldObjects, gameLoaderObject));
                }
            }
        }