Exemplo n.º 1
0
        // sets up the host game form
        private void SetUpHostGameForm()
        {
            lock (_lock_guiSetUp)
            {
                // load the form config
                FormConfig formConfig = FormConfig.FromStream(Engine.Instance.Content.GetAsset <Stream>("Core:XML/Interface/Menu/Host"));
                // setup the form
                canvas.RemoveChild(frm_hostGame);
                frm_hostGame = new Form(formConfig, canvas);
                frm_hostGame.CentreControl();

                // get and setup the form elements
                tbAddress         = (TextBox)frm_hostGame.GetChildByName("tbAddress");
                tbAddress.Text    = "Retrieving WAN Address...";
                tbAddress.ToolTip = new ToolTip("This is your public IP address that people can use join to join your game over the internet".ToRichText(), 500);
                SetCurrentAddressAsync();
                tbPort             = (TextBox)frm_hostGame.GetChildByName("tbPort");
                tbPort.Text        = "7894";
                tbPort.ToolTip     = new ToolTip("You need to forward this TCP port to play over the internet".ToRichText(), 500);
                tbUsername         = (TextBox)frm_hostGame.GetChildByName("tbUsername");
                tbUsername.Text    = Environment.MachineName;
                tbUsername.ToolTip = new ToolTip("This is the name other players will see you as".ToRichText(), 500);
                tbPassword         = (TextBox)frm_hostGame.GetChildByName("tbPassword");
                tbPassword.Text    = "dog";
                tbPassword.ToolTip = new ToolTip("This is the password people will need to join your lobby".ToRichText(), 500);
                Button btnBack = (Button)frm_hostGame.GetChildByName("btnBack");
                btnBack.MouseClick += Host_BtnBack_MouseClick;
                Button btnHost = (Button)frm_hostGame.GetChildByName("btnHost");
                btnHost.MouseClick += Host_BtnHost_MouseClick;
            }
        }
Exemplo n.º 2
0
 public GUI_Settings(Canvas canvas)
 {
     this.canvas         = canvas;
     configGameSettings  = FormConfig.FromStream(Engine.Instance.Content.GetAsset <Stream>("Core:XML/Interface/Menu/Settings_GameSettings"));
     configVideoSettings = FormConfig.FromStream(Engine.Instance.Content.GetAsset <Stream>("Core:XML/Interface/Menu/Settings_VideoSettings"));
     configAudioSettings = FormConfig.FromStream(Engine.Instance.Content.GetAsset <Stream>("Core:XML/Interface/Menu/Settings_AudioSettings"));
 }
Exemplo n.º 3
0
 public GUI_GameMenu(Client client, SceneGame sceneGame, Canvas canvas)
 {
     // get the form config
     formConfig     = FormConfig.FromStream(Engine.Instance.Content.GetAsset <Stream>("Core:XML/Interface/Game/GameMenu"));
     guiSettings    = new GUI_Settings(canvas);
     this.client    = client;
     this.sceneGame = sceneGame;
     this.canvas    = canvas;
 }
Exemplo n.º 4
0
 public GUI_UnitList(Client client, SceneGame sceneGame, Canvas canvas)
 {
     // load the form config
     formConfig           = FormConfig.FromStream(Engine.Instance.Content.GetAsset <Stream>("Core:XML/Interface/Game/UnitList"));
     this.client          = client;
     this.sceneGame       = sceneGame;
     this.canvas          = canvas;
     client.UnitsUpdated += Client_UnitsUpdated;
     RebuildUnitList(client.GetMyUnits());
 }
Exemplo n.º 5
0
 public GUI_CityList(Client client, SceneGame sceneGame, Canvas canvas)
 {
     // load the form configs
     formConfig            = FormConfig.FromStream(Engine.Instance.Content.GetAsset <Stream>("Core:XML/Interface/Game/CityList"));
     this.client           = client;
     this.sceneGame        = sceneGame;
     this.canvas           = canvas;
     client.CitiesUpdated += Client_CitiesUpdated;
     client.CityUpdated   += Client_CityUpdated;
     client.CityAdded     += Client_CityUpdated;
     client.CityRemoved   += Client_CityUpdated;
     RebuildCityList(client.GetMyCities());
 }
Exemplo n.º 6
0
        public GUI_StatusBar(Client client, SceneGame sceneGame, Canvas canvas)
        {
            this.client    = client;
            this.sceneGame = sceneGame;
            this.canvas    = canvas;

            // get form config
            formConfig = FormConfig.FromStream(Engine.Instance.Content.GetAsset <Stream>("Core:XML/Interface/Game/StatusBar"));

            // register events
            client.PlayerUpdated += (s, a) => UpdateResourceLabel();

            Show();
        }
Exemplo n.º 7
0
 public GUI_CityManagment(Client client, SceneGame sceneGame, Canvas canvas)
 {
     // load form configs
     frmFocusConfig      = FormConfig.FromStream(Engine.Instance.Content.GetAsset <Stream>("Core:XML/Interface/Game/City_FocusPane"));
     frmProductionConfig = FormConfig.FromStream(Engine.Instance.Content.GetAsset <Stream>("Core:XML/Interface/Game/City_ProductionPane"));
     frmStatsConfig      = FormConfig.FromStream(Engine.Instance.Content.GetAsset <Stream>("Core:XML/Interface/Game/City_StatsPane"));
     frmReturnBuyConfig  = FormConfig.FromStream(Engine.Instance.Content.GetAsset <Stream>("Core:XML/Interface/Game/City_ReturnBuyPane"));
     this.client         = client;
     this.sceneGame      = sceneGame;
     this.canvas         = canvas;
     // register events
     client.SelectedCityChnaged += (s, a) => Show();
     client.CityUpdated         += (s, a) => Show();
 }
Exemplo n.º 8
0
        public GUI_SocialPolicy(Client client, SceneGame sceneGame, Canvas canvas)
        {
            // load the form config
            formConfig     = FormConfig.FromStream(Engine.Instance.Content.GetAsset <Stream>("Core:XML/Interface/Game/SocialPolicy"));
            this.client    = client;
            this.sceneGame = sceneGame;
            this.canvas    = canvas;

            client.PlayerUpdated += (s, a) =>
            {
                if (Visible)
                {
                    Show();
                }
            };

            // load sprites
            policyLockedSprite   = Engine.Instance.Content.GetAsset <Sprite>("Core:Textures/Interface/Tech_Locked");
            policyUnlockedSprite = Engine.Instance.Content.GetAsset <Sprite>("Core:Textures/Interface/Tech_Unlocked");
            policyAdoptable      = Engine.Instance.Content.GetAsset <Sprite>("Core:Textures/Interface/Tech_Selectedable");
        }
Exemplo n.º 9
0
        // sets up the main for
        private void SetUpMainForm()
        {
            lock (_lock_guiSetUp)
            {
                // load the form config
                FormConfig formConfig = FormConfig.FromStream(Engine.Instance.Content.GetAsset <Stream>("Core:XML/Interface/Menu/Main"));
                // setup the form
                canvas.RemoveChild(frm_main);
                frm_main = new Form(formConfig, canvas);
                frm_main.CentreControl();

                // get and setup the form elements
                Button btnHost = (Button)frm_main.GetChildByName("btnHost");
                btnHost.MouseClick += Main_BtnHost_MouseClick;
                Button btnJoin = (Button)frm_main.GetChildByName("btnJoin");
                btnJoin.MouseClick += Main_BtnJoin_MouseClick;
                Button btnOptions = (Button)frm_main.GetChildByName("btnOptions");
                btnOptions.MouseClick += Main_BtnOptions_MouseClick;
                Button btnQuit = (Button)frm_main.GetChildByName("btnQuit");
                btnQuit.MouseClick += Main_BtnQuit_MouseClick;
            }
        }
Exemplo n.º 10
0
 private void SetUpJoinGameForm()
 {
     lock (_lock_guiSetUp)
     {
         if (getWANcancellationToken != null)
         {
             getWANcancellationToken.Cancel();
         }
         FormConfig formConfig = FormConfig.FromStream(Engine.Instance.Content.GetAsset <Stream>("Core:XML/Interface/Menu/Join"));
         canvas.RemoveChild(frm_joinGame);
         frm_joinGame          = new Form(formConfig, canvas);
         frm_joinGame.Location = new Point(GraphicsManager.Instance.Viewport.Width / 2 - frm_joinGame.Size.Width / 2, GraphicsManager.Instance.Viewport.Height / 2 - frm_joinGame.Size.Height / 2);
         tbAddress             = (TextBox)frm_joinGame.GetChildByName("tbAddress");
         tbAddress.Text        = ConfigManager.Instance.GetVar(CONFIG_NET_CLIENT_ADDRESS);
         tbUsername            = (TextBox)frm_joinGame.GetChildByName("tbUsername");
         tbUsername.Text       = Environment.MachineName;
         tbPassword            = (TextBox)frm_joinGame.GetChildByName("tbPassword");
         tbPassword.Text       = "dog";
         Button btnBack = (Button)frm_joinGame.GetChildByName("btnBack");
         btnBack.MouseClick += Join_BtnBack_MouseClick;
         Button btnJoin = (Button)frm_joinGame.GetChildByName("btnJoin");
         btnJoin.MouseClick += Join_BtnJoin_MouseClick;
     }
 }
Exemplo n.º 11
0
        // sets up the lobby form
        private void SetUpLobbyForm()
        {
            lock (_lock_guiSetUp)
            {
                // set the audio manager to play the selected empire's anthem over and over
                AudioManager.Instance.PlayerState = MusicPlayerState.RepeatOne;

                // register events
                manager.Client.LostConnection += Client_LostConnection;

                // load the form config
                FormConfig formConfig = FormConfig.FromStream(Engine.Instance.Content.GetAsset <Stream>("Core:XML/Interface/Menu/Lobby"));

                // setup the form
                canvas.RemoveChild(frm_lobby);
                frm_lobby = new Form(formConfig, canvas);
                frm_lobby.CentreControl();

                // get and setup the for elements
                Button btnStart = (Button)frm_lobby.GetChildByName("btnStart");
                if (host)
                {
                    btnStart.MouseClick += Lobby_BtnStart_MouseClick;
                }
                else
                {
                    btnStart.Enabled = false;
                }

                Button btnBack = (Button)frm_lobby.GetChildByName("btnBack");
                btnBack.MouseClick += Lobby_BtnBack_MouseClick;

                Button btnKick = (Button)frm_lobby.GetChildByName("btnKick");
                if (host)
                {
                    btnKick.MouseClick += Lobby_BtnKick_MouseClick;
                }
                else
                {
                    btnKick.Enabled = false;
                }

                Button btnBan = (Button)frm_lobby.GetChildByName("btnBan");
                if (host)
                {
                    btnBan.MouseClick += Lobby_BtnBan_MouseClick;
                }
                else
                {
                    btnBan.Enabled = false;
                }

                lobby_btnEmpireSelect             = (Button)frm_lobby.GetChildByName("btnEmpire");
                lobby_btnEmpireSelect.MouseClick += Lobby_BtnEmpireSelect_MouseClick;

                lobby_btnWorldSize = (Button)frm_lobby.GetChildByName("btnWorldSize");
                if (host)
                {
                    lobby_btnWorldSize.MouseClick += Lobby_BtnWorldSize_MouseClick;
                }
                else
                {
                    lobby_btnWorldSize.Enabled = false;
                }

                lobby_btnWorldType = (Button)frm_lobby.GetChildByName("btnWorldType");
                if (host)
                {
                    lobby_btnWorldType.MouseClick += Lobby_BtnWorldType_MouseClick;
                }
                else
                {
                    lobby_btnWorldType.Enabled = false;
                }

                lobby_btnGameSpeed = (Button)frm_lobby.GetChildByName("btnGameSpeed");
                if (host)
                {
                    lobby_btnGameSpeed.MouseClick += Lobby_BtnGameSpeed_MouseClick;
                }
                else
                {
                    lobby_btnGameSpeed.Enabled = false;
                }

                lobby_btnVictoryTypes             = (Button)frm_lobby.GetChildByName("btnVictoryTypes");
                lobby_btnVictoryTypes.MouseClick += Lobby_BtnVictoryTypes_MouseClick;

                lobby_btnOtherOptions             = (Button)frm_lobby.GetChildByName("btnOtherOptions");
                lobby_btnOtherOptions.MouseClick += Lobby_BtnOtherOptions_MouseClick;

                lobby_sbPlayers       = (ScrollBox)frm_lobby.GetChildByName("sbPlayers");
                lobby_sbPlayers.Items = GetPlayers();

                // fake an event to open the empire select menu
                Lobby_BtnEmpireSelect_MouseClick(lobby_btnEmpireSelect, new MouseEventArgs(true, false, false, lobby_btnEmpireSelect.AbsoluteLocation, 0));
            }
        }