Ejemplo n.º 1
0
        public LoginUI(ShuffUIManager shuffUIManager, PageHandler pageHandler)
        {
            UIWindow = shuffUIManager.CreateWindow(new ShuffWindow() {
                                                                             Title = "Login",
                                                                             X = jQuery.Select("body").GetInnerWidth() - 500,
                                                                             Y = 100,
                                                                             Width = 280,
                                                                             Height = 165,
                                                                             AllowClose = true,
                                                                             AllowMinimize = true,
                                                                             Visible = true
                                                                     });

            ShuffTextbox loginName;
            ShuffTextbox password;
            UIWindow.AddElement(loginName = new ShuffTextbox(115, 40, 150, 30, "", "Username"));
            UIWindow.AddElement(password = new ShuffTextbox(115, 75, 150, 30, "", "Password"));

            UIWindow.AddElement(new ShuffButton(55, 150, 90, 30, "Create", (e) => { pageHandler.ClientSiteManager.Login(loginName.Text, password.Text); }));
            UIWindow.AddElement(new ShuffButton(155, 150, 90, 30, "Login", (e) => { pageHandler.ClientSiteManager.Login(loginName.Text, password.Text); }));

            pageHandler.ClientSiteManager.OnLogin += (user, data) => {
                                                         pageHandler.ClientInfo.LoggedInUser = user;
                                                         pageHandler.HomeUI.UserLoggedIn();
                                                         UIWindow.SwingAway(SwingDirection.Left);
                                                     };
        }
Ejemplo n.º 2
0
        public CreateRoomUI(ShuffUIManager shuffUIManager, PageHandler pageHandler, string gameType)
        {
            UIWindow = shuffUIManager.CreateWindow(new ShuffWindow() {
                                                                             Title = "Create Room",
                                                                             X = jQuery.Select("body").GetInnerWidth() / 2 - 280 / 2,
                                                                             Y = jQuery.Select("body").GetInnerHeight() / 2 - 125 / 2,
                                                                             Width = 280,
                                                                             Height = 125,
                                                                             AllowClose = true,
                                                                             AllowMinimize = true,
                                                                             Visible = true
                                                                     });
            UIWindow.SwingAway(SwingDirection.BottomLeft, true);
            UIWindow.SwingBack();

            ShuffTextbox roomName = null;
            UIWindow.AddElement(roomName = new ShuffTextbox(115, 40, 150, 30, "", "Room Name") {OnEnter = () => { createRoom(pageHandler, gameType, roomName); }});

            UIWindow.AddElement(new ShuffButton(55,
                                                100,
                                                90,
                                                30,
                                                "Create",
                                                (e) => { createRoom(pageHandler, gameType, roomName); }));
            roomName.Focus();
        }
Ejemplo n.º 3
0
        public ActiveLobbyUI(ShuffUIManager shuffUIManager, PageHandler pageHandler, RoomData room)
        {
            pageHandler.ClientSiteManager.OnGetRoomInfoReceived += GetRoomInfo;
            pageHandler.ClientChatManager.OnGetChatLines += GetChatLines;
            pageHandler.ClientChatManager.OnGetChatInfo += GetChatInfo;

            myShuffUIManager = shuffUIManager;
            myPageHandler = pageHandler;
            myRoom = room;

            UIWindow = shuffUIManager.CreateWindow(new ShuffWindow() {
                                                                             Title = string.Format("{0} Lobby", myRoom.RoomName),
                                                                             X = 250,
                                                                             Y = 100,
                                                                             Width = 800,
                                                                             Height = 600,
                                                                             AllowClose = true,
                                                                             AllowMinimize = true,
                                                                             Visible = true
                                                                     });
            UIWindow.OnClose += () => {
                                    UIWindow.Visible = true;
                                    UIWindow.SwingAway(SwingDirection.BottomRight);
                                    pageHandler.ClientSiteManager.LeaveRoom(new LeaveRoomRequest(room));
                                    pageHandler.HomeUI.UIWindow.SwingBack();
                                };

            UIWindow.SwingAway(SwingDirection.BottomRight, true);

            myRoomPlayers = UIWindow.AddElement(new ShuffListBox(600, 200, 175, 300) {Visible = true});

            UIWindow.AddElement(new ShuffButton(600, 510, 175, 23, "Start Game!", (a) =>
            {
                pageHandler.GameManager.StartGame( );

                UIWindow.Height = 200;
            }));

            myChatBox = UIWindow.AddElement(new ChatBox(50, 50, 550, 500) {Visible = true});

            myChatText = UIWindow.AddElement(new ShuffTextbox(50, 560, 500, 30, "", "")
            {
                OnEnter = () =>
                {
                    if (myChatText.Text.Trim() == string.Empty)
                        return;

                    pageHandler.ClientChatManager.SendChatMessage(new SendChatMessageModel(myChatText.Text));
                    myChatText.Text = "";
                }
            });

            UIWindow.AddElement(new ShuffButton(560,
                                                560,
                                                50,
                                                30,
                                                "Send",
                                                (e) => {
                                                    if (myChatText.Text.Trim() == string.Empty)
                                                        return;

                                                    pageHandler.ClientChatManager.SendChatMessage(new SendChatMessageModel(myChatText.Text));
                                                    myChatText.Text = "";
                                                }));

            UIWindow.SwingBack();
            PopulateGameRoom(room);
        }
Ejemplo n.º 4
0
        private void createRoom(PageHandler pageHandler, string gameType, ShuffTextbox roomName)
        {
            pageHandler.ClientSiteManager.CreateRoom(new CreateRoomRequest(gameType, roomName.Text));

            UIWindow.SwingAway(SwingDirection.TopRight);
        }