Пример #1
0
        //static void CurrentDomain_FirstChanceException(object sender, System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs e) {
        //    //System.Windows.Forms.MessageBox.Show(e.Exception.ToString());
        //}

        /// <summary>
        /// Loads the game data.
        /// </summary>
        public static void LoadData()
        {
            // Load the main font
            Graphics.FontManager.InitFonts();

            IO.Options.Initialize();
            IO.Options.LoadOptions();
            IO.ControlLoader.LoadControls();

            // Load the initial skin
            Skins.SkinManager.ChangeActiveSkin(IO.Options.ActiveSkin);

            if (Globals.InDebugMode)
            {
                // Init the debug controls
                Globals.GameScreen.InitControls();
            }

            SdlDotNet.Widgets.Widgets.Initialize(
                SdlDotNet.Graphics.Video.Screen,
                SdlDotNet.Widgets.Widgets.ResourceDirectory,
                IO.Paths.FontPath + "tahoma.ttf",
                12
                );
            //SdlDotNet.Widgets.Settings.DefaultFont = ;
            //SdlDotNet.Widgets.WindowManager.Initialize(SdlDotNet.Graphics.Video.Screen);
            //SdlDotNet.Widgets.WindowManager.WindowSwitcherEnabled = false;
            GraphicsCache.LoadCache();
            Input.InputProcessor.Initialize();
            // Switch to the loading window
            SdlDotNet.Widgets.WindowManager.AddWindow(new winLoading());
            ((winLoading)WindowSwitcher.FindWindow("winLoading")).UpdateLoadText("Checking for updates...");
            DoUpdateCheck();
        }
Пример #2
0
        private static void DoUpdateCheck()
        {
#if !DEBUG
            Updater.UpdateEngine updateEngine = new Updater.UpdateEngine("clientpackagekey7wf8ysdch");
            Thread updateCheckThread          = new Thread(new ThreadStart(delegate()
            {
                try {
                    DeleteToDeleteFiles();
                    if (updateEngine.CheckForUpdates())
                    {
                        WindowSwitcher.FindWindow("winLoading").Visible = false;
                        SdlDotNet.Widgets.WindowManager.AddWindow(new Updater.winUpdater(updateEngine));
                        Windows.WindowSwitcher.UpdaterWindow.AlwaysOnTop = true;
                    }
                    else
                    {
                        PostUpdateLoad();
                    }
                } catch (Exception ex) {
                    PostUpdateLoad();
                }
            }));
            updateCheckThread.Start();
#else
            PostUpdateLoad();
#endif
        }
Пример #3
0
        private static void DoUpdateCheck()
        {
#if !DEBUG && !DISABLEUPDATER
            Thread updateCheckThread = new Thread(new ThreadStart(async delegate()
            {
                try
                {
                    var updater = new GitHubUpdater();

                    DeleteToDeleteFiles();

                    var result = await updater.CheckForUpdates();

                    if (result.Count > 0)
                    {
                        WindowSwitcher.FindWindow("winLoading").Visible = false;
                        SdlDotNet.Widgets.WindowManager.AddWindow(new Updater.winUpdater(updater, result, PostUpdateLoad));
                        Windows.WindowSwitcher.UpdaterWindow.AlwaysOnTop = true;
                    }
                    else
                    {
                        PostUpdateLoad();
                    }
                }
                catch (Exception ex)
                {
                    PostUpdateLoad();
                }
            }));
            updateCheckThread.Start();
#else
            PostUpdateLoad();
#endif
        }
Пример #4
0
 public static void OpenHouseEditor()
 {
     WindowSwitcher.GameWindow.inMapEditor = true;
     Logic.Graphics.Renderers.Screen.ScreenRenderer.RenderOptions.DisplayMapGrid       = IO.Options.MapGrid;
     Logic.Graphics.Renderers.Screen.ScreenRenderer.RenderOptions.DisplayAttributes    = IO.Options.DisplayAttributes;
     Logic.Graphics.Renderers.Screen.ScreenRenderer.RenderOptions.DisplayDungeonValues = IO.Options.DisplayDungeonValues;
     WindowSwitcher.GameWindow.EnableMapEditorWidgets(Enums.MapEditorLimitTypes.House, false);
     WindowSwitcher.FindWindow("winExpKit").Visible = false;
 }
Пример #5
0
 public static void CloseHouseEditor()
 {
     if (WindowSwitcher.GameWindow.inMapEditor)
     {
         WindowSwitcher.GameWindow.DisableMapEditorWidgets();
         WindowSwitcher.FindWindow("winExpKit").Visible = true;
         WindowSwitcher.GameWindow.inMapEditor          = false;
         Logic.Graphics.Renderers.Screen.ScreenRenderer.RenderOptions.DisplayMapGrid       = false;
         Logic.Graphics.Renderers.Screen.ScreenRenderer.RenderOptions.DisplayAttributes    = false;
         Logic.Graphics.Renderers.Screen.ScreenRenderer.RenderOptions.DisplayDungeonValues = false;
     }
 }
Пример #6
0
        private static void PostWelcomeLoad()
        {
            winLoading winLoading = WindowSwitcher.FindWindow("winLoading") as winLoading;

            if (winLoading == null)
            {
                winLoading = new winLoading();
                WindowSwitcher.AddWindow(winLoading);
            }

            // TODO: Add encryption key here
            Logic.Globals.Encryption = new Client.Logic.Security.Encryption();
            winLoading.UpdateLoadText("Connecting to server...");
            // Load TCP and connect to the server
            NetworkManager.InitializeTcp();
            NetworkManager.InitializePacketSecurity();
            NetworkManager.Connect();
            winLoading.Close();
            Windows.WindowSwitcher.ShowMainMenu();
            Globals.GameLoaded = true;
        }
Пример #7
0
        private static void PostUpdateLoad()
        {
            Music.Music.Initialize();
            Skins.SkinManager.PlaySkinMusic();
            winLoading winLoading = WindowSwitcher.FindWindow("winLoading") as winLoading;

            winLoading.UpdateLoadText("Loading game...");
            CheckFolders();
            LoadGuis();
            LoadGraphics();

            if (string.IsNullOrEmpty(IO.Options.ConnectionIP))
            {
                winLoading.Close();
                WindowSwitcher.AddWindow(new winWelcome(PostWelcomeLoad));
            }
            else
            {
                PostWelcomeLoad();
            }
        }
Пример #8
0
        private static void PostUpdateLoad()
        {
            Music.Music.Initialize();
            Skins.SkinManager.PlaySkinMusic();
            winLoading winLoading = WindowSwitcher.FindWindow("winLoading") as winLoading;

            winLoading.UpdateLoadText("Loading game...");
            CheckFolders();
            LoadGuis();
            LoadGraphics();

            // TODO: Add encryption key here
            Logic.Globals.Encryption = new Client.Logic.Security.Encryption();
            winLoading.UpdateLoadText("Connecting to server...");
            // Load TCP and connect to the server
            NetworkManager.InitializeTcp();
            NetworkManager.InitializePacketSecurity();
            NetworkManager.Connect();
            winLoading.Close();
            Windows.WindowSwitcher.ShowMainMenu();
            Globals.GameLoaded = true;
        }