コード例 #1
0
        public void Startup()
        {
            UserInterfaceManager.DisposeAllComponents();

            NetworkManager.MessageArrived += NetworkManagerMessageArrived;

            _lobbyChat = new Chatbox(ResourceManager, UserInterfaceManager, KeyBindingManager);
            _lobbyChat.TextSubmitted += LobbyChatTextSubmitted;

            _lobbyChat.Update(0);

            UserInterfaceManager.AddComponent(_lobbyChat);

            _lobbyText = new TextSprite("lobbyText", "", ResourceManager.GetFont("CALIBRI"))
            {
                Color        = Color.Black,
                ShadowColor  = Color.DimGray,
                Shadowed     = true,
                ShadowOffset = new Vector2D(1, 1)
            };

            NetOutgoingMessage message = NetworkManager.CreateMessage();

            message.Write((byte)NetMessage.WelcomeMessage);  //Request Welcome msg.
            NetworkManager.SendMessage(message, NetDeliveryMethod.ReliableOrdered);

            NetworkManager.SendClientName(ConfigurationManager.GetPlayerName()); //Send name.

            NetOutgoingMessage playerListMsg = NetworkManager.CreateMessage();

            playerListMsg.Write((byte)NetMessage.PlayerList);  //Request Playerlist.
            NetworkManager.SendMessage(playerListMsg, NetDeliveryMethod.ReliableOrdered);

            _playerListTime = DateTime.Now.AddSeconds(PlayerListRefreshDelaySec);

            NetOutgoingMessage jobListMsg = NetworkManager.CreateMessage();

            jobListMsg.Write((byte)NetMessage.JobList);  //Request Joblist.
            NetworkManager.SendMessage(jobListMsg, NetDeliveryMethod.ReliableOrdered);

            var joinButton = new Button("Join Game", ResourceManager)
            {
                mouseOverColor = Color.LightSteelBlue
            };

            joinButton.Position = new Point(605 - joinButton.ClientArea.Width - 5,
                                            200 - joinButton.ClientArea.Height - 5);
            joinButton.Clicked += JoinButtonClicked;

            UserInterfaceManager.AddComponent(joinButton);

            _jobButtonContainer = new ScrollableContainer("LobbyJobCont", new Size(375, 400), ResourceManager)
            {
                Position = new Point(630, 10)
            };

            UserInterfaceManager.AddComponent(_jobButtonContainer);

            Gorgon.CurrentRenderTarget.Clear();
        }
コード例 #2
0
        public void Startup()
        {
            UserInterfaceManager.DisposeAllComponents();

            NetworkManager.MessageArrived += NetworkManagerMessageArrived;

            _lobbyChat = new Chatbox("lobbychat", new Vector2i(475, 175), ResourceManager);
            _lobbyChat.TextSubmitted += LobbyChatTextSubmitted;

            _lobbyChat.Update(0);

            UserInterfaceManager.AddComponent(_lobbyChat);

            _lobbyText = new TextSprite("lobbyText", "", ResourceManager.GetFont("CALIBRI"))
            {
                Color       = SFML.Graphics.Color.Black,
                ShadowColor = SFML.Graphics.Color.Transparent,
                Shadowed    = true,
                //TODO CluwneSprite ShadowOffset
                // ShadowOffset = new Vector2(1, 1)
            };

            NetOutgoingMessage message = NetworkManager.CreateMessage();

            message.Write((byte)NetMessage.WelcomeMessage); //Request Welcome msg.
            NetworkManager.SendMessage(message, NetDeliveryMethod.ReliableOrdered);

            NetworkManager.SendClientName(ConfigurationManager.GetCVar <string>("player.name")); //Send name.

            NetOutgoingMessage playerListMsg = NetworkManager.CreateMessage();

            playerListMsg.Write((byte)NetMessage.PlayerList); //Request Playerlist.
            NetworkManager.SendMessage(playerListMsg, NetDeliveryMethod.ReliableOrdered);

            _playerListTime = DateTime.Now.AddSeconds(PlayerListRefreshDelaySec);

            var joinButton = new Button("Join Game", ResourceManager)
            {
                mouseOverColor = new SFML.Graphics.Color(176, 222, 196)
            };

            joinButton.Position = new Vector2i(605 - joinButton.ClientArea.Width - 5,
                                               200 - joinButton.ClientArea.Height - 5);
            joinButton.Clicked += JoinButtonClicked;

            UserInterfaceManager.AddComponent(joinButton);

            CluwneLib.CurrentRenderTarget.Clear();
        }
コード例 #3
0
 public void Shutdown()
 {
     UserInterfaceManager.DisposeAllComponents();
     NetworkManager.MessageArrived -= NetworkManagerMessageArrived;
     //TODO RenderTargetCache.DestroyAll();
 }
コード例 #4
0
 public void Shutdown()
 {
     UserInterfaceManager.DisposeAllComponents();
 }