Init() public static méthode

public static Init ( ) : void
Résultat void
Exemple #1
0
        /// <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()
        {
            OperatingSystem os  = Environment.OSVersion;
            PlatformID      pid = os.Platform;

            GameFacade.Linux = (pid == PlatformID.MacOSX || pid == PlatformID.Unix);

            FSO.Content.Content.Init(GlobalSettings.Default.StartupPath, GraphicsDevice);
            base.Initialize();

            GameFacade.SoundManager = new FSO.Client.Sound.SoundManager();
            GameFacade.GameThread   = Thread.CurrentThread;

            SceneMgr = new _3DLayer();
            SceneMgr.Initialize(GraphicsDevice);

            GameFacade.Controller            = new GameController();
            GameFacade.Screens               = uiLayer;
            GameFacade.Scenes                = SceneMgr;
            GameFacade.GraphicsDevice        = GraphicsDevice;
            GameFacade.GraphicsDeviceManager = Graphics;
            GameFacade.Cursor                = new CursorManager(this.Window);
            if (!GameFacade.Linux)
            {
                GameFacade.Cursor.Init(FSO.Content.Content.Get().GetPath(""));
            }

            /** Init any computed values **/
            GameFacade.Init();

            GameFacade.Strings = new ContentStrings();
            GameFacade.Controller.StartLoading();

            GraphicsDevice.RasterizerState = new RasterizerState()
            {
                CullMode = CullMode.None
            };

            if (!GameFacade.Linux)
            {
                BassNet.Registration("*****@*****.**", "2X3163018312422");
                Bass.BASS_Init(-1, 8000, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero, System.Guid.Empty);
            }

            this.IsMouseVisible = true;

            this.IsFixedTimeStep = true;

            WorldContent.Init(this.Services, Content.RootDirectory);

            base.Screen.Layers.Add(SceneMgr);
            base.Screen.Layers.Add(uiLayer);
            GameFacade.LastUpdateState = base.Screen.State;
            if (!GlobalSettings.Default.Windowed)
            {
                Graphics.ToggleFullScreen();
            }
        }
Exemple #2
0
        /// <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()
        {
            var kernel = new StandardKernel(
                new RegulatorsModule(),
                new NetworkModule(),
                new CacheModule()
                );

            FSOFacade.Kernel = kernel;

            var settings = GlobalSettings.Default;

            if (FSOEnvironment.SoftwareDepth)
            {
                settings.GraphicsWidth  = (int)(GraphicsDevice.Viewport.Width / FSOEnvironment.DPIScaleFactor);
                settings.GraphicsHeight = (int)(GraphicsDevice.Viewport.Height / FSOEnvironment.DPIScaleFactor);
            }

            //manage settings
            if (settings.LightingMode == -1)
            {
                if (settings.Lighting)
                {
                    if (settings.Shadows3D)
                    {
                        settings.LightingMode = 2;
                    }
                    else
                    {
                        settings.LightingMode = 1;
                    }
                }
                else
                {
                    settings.LightingMode = 0;
                }
                settings.Save();
            }

            LotView.WorldConfig.Current = new LotView.WorldConfig()
            {
                LightingMode    = settings.LightingMode,
                SmoothZoom      = settings.SmoothZoom,
                SurroundingLots = settings.SurroundingLotMode,
                AA = settings.AntiAlias,
            };

            FeatureLevelTest.UpdateFeatureLevel(GraphicsDevice);

            if (!FSOEnvironment.TexCompressSupport)
            {
                settings.TexCompression = 0;
            }
            else if ((settings.TexCompression & 2) == 0)
            {
                settings.TexCompression = 1;
            }
            FSOEnvironment.TexCompress = (!IffFile.RETAIN_CHUNK_DATA) && (settings.TexCompression & 1) > 0;
            //end settings management

            OperatingSystem os  = Environment.OSVersion;
            PlatformID      pid = os.Platform;

            GameFacade.Linux = (pid == PlatformID.MacOSX || pid == PlatformID.Unix);

            FSO.Content.Content.TS1Hybrid         = GlobalSettings.Default.TS1HybridEnable;
            FSO.Content.Content.TS1HybridBasePath = GlobalSettings.Default.TS1HybridPath;
            FSO.Content.Content.Init(GlobalSettings.Default.StartupPath, GraphicsDevice);
            VMContext.InitVMConfig();
            base.Initialize();

            GameFacade.GameThread = Thread.CurrentThread;

            SceneMgr = new _3DLayer();
            SceneMgr.Initialize(GraphicsDevice);

            FSOFacade.Controller             = kernel.Get <GameController>();
            GameFacade.Screens               = uiLayer;
            GameFacade.Scenes                = SceneMgr;
            GameFacade.GraphicsDevice        = GraphicsDevice;
            GameFacade.GraphicsDeviceManager = Graphics;
            GameFacade.Emojis                = new Common.Rendering.Emoji.EmojiProvider(GraphicsDevice);
            GameFacade.Cursor                = new CursorManager(GraphicsDevice);
            if (!GameFacade.Linux)
            {
                GameFacade.Cursor.Init(FSO.Content.Content.Get().GetPath(""), false);
            }

            /** Init any computed values **/
            GameFacade.Init();

            //init audio now
            HITVM.Init();
            var hit = HITVM.Get();

            hit.SetMasterVolume(HITVolumeGroup.FX, GlobalSettings.Default.FXVolume / 10f);
            hit.SetMasterVolume(HITVolumeGroup.MUSIC, GlobalSettings.Default.MusicVolume / 10f);
            hit.SetMasterVolume(HITVolumeGroup.VOX, GlobalSettings.Default.VoxVolume / 10f);
            hit.SetMasterVolume(HITVolumeGroup.AMBIENCE, GlobalSettings.Default.AmbienceVolume / 10f);

            GameFacade.Strings = new ContentStrings();
            FSOFacade.Controller.StartLoading();

            GraphicsDevice.RasterizerState = new RasterizerState()
            {
                CullMode = CullMode.None
            };

            try {
                var audioTest = new SoundEffect(new byte[2], 44100, AudioChannels.Mono); //initialises XAudio.
                audioTest.CreateInstance().Play();
            } catch (Exception e)
            {
                //MessageBox.Show("Failed to initialize audio: \r\n\r\n" + e.StackTrace);
            }

            this.IsMouseVisible  = true;
            this.IsFixedTimeStep = true;

            WorldContent.Init(this.Services, Content.RootDirectory);
            DGRP3DMesh.InitRCWorkers();
            if (!FSOEnvironment.SoftwareKeyboard)
            {
                AddTextInput();
            }
            base.Screen.Layers.Add(SceneMgr);
            base.Screen.Layers.Add(uiLayer);
            GameFacade.LastUpdateState = base.Screen.State;
            //Bind ninject objects
            kernel.Bind <FSO.Content.Content>().ToConstant(FSO.Content.Content.Get());
            kernel.Load(new ClientDomainModule());

            //Have to be eager with this, it sets a singleton instance on itself to avoid packets having
            //to be created using Ninject for performance reasons
            kernel.Get <cTSOSerializer>();
            var ds = kernel.Get <DataService>();

            ds.AddProvider(new ClientAvatarProvider());

            this.Window.Title = "FreeSO";
            DiscordRpcEngine.Init();

            if (!GlobalSettings.Default.Windowed && !GameFacade.GraphicsDeviceManager.IsFullScreen)
            {
                GameFacade.GraphicsDeviceManager.ToggleFullScreen();
            }
        }
Exemple #3
0
        /// <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()
        {
            OperatingSystem os  = Environment.OSVersion;
            PlatformID      pid = os.Platform;

            GameFacade.Linux = (pid == PlatformID.MacOSX || pid == PlatformID.Unix);

            FSO.Content.Content.Init(GlobalSettings.Default.StartupPath, GraphicsDevice);
            base.Initialize();

            GameFacade.GameThread = Thread.CurrentThread;

            SceneMgr = new _3DLayer();
            SceneMgr.Initialize(GraphicsDevice);

            GameFacade.Controller            = new GameController();
            GameFacade.Screens               = uiLayer;
            GameFacade.Scenes                = SceneMgr;
            GameFacade.GraphicsDevice        = GraphicsDevice;
            GameFacade.GraphicsDeviceManager = Graphics;
            GameFacade.Cursor                = new CursorManager(this.Window);
            if (!GameFacade.Linux)
            {
                GameFacade.Cursor.Init(FSO.Content.Content.Get().GetPath(""));
            }

            /** Init any computed values **/
            GameFacade.Init();

            //init audio now
            HITVM.Init();

            GameFacade.Strings = new ContentStrings();
            GameFacade.Controller.StartLoading();

            GraphicsDevice.RasterizerState = new RasterizerState()
            {
                CullMode = CullMode.None
            };

            try {
                var audioTest = new SoundEffect(new byte[2], 44100, AudioChannels.Mono); //initialises XAudio.
                audioTest.CreateInstance().Play();
            } catch (Exception e)
            {
                MessageBox.Show("Failed to initialize audio: \r\n\r\n" + e.StackTrace);
            }

            this.IsMouseVisible  = true;
            this.IsFixedTimeStep = true;

            WorldContent.Init(this.Services, Content.RootDirectory);

            base.Screen.Layers.Add(SceneMgr);
            base.Screen.Layers.Add(uiLayer);
            GameFacade.LastUpdateState = base.Screen.State;
            this.Window.TextInput     += GameScreen.TextInput;
            this.Window.Title          = "FreeSO";

            if (!GlobalSettings.Default.Windowed)
            {
                GameFacade.GraphicsDeviceManager.ToggleFullScreen();
            }
        }
Exemple #4
0
        /// <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()
        {
            if (FSOEnvironment.DPIScaleFactor != 1 || FSOEnvironment.SoftwareDepth)
            {
                GlobalSettings.Default.GraphicsWidth  = GraphicsDevice.Viewport.Width / FSOEnvironment.DPIScaleFactor;
                GlobalSettings.Default.GraphicsHeight = GraphicsDevice.Viewport.Height / FSOEnvironment.DPIScaleFactor;
            }

            OperatingSystem os  = Environment.OSVersion;
            PlatformID      pid = os.Platform;

            GameFacade.Linux = (pid == PlatformID.MacOSX || pid == PlatformID.Unix);

            FSO.Content.Content.Init(GlobalSettings.Default.StartupPath, GraphicsDevice);
            base.Initialize();

            GameFacade.GameThread = Thread.CurrentThread;

            SceneMgr = new _3DLayer();
            SceneMgr.Initialize(GraphicsDevice);

            uiLayer = new UILayer(this, Font, BigFont);
            GameFacade.Controller            = new GameController();
            GameFacade.Screens               = uiLayer;
            GameFacade.Scenes                = SceneMgr;
            GameFacade.GraphicsDevice        = GraphicsDevice;
            GameFacade.GraphicsDeviceManager = Graphics;
            GameFacade.Cursor                = new CursorManager(this.Window);
            if (!GameFacade.Linux)
            {
                GameFacade.Cursor.Init(FSO.Content.Content.Get().GetPath(""));
            }

            /** Init any computed values **/
            GameFacade.Init();

            //init audio now
            HITVM.Init();

            GameFacade.Strings = new ContentStrings();
            GameFacade.Controller.StartLoading();

            GraphicsDevice.RasterizerState = new RasterizerState()
            {
                CullMode = CullMode.None
            };

            try {
                var audioTest = new SoundEffect(new byte[2], 44100, AudioChannels.Mono); //initialises XAudio.
                audioTest.CreateInstance().Play();
            } catch (Exception e)
            {
                e = new Exception();
            }

            this.IsMouseVisible           = true;
            this.IsFixedTimeStep          = true;
            this.Window.AllowUserResizing = true;

            this.Window.ClientSizeChanged += new EventHandler <EventArgs>(Window_ClientSizeChanged);


            if (!FSOEnvironment.SoftwareKeyboard)
            {
                AddTextInput();
            }
            base.Screen.Layers.Add(SceneMgr);
            base.Screen.Layers.Add(uiLayer);
            GameFacade.LastUpdateState = base.Screen.State;

            //this.Window.Title = "FreeSO";

            if (!GlobalSettings.Default.Windowed && !GameFacade.GraphicsDeviceManager.IsFullScreen)
            {
                GameFacade.GraphicsDeviceManager.ToggleFullScreen();
            }
        }