예제 #1
0
        public void Init(Config config)
        {
            this.render = new XNARender2(this.graphics, this.game.GraphicsDevice);
            this.xnaInput = new XNAInput(this.game.Window, this.game.GraphicsDevice, this.game);
            this.xnaAudio = new XNAAudio();
            this.render.Init();

            this.worldEngine = new WorldEngine(new XNAPlatform(this.game, this.graphics), this.render, null);
            this.worldEngine.FilesSystem.AddFilesProvider(new XNAContentStoreProvider(this.game.Content.RootDirectory, null));
            this.worldEngine.Shaders.RegisterTextureLoader(new XNAContentTextureLoader(this.game.Content, this.game.Content.RootDirectory, null));
            this.worldEngine.Init(this.game, this.game.Window.Handle, this.game.Content.RootDirectory, this.xnaInput, this.xnaAudio, "ui/themes/wp7", null);
            this.worldEngine.UIEngine.RegisterWindowType(new OptionsWindowCreator(config, this.graphics), OptionsWindow.TypeName);
            this.worldEngine.UIEngine.RegisterWindowType(new SelectGameWindowCreator(config), SelectGameWindow.TypeName);
            this.worldEngine.MainDesktop.Desktop.DrawCursor = false;
            this.worldEngine.ProgressHandler.ProgressStarted();
            this.worldEngine.ProgressHandler.ProgressMessage("");
            this.worldEngine.HudVisible = false;
            this.worldEngine.ShowFps = true;

            this.game.IsMouseVisible = true;
            this.game.IsFixedTimeStep = false;

            this.worldEngine.UIEngine.RegisterControlsCreator(new BindKeyInputControlsCreator(this.game), BindKeyInput.TypeName, typeof(BindKeyInput));
            this.worldEngine.UIEngine.RegisterPropertyCreator(new IPropertyCreatorTemplate<BindPropertyKey>(), BindPropertyKey.TypeName);

            this.statusDesktop = this.worldEngine.UIEngine.NewDesktop("", "ui/themes/wp7/");
            this.statusWindow = new StatusWindow(this.statusDesktop, this.graphics.GraphicsDevice);
            this.statusDesktop.AddWindow(this.statusWindow);
            this.statusDesktop.DrawCursor = false;
            this.worldEngine.MainDesktop.Desktop.CursorChanged += this.MainDesktopCursorChanged;
            this.worldEngine.ProgressHandler.ProgressFinished();
        }
예제 #2
0
        private static void AddHaloReach(Config config)
        {
            Bindings bindings = new Bindings("Halo Reach");

            bindings.KeyBindings.Clear();
            bindings.KeyBindings.Add(new Bind(X360Keys.Guide, Keys.D1));
            bindings.KeyBindings.Add(new Bind(X360Keys.LS, Keys.Space));
            bindings.KeyBindings.Add(new Bind(X360Keys.Back, Keys.Tab));
            bindings.KeyBindings.Add(new Bind(X360Keys.Start, Keys.Escape));
            bindings.KeyBindings.Add(new Bind(X360Keys.Left, Keys.Left));
            bindings.KeyBindings.Add(new Bind(X360Keys.Right, Keys.Right));
            bindings.KeyBindings.Add(new Bind(X360Keys.Up, Keys.Up));
            bindings.KeyBindings.Add(new Bind(X360Keys.Down, Keys.Down));
            bindings.KeyBindings.Add(new Bind(X360Keys.RS, Keys.W));
            bindings.KeyBindings.Add(new Bind(X360Keys.B, Keys.F));
            bindings.KeyBindings.Add(new Bind(X360Keys.X, Keys.E));
            bindings.KeyBindings.Add(new Bind(X360Keys.Y, MouseKey.MouseWheelUp));
            bindings.KeyBindings.Add(new Bind(X360Keys.RB, Keys.LeftAlt));
            bindings.KeyBindings.Add(new Bind(X360Keys.A, Keys.A));
            bindings.KeyBindings.Add(new Bind(X360Keys.LB, Keys.LeftControl));
            bindings.KeyBindings.Add(new Bind(X360Keys.LSLeft, Keys.S));
            bindings.KeyBindings.Add(new Bind(X360Keys.LSRight, Keys.D));
            bindings.KeyBindings.Add(new Bind(X360Keys.LSDown, Keys.X));
            bindings.KeyBindings.Add(new Bind(X360Keys.LT, Keys.G));
            bindings.KeyBindings.Add(new Bind(X360Keys.LSUp, MouseKey.MouseRight));
            bindings.KeyBindings.Add(new Bind(X360Keys.RT, MouseKey.MouseLeft));

            config.Games.Add(bindings);
        }
예제 #3
0
파일: Config.cs 프로젝트: glocklueng/px360
        internal static Config Load(String fileName)
        {
#if WINDOWS
            try
            {
                using (IsolatedStorageFile store = IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Assembly, null, null))
                {
                    using (IsolatedStorageFileStream stream = new IsolatedStorageFileStream(fileName, FileMode.Open, store))
                    {
                        XmlSerializer serializer = new XmlSerializer(typeof(Config));
                        return (Config)serializer.Deserialize(stream);
                    }
                }
            }
            catch (Exception)
            {
                Config config = new Config();

                DefaultBindings.AddDefaultBindings(config);

                return config;
            }
#else
            Config config = new Config();

            config.bindings.Add(new Bindings("Default game"));

            return config;
#endif
        }
예제 #4
0
 public static void AddDefaultBindings(Config config)
 {
     AddDashboard(config);
     AddHalo1(config);
     AddHalo3(config);
     AddHaloODST(config);
     AddHaloReach(config);
     AddTDU2(config);
 }
예제 #5
0
        private void RemoteServerPortChanged(Config config, EventArgs args)
        {
            Stop();

            this.port = config.RemoteServerPort;

            if (port > 0)
            {
                Start();
            }
        }
예제 #6
0
파일: Config.cs 프로젝트: glocklueng/px360
        private static void Save(Config config, String fileName)
        {
#if WINDOWS
            using (IsolatedStorageFile store = IsolatedStorageFile.GetStore(IsolatedStorageScope.User| IsolatedStorageScope.Assembly, null, null))
            {
                using (IsolatedStorageFileStream stream = new IsolatedStorageFileStream(fileName, FileMode.Create, store))
                {
                    XmlSerializer formatter = new XmlSerializer(config.GetType());
                    formatter.Serialize(stream, config);
                }
            }
#endif
        }
예제 #7
0
파일: Config.cs 프로젝트: glocklueng/px360
        /// <summary>
        /// Saves settings o nthe thead while displaying spinner window.
        /// </summary>
        /// <param name="desktop">desktop to which attch saving window</param>
        /// <param name="config">config to save</param>
        internal static void Save(Desktop desktop, Config config)
        {
            Window window = desktop.NewWindow("g_ui/main_menu/saving.window.xml");

            window.Visible = true;

            Thread thread = new Thread(new ThreadStart(() => 
            {
                Config.Save(config, "x360.xonfig.xml");

                Thread.Sleep(100);

                window.Close(); 
            }));

            thread.Start();
        }
예제 #8
0
        public RemoteService(Controller controller, Config config)
        {
            this.controller = controller;

            config.RemoteServerChanged += this.RemoteServerPortChanged;
        }
예제 #9
0
 private void ArduinoPortChanged(Config config, EventArgs e)
 {
     ChangePort(config.ArduinoPort);
 }
예제 #10
0
 public Controller(Config config)
 {
     this.config = config;
     this.config.ArduinoPortChanged += this.ArduinoPortChanged;
     this.state = new X360State(this.config);
 }
예제 #11
0
 public X360State(Config config)
 {
     this.config = config;
 }