public async Task <IActionResult> Index(int Page = 1) { var query = this.Db.Users.AsQueryable(); var pager = new PageHandler(Page, await query.CountAsync(), 15); var items = await query .Select(x => new Database.Tables.User { Id = x.Id, Name = x.Name, Birthday = x.Birthday, Phone = x.Phone, Email = x.Email, Gender = x.Gender, CreateTime = x.CreateTime }) .OrderByDescending(x => x.CreateTime) .Skip((pager.CurrentPage - 1) * pager.TakeItemCount) .Take(pager.TakeItemCount) .ToArrayAsync(); ViewBag.Pager = pager; ViewBag.Items = items; return(View()); }
public async Task LoadApartComplexDataHtml() { // Arrange var apartComplexHtmlNode = HtmlNode.CreateNode(_htmlApartComplexLiteral); var loadHtmlNodesTask = Task.Run(() => new HtmlNodeCollection(null) { apartComplexHtmlNode }); var htmlParser = new Mock <HtmlParser>(new HtmlWeb()); htmlParser .Setup(htmlParser => htmlParser.LoadHtmlNodes(_homePageUrl, _apartComplexGroupXPath)) .Returns(loadHtmlNodesTask); var expectedResult = new HtmlNodeCollection(null) { apartComplexHtmlNode }; var pageHandler = new PageHandler(htmlParser.Object); // Act var actualResult = await pageHandler.LoadApartComplexDataHtml(); // Assert Assert.Equal(expectedResult, actualResult); }
public override void ConstructSubcontent() { base.ConstructSubcontent(); m_pageHandler = new PageHandler(null); m_pageHandler.ConstructUI(m_subContentParent); m_pageHandler.OnPageChanged += OnPageTurned; m_listContent = UIFactory.CreateVerticalGroup(this.m_subContentParent, "EnumerableContent", true, true, true, true, 2, new Vector4(5, 5, 5, 5), new Color(0.08f, 0.08f, 0.08f)); var scrollRect = m_listContent.GetComponent <RectTransform>(); scrollRect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 0); m_listLayout = Owner.m_mainContent.GetComponent <LayoutElement>(); m_listLayout.minHeight = 25; m_listLayout.flexibleHeight = 0; Owner.m_mainRect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 25); var contentFitter = m_listContent.AddComponent <ContentSizeFitter>(); contentFitter.horizontalFit = ContentSizeFitter.FitMode.Unconstrained; contentFitter.verticalFit = ContentSizeFitter.FitMode.PreferredSize; }
public void TestMethod1() { ExtentTest = ExtentReports.CreateTest("Automation Assessment"); ExtentTest.Log(Status.Info, "Login"); PageHandler.loginHelper().Login(); ExtentTest.Log(Status.Info, "Filling Page 1"); PageHandler.page1Helper().FillPage1(); ExtentTest.Log(Status.Info, "Filling Page 2--Question1"); PageHandler.page2Helper().Question1(); ExtentTest.Log(Status.Info, "Filling Page 2--Question2"); PageHandler.page2Helper().Question2(); ExtentTest.Log(Status.Info, "Filling Page 2--Clicking Next Button"); PageHandler.commonHelper().ClickNextBtn(); ExtentTest.Log(Status.Info, "Filling Page 3--Question1"); PageHandler.page3Helper().Question1(); ExtentTest.Log(Status.Info, "Filling Page 3--Question2"); PageHandler.page3Helper().Question2(); ExtentTest.Log(Status.Info, "Filling Page 3--Clicking Next Button"); PageHandler.commonHelper().ClickNextBtn(); ExtentTest.Log(Status.Info, "Filling Page 4--Question1"); PageHandler.page4Helper().Question1(); ExtentTest.Log(Status.Info, "Filling Page 4--Question2"); PageHandler.page4Helper().Question2(); ExtentTest.Log(Status.Info, "Filling Page 4--Clicking Next Button"); PageHandler.commonHelper().ClickNextBtn(); ExtentTest.Log(Status.Info, "Filling Page 5--Question1"); PageHandler.page5Helper().Question1(); ExtentTest.Log(Status.Info, "Filling Page 5--Question2"); PageHandler.page5Helper().Question2(); PageHandler.commonHelper().ClickNextBtn(); }
public async Task LoadCityHtml_ReturnNodeCollection() { // Arrange var expectedResult = new HtmlNodeCollection(null) { HtmlNode.CreateNode(_htmlDummyNodeLiteral), HtmlNode.CreateNode(_htmlDummyNodeLiteral) }; var LoadHtmlNodesTask = Task.Run(() => expectedResult); const string cityXPath = "//*[@id='geo-control']/div[3]/div[2]/div/div[4]/a[*]"; var htmlParserMock = new Mock <HtmlParser>(new HtmlWeb()); htmlParserMock .Setup(htmlParser => htmlParser.LoadHtmlNodes(_homePageUrl, cityXPath)) .Returns(LoadHtmlNodesTask); var pageHandler = new PageHandler(htmlParserMock.Object); // Act var actualResult = await pageHandler.LoadCityHtml(); // Assert Assert.Equal(expectedResult, actualResult); }
public async Task LoadApartmentsHtml() { // Arrange var expectedResult = new HtmlNodeCollection(null) { HtmlNode.CreateNode(_htmlDummyNodeLiteral), HtmlNode.CreateNode(_htmlDummyNodeLiteral) }; var loadHtmlNodesTask = Task.Run(() => expectedResult); var htmlParser = new Mock <HtmlParser>(new HtmlWeb()); htmlParser .Setup(htmlParser => htmlParser.LoadHtmlNodes(_dummyUrl, _apartmentXPath)) .Returns(loadHtmlNodesTask); var pageHandler = new PageHandler(htmlParser.Object); // Act var actualResult = await pageHandler.LoadApartmentsHtml(_dummyUrl); // Assert Assert.Equal(expectedResult, actualResult); }
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(); }
public async Task <IActionResult> Index(int Page = 1) { var query = this.Db.Reservations.AsQueryable(); var pager = new PageHandler(Page, await query.CountAsync(), 15); var items = await query .Select(x => new Database.Tables.Reservation { Id = x.Id, Category = x.Category, ReservationTime = x.ReservationTime, Name = x.Name, Phone = x.Phone, UseCall = x.UseCall, CreateTime = x.CreateTime }) .OrderByDescending(x => x.CreateTime) .Skip((pager.CurrentPage - 1) * pager.TakeItemCount) .Take(pager.TakeItemCount) .ToArrayAsync(); ViewBag.Pager = pager; ViewBag.Items = items; return(View()); }
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); }; }
internal void ConstructChildList(GameObject parent) { var vertGroupObj = UIFactory.CreateVerticalGroup(parent, new Color(1, 1, 1, 0)); var vertGroup = vertGroupObj.GetComponent <VerticalLayoutGroup>(); vertGroup.childForceExpandHeight = true; vertGroup.childForceExpandWidth = false; vertGroup.childControlWidth = true; vertGroup.spacing = 5; var vertLayout = vertGroupObj.AddComponent <LayoutElement>(); vertLayout.minWidth = 120; vertLayout.flexibleWidth = 25000; vertLayout.minHeight = 200; vertLayout.flexibleHeight = 5000; var childTitleObj = UIFactory.CreateLabel(vertGroupObj, TextAnchor.MiddleLeft); var childTitleText = childTitleObj.GetComponent <Text>(); childTitleText.text = "Children"; childTitleText.color = Color.grey; childTitleText.fontSize = 14; var childTitleLayout = childTitleObj.AddComponent <LayoutElement>(); childTitleLayout.minHeight = 30; var childrenScrollObj = UIFactory.CreateScrollView(vertGroupObj, out s_childListContent, out SliderScrollbar scroller, new Color(0.07f, 0.07f, 0.07f)); var contentLayout = childrenScrollObj.GetComponent <LayoutElement>(); contentLayout.minHeight = 50; s_childListPageHandler = new PageHandler(scroller); s_childListPageHandler.ConstructUI(vertGroupObj); s_childListPageHandler.OnPageChanged += OnChildListPageTurn; }
private static void PostResolveRequestCache(object sender, EventArgs e) { HttpContext context = ((HttpApplication)sender).Context; HttpRequest request = context.Request; string appExecPath = request.AppRelativeCurrentExecutionFilePath; if (!appExecPath.EndsWith(WebAppConfig.Extension)) { return; } ControllerAction controllerAction = WebAppHelper.GetControllerAction(appExecPath, request.PathInfo); if (controllerAction != null) { string rawUrl = context.Request.RawUrl; IHttpHandler httpHandler = new PageHandler(new CPageHandler(controllerAction)); if (rawUrl.EndsWith("/")) { string filename = context.Request.ServerVariables["SCRIPT_FILENAME"]; rawUrl = string.Concat(rawUrl, Path.GetFileName(filename)); } context.Items[_contextItemKey] = new RequestData(UrlHelper.GetUrlWithoutPathInfo(rawUrl, request.PathInfo), httpHandler); context.RewritePath("~/MiniMVC.axd"); } }
public QuestionUI(ShuffUIManager shuffUIManager, PageHandler pageHandler) { PageHandler = pageHandler; UIWindow = shuffUIManager.CreateWindow(new ShuffWindow() { Title = "Question", X = 600, Y = 100, Width = 300, Height = 275, AllowClose = true, AllowMinimize = true, Visible = true }); UIWindow.SwingAway(SwingDirection.TopLeft,true); Question = UIWindow.AddElement(new ShuffLabel(20, 40, "")); Load = (question) => { UIWindow.SwingBack(); Question.Text = ( question.Question ); AnswerBox.ClearItems(); for (var i = 0; i < question.Answers.Length; i++) { AnswerBox.AddItem(new ShuffListItem(question.Answers[i], i)); } }; ExtensionMethods.debugger(); AnswerBox = UIWindow.AddElement(new ShuffListBox(30, 65, 215, 25 * 5) { OnClick = e => selectAnswer( e) }); }
public MainPage() { InitializeComponent(); ms_PageHandler = new PageHandler(panel_PagePanel); ms_PageHandler.CreatePage("Team List", new TeamListPage()); ms_PageHandler.CreatePage("Player List", new PlayerListPage()); ms_PageHandler.CreatePage("Build Team", new BuildTeamPage()); }
public vmFooter() { Copyright = AquireCopyright(); Company = AquireCompany(); Hyperlink.Callback += Hyperlink_Callback; Version = AquireVersion(); PageHandler.SetNavigationCommands(Back, Next, Exit); }
public async Task <IActionResult> Index(int Page = 1, string search = null, string categoryFilter = null, string applyFilter = null) { var query = this.Db.Counselings.AsQueryable(); if (!string.IsNullOrWhiteSpace(search)) { query = query.Where(x => x.Subject.Contains(search)); } if (!string.IsNullOrWhiteSpace(categoryFilter) && categoryFilter != "전체") { query = query.Where(x => x.Category == categoryFilter); } if (!string.IsNullOrWhiteSpace(applyFilter) && applyFilter != "전체") { switch (applyFilter) { case "처리완료": query = query.Where(x => !string.IsNullOrWhiteSpace(x.Answer)); break; case "미처리": query = query.Where(x => string.IsNullOrWhiteSpace(x.Answer)); break; default: break; } } var pager = new PageHandler(Page, await query.CountAsync(), 15); var items = await query .Select(x => new Database.Tables.Counseling { Id = x.Id, Category = x.Category, Subject = x.Subject, Answer = x.Answer, UserName = x.UserName, CreateTime = x.CreateTime }) .OrderByDescending(x => x.CreateTime) .Skip((pager.CurrentPage - 1) * pager.TakeItemCount) .Take(pager.TakeItemCount) .ToArrayAsync(); ViewBag.Pager = pager; ViewBag.Search = search; ViewBag.Items = items; ViewBag.CategoryFilter = categoryFilter; ViewBag.ApplyFilter = applyFilter; return(View()); }
// GET users public UserListRepresentation Get(int page = 1) { var users = db.Users.Include("Reviews").Select(x => new UserRepresentation() { Id = x.Id, Name = x.Name }).ToList(); var pageHandler = new PageHandler <UserRepresentation>(users, page, pageSize); var resourceList = new UserListRepresentation(pageHandler.Result, pageHandler.Total, pageHandler.PagesTotal, pageHandler.Page, LinkTemplates.Users.GetUsers); return(resourceList); }
// GET categories public CategoryListRepresentation Get(int page = 1) { var categories = db.Categories.Include("Posts").Select(x => new CategoryRepresentation() { Id = x.Id, Title = x.Title }).ToList(); var pageHandler = new PageHandler <CategoryRepresentation>(categories, page, pageSize); var resourceList = new CategoryListRepresentation(pageHandler.Result, pageHandler.Total, pageHandler.PagesTotal, pageHandler.Page, LinkTemplates.Posts.GetPosts); return(resourceList); }
// GET users public ReviewListRepresentation Get(int page = 1) { var reviews = db.Reviews.Include("User").Include("Post").Select(x => new ReviewRepresentation() { Id = x.Id, Content = x.Content }).ToList(); var pageHandler = new PageHandler <ReviewRepresentation>(reviews, page, pageSize); var resourceList = new ReviewListRepresentation(pageHandler.Result, pageHandler.Total, pageHandler.PagesTotal, pageHandler.Page, LinkTemplates.Reviews.GetReviews); return(resourceList); }
// GET posts public PostListRepresentation Get(int page = 1) { var posts = db.Posts.Include("Categories").Include("Reviews").Select(x => new PostRepresentation() { Id = x.Id, Content = x.Content, Title = x.Title }).ToList(); var pageHandler = new PageHandler <PostRepresentation>(posts, page, pageSize); var resourceList = new PostListRepresentation(pageHandler.Result, pageHandler.Total, pageHandler.PagesTotal, pageHandler.Page, LinkTemplates.Posts.GetPosts); return(resourceList); }
public void HasMultipleFloors(string apartmentHtmlNodeLiteral, bool expectedResult) { // Arrange var apartmentNode = HtmlNode.CreateNode(apartmentHtmlNodeLiteral); var htmlHandler = new PageHandler(new HtmlParser(new HtmlWeb())); // Act var actualResult = htmlHandler.HasMultipleFloors(apartmentNode); // Assert Assert.Equal(expectedResult, actualResult); }
public CodeEditorUI(ShuffUIManager shuffUIManager, PageHandler pageHandler) { ShuffUIManager = shuffUIManager; breakPoints = new List<int>(); codeEditor = UIWindow.AddElement(new ShuffCodeEditor(0, 0, "100%", "80%", "") {Dock = DockStyle.FillWidth}); console = UIWindow.AddElement(new ShuffCodeEditor(0, 0, "100%", "20%", "") {LineNumbers = false, Dock = DockStyle.FillWidth}); pageHandler.ClientDebugManager.OnGetGameSource += populateGameSource; pageHandler.ClientDebugManager.RequestGameSource(new GameSourceRequestModel("Sevens")); }
public void CreateUrl_ReturnExpectedString() { // Arrange var pageHandler = new PageHandler(new HtmlParser(new HtmlWeb())); const string hRef = "/uk/жк-oasis-київ"; const string expectedResult = _homePageUrl + hRef; // Act var actualResult = pageHandler.CreateDomRiaUrl(hRef); // Assert Assert.Equal(expectedResult, actualResult); }
public void ParseHtmlNumOfRooms() { // Arrange var apartmentNode = HtmlNode.CreateNode(_htmlApartmentThreeRoomLiteral); var htmlHandler = new PageHandler(new HtmlParser(new HtmlWeb())); const int expectedResult = 3; // Act var actualResult = htmlHandler.ParseHtmlNumOfRooms(apartmentNode); // Assert Assert.Equal(expectedResult, actualResult); }
public void ParseHtmlApartPrice() { // Arrange const string apartmentHtmlNodeLiteral = "<a href=\"/uk/жк-ріел-сіті-львів/планування/однокімнатні\" class=\"BuildingPrices-row\" data-analytics-click=\"view_building_about|prices|goto_layout_view\"><div class=\"BuildingPrices-cell -img\"><img class=\"BuildingPrices-image lazyload\" data-src=\"//img.lunstatic.net/vector-layout/35198-0.svg\" alt=\"ЖК Ріел Сіті: планування 1-кімнатної квартири 23.54 м2, тип 1-23.54\"></div><div class=\"BuildingPrices-subrow\"><div class=\"BuildingPrices-cell\">1-кімнатні</div><div class=\"BuildingPrices-cell\">ід <span data-currency=\"uah\" class=\"\">363 тис. грн</span><span data-currency=\"usd\" class=\"hidden\">13 620 $</span></div></div><div class=\"BuildingPrices-subrow \"><div class=\"BuildingPrices-cell\">24...67 м² </div><div class=\"BuildingPrices-cell -sqm\"><div data-currency=\"uah\" class=\"\">14 500 — 18 800 грн/м² </div><div data-currency=\"usd\" class=\"hidden\">40 — 710 $/м² </div></div></div></a>"; var expectedResult = new Tuple <int, int>(14500, 18800); var apartmentNode = HtmlNode.CreateNode(apartmentHtmlNodeLiteral); var htmlHandler = new PageHandler(new HtmlParser(new HtmlWeb())); // Act var actualResult = htmlHandler.ParseHtmlApartPrice(apartmentNode); // Assert Assert.Equal(expectedResult, actualResult); }
public void CreatePageUrl_ReturnExpectedString() { // Arrange var pageHandler = new PageHandler(new HtmlParser(new HtmlWeb())); const string pageTag = "?page="; const int pageNumber = 7; var expectedResult = _dummyUrl + pageTag + pageNumber; // Act var actualResult = pageHandler.CreatePageUrl(_dummyUrl, pageNumber); // Assert Assert.Equal(expectedResult, actualResult); }
public void getPage(string url, PageHandler pageHandler, int index) { getPage_pageHandler = pageHandler; getPage_index = index; IsLoading = true; WebClient webClient = new WebClient(); webClient.Encoding = System.Text.Encoding.GetEncoding("iso-8859-1"); System.Uri uri = new System.Uri(url); webClient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(getPage_downloadCompletedHandler); webClient.DownloadStringAsync(uri); }
public UIView GetNativePageContent(PageHandler handler) { int childCount = 0; if (handler.PlatformView is UIView view) { childCount = view.Subviews.Length; if (childCount == 1) { return(view.Subviews[0]); } } Assert.Equal(1, childCount); return(null); }
public View GetNativePageContent(PageHandler handler) { int childCount = 0; if (handler.PlatformView is ViewGroup view) { childCount = view.ChildCount; if (childCount == 1) { return(view.GetChildAt(0)); } } Assert.Equal(1, childCount); return(null); }
public void ParseHtmlApartPrice(int previousPrice, int maxPrice) { // Arrange var expectedResult = new Tuple <int, int>(4614009, maxPrice); var apartmentNode = HtmlNode.CreateNode(_htmlApartmentThreeRoomLiteral); var transferData = new ApartmentTransferData() { PreviousPrice = previousPrice }; var htmlHandler = new PageHandler(new HtmlParser(new HtmlWeb())); // Act var actualResult = htmlHandler.ParseHtmlApartPrice(apartmentNode, ref transferData); // Assert Assert.Equal(expectedResult, actualResult); }
/// <summary> /// /// </summary> public void Load() { List <Page> pages; DataTable dt = new DataTable(); dt = PageHandler.Load(this.surveyID); pages = dt.toList <Page>(new DataFieldMappings() .Add("PageID", "PageID") .Add("SurveyID", "SurveyID") .Add("PageName", "PageTitle") .Add("PageDescription", "Description") .Add("PageNo", "PageNo") , null); foreach (Page p in pages) { PageList.Add(p); } }
public void ParseApartComplexText_ReturnApartComplexText() { // Arrange const string apartComplexNameXPath = ".//a/div[3]/div[@class='card-title']"; var apartComplexNode = HtmlNode.CreateNode(_htmlApartComplexLiteral); const string expectedResult = "ЖК Manhattan"; var htmlParserMock = new Mock <HtmlParser>(new HtmlWeb()); htmlParserMock .Setup(htmlParser => htmlParser.ParseTextByXPath(apartComplexNode, apartComplexNameXPath)) .Returns(expectedResult); var pageHandler = new PageHandler(htmlParserMock.Object); // Act var actualResult = pageHandler.ParseApartComplexText(apartComplexNode); // Assert Assert.Equal(expectedResult, actualResult); }
/// <summary> /// 退出 /// </summary> private void quit() { NodeHandler.getInstance().setBaseNodes(this.baseNodes); PreconditionHandler.getInstance().setBasePreconditions(this.basePreconditions); TemplateHandler.getInstance().setBaseTrees(this.baseTrees); if (this.currentFile != null && this.currentFile.savePath != null && this.currentFile.isTemplate == false) { PageHandler.getInstance().setLastPage(this.currentFile.savePath); } if (this.openFiles != null && this.openFiles.Count > 0) { foreach (var item in this.openFiles) { if (item.savePath != null && item.savePath.Length > 0) { item.SaveTree(item.savePath); } } } }
public void ParseApartComplexHRef_ReturnApartComplexHRef() { // Arrange const string apartComplexNameXPath = ".//div/div/h2/a"; var apartComplexNode = HtmlNode.CreateNode(_htmlApartComplexLiteral); const string expectedResult = "/uk/жк-manhattan-одеса"; var htmlParserMock = new Mock <HtmlParser>(new HtmlWeb()); htmlParserMock .Setup(htmlParser => htmlParser.ParseHrefByXPath(apartComplexNode, apartComplexNameXPath)) .Returns(expectedResult); var pageHandler = new PageHandler(htmlParserMock.Object); // Act var actualResult = pageHandler.ParseApartComplexHRef(apartComplexNode); // Assert Assert.Equal(expectedResult, actualResult); }
public override void ConstructSubcontent() { base.ConstructSubcontent(); m_pageHandler = new PageHandler(null); m_pageHandler.ConstructUI(m_subContentParent); m_pageHandler.OnPageChanged += OnPageTurned; var scrollObj = UIFactory.CreateVerticalGroup(this.m_subContentParent, new Color(0.08f, 0.08f, 0.08f)); m_listContent = scrollObj; var scrollRect = scrollObj.GetComponent <RectTransform>(); scrollRect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 0); m_listLayout = Owner.m_mainContent.GetComponent <LayoutElement>(); m_listLayout.minHeight = 25; m_listLayout.flexibleHeight = 0; Owner.m_mainRect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 25); var scrollGroup = m_listContent.GetComponent <VerticalLayoutGroup>(); scrollGroup.childForceExpandHeight = true; scrollGroup.childControlHeight = true; scrollGroup.spacing = 2; scrollGroup.padding.top = 5; scrollGroup.padding.left = 5; scrollGroup.padding.right = 5; scrollGroup.padding.bottom = 5; var contentFitter = scrollObj.AddComponent <ContentSizeFitter>(); contentFitter.horizontalFit = ContentSizeFitter.FitMode.Unconstrained; contentFitter.verticalFit = ContentSizeFitter.FitMode.PreferredSize; ConstructAddRow(); RefreshElementsAfterUpdate(); }
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")); }
private void createRoom(PageHandler pageHandler, string gameType, ShuffTextbox roomName) { pageHandler.ClientSiteManager.CreateRoom(new CreateRoomRequest(gameType, roomName.Text)); UIWindow.SwingAway(SwingDirection.TopRight); }
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); }
public GameManager(PageHandler pageHandler) { PageHandler = pageHandler; ClientGameManager = pageHandler.ClientGameManager; Init( ); }
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(); })); }