コード例 #1
0
        /// <summary>
        /// On load, get GUI ready.
        /// </summary>
        public void Frmmenu_Load(object sender, EventArgs e)
        {
            Strings.Init(0, "English");

            LoadMenuGraphics();

            pnlLoad.Width  = 730;
            pnlLoad.Height = 550;

            Width         = 730;
            pnlLogin.Top  = pnlMainMenu.Top;
            pnlLogin.Left = pnlMainMenu.Left;

            pnlNewChar.Top  = pnlMainMenu.Top;
            pnlNewChar.Left = pnlMainMenu.Left;

            pnlRegister.Top  = pnlMainMenu.Top;
            pnlRegister.Left = pnlMainMenu.Left;

            pnlCredits.Top  = pnlMainMenu.Top;
            pnlCredits.Left = pnlMainMenu.Left;

            pnlIPConfig.Top  = pnlMainMenu.Top;
            pnlIPConfig.Left = pnlMainMenu.Left;

            pnlCharSelect.Top  = pnlMainMenu.Top;
            pnlCharSelect.Left = pnlMainMenu.Left;

            if (C_General.Started == false)
            {
                C_General.Startup();
            }

            C_NetworkConfig.Connect();
        }
コード例 #2
0
        internal static void DestroyGame(bool restart = false)
        {
            //SendLeaveGame()
            // break out of GameLoop
            if (restart)
            {
                RestartGame();
            }
            else
            {
                C_Variables.InGame = false;

                C_Graphics.DestroyGraphics();
                C_UpdateUI.GameDestroyed = true;
                C_NetworkConfig.DestroyNetwork();
                Application.Exit();
                ProjectData.EndApp();
            }
        }
コード例 #3
0
        internal static bool ConnectToServer(int i)
        {
            bool returnValue = false;
            int  Until;

            returnValue = false;

            // Check to see if we are already connected, if so just exit
            if (C_NetworkConfig.Socket.IsConnected)
            {
                return(true);
            }

            if (i == 4)
            {
                return(returnValue);
            }
            Until = GetTickCount() + 3500;

            C_NetworkConfig.Connect();

            SetStatus(Strings.Get("mainmenu", "connectserver", i));

            // Wait until connected or a few seconds have passed and report the server being down
            while ((!C_NetworkConfig.Socket.IsConnected) && (GetTickCount() <= Until))
            {
                Application.DoEvents();
                Thread.Sleep(10);
            }

            // return value
            if (C_NetworkConfig.Socket.IsConnected)
            {
                returnValue = true;
            }

            if (returnValue)
            {
                ConnectToServer(i + 1);
            }

            return(returnValue);
        }
コード例 #4
0
        public static void Startup()
        {
            SFML.Portable.Activate();

            SetStatus(Strings.Get("loadscreen", "loading"));

            FrmMenu.Default.Visible = true;

            Application.DoEvents();

            C_Types.CharSelection = new C_Types.CharSelRec[4];

            C_Types.Player = new C_Types.PlayerRec[Constants.MAX_PLAYERS + 1];

            for (var i = 1; i <= Constants.MAX_PLAYERS; i++)
            {
                C_Player.ClearPlayer(i);
            }

            C_AutoTiles.ClearAutotiles();

            //Housing
            C_Housing.House       = new C_Housing.HouseRec[C_Housing.MaxHouses + 1];
            C_Housing.HouseConfig = new C_Housing.HouseRec[C_Housing.MaxHouses + 1];

            //quests
            C_Quest.ClearQuests();

            //npc's
            C_DataBase.ClearNpcs();
            C_Maps.Map.Npc = new int[Constants.MAX_MAP_NPCS + 1];
            C_Maps.MapNpc  = new C_Types.MapNpcRec[Constants.MAX_MAP_NPCS + 1];
            for (var i = 0; i <= Constants.MAX_MAP_NPCS; i++)
            {
                for (var x = 0; x <= (int)Enums.VitalType.Count - 1; x++)
                {
                    C_Maps.MapNpc[(int)i].Vital = new int[(int)x + 1];
                }
            }

            C_Shops.ClearShops();

            C_DataBase.ClearAnimations();

            C_DataBase.ClearAnimInstances();

            C_Banks.ClearBank();

            C_Projectiles.MapProjectiles = new C_Projectiles.MapProjectileRec[C_Projectiles.MaxProjectiles + 1];
            C_Projectiles.Projectiles    = new C_Projectiles.ProjectileRec[C_Projectiles.MaxProjectiles + 1];

            C_Items.ClearItems();

            //craft
            C_Crafting.ClearRecipes();

            //party
            C_Parties.ClearParty();

            //pets
            C_Pets.ClearPets();

            C_Variables.GettingMap = true;
            C_Variables.VbQuote    = System.Convert.ToString((char)34);           // "

            // Update the form with the game's name before it's loaded
            FrmGame.Default.Text = C_Constants.GameName;

            SetStatus(Strings.Get("loadscreen", "options"));

            // load options
            if (File.Exists(Application.StartupPath + "\\Data\\Config.xml"))
            {
                C_DataBase.LoadOptions();
            }
            else
            {
                C_DataBase.CreateOptions();
            }

            // randomize rnd's seed
            VBMath.Randomize();

            SetStatus(Strings.Get("loadscreen", "network"));

            FrmMenu.Default.Text = C_Constants.GameName;

            // DX7 Master Object is already created, early binding
            SetStatus(Strings.Get("loadscreen", "graphics"));
            C_Maps.CheckTilesets();
            C_DataBase.CheckCharacters();
            C_DataBase.CheckPaperdolls();
            C_DataBase.CheckAnimations();
            C_Items.CheckItems();
            C_Resources.CheckResources();
            C_DataBase.CheckSkillIcons();
            C_DataBase.CheckFaces();
            C_DataBase.CheckFog();
            C_DataBase.CacheMusic();
            C_DataBase.CacheSound();
            C_DataBase.CheckEmotes();
            C_DataBase.CheckPanoramas();
            C_Housing.CheckFurniture();
            C_Projectiles.CheckProjectiles();
            C_DataBase.CheckParallax();

            C_Graphics.InitGraphics();

            // check if we have main-menu music
            if (C_Types.Options.Music == 1 && C_Types.Options.MenuMusic.Trim().Length > 0)
            {
                C_Sound.PlayMusic(C_Types.Options.MenuMusic.Trim());
                C_Sound.MusicPlayer.Volume = 100;
            }

            // Reset values
            C_Variables.Ping = -1;

            // set values for directional blocking arrows
            C_Variables.DirArrowX[1] = 12;             // up
            C_Variables.DirArrowY[1] = 0;

            C_Variables.DirArrowX[2] = 12;             // down
            C_Variables.DirArrowY[2] = 23;

            C_Variables.DirArrowX[3] = 0;             // left
            C_Variables.DirArrowY[3] = 12;

            C_Variables.DirArrowX[4] = 23;             // right
            C_Variables.DirArrowY[4] = 12;

            //set gui switches
            C_UpdateUI.HudVisible = true;

            SetStatus(Strings.Get("loadscreen", "starting"));
            Started = true;
            C_UpdateUI.Frmmenuvisible = true;
            C_UpdateUI.Pnlloadvisible = false;

            //C_UpdateUI.PnlInventoryVisible = true;

            C_NetworkConfig.InitNetwork();

            C_GameLogic.GameLoop();
        }