Ejemplo n.º 1
0
        public DebugUI(ShuffUIManager shuffUIManager, PageHandler pageHandler)
        {
            UIWindow = shuffUIManager.CreateWindow(new ShuffWindow() {
                                                                             Title = "Developer",
                                                                             X = 500, //jQuery.Select("body").GetInnerWidth() -
                                                                             Y = 100,
                                                                             Width = 420,
                                                                             Height = 450,
                                                                             AllowClose = true,
                                                                             AllowMinimize = true,
                                                                             Visible = false
                                                                     });

            ShuffButton but = null;
            UIWindow.AddElement(but = new ShuffButton(280,
                                                      84,
                                                      150,
                                                      25,
                                                      new Func<string>(() => "Game: " + selectedGame),
                                                      (e) => {
                                                          if (selectedGame == "Sevens") selectedGame = "BlackJack";
                                                          else selectedGame = "Sevens";

                                                          pageHandler.ClientDebugManager.RequestGameSource(new GameSourceRequestModel(selectedGame));

                                                          string m = but.Text;
                                                      }
                                              ));

            lblHowFast = UIWindow.AddElement(new ShuffLabel(280 - 200, 80, "Time Taken:"));
            lblAnother = UIWindow.AddElement(new ShuffLabel(280 - 200, 100, "Another: "));

            /* devArea.AddButton(new ShuffButton()
             {
                 X = 280,
                 Y = 94,
                 Width = "150",
                 Height = "25",
                 Text = "Continue",
                 Click = (evt) =>
                 {
                     pageHandler.gateway.Emit("Area.Debug.Continue", new { }, devArea.Data.gameServer); //NO EMIT"ING OUTSIDE OF PageHandler
                 }
             });*/

            varText = UIWindow.AddElement(new ShuffTextbox(150, 134, 100, 25, "Var Lookup"));
            /*  devArea.AddButton(new ShuffButton()
              {
                  X = 280,
                  Y = 134,
                  Width = "150",
                  Height = "25",
                  Text = "Lookup",
                  Click = (evt) =>
                  {
                      pageHandler.gateway.Emit("Area.Debug.VariableLookup.Request", new { variableName = devArea.Data.varText.GetValue() }, devArea.Data.gameServer); //NO EMIT"ING OUTSIDE OF PageHandler
                  }
              });*/

            /*   devArea.AddButton(new ShuffButton()
               {
                   X = 280,
                   Y = 164,
                   Width = "150",
                   Height = "25",
                   Text = "Push New Source",
                   Click = (evt) =>
                   {
                       pageHandler.gateway.Emit("Area.Debug.PushNewSource", new { source = codeArea.Data.codeEditor.editor.GetValue(), breakPoints = codeArea.Data.breakPoints },
                           devArea.Data.gameServer); //NO EMIT"ING OUTSIDE OF PageHandler
                   }
               });*/

            txtNumOfPlayers = UIWindow.AddElement(new ShuffTextbox(130, 43, 130, 20, "6", "Number of players=", "font-size:13px"));
        }
Ejemplo n.º 2
0
        public HomeUI(ShuffUIManager shuffUIManager, PageHandler pageHandler)
        {
            myShuffUIManager = shuffUIManager;
            myPageHandler = pageHandler;

            pageHandler.ClientSiteManager.OnGetGameTypesReceived += PopulateGames;
            pageHandler.ClientSiteManager.OnGetRoomsReceived += PopulateRooms;
            pageHandler.ClientSiteManager.OnRoomJoined += RoomJoined;
            pageHandler.ClientSiteManager.OnGetRoomInfoReceived += GetRoomInfo;

            UIWindow = shuffUIManager.CreateWindow(new ShuffWindow() {
                                                                             Title = "CardGame",
                                                                             X = 400,
                                                                             Y = 100,
                                                                             Width = 600,
                                                                             Height = 450,
                                                                             AllowClose = true,
                                                                             AllowMinimize = true,
                                                                             Visible = false
                                                                     });

            lblHeader = UIWindow.AddElement(new ShuffLabel(40, 44, "Please Login!"));

            UIWindow.AddElement(new ShuffLabel(30, 80, "Game Types"));
            myGameTypeList = UIWindow.AddElement(new ShuffListBox(25, 100, 150, 300) {
                                                                                             OnClick = (item) => { myPageHandler.ClientSiteManager.GetRooms(new GetRoomsRequest((string) item.Value)); }
                                                                                     });

            myCreateGameType = UIWindow.AddElement(new ShuffButton(45, 410, 100, 40, "Create New Game!", c => {

                                                                                                             CodeEditorUI ui = new CodeEditorUI(shuffUIManager, pageHandler);

                                                                                                         }));

            UIWindow.AddElement(new ShuffLabel(210, 80, "Rooms"));

            myCreateRoom = UIWindow.AddElement(new ShuffButton(260,
                                                               70,
                                                               70,
                                                               25,
                                                               "Refresh!",
                                                               c => { myPageHandler.ClientSiteManager.GetRooms(new GetRoomsRequest((string) myGameTypeList.SelectedItem.Value)); }));

            myRoomsList = UIWindow.AddElement(new ShuffListBox(200, 100, 175, 300) {
                                                                                           OnClick = (item) => {
                                                                                                         var room = myLoadedRooms.First(a => a.RoomName == (string) item.Value);

                                                                                                         PopulateRoom(room);
                                                                                                     }
                                                                                   });

            myCreateRoom = UIWindow.AddElement(new ShuffButton(225,
                                                               410,
                                                               100,
                                                               40,
                                                               "Create New Room!",
                                                               c => {
                                                                   var create = new CreateRoomUI(shuffUIManager, pageHandler, (string) myGameTypeList.SelectedItem.Value);
                                                                   shuffUIManager.Focus(create.UIWindow);
                                                               }));

            myRoomPlayers = UIWindow.AddElement(new ShuffListBox(400, 200, 175, 200) {Visible = false});

            myRoomGameType = UIWindow.AddElement(new ShuffLabel(400, 100, "") {Visible = false});
            myRoomName = UIWindow.AddElement(new ShuffLabel(400, 130, "") {Visible = false});
            myJoinRoom = UIWindow.AddElement(new ShuffButton(410, 160, 75, 25, "Join!", c => { pageHandler.ClientSiteManager.JoinRoom(new RoomJoinRequest((string) myGameTypeList.SelectedItem.Value, (string) myRoomsList.SelectedItem.Value)); }) {Visible = false});

            mySpectateRoom = UIWindow.AddElement(new ShuffButton(490, 160, 75, 25, "Spectate!", c => { }) {Visible = false});

            myRefreshRoom = UIWindow.AddElement(new ShuffButton(420, 410, 150, 25, "Refresh!", c => { pageHandler.ClientSiteManager.GetRoomInfo(new GetRoomInfoRequest((string) myGameTypeList.SelectedItem.Value, (string) myRoomsList.SelectedItem.Value)); }) {Visible = false});

            //UIWindow.AddElement(new ShuffButton(280, 54, 150, 25, "Update game list", (e) => { pageHandler.ClientSiteManager.GetGameList(); }));
        }