private void CreateMissionInfo(GUIFrame infoFrame) { infoFrameContent.ClearChildren(); var isTraitor = GameMain.Client?.Character?.IsTraitor ?? false; var missionFrame = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, isTraitor ? 0.95f : 0.45f), infoFrameContent.RectTransform)) { RelativeSpacing = 0.05f }; if (Mission != null) { new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), missionFrame.RectTransform), Mission.Name, font: GUI.LargeFont); new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), missionFrame.RectTransform), TextManager.GetWithVariable("MissionReward", "[reward]", Mission.Reward.ToString())); new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), missionFrame.RectTransform), Mission.Description, wrap: true); } else { new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), missionFrame.RectTransform, Anchor.TopCenter), TextManager.Get("NoMission"), font: GUI.LargeFont); } if (isTraitor) { var traitorFrame = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.45f), infoFrameContent.RectTransform, Anchor.BottomLeft)) { RelativeSpacing = 0.05f }; new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), traitorFrame.RectTransform), TextManager.Get("Traitors"), font: GUI.LargeFont); new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), traitorFrame.RectTransform), GameMain.Client.Character.TraitorCurrentObjective, wrap: true); } }
/*private void ShowDirectJoinPrompt() * { * var msgBox = new GUIMessageBox(TextManager.Get("ServerListDirectJoin"), "", new string[] { TextManager.Get("OK"), TextManager.Get("Cancel") }, * relativeSize: new Vector2(0.25f, 0.2f), minSize: new Point(400, 150)); * * var content = new GUILayoutGroup(new RectTransform(new Vector2(0.8f, 0.3f), msgBox.InnerFrame.RectTransform, Anchor.Center) { MinSize = new Point(0, 50) }) * { * IgnoreLayoutGroups = true, * Stretch = true, * RelativeSpacing = 0.05f * }; * * new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.5f), content.RectTransform), TextManager.Get("ServerIP")); * var ipBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.5f), content.RectTransform)); * * var okButton = msgBox.Buttons[0]; * okButton.Enabled = false; * okButton.OnClicked = (btn, userdata) => * { * JoinServer(ipBox.Text, ""); * msgBox.Close(); * return true; * }; * * var cancelButton = msgBox.Buttons[1]; * cancelButton.OnClicked = msgBox.Close; * * ipBox.OnTextChanged += (textBox, text) => * { * okButton.Enabled = !string.IsNullOrEmpty(text); * return true; * }; * }*/ private void RefreshServers() { if (waitingForRefresh) { return; } serverList.ClearChildren(); serverPreview.ClearChildren(); joinButton.Enabled = false; ipBox.UserData = null; ipBox.Text = ""; new GUITextBlock(new RectTransform(new Vector2(1.0f, 1.0f), serverList.Content.RectTransform), TextManager.Get("RefreshingServerList"), textAlignment: Alignment.Center) { CanBeFocused = false }; CoroutineManager.StartCoroutine(WaitForRefresh()); }
private void CreateMissionInfo(GUIFrame infoFrame) { infoFrameContent.ClearChildren(); var paddedFrame = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.95f), infoFrameContent.RectTransform)) { RelativeSpacing = 0.05f }; if (Mission == null) { new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.1f), paddedFrame.RectTransform, Anchor.TopCenter), TextManager.Get("NoMission")); return; } new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.1f), paddedFrame.RectTransform), Mission.Name, font: GUI.LargeFont); new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.1f), paddedFrame.RectTransform), TextManager.Get("MissionReward").Replace("[reward]", Mission.Reward.ToString())); new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), paddedFrame.RectTransform), Mission.Description, wrap: true); }
public override void Select() { base.Select(); CampaignMode campaign = GameMain.GameSession.GameMode as CampaignMode; if (campaign == null) { return; } campaign.Map.SelectLocation(-1); campaignUIContainer.ClearChildren(); campaignUI = new CampaignUI(campaign, campaignUIContainer) { StartRound = StartRound, OnLocationSelected = SelectLocation }; campaignUI.UpdateCharacterLists(); GameAnalyticsManager.SetCustomDimension01("singleplayer"); }
private void ShowItemPreview(Facepunch.Steamworks.Workshop.Item item) { itemPreviewFrame.ClearChildren(); if (item == null) { return; } var content = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.95f), itemPreviewFrame.RectTransform, Anchor.Center)) { RelativeSpacing = 0.02f }; new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), content.RectTransform), item.Title, font: GUI.LargeFont); new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), content.RectTransform), item.Description, wrap: true); new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), content.RectTransform), "Score: " + item.Score); new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), content.RectTransform), "Upvotes: " + item.VotesUp); new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), content.RectTransform), "Downvotes: " + item.VotesDown); new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), content.RectTransform), "Creator: " + item.OwnerName); new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), content.RectTransform), "Created: " + item.Created); new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), content.RectTransform), "Modified: " + item.Modified); new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), content.RectTransform), "Url: " + item.Url); }
private void ShowCreateItemFrame() { createItemFrame.ClearChildren(); if (itemEditor == null) { return; } var createItemContent = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.9f), createItemFrame.RectTransform, Anchor.Center)) { RelativeSpacing = 0.02f }; new GUITextBlock(new RectTransform(new Vector2(0.2f, 0.05f), createItemContent.RectTransform), "Title"); var titleBox = new GUITextBox(new RectTransform(new Vector2(0.8f, 0.05f), createItemContent.RectTransform), itemEditor.Title); new GUITextBlock(new RectTransform(new Vector2(0.2f, 0.05f), createItemContent.RectTransform), "Description"); var descriptionBox = new GUITextBox(new RectTransform(new Vector2(0.8f, 0.1f), createItemContent.RectTransform), itemEditor.Description); descriptionBox.OnTextChanged += (textBox, text) => { itemEditor.Description = text; return(true); }; new GUIButton(new RectTransform(new Vector2(0.25f, 0.05f), createItemContent.RectTransform, Anchor.TopRight), "Show folder") { IgnoreLayoutGroups = true, OnClicked = (btn, userdata) => { System.Diagnostics.Process.Start(Path.GetFullPath(SteamManager.WorkshopItemStagingFolder)); return(true); } }; new GUITextBlock(new RectTransform(new Vector2(0.2f, 0.05f), createItemContent.RectTransform), "Files included in the item"); createItemFileList = new GUIListBox(new RectTransform(new Vector2(0.8f, 0.4f), createItemContent.RectTransform)); RefreshCreateItemFileList(); new GUIButton(new RectTransform(new Vector2(0.25f, 0.05f), createItemContent.RectTransform, Anchor.TopRight), "Refresh") { OnClicked = (btn, userdata) => { itemContentPackage = new ContentPackage(itemContentPackage.Path); RefreshCreateItemFileList(); return(true); } }; new GUIButton(new RectTransform(new Vector2(0.25f, 0.05f), createItemContent.RectTransform, Anchor.BottomRight), "Publish item") { IgnoreLayoutGroups = true, OnClicked = (btn, userData) => { itemEditor.Title = titleBox.Text; itemEditor.Description = descriptionBox.Text; if (string.IsNullOrWhiteSpace(itemEditor.Title)) { titleBox.Flash(Color.Red); return(false); } if (string.IsNullOrWhiteSpace(itemEditor.Description)) { descriptionBox.Flash(Color.Red); return(false); } PublishWorkshopItem(); return(true); } }; }
private void UpdatePaging() { if (pageIndicatorHolder == null) { return; } pageIndicatorHolder.ClearChildren(); if (currentPage > pageCount) { currentPage = pageCount; } if (pageCount < 2) { return; } browseLeftButton = new GUIButton(new RectTransform(new Vector2(1.15f, 1.15f), pageIndicatorHolder.RectTransform, Anchor.CenterLeft, Pivot.CenterRight) { AbsoluteOffset = new Point(-HUDLayoutSettings.Padding * 3, 0) }, string.Empty, style: "GUIButtonToggleLeft") { IgnoreLayoutGroups = true, OnClicked = (button, userData) => { ChangePage(-1); return(true); } }; Point indicatorSize = new Point(GUI.IntScale(pageIndicator.SourceRect.Width * 1.5f), GUI.IntScale(pageIndicator.SourceRect.Height * 1.5f)); pageIndicatorHolder.RectTransform.NonScaledSize = new Point(pageCount * indicatorSize.X + HUDLayoutSettings.Padding * (pageCount - 1), pageIndicatorHolder.RectTransform.NonScaledSize.Y); int xPos = 0; int yPos = pageIndicatorHolder.Rect.Height / 2 - indicatorSize.Y / 2; pageIndicators = new GUIImage[pageCount]; for (int i = 0; i < pageCount; i++) { pageIndicators[i] = new GUIImage(new RectTransform(indicatorSize, pageIndicatorHolder.RectTransform) { AbsoluteOffset = new Point(xPos, yPos) }, pageIndicator, null, true); xPos += indicatorSize.X + HUDLayoutSettings.Padding; } for (int i = 0; i < pageIndicators.Length; i++) { pageIndicators[i].Color = i == currentPage - 1 ? Color.White : Color.Gray; } browseRightButton = new GUIButton(new RectTransform(new Vector2(1.15f, 1.15f), pageIndicatorHolder.RectTransform, Anchor.CenterRight, Pivot.CenterLeft) { AbsoluteOffset = new Point(-HUDLayoutSettings.Padding * 3, 0) }, string.Empty, style: "GUIButtonToggleRight") { IgnoreLayoutGroups = true, OnClicked = (button, userData) => { ChangePage(1); return(true); } }; browseLeftButton.Enabled = currentPage > 1; browseRightButton.Enabled = currentPage < pageCount; }