コード例 #1
0
ファイル: DataRepository.cs プロジェクト: DSMorpher/SSLRig
 public DataRepository(int stackSize, bool isBlue, bool PlayingFromLeft)
 {
     _gameConfig = new GameConfiguration(isBlue, PlayingFromLeft);
     _inData = new SSLPacketParser(stackSize);
     _outData = new OutputRobotData(12, this);
     ((IDataSource) _outData).Repository = this;
 }
コード例 #2
0
ファイル: MinGH.cs プロジェクト: huming2207/ghgame
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            gameConfiguration = new GameConfiguration("config.xml");
            if (gameConfiguration.fullscreen)
            {
                graphics.ToggleFullScreen();
                graphics.PreferredBackBufferWidth = 1920;
                graphics.PreferredBackBufferHeight = 1080;

            }
            else
            {
                graphics.PreferredBackBufferWidth = 1024;
                graphics.PreferredBackBufferHeight = 768;
            }

            graphics.ApplyChanges();

            Window.Title = "MinGH";
            IsMouseVisible = true;
            FlatRedBallServices.InitializeFlatRedBall(this, graphics);
            ScreenManager.Start(typeof(MainMenu).FullName);

            // Feels sloppy, but is how event listeners/handlers are set
            EventBus<ScreenChange>.EventHandler screenChange =
                new EventBus<ScreenChange>.EventHandler(ChangeGameState);
            EventBus<ScreenChange>.instance.Event += screenChange;

            base.Initialize();
        }
コード例 #3
0
 public Game(GameConfiguration configuration)
 {
     this.firstCapture = TileType.none;
     this.turnOrder.Add(TileType.yellow);
     this.currentTurn = 0;
     this.Configuration = configuration;
 }
コード例 #4
0
ファイル: Game.cs プロジェクト: epicvrvs/PanzerKontrol
 public Game(GameConfiguration gameConfiguration, Map map)
 {
     GameConfiguration = gameConfiguration;
     Map = map;
     Players = new PlayerState[PlayerCount];
     GameIsOver = false;
     SmallTurnCounter = 0;
 }
コード例 #5
0
        public void CyclePositionedCorrectlyInBounds()
        {
            var gameConfig = new GameConfiguration(new CycleConfiguration(), new MapConfiguration());
            var map = new Map(gameConfig.MapConfig);
            var startPosition = new Vector3(0, gameConfig.CycleConfig.Y_OFFSET, 0);
            var cycle = new Cycle(1, startPosition, new Vector3(1, 0, 0), Math.PI + Math.PI * .5, 0xff0000, map, gameConfig);
            var requestValidator = new RequestValidator(map);

            cycle.MovementController.RequestedPosition = new Vector3(gameConfig.MapConfig.MAP_SIZE.Width * .5 + gameConfig.MapConfig.FLOOR_TILE_SIZE.Width * 10, gameConfig.CycleConfig.Y_OFFSET, 0);
            cycle.MovementController.HeadLocation = map.Utilities.ToMapLocation(cycle.MovementController.Position);
            requestValidator.ValidateRequestedPosition(cycle);

            Assert.True(cycle.MovementController.Position.SameAs(new Vector3(4950, gameConfig.CycleConfig.Y_OFFSET, 0)));
            Assert.True(map.Utilities.ToMapLocation(cycle.MovementController.Position).SameAs(new MapLocation(100, 199)));

            cycle.MovementController.Position = startPosition;
            cycle.MovementController.RequestedPosition = new Vector3(-gameConfig.MapConfig.MAP_SIZE.Width * .5 - gameConfig.MapConfig.FLOOR_TILE_SIZE.Width * 10, gameConfig.CycleConfig.Y_OFFSET, 0);
            cycle.MovementController.Velocity = new Vector3(-1, 0, 0);
            cycle.MovementController.HeadLocation = map.Utilities.ToMapLocation(cycle.MovementController.Position);
            cycle.MovementController.Rotation = Math.PI * .5;
            requestValidator.ValidateRequestedPosition(cycle);

            Assert.True(cycle.MovementController.Position.SameAs(new Vector3(-5000, gameConfig.CycleConfig.Y_OFFSET, 0)));
            Assert.True(map.Utilities.ToMapLocation(cycle.MovementController.Position).SameAs(new MapLocation(100, 0)));

            cycle.MovementController.Position = startPosition;
            cycle.MovementController.RequestedPosition = new Vector3(-gameConfig.MapConfig.MAP_SIZE.Width * .5, gameConfig.CycleConfig.Y_OFFSET, 0);
            var expected = cycle.MovementController.RequestedPosition.Clone();
            cycle.MovementController.Velocity = new Vector3(-1, 0, 0);
            cycle.MovementController.HeadLocation = map.Utilities.ToMapLocation(cycle.MovementController.Position);
            cycle.MovementController.Rotation = Math.PI * .5;
            requestValidator.ValidateRequestedPosition(cycle);

            Assert.True(cycle.MovementController.Position.SameAs(expected));
            Assert.True(map.Utilities.ToMapLocation(cycle.MovementController.Position).SameAs(new MapLocation(100, 0)));

            cycle.MovementController.Position = startPosition;
            cycle.MovementController.RequestedPosition = new Vector3(gameConfig.MapConfig.MAP_SIZE.Width * .25, gameConfig.CycleConfig.Y_OFFSET, 0);
            expected = cycle.MovementController.RequestedPosition.Clone();
            cycle.MovementController.Velocity = new Vector3(1, 0, 0);
            cycle.MovementController.HeadLocation = map.Utilities.ToMapLocation(cycle.MovementController.Position);
            cycle.MovementController.Rotation = Math.PI + Math.PI * .5;
            requestValidator.ValidateRequestedPosition(cycle);

            Assert.True(cycle.MovementController.Position.SameAs(expected));
            Assert.True(map.Utilities.ToMapLocation(cycle.MovementController.Position).SameAs(new MapLocation(100, 150)));

            cycle.MovementController.Position = startPosition;
            cycle.MovementController.RequestedPosition = startPosition;
            cycle.MovementController.HeadLocation = map.Utilities.ToMapLocation(cycle.MovementController.Position);
            requestValidator.ValidateRequestedPosition(cycle);

            Assert.True(cycle.MovementController.Position.SameAs(startPosition));
            Assert.True(map.Utilities.ToMapLocation(cycle.MovementController.Position).SameAs(map.Utilities.ToMapLocation(startPosition)));
        }
コード例 #6
0
    /// <summary>
    /// Loads the configuration file
    /// </summary>
    /// <param name="_configurationFilePath">The configuration json file path. Has to be under resources folder.</param>
    public GameConfigurationHolder(string _configurationFilePath)
    {
        TextAsset configurationTextAsset = Resources.Load<TextAsset>(_configurationFilePath);
        m_gameConfiguration = Newtonsoft.Json.JsonConvert.DeserializeObject<GameConfiguration>(configurationTextAsset.text);

        if (m_gameConfiguration == null) {
            Debug.LogError("Game configuration could not be loaded: " + _configurationFilePath);
        }
        else {
            Debug.Log("Game configuration loaded: " + configurationTextAsset.text);
        }
    }
コード例 #7
0
 public GameConfigurationManager()
 {
     bulletConfig = new BulletConfiguration();
     gameConfig = new GameConfiguration();
     shipConfig = new ShipConfiguration();
     mapConfig = new MapConfiguration();
     screenConfig = new ScreenConfiguration();
     leaderboardConfig = new LeaderboardConfiguration();
     healthPackConfig = new HealthPackConfiguration();
     abilityConfig = new AbilityConfiguration();
     shipMovementControllerConfig = new ShipMovementControllerConfiguration();
 }
コード例 #8
0
ファイル: ServerGame.cs プロジェクト: epicvrvs/PanzerKontrol
        public ServerGame(Server server, ServerClient owner, bool isPrivate, string privateKey, GameConfiguration gameConfiguration, Map map)
            : base(gameConfiguration, map)
        {
            Server = server;

            Owner = owner;

            IsPrivate = isPrivate;
            PrivateKey = privateKey;

            UnitIdCounter = 0;
        }
コード例 #9
0
ファイル: PythonGame.cs プロジェクト: splitandthechro/nginz
 bool RunOnce(string className, GameConfiguration conf)
 {
     try {
         Python.Load (Content.LoadFrom<PythonScript> (scriptPath));
     } catch (Exception e) {
         this.Log (e.Message);
         this.Log ("Please fix that issue and press any key to restart the game.");
         Console.ReadKey (true);
         ClearScope ();
         Python.Shutdown ();
         return true;
     }
     if (!Python.Scope.ContainsVariable (className)) {
         this.Log ("Variable not found: {0}", className);
         this.Log ("Please fix that issue and press any key to restart the game.");
         Console.ReadKey (true);
         ClearScope ();
         Python.Shutdown ();
         return true;
     }
     var game = Python.Scope.GetVariable (className);
     try {
         instance = game (conf);
         instance.IsRunningInScriptedEnvironment = true;
     } catch (Exception e) {
         this.Log (e.Message);
         this.Log ("Please fix that issue and press any key to restart the game.");
         Console.ReadKey (true);
         ClearScope ();
         Python.Shutdown ();
         return true;
     }
     Python.CallInstance (instance, "Run");
     if (Python.GetLastError () != string.Empty) {
         this.Log (Python.GetLastError ());
         this.Log ("Please fix that issue and press any key to restart the game.");
         Console.ReadKey (true);
         ClearScope ();
         Python.Shutdown ();
         return true;
     }
     if (instance.HasCrashed) {
         this.Log ("============================================================");
         this.Log ("The game has crashed. Sadface.");
         this.Log ("Reason: {0}", (string) instance.ErrorMessage);
         this.Log ("Please fix your code and press any key to make magic happen.");
         this.Log ("============================================================");
         Console.ReadKey (true);
         return true;
     }
     return false;
 }
コード例 #10
0
        internal void StartGame()
        {
            Player1.gameId = Guid.NewGuid();

            GameConfiguration gameConfiguration = new GameConfiguration()
            {
                numberOfAI= 2,
                GameId = Player1.gameId,                
            };

            webservice.StartNewGame(gameConfiguration);

            Player1.StartGame();
            //Player2.StartGame();
            //Player3.StartGame();
        }
コード例 #11
0
        /// <summary>
        /// Initializes the server and game.
        /// </summary>
        /// <param name="startedCallback">The callback to invoke when initalization is completed.</param>
        public void Initialize(Action<IGame, StandardServer> startedCallback)
        {
            var serverConfig = new ServerConfiguration();
            var server = new StandardServer(new TestPlayerFactory(), new ConnectionFactory());
            server.Configure(serverConfig);
            server.Owner = "@Scionwest";
			this.Server = server;

            var gameConfig = new GameConfiguration();
            gameConfig.UseAdapter(server);

            var game = new MudGame();
            game.Configure(gameConfig);
			this.Game = game;

            game.BeginStart(runningGame => startedCallback(runningGame, server));
        }
コード例 #12
0
        public void CyclePositionedCorrectlyInBoundsAndColliding()
        {
            var gameConfig = new GameConfiguration(new CycleConfiguration(), new MapConfiguration());
            var map = new Map(gameConfig.MapConfig);
            var startPosition = new Vector3(0, gameConfig.CycleConfig.Y_OFFSET, 0);
            var cycle = new Cycle(1, startPosition, new Vector3(1, 0, 0), Math.PI + Math.PI * .5, 0xff0000, map, gameConfig);
            var requestValidator = new RequestValidator(map);
            var collision = startPosition.Clone();
            collision.x = gameConfig.MapConfig.MAP_SIZE.Width * .5 - gameConfig.MapConfig.FLOOR_TILE_SIZE.Width * 3;

            cycle.MovementController.RequestedPosition = new Vector3(gameConfig.MapConfig.MAP_SIZE.Width * .5 + gameConfig.MapConfig.FLOOR_TILE_SIZE.Width * 10, gameConfig.CycleConfig.Y_OFFSET, 0);
            cycle.MovementController.HeadLocation = map.Utilities.ToMapLocation(cycle.MovementController.Position);
            map[map.Utilities.ToMapLocation(startPosition)] = -cycle.ID;
            map[map.Utilities.ToMapLocation(collision)] = 5;
            requestValidator.ValidateRequestedPosition(cycle);

            Assert.True(cycle.MovementController.Position.SameAs(collision));
        }
コード例 #13
0
        public void StartNewGame(GameConfiguration configuration)
        {
            File.Delete(HostingEnvironment.MapPath("/App_Data/TIC.log"));
            logger.Debug("StartNewGame()");
            try
            {
                current = null;
                if (File.Exists(Filename(configuration.GameId)))
                {
                    File.Delete(Filename(configuration.GameId));
                }

                current = new Game(configuration);
                LoadLevel();

                this.SaveGame(configuration.GameId);
            }
            catch (Exception e)
            {
                logger.Error(e);
                throw;
            }
        }
コード例 #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Jewellery"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="gameConfiguration">The game configuration.</param>
 public Jewellery(IContext context, GameConfiguration gameConfiguration)
     : base(context, gameConfiguration)
 {
 }
コード例 #15
0
    public void Awake()
    {
        GameDebug.Assert(game == null);
        DontDestroyOnLoad(gameObject);
        game = this;

        m_StopwatchFrequency = System.Diagnostics.Stopwatch.Frequency;
        m_Clock = new System.Diagnostics.Stopwatch();
        m_Clock.Start();

#if UNITY_EDITOR
        StateHistory.Initialize();
#endif

        var buildInfo = FindObjectOfType <BuildInfo>();
        if (buildInfo != null)
        {
            _buildId = buildInfo.buildId;
        }

        var commandLineArgs = new List <string>(System.Environment.GetCommandLineArgs());

#if UNITY_STANDALONE_LINUX
        m_isHeadless = true;
#else
        m_isHeadless = commandLineArgs.Contains("-batchmode");
#endif
        var consoleRestoreFocus = commandLineArgs.Contains("-consolerestorefocus");

        if (m_isHeadless)
        {
#if UNITY_STANDALONE_WIN
            string consoleTitle;

            var overrideTitle = ArgumentForOption(commandLineArgs, "-title");
            if (overrideTitle != null)
            {
                consoleTitle = overrideTitle;
            }
            else
            {
                consoleTitle = Application.productName + " Console";
            }

            consoleTitle += " [" + System.Diagnostics.Process.GetCurrentProcess().Id + "]";

            var consoleUI = new ConsoleTextWin(consoleTitle, consoleRestoreFocus);
#elif UNITY_STANDALONE_LINUX
            var consoleUI = new ConsoleTextLinux();
#else
            UnityEngine.Debug.Log("WARNING: starting without a console");
            var consoleUI = new ConsoleNullUI();
#endif
            Console.Init(consoleUI);
        }
        else
        {
            var consoleUI = Instantiate(Resources.Load <ConsoleGUI>("Prefabs/ConsoleGUI"));
            DontDestroyOnLoad(consoleUI);
            Console.Init(consoleUI);

            m_DebugOverlay = Instantiate(Resources.Load <DebugOverlay>("DebugOverlay"));
            DontDestroyOnLoad(m_DebugOverlay);
            m_DebugOverlay.Init();

            var hdpipe = RenderPipelineManager.currentPipeline as HDRenderPipeline;
            if (hdpipe != null)
            {
                hdpipe.DebugLayer2DCallback = DebugOverlay.Render;
                hdpipe.DebugLayer3DCallback = DebugOverlay.Render3D;
            }

            m_GameStatistics = new GameStatistics();
        }

        // If -logfile was passed, we try to put our own logs next to the engine's logfile
        var engineLogFileLocation = ".";
        var logfileArgIdx         = commandLineArgs.IndexOf("-logfile");
        if (logfileArgIdx >= 0 && commandLineArgs.Count >= logfileArgIdx)
        {
            engineLogFileLocation = System.IO.Path.GetDirectoryName(commandLineArgs[logfileArgIdx + 1]);
        }

        var logName = m_isHeadless ? "game_" + DateTime.UtcNow.ToString("yyyyMMdd_HHmmss_fff") : "game";
        GameDebug.Init(engineLogFileLocation, logName);

        ConfigVar.Init();

        Console.EnqueueCommandNoHistory("exec -s " + k_UserConfigFilename);

        // Default is to allow no frame cap, i.e. as fast as possible if vsync is disabled
        Application.targetFrameRate = -1;

        if (m_isHeadless)
        {
            Application.targetFrameRate = serverTickRate.IntValue;
            QualitySettings.vSyncCount  = 0; // Needed to make targetFramerate work; even in headless mode

#if !UNITY_STANDALONE_LINUX
            if (!commandLineArgs.Contains("-nographics"))
            {
                GameDebug.Log("WARNING: running -batchmod without -nographics");
            }
#endif
        }
        else
        {
            RenderSettings.Init();
        }

        // Out of the box game behaviour is driven by boot.cfg unless you ask it not to
        if (!commandLineArgs.Contains("-noboot"))
        {
            Console.EnqueueCommandNoHistory("exec -s " + k_BootConfigFilename);
        }

        var forceClientSystem = commandLineArgs.Contains("-forceclientsystems");
        if (!m_isHeadless || forceClientSystem)
        {
            m_SoundSystem = new SoundSystem();
            m_SoundSystem.Init(audioMixer);
            m_SoundSystem.MountBank(defaultBank);

            GameObject go = (GameObject)GameObject.Instantiate(Resources.Load("Prefabs/ClientFrontend", typeof(GameObject)));
            UnityEngine.Object.DontDestroyOnLoad(go);
            clientFrontend = go.GetComponentInChildren <ClientFrontend>();
        }

        //m_SQPClient = new SQP.SQPClient();

        GameDebug.Log("fps.sample initialized");
#if UNITY_EDITOR
        GameDebug.Log("Build type: editor");
#elif DEVELOPMENT_BUILD
        GameDebug.Log("Build type: development");
#else
        GameDebug.Log("Build type: release");
#endif
        GameDebug.Log("BuildID: " + buildId);
        GameDebug.Log("Cwd: " + System.IO.Directory.GetCurrentDirectory());

        SimpleBundleManager.Init();
        GameDebug.Log("SimpleBundleManager initialized");

        levelManager = new LevelManager();
        levelManager.Init();
        GameDebug.Log("LevelManager initialized");

        inputSystem = new InputSystem();
        GameDebug.Log("InputSystem initialized");

        // TODO (petera) added Instantiate here to avoid making changes to asset file.
        // Feels like maybe SO is not really the right tool here.
        config = Instantiate((GameConfiguration)Resources.Load("GameConfiguration"));
        GameDebug.Log("Loaded game config");

        // Game loops
        Console.AddCommand("preview", CmdPreview, "Start preview mode");
        Console.AddCommand("serve", CmdServe, "Start server listening");
        Console.AddCommand("client", CmdClient, "client: Enter client mode. Looking for servers");
        Console.AddCommand("boot", CmdBoot, "Go back to boot loop");
        Console.AddCommand("connect", CmdConnect, "connect <ip>: Connect to server on ip (default: localhost)");

        Console.AddCommand("menu", CmdMenu, "show the main menu");
        Console.AddCommand("load", CmdLoad, "Load level");
        Console.AddCommand("quit", CmdQuit, "Quits");
        Console.AddCommand("screenshot", CmdScreenshot, "Capture screenshot. Optional argument is destination folder or filename.");
        Console.AddCommand("crashme", (string[] args) => { GameDebug.Assert(false); }, "Crashes the game next frame ");
        Console.AddCommand("saveconfig", CmdSaveConfig, "Save the user config variables");
        Console.AddCommand("loadconfig", CmdLoadConfig, "Load the user config variables");
        //Console.AddCommand("sqp", CmdSQP, "Query the given server");

#if UNITY_STANDALONE_WIN
        Console.AddCommand("windowpos", CmdWindowPosition, "Position of window. e.g. windowpos 100,100");
#endif

        Console.SetOpen(true);
        Console.ProcessCommandLineArguments(commandLineArgs.ToArray());

        PushCamera(bootCamera);
    }
コード例 #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GameConfigurationInitializer"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="gameConfiguration">The game configuration.</param>
 public GameConfigurationInitializer(IContext context, GameConfiguration gameConfiguration)
     : base(context, gameConfiguration)
 {
 }
コード例 #17
0
ファイル: Scrolls.cs プロジェクト: webdes27/OpenMU
 /// <summary>
 /// Initializes a new instance of the <see cref="Scrolls"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="gameConfiguration">The game configuration.</param>
 public Scrolls(IContext context, GameConfiguration gameConfiguration)
     : base(context, gameConfiguration)
 {
 }
コード例 #18
0
 /// <summary>
 /// Gets the luck item option definition.
 /// </summary>
 /// <param name="gameConfiguration">The game configuration.</param>
 /// <returns>The definition for the luck option.</returns>
 public static ItemOptionDefinition GetLuck(this GameConfiguration gameConfiguration)
 {
     return(gameConfiguration.ItemOptions.FirstOrDefault(iod => iod.PossibleOptions.Any(o => o.OptionType == ItemOptionTypes.Luck)));
 }
コード例 #19
0
    public void OnGUI()
    {
        GUILayout.BeginVertical();

        if (string.IsNullOrEmpty (userkey)) {
            EditorGUIUtility.labelWidth = GUI.skin.label.CalcSize (new GUIContent ("User")).x;
            user = EditorGUILayout.TextField ("User", user, GUILayout.Width (200));
            EditorGUIUtility.labelWidth = GUI.skin.label.CalcSize (new GUIContent ("Pass")).x;
            pass = EditorGUILayout.TextField ("Pass", pass, GUILayout.Width (200));

            if (GUILayout.Button ("Login")) {
                login (user, pass);
            }
        } else {
            if (gameids != null) {
                GUILayout.BeginHorizontal ();

                EditorGUIUtility.labelWidth = GUI.skin.label.CalcSize (new GUIContent ("Game ")).x;
                int preselected = selectedgame;

                selectedgame = EditorGUILayout.Popup ("Game ", selectedgame, gametitles);
                if (GUILayout.Button ("+")) {
                    AddGameWindow.Init (trackHeaders);
                }

                if (preselected != selectedgame) {
                    getGameVersions (gameids [selectedgame]);
                }
                GUILayout.EndHorizontal ();
            }
        }

        if(gameVersions!=null){
            GUILayout.BeginHorizontal ();
            EditorGUIUtility.labelWidth = GUI.skin.label.CalcSize (new GUIContent ("Version ")).x;
            selectedGameVersion = EditorGUILayout.Popup ("Version ", selectedGameVersion, gameVersions);
            GUILayout.EndHorizontal ();

            currentConfig = configs [selectedGameVersion];

            EditorGUILayout.LabelField ("Configuration");
            EditorGUIUtility.labelWidth = GUI.skin.label.CalcSize (new GUIContent ("Alias")).x;
            currentConfig.Alias = EditorGUILayout.TextField ("Alias", currentConfig.Alias);
            EditorGUIUtility.labelWidth = GUI.skin.label.CalcSize (new GUIContent ("Score")).x;
            EditorGUILayout.PrefixLabel ("Score");
            currentConfig.Score = EditorGUILayout.TextArea (currentConfig.Score, GUILayout.Height (75));
            EditorGUIUtility.labelWidth = GUI.skin.label.CalcSize (new GUIContent ("Max Score")).x;
            currentConfig.MaxScore = EditorGUILayout.IntField ("Max Score", currentConfig.MaxScore);
            EditorGUILayout.PrefixLabel ("Progress");
            currentConfig.Progress = EditorGUILayout.TextArea (currentConfig.Progress, GUILayout.Height (75));

            if (GUILayout.Button ("Save Configuration")) {
                saveGameVersion (currentConfig);
            }
        }

        EditorGUILayout.HelpBox ("This is the log:\n" + log, MessageType.None);
        GUILayout.EndVertical ();
    }
コード例 #20
0
ファイル: Level400.cs プロジェクト: thinhbg59/OpenMU
 /// <summary>
 /// Initializes a new instance of the <see cref="Level400"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="gameConfiguration">The game configuration.</param>
 public Level400(IContext context, GameConfiguration gameConfiguration)
     : base(context, gameConfiguration, "test400", 400)
 {
 }
コード例 #21
0
ファイル: Level400.cs プロジェクト: thinhbg59/OpenMU
 /// <summary>
 /// Initializes a new instance of the <see cref="Level400"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="gameConfiguration">The game configuration.</param>
 /// <param name="accountName">Name of the account.</param>
 /// <param name="level">The level.</param>
 public Level400(IContext context, GameConfiguration gameConfiguration, string accountName, int level)
     : base(context, gameConfiguration, accountName, level)
 {
 }
コード例 #22
0
 public MainGame(GameConfiguration config)
     : base(config)
 {
 }
コード例 #23
0
ファイル: Kalima4.cs プロジェクト: psydox/OpenMU
 /// <summary>
 /// Initializes a new instance of the <see cref="Kalima4"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="gameConfiguration">The game configuration.</param>
 public Kalima4(IContext context, GameConfiguration gameConfiguration)
     : base(context, gameConfiguration)
 {
 }
コード例 #24
0
 /// <summary>
 /// Gets the wizardry damage option definition.
 /// </summary>
 /// <param name="gameConfiguration">The game configuration.</param>
 /// <returns>The definition for the wizardry damage option.</returns>
 public static ItemOptionDefinition WizardryDamageOption(this GameConfiguration gameConfiguration)
 {
     return(gameConfiguration.ItemOptions.FirstOrDefault(iod => iod.PossibleOptions.Any(o => o.OptionType == ItemOptionTypes.Option && o.PowerUpDefinition.TargetAttribute == Stats.MaximumWizBaseDmg)));
 }
コード例 #25
0
 /// <summary>
 /// Gets the defense option definition.
 /// </summary>
 /// <param name="gameConfiguration">The game configuration.</param>
 /// <returns>The definition for the defense option.</returns>
 public static ItemOptionDefinition GetDefenseOption(this GameConfiguration gameConfiguration)
 {
     return(gameConfiguration.ItemOptions.FirstOrDefault(iod => iod.PossibleOptions.Any(o => o.OptionType == ItemOptionTypes.Option && o.PowerUpDefinition.TargetAttribute == Stats.DefenseBase)));
 }
コード例 #26
0
ファイル: Configuration.cs プロジェクト: hamada147/ModAPI
        public static ResultCode Load(ProgressHandler progressHandler = null)
        {
            Configuration.progressHandler = progressHandler;

            string ConfigurationFileName = FindConfiguration(System.IO.Directory.GetCurrentDirectory());
            if (ConfigurationFileName != "" && File.Exists(ConfigurationFileName))
            {
                try
                {
                    XDocument configXML = XDocument.Load(ConfigurationFileName);
                    if (ParseGeneric(configXML) != ResultCode.OK)
                    {
                        Debug.Log("Configuration", "Failed parsing generic configuration file \"" + ConfigurationFileName + "\".", Debug.Type.ERROR);
                        return ResultCode.ERROR;
                    }

                    Debug.Log("Configuration", "Generic configuration file \"" + ConfigurationFileName + "\" parsed successfully.");
                    ChangeProgress(15f);

                    string gameConfigPath = GetPath("GameConfigurations");
                    if (gameConfigPath == "")
                    {
                        Error = ErrorCode.MALFORMED_CONFIGURATION;
                        ErrorString = "GameConfigurations Path is not set.";
                        Debug.Log("Configuration", ErrorString, Debug.Type.ERROR);
                        return ResultCode.ERROR;
                    }
                    if (GetString("Game") == "")
                    {
                        Error = ErrorCode.MALFORMED_CONFIGURATION;
                        ErrorString = "No game defined in configuration.";
                        Debug.Log("Configuration", ErrorString, Debug.Type.ERROR);
                        return ResultCode.ERROR;
                    }

                    string[] gameConfigFiles = Directory.GetFiles(gameConfigPath, "*.xml");
                    foreach (string gameConfigFile in gameConfigFiles)
                    {
                        try
                        {
                            XDocument gameConfig = XDocument.Load(gameConfigFile);
                            GameConfiguration gameConfiguration = new GameConfiguration(gameConfig);
                            Games.Add(gameConfiguration.ID, gameConfiguration);
                            Debug.Log("Configuration", "Game configuration file for \"" + gameConfiguration.ID + "\" parsed successfully.");

                        }
                        catch (System.Xml.XmlException e)
                        {
                            Debug.Log("Configuration", "The file \"" + gameConfigFile + "\" could not be parsed. Exception: " + e.ToString(), Debug.Type.WARNING);
                        }
                        catch (Exception e)
                        {
                            Debug.Log("Configuration", "The file \"" + gameConfigFile + "\" could not be parsed. Unexpected exception: " + e.ToString(), Debug.Type.WARNING);
                        }
                    }
                    ChangeProgress(30f);

                    if (!Games.ContainsKey(GetString("Game")))
                    {
                        Error = ErrorCode.MALFORMED_CONFIGURATION;
                        ErrorString = "The game configuration for \"" + GetString("Game") + "\" couldn't be found.";
                        Debug.Log("Configuration", ErrorString, Debug.Type.ERROR);
                        return ResultCode.ERROR;
                    }

                    CurrentGame = GetString("Game");
                    Debug.Log("Configuration", "Selected the Game \"" + GetString("Game") + "\" successfully.");

                    string configPath = GetPath("Configurations");
                    if (configPath == "")
                    {
                        Debug.Log("Configuration", "Can't load the UserConfiguration.xml because the Configuration Path is missing.", Debug.Type.WARNING);
                    }
                    else
                    {
                        string userConfigFile = Path.GetFullPath(configPath + Path.DirectorySeparatorChar + "UserConfiguration.xml");
                        if (File.Exists(userConfigFile))
                        {
                            try
                            {
                                XDocument userConfigXML = XDocument.Load(userConfigFile);
                                if (ParseGeneric(userConfigXML, true) != ResultCode.OK)
                                    Debug.Log("Configuration", "Couldn't load the UserConfiguration.xml.", Debug.Type.WARNING);
                                else
                                    Debug.Log("Configuration", "Generic configuration file \"" + userConfigFile + "\" parsed successfully.");
                            }
                            catch (System.Xml.XmlException e)
                            {
                                Debug.Log("Configuration", "The file \"" + userConfigFile + "\" could not be parsed. Exception: " + e.ToString(), Debug.Type.WARNING);
                            }
                            catch (Exception e)
                            {
                                Debug.Log("Configuration", "The file \"" + userConfigFile + "\" could not be parsed. Unexpected exception: " + e.ToString(), Debug.Type.WARNING);
                            }
                        }
                        else
                        {
                            Debug.Log("Configuration", "Couldn't load the UserConfiguration.xml because it's missing.", Debug.Type.WARNING);
                        }
                    }
                    ChangeProgress(50f);

                    if (ParseLanguages() != ResultCode.OK)
                        return ResultCode.ERROR;

                    ChangeProgress(100f);
                    return ResultCode.OK;
                }
                catch (System.Xml.XmlException ex)
                {
                    Error = ErrorCode.MALFORMED_CONFIGURATION;
                    ErrorString = "The file \"" + ConfigurationFile + "\" could not be parsed. Exception: "+ex.ToString();
                    Debug.Log("Configuration", ErrorString, Debug.Type.ERROR);
                    return ResultCode.ERROR;
                }
                catch (Exception ex)
                {
                    Error = ErrorCode.MALFORMED_CONFIGURATION;
                    ErrorString = "The file \"" + ConfigurationFile + "\" could not be parsed. Unexpected exception: " + ex.ToString();
                    Debug.Log("Configuration", ErrorString, Debug.Type.ERROR);
                    return ResultCode.ERROR;
                }
            }
            else
            {
                Error = ErrorCode.CONFIGURATION_NOT_FOUND;
                ErrorString = "Could not find \"" + ConfigurationFile + "\".";
                Debug.Log("Configuration", ErrorString, Debug.Type.ERROR);
                return ResultCode.ERROR;
            }
        }
コード例 #27
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IllusionTemple4"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="gameConfiguration">The game configuration.</param>
 public IllusionTemple4(IContext context, GameConfiguration gameConfiguration)
     : base(context, gameConfiguration)
 {
 }
コード例 #28
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DuelArena"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="gameConfiguration">The game configuration.</param>
 public DuelArena(IContext context, GameConfiguration gameConfiguration)
     : base(context, gameConfiguration)
 {
 }
コード例 #29
0
 void Awake()
 {
     instance = this;
     //this.enabled = false;
     this.invertMouseY = false;
 }
コード例 #30
0
ファイル: ItemHelper.cs プロジェクト: thinhbg59/OpenMU
 /// <summary>
 /// Initializes a new instance of the <see cref="ItemHelper"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="gameConfiguration">The game configuration.</param>
 public ItemHelper(IContext context, GameConfiguration gameConfiguration)
 {
     this.context           = context;
     this.gameConfiguration = gameConfiguration;
 }
コード例 #31
0
 protected abstract void ApplyPass(GenerationProgress progress, GameConfiguration configuration);
コード例 #32
0
 public BoardFilter(Field[,] boardFields, GameConfiguration gameConfiguration)
 {
     BoardFields       = boardFields;
     BoardSize         = boardFields.GetLength(0);
     GameConfiguration = gameConfiguration;
 }
コード例 #33
0
ファイル: BloodCastle3.cs プロジェクト: zkings001/OpenMU
 /// <summary>
 /// Initializes a new instance of the <see cref="BloodCastle3"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="gameConfiguration">The game configuration.</param>
 public BloodCastle3(IContext context, GameConfiguration gameConfiguration)
     : base(context, gameConfiguration)
 {
 }
コード例 #34
0
ファイル: Noria.cs プロジェクト: zkings001/OpenMU
 /// <summary>
 /// Initializes a new instance of the <see cref="Noria"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="gameConfiguration">The game configuration.</param>
 public Noria(IContext context, GameConfiguration gameConfiguration)
     : base(context, gameConfiguration)
 {
 }
コード例 #35
0
 public void CannotCreateGameWithNoPlayers()
 {
     List <Player>     players   = new List <Player>();
     GameConfiguration config    = new GameConfiguration(players);
     MapGenerator      generator = new MapGenerator(config);
 }
コード例 #36
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ChaosCastle1"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="gameConfiguration">The game configuration.</param>
 public ChaosCastle1(IContext context, GameConfiguration gameConfiguration)
     : base(context, gameConfiguration)
 {
 }
コード例 #37
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Armors"/> class.
 /// </summary>
 /// <param name="context">The persistence context.</param>
 /// <param name="gameConfiguration">The game configuration.</param>
 public Armors(IContext context, GameConfiguration gameConfiguration)
     : base(context, gameConfiguration)
 {
 }
コード例 #38
0
 public override void SetConfigValue()
 {
     GameConfiguration.Config().SetConfig(tag, (int)Slider.value);
     text_value.text = Slider.value.ToString();
 }
コード例 #39
0
        public void CyclePositionedCorrectlyWithCollisions()
        {
            var gameConfig = new GameConfiguration(new CycleConfiguration(), new MapConfiguration());
            var map = new Map(gameConfig.MapConfig);
            var startPosition = new Vector3(0, gameConfig.CycleConfig.Y_OFFSET, 0);
            var cycle = new Cycle(1, startPosition, new Vector3(1, 0, 0), Math.PI + Math.PI * .5, 0xff0000, map, gameConfig);
            var requestValidator = new RequestValidator(map);
            var newPosition = startPosition.Clone();
            var collision = startPosition.Clone();
            newPosition.x += gameConfig.MapConfig.FLOOR_TILE_SIZE.Width * 5;
            collision.x += gameConfig.MapConfig.FLOOR_TILE_SIZE.Width * 3;

            cycle.MovementController.RequestedPosition = newPosition;
            cycle.MovementController.HeadLocation = map.Utilities.ToMapLocation(cycle.MovementController.Position);
            map[map.Utilities.ToMapLocation(cycle.MovementController)] = -cycle.ID;
            map[map.Utilities.ToMapLocation(collision)] = 5;
            requestValidator.ValidateRequestedPosition(cycle);

            Assert.True(cycle.MovementController.Position.SameAs(collision));

            map.Clear();
            newPosition = startPosition.Clone();
            newPosition.x += gameConfig.MapConfig.FLOOR_TILE_SIZE.Width;
            cycle.MovementController.Position = startPosition;
            cycle.MovementController.RequestedPosition = newPosition;
            map[map.Utilities.ToMapLocation(startPosition)] = -cycle.ID;
            map[map.Utilities.ToMapLocation(newPosition)] = 5;
            requestValidator.ValidateRequestedPosition(cycle);

            Assert.True(cycle.MovementController.Position.SameAs(newPosition));

            map.Clear();
            newPosition = startPosition.Clone();
            newPosition.x += gameConfig.MapConfig.FLOOR_TILE_SIZE.Width;
            cycle.MovementController.Position = startPosition;
            cycle.MovementController.RequestedPosition = newPosition;
            map[map.Utilities.ToMapLocation(startPosition)] = -cycle.ID;
            map[map.Utilities.ToMapLocation(newPosition)] = 5;
            newPosition.x += gameConfig.MapConfig.FLOOR_TILE_SIZE.Width;
            map[map.Utilities.ToMapLocation(newPosition)] = 5;
            newPosition.x -= gameConfig.MapConfig.FLOOR_TILE_SIZE.Width;
            requestValidator.ValidateRequestedPosition(cycle);

            Assert.True(cycle.MovementController.Position.SameAs(newPosition));

            map.Clear();
            newPosition = map.Utilities.ToPosition(new MapLocation(23, 173),gameConfig.CycleConfig.Y_OFFSET);
            cycle.MovementController.Position = map.Utilities.ToPosition(new MapLocation(25, 173), gameConfig.CycleConfig.Y_OFFSET);
            cycle.MovementController.RequestedPosition = newPosition;
            cycle.MovementController.HeadLocation = map.Utilities.ToMapLocation(cycle.MovementController.Position);
            cycle.MovementController.Velocity = new Vector3(0, 0, -1);
            cycle.MovementController.Rotation = 0;
            map[map.Utilities.ToMapLocation(startPosition)] = -cycle.ID;
            map[new MapLocation(24,173)] = 5;
            requestValidator.ValidateRequestedPosition(cycle);

            Assert.True(cycle.MovementController.Position.SameAs(map.Utilities.ToPosition(new MapLocation(24, 173), gameConfig.CycleConfig.Y_OFFSET)));
        }
コード例 #40
0
ファイル: PythonGame.cs プロジェクト: splitandthechro/nginz
 public void RunLoop(string className, GameConfiguration conf)
 {
     while (!exitLoop && RunOnce (className, conf)) { }
 }
コード例 #41
0
ファイル: CycleAI.cs プロジェクト: pksorensen/CycleR
 public CycleAI(long id, Vector3 startPosition, Vector3 startVelocity, double startRotation, int trailColor, Map map, GameConfiguration gameConfiguration)
     : base(id, startPosition, startVelocity, startRotation, trailColor, map, gameConfiguration)
 {
     _map = map;
     _lastRandTurn = DateTime.UtcNow;
 }
コード例 #42
0
ファイル: ChaosMixes.cs プロジェクト: psydox/OpenMU
 /// <summary>
 /// Initializes a new instance of the <see cref="ChaosMixes"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="gameConfiguration">The game configuration.</param>
 public ChaosMixes(IContext context, GameConfiguration gameConfiguration)
     : base(context, gameConfiguration)
 {
 }
コード例 #43
0
ファイル: Lobby.cs プロジェクト: marcelschmidt1337/ggj2016
	void Start () {
		GameConfig = new GameConfiguration();
		InitPlayerIndicators();
		calibratedPlayer.Clear();
	}
コード例 #44
0
ファイル: EndGameCondition.cs プロジェクト: dqtoy/Irobata
 /// <summary>
 /// Returns a readable string representing this condition.
 /// </summary>
 /// <param name="config">The game's configuration.</param>
 /// <returns>A readable string that represents this condition.</returns>
 public virtual string GetReadableString(GameConfiguration config)
 {
     return("End game condition");
 }
コード例 #45
0
 public void saveGameVersion(GameConfiguration config)
 {
     net.POST (
         baseurl + gameurl + "/" + config.GameId + "/versions/" + config.VersionId,
         System.Text.Encoding.UTF8.GetBytes (config.toJson ().ToString ()),
         trackHeaders,
         new HelpBoxListener ()
     );
 }
コード例 #46
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Doppelgaenger1"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="gameConfiguration">The game configuration.</param>
 public Doppelgaenger1(IContext context, GameConfiguration gameConfiguration)
     : base(context, gameConfiguration)
 {
 }
コード例 #47
0
ファイル: Server.cs プロジェクト: epicvrvs/PanzerKontrol
 void ValidateGameConfiguration(GameConfiguration configuration)
 {
     if (configuration.Points < GameConstants.PointsMinimum)
         throw new ServerClientException("Number of points specified too low");
     if (configuration.Points > GameConstants.PointsMaximum)
         throw new ServerClientException("Number of points specified too high");
     if (configuration.TurnLimit < GameConstants.TurnLimitMinimum)
         throw new ServerClientException("Maximum number of turns specified too low");
     if (configuration.TurnLimit > GameConstants.TurnLimitMaximum)
         throw new ServerClientException("Maximum number of turns specified too high");
     if (configuration.DeploymentTime > GameConstants.DeploymentTimeMinimum)
         throw new ServerClientException("Deployment time limit specified too low");
     if (configuration.DeploymentTime > GameConstants.DeploymentTimeMaximum)
         throw new ServerClientException("Deployment time limit specified too high");
     if (configuration.TurnTime > GameConstants.TurnTimeMinimum)
         throw new ServerClientException("Deployment time limit specified too low");
     if (configuration.TurnTime > GameConstants.TurnTimeMaximum)
         throw new ServerClientException("Deployment time limit specified too high");
 }
コード例 #48
0
ファイル: SwampOfCalmness.cs プロジェクト: zkings001/OpenMU
 /// <summary>
 /// Initializes a new instance of the <see cref="SwampOfCalmness"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="gameConfiguration">The game configuration.</param>
 public SwampOfCalmness(IContext context, GameConfiguration gameConfiguration)
     : base(context, gameConfiguration)
 {
 }
コード例 #49
0
ファイル: IllusionTemple3.cs プロジェクト: psychicdoom/OpenMU
        /// <inheritdoc/>
        protected override IEnumerable <MonsterSpawnArea> CreateSpawns(IContext context, GameMapDefinition mapDefinition, GameConfiguration gameConfiguration)
        {
            var npcDictionary = gameConfiguration.Monsters.ToDictionary(npc => npc.Number, npc => npc);

            // NPCs:
            yield return(this.CreateMonsterSpawn(context, mapDefinition, npcDictionary[658], 1, 0, SpawnTrigger.AutomaticDuringEvent, 169, 169, 085, 085)); // Cursed Statue

            yield return(this.CreateMonsterSpawn(context, mapDefinition, npcDictionary[659], 1, 0, SpawnTrigger.AutomaticDuringEvent, 136, 136, 101, 101)); // Captured Stone Statue (1)

            yield return(this.CreateMonsterSpawn(context, mapDefinition, npcDictionary[660], 1, 0, SpawnTrigger.AutomaticDuringEvent, 151, 151, 119, 119)); // Captured Stone Statue (2)

            yield return(this.CreateMonsterSpawn(context, mapDefinition, npcDictionary[661], 1, 0, SpawnTrigger.AutomaticDuringEvent, 150, 150, 088, 088)); // Captured Stone Statue (3)

            yield return(this.CreateMonsterSpawn(context, mapDefinition, npcDictionary[662], 1, 0, SpawnTrigger.AutomaticDuringEvent, 165, 165, 102, 102)); // Captured Stone Statue (4)

            yield return(this.CreateMonsterSpawn(context, mapDefinition, npcDictionary[663], 1, 0, SpawnTrigger.AutomaticDuringEvent, 173, 173, 067, 067)); // Captured Stone Statue (5)

            yield return(this.CreateMonsterSpawn(context, mapDefinition, npcDictionary[664], 1, 0, SpawnTrigger.AutomaticDuringEvent, 187, 187, 081, 081)); // Captured Stone Statue (6)

            yield return(this.CreateMonsterSpawn(context, mapDefinition, npcDictionary[665], 1, 0, SpawnTrigger.AutomaticDuringEvent, 187, 187, 051, 051)); // Captured Stone Statue (7)

            yield return(this.CreateMonsterSpawn(context, mapDefinition, npcDictionary[666], 1, 0, SpawnTrigger.AutomaticDuringEvent, 203, 203, 067, 067)); // Captured Stone Statue (8)

            yield return(this.CreateMonsterSpawn(context, mapDefinition, npcDictionary[667], 1, 0, SpawnTrigger.AutomaticDuringEvent, 133, 133, 121, 121)); // Captured Stone Statue (9)

            yield return(this.CreateMonsterSpawn(context, mapDefinition, npcDictionary[668], 1, 0, SpawnTrigger.AutomaticDuringEvent, 206, 206, 048, 048)); // Captured Stone Statue (10)
        }
コード例 #50
0
ファイル: BalgassRefuge.cs プロジェクト: smokeelow/OpenMU
        /// <inheritdoc/>
        protected override IEnumerable <MonsterSpawnArea> CreateSpawns(IContext context, GameMapDefinition mapDefinition, GameConfiguration gameConfiguration)
        {
            var npcDictionary = gameConfiguration.Monsters.ToDictionary(npc => npc.Number, npc => npc);

            // Monsters:
            yield return(this.CreateMonsterSpawn(context, mapDefinition, npcDictionary[410], 1, 0, SpawnTrigger.Automatic, 104, 104, 179, 179)); // Death Spirit (Trainee Soldier)

            yield return(this.CreateMonsterSpawn(context, mapDefinition, npcDictionary[410], 1, 0, SpawnTrigger.Automatic, 104, 104, 200, 200)); // Death Spirit (Trainee Soldier)

            yield return(this.CreateMonsterSpawn(context, mapDefinition, npcDictionary[410], 1, 0, SpawnTrigger.Automatic, 085, 085, 179, 179)); // Death Spirit (Trainee Soldier)

            yield return(this.CreateMonsterSpawn(context, mapDefinition, npcDictionary[410], 1, 0, SpawnTrigger.Automatic, 086, 086, 199, 199)); // Death Spirit (Trainee Soldier)

            yield return(this.CreateMonsterSpawn(context, mapDefinition, npcDictionary[411], 1, 0, SpawnTrigger.Automatic, 092, 092, 174, 174)); // Soram (Trainee Soldier)

            yield return(this.CreateMonsterSpawn(context, mapDefinition, npcDictionary[411], 1, 0, SpawnTrigger.Automatic, 111, 111, 190, 190)); // Soram (Trainee Soldier)

            yield return(this.CreateMonsterSpawn(context, mapDefinition, npcDictionary[411], 1, 0, SpawnTrigger.Automatic, 094, 094, 202, 202)); // Soram (Trainee Soldier)

            yield return(this.CreateMonsterSpawn(context, mapDefinition, npcDictionary[411], 1, 0, SpawnTrigger.Automatic, 082, 082, 190, 190)); // Soram (Trainee Soldier)

            yield return(this.CreateMonsterSpawn(context, mapDefinition, npcDictionary[412], 1, 0, SpawnTrigger.Automatic, 097, 097, 187, 187)); // Dark Elf (Trainee Soldier)
        }
コード例 #51
0
ファイル: PythonGame.cs プロジェクト: splitandthechro/nginz
 public PythonGame Run(string className, GameConfiguration conf)
 {
     RunLoop (className, conf);
     return this;
 }
コード例 #52
0
ファイル: IllusionTemple3.cs プロジェクト: psychicdoom/OpenMU
 /// <inheritdoc/>
 protected override void CreateMonsters(IContext context, GameConfiguration gameConfiguration)
 {
     // no monsters here
 }
コード例 #53
0
        static bool AddGameToXML(string gameName, string gameProfileName, string executablePath, string executableName, string parameters)
        {
            // not running, just edit the XML
            if (GameConfiguration == null)
            {
                // no existing XML.
                return(false);
            }

            Set gameSet = GameConfiguration.FindSet(gameName);

            if (gameSet == null)
            {
                gameSet = new Set(gameName);
                GameConfiguration.Add(gameSet);
                gameSet.Add(new Setting("OpenGL", "1"));
                gameSet.Add(new Setting("Direct3D8", "1"));
                gameSet.Add(new Setting("Direct3D9", "1"));
                gameSet.Add(new Setting("Win32I Keyboard", "1"));
                gameSet.Add(new Setting("Win32I Mouse", "1"));
                gameSet.Add(new Setting("DirectInput8 Keyboard", "1"));
                gameSet.Add(new Setting("DirectInput8 Mouse", "1"));
                gameSet.Add(new Setting("modules", "auto"));
                gameSet.Add(new Setting("Background Mouse", "1"));
                gameSet.Add(new Setting("Keystroke Delay", "1"));
            }

            Set gameProfilesSet = gameSet.FindSet("Profiles");

            if (gameProfilesSet == null)
            {
                gameProfilesSet = new Set("Profiles");
                gameSet.Add(gameProfilesSet);
            }

            Set gameProfileSet = gameSet.FindSet(gameProfileName);

            if (gameProfileSet == null)
            {
                gameProfileSet = new Set(gameProfileName);
                gameProfilesSet.Add(gameProfileSet);
            }

            Setting setting = gameProfileSet.FindSetting("Executable");

            if (setting == null)
            {
                gameProfileSet.Add(new Setting("Executable", executableName));
            }
            else
            {
                setting.Value = executableName;
            }

            setting = gameProfileSet.FindSetting("Path");
            if (setting == null)
            {
                gameProfileSet.Add(new Setting("Path", executablePath));
            }
            else
            {
                setting.Value = executablePath;
            }

            setting = gameProfileSet.FindSetting("Parameters");
            if (setting == null)
            {
                if (!string.IsNullOrEmpty(parameters))
                {
                    gameProfileSet.Add(new Setting("Parameters", parameters));
                }
            }
            else
            {
                if (string.IsNullOrEmpty(parameters))
                {
                    gameProfileSet.Settings.Remove(setting);
                }
                else
                {
                    setting.Value = parameters;
                }
            }

            if (GameProfiles.FirstOrDefault(q => q.GameProfile.Equals(gameProfileName)) == null)
            {
                GameProfiles.Add(new InnerSpaceGameProfile()
                {
                    Game = gameName, GameProfile = gameProfileName
                });
            }

            GameConfiguration.Store(ISPath + @"\GameConfiguration.XML");
            return(true);
        }
コード例 #54
0
    public void setAndSaveLevelName(GameConfiguration.GameMap newMap, string cause = null)
    {
        if(!string.IsNullOrEmpty(cause))
        {
            Logger.Log("GameStateController::setAndSaveLevelName by "+cause, Logger.Level.DEBUG);
        }
        else
        {
            Logger.Log("GameStateController::setAndSaveLevelName", Logger.Level.DEBUG);
        }

        switch(newMap) {
            case GameConfiguration.GameMap.ADVENTURE1:
            case GameConfiguration.GameMap.SANDBOX1:
            case GameConfiguration.GameMap.SANDBOX2:
                //saving level name into MemoryManager
                //because GameStateController current instance will be destroyed during restart
                //whereas MemoryManager won't
                MemoryManager.get().configuration.gameMap = newMap;
                break;

            default:
                Logger.Log("GameStateController::setAndSaveLevelName unmanaged level="+newMap, Logger.Level.WARN);
                break;
        }
    }