/// <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() { // Initialize fonts Globals.Font14 = Content.Load <SpriteFont>("GeonBit.UI/themes/classic/fonts/Size14"); Globals.Font12 = Content.Load <SpriteFont>("GeonBit.UI/themes/classic/fonts/Size12"); Globals.Font10 = Content.Load <SpriteFont>("GeonBit.UI/themes/classic/fonts/Size10"); Globals.Font8 = Content.Load <SpriteFont>("GeonBit.UI/themes/classic/fonts/Size8"); for (var n = 0; n < Constants.MAX_PLAYERS; n++) { Types.Player[n] = new User(); } ctcp = new ClientTCP(); chd = new ClientData(); renderTarget = new RenderTarget2D(GraphicsDevice, GraphicsDevice.PresentationParameters.BackBufferWidth, GraphicsDevice.PresentationParameters.BackBufferHeight, false, GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24); Camera = new OrthographicCamera(new BoxingViewportAdapter(Window, GraphicsDevice, Globals.PreferredBackBufferWidth, Globals.PreferredBackBufferHeight)) { Position = new Vector2(-1000, -1000) }; chd.InitializeMessages(); ctcp.ConnectToServer(); Graphics.InitializeGraphics(Content); UserInterface.Initialize(Content, "classic"); UserInterface.Active.UseRenderTarget = true; IGUI.InitializeGUI(Content); MenuManager.ChangeMenu(MenuManager.Menu.Login); base.Initialize(); }
public void InitializeMessages() { ctcp = new ClientTCP(); packets = new Dictionary <int, Packet_> { { (int)SMessage, HandleMessage }, { (int)SPlayerData, DownloadData }, { (int)SAckRegister, GoodRegister }, { (int)SPulse, HandleServerPulse }, { (int)SFullData, GetStaticPulse }, { (int)SGalaxy, HandleGalaxy }, { (int)SItems, HandleItems }, { (int)SInventory, HandleInventory }, { (int)SPlayerUpdate, UpdateData }, { (int)SLevelUp, HandleExperience }, { (int)SNebulae, HandleNebulae } }; }