示例#1
0
文件: Main.cs 项目: RHY3756547/FreeSO
		internal static void RunGame()
		{
            var iPad = UIDevice.CurrentDevice.Model.Contains("iPad");
            //TODO: disable iPad retina somehow
            FSOEnvironment.ContentDir = "Content/";
			FSOEnvironment.GFXContentDir = "Content/iOS/";
			FSOEnvironment.UserDir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
			FSOEnvironment.Linux = true;
			FSOEnvironment.DirectX = false;
			FSOEnvironment.SoftwareKeyboard = true;
			FSOEnvironment.SoftwareDepth = true;
            FSOEnvironment.UseMRT = false;
			FSOEnvironment.UIZoomFactor = iPad?1:2;
            FSOEnvironment.DPIScaleFactor = iPad ? 2 : 1;
            FSO.Files.ImageLoader.UseSoftLoad = false;

            if (File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "The Sims Online.zip")))
                File.Delete(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "The Sims Online.zip"));

			var start = new GameStartProxy();
            start.SetPath(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "The Sims Online/TSOClient/"));//"/private/var/mobile/Documents/The Sims Online/TSOClient/");

            TSOGame game = new TSOGame();
            GameFacade.DirectX = false;
            FSO.LotView.World.DirectX = false;
            game.Run();

#if !__IOS__ && !__TVOS__
			game.Dispose();
#endif
        }
示例#2
0
 public void Start(bool useDX)
 {
     Game = new TSOGame();
     GameFacade.DirectX = useDX;
     World.DirectX      = useDX;
     Game.Run();
     Game.Dispose();
 }
示例#3
0
 public void Start(bool useDX)
 {
     TSOGame game = new TSOGame();
     GameFacade.DirectX = useDX;
     World.DirectX = useDX;
     game.Run();
     game.Dispose();
 }
示例#4
0
 public void Start(bool useDX)
 {
     using (TSOGame game = new TSOGame())
     {
         GameFacade.DirectX = useDX;
         World.DirectX      = useDX;
         game.Run();
     }
 }
示例#5
0
 public void Start(bool useDX)
 {
     using (TSOGame game = new TSOGame())
     {
         GameFacade.DirectX = useDX;
         World.DirectX      = useDX;
         game.Run(Microsoft.Xna.Framework.GameRunBehavior.Synchronous);
     }
 }
示例#6
0
文件: Program.cs 项目: Daribon/FreeSO
        public static void Main(string[] args)
        {
            Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
            AppDomain.CurrentDomain.UnhandledException +=new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

            //Controls whether the application is allowed to start.
            bool Exit = false;
            string Software = "";

            #if WINDOWS
            #endif

            if ((is64BitOperatingSystem == false) && (is64BitProcess == false))
                Software = "SOFTWARE";
            else
                Software = "SOFTWARE\\Wow6432Node";

            #region User resolution parmeters
            if (args.Length > 0)
            {
                int ScreenWidth = int.Parse(args[0].Split("x".ToCharArray())[0]);
                int ScreenHeight = int.Parse(args[0].Split("x".ToCharArray())[1]);

                GlobalSettings.Default.GraphicsWidth = ScreenWidth;
                GlobalSettings.Default.GraphicsHeight = ScreenHeight;

                // Client seems to bitch without one of these set
                if (args.Length >= 1)
                {
                    if (args[1].Equals("w", StringComparison.InvariantCultureIgnoreCase))
                        GlobalSettings.Default.Windowed = true;
                    else if (args[1].Equals("f", StringComparison.InvariantCultureIgnoreCase))
                        GlobalSettings.Default.Windowed = false;
                }
            }
            #endregion

            //Find the path to TSO on the user's system.
            RegistryKey softwareKey = Registry.LocalMachine.OpenSubKey(Software);

            if (Array.Exists(softwareKey.GetSubKeyNames(), delegate(string s) { return s.Equals("Maxis", StringComparison.InvariantCultureIgnoreCase); }))
            {
                RegistryKey maxisKey = softwareKey.OpenSubKey("Maxis");
                if (Array.Exists(maxisKey.GetSubKeyNames(), delegate(string s) { return s.Equals("The Sims Online", StringComparison.InvariantCultureIgnoreCase); }))
                {
                    RegistryKey tsoKey = maxisKey.OpenSubKey("The Sims Online");
                    string installDir = (string)tsoKey.GetValue("InstallDir");
                    installDir += "\\TSOClient\\";
                    GlobalSettings.Default.StartupPath = installDir;
                }
                else
                {
                    MessageBox.Show("Error TSO was not found on your system.");
                    Exit = true;
                }
            }
            else
            {
                MessageBox.Show("Error: No Maxis products were found on your system.");
                Exit = true;
            }

            GlobalSettings.Default.StartupPath = GlobalSettings.Default.StartupPath.Replace('\\', '/');

            if (!Exit)
            {
                using (TSOGame game = new TSOGame())
                {
                    GlobalSettings.Default.ClientVersion = GetClientVersion();
                    //This path should be used to store all files generated by the client, to avoid access conflicts.
                    GlobalSettings.Default.DocumentsPath =
                        System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\Project Dollhouse\\";

                    if (!Directory.Exists(GlobalSettings.Default.DocumentsPath))
                        Directory.CreateDirectory(GlobalSettings.Default.DocumentsPath);

                    game.Run();
                }
            }
        }
示例#7
0
        private void RunGame()
        {
            var disp = new DisplayMetrics();
            WindowManager.DefaultDisplay.GetMetrics(disp);

            var initSF = 1 + ((int)disp.DensityDpi / 200);
            var dpiScaleFactor = initSF;
            var width = Math.Max(disp.WidthPixels, disp.HeightPixels);
            var height = Math.Min(disp.WidthPixels, disp.HeightPixels);
            float uiZoomFactor = 1f;
            while (width / dpiScaleFactor < 800 && dpiScaleFactor > 1)
            {
                dpiScaleFactor--;
                uiZoomFactor = (initSF / dpiScaleFactor);
            }

            var iPad = ((int)disp.DensityDpi < 200);
            var docs = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments);
            CopyAssets("", docs);
            FSOEnvironment.ContentDir = Path.Combine(docs, "Content/"); //copied to storage
            FSOEnvironment.GFXContentDir = "Content/iOS/"; //in assets
            FSOEnvironment.UserDir = docs;
            FSOEnvironment.Linux = true;
            FSOEnvironment.DirectX = false;
            FSOEnvironment.SoftwareKeyboard = true;
            FSOEnvironment.SoftwareDepth = true;
            FSOEnvironment.UseMRT = false;
            FSOEnvironment.UIZoomFactor = uiZoomFactor;
            FSOEnvironment.DPIScaleFactor = dpiScaleFactor;
            FSO.Files.ImageLoader.UseSoftLoad = false;

            //below is just to get blueprint.dtd reading. Should be only thing using relative directories.
            Directory.SetCurrentDirectory(Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments), "Content/Blueprints/"));

            if (File.Exists(Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments), "The Sims Online.zip")))
                File.Delete(Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments), "The Sims Online.zip"));

            var start = new GameStartProxy();
            start.SetPath(Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments), "The Sims Online/TSOClient/"));

            TSOGame game = new TSOGame();
            new Microsoft.Xna.Framework.GamerServices.GamerServicesComponent(game);
            GameFacade.DirectX = false;
            World.DirectX = false;
            SetContentView((View)game.Services.GetService(typeof(View)));
            game.Run();
        }