public UINominationSelectContainer(NhoodCandidateList candidates, bool nonPerson) { NonPerson = nonPerson; var ui = RenderScript("fsodonatorlist.uis"); var listBg = ui.Create <UIImage>("ListBoxBackground"); AddAt(0, listBg); listBg.With9Slice(25, 25, 25, 25); listBg.Width += 110; listBg.Height += 50; RoommateListSlider.AttachButtons(RoommateListScrollUpButton, RoommateScrollDownButton, 1); RoommateListBox.AttachSlider(RoommateListSlider); RoommateListBox.Columns[1].Alignment = Framework.TextAlignment.Left | Framework.TextAlignment.Middle; DonatorsLabel.Caption = "Search"; DonatorsLabel.CaptionStyle = DonatorsLabel.CaptionStyle.Clone(); DonatorsLabel.CaptionStyle.Shadow = true; DonatorsLabel.Y -= 26; foreach (var child in GetChildren()) { child.Y -= 45; } SearchBox = new UITextBox(); SearchBox.X = RoommateListBox.X; SearchBox.Y = 20; SearchBox.SetSize(listBg.Width, 25); SearchBox.OnChange += SearchBox_OnChange; Add(SearchBox); Candidates = candidates; UpdateCandidateList(candidates); }
public void RefreshSize() { var w = Width; var h = m_Options.Height; h = Math.Max(h, Math.Max((int)IconSpace.Y - 25, m_MessageText == null ? 0 : m_MessageText.BoundingBox.Height) + 105); if (Buttons.Count > 0) { h += 175; } else { h += 32; } if (m_Options.TextEntry) { TextBox.X = 32; TextBox.Y = h - 54; TextBox.SetSize(w - 64, 25); h += 45; } h = ResetButtons(h, true); if (Height != h) { SetHeight(h); } //update bg with height }
public UIColorPicker() { ClickHandler = ListenForMouse(new Rectangle(0, 0, 206, 128), new UIMouseEvent(OnMouseEvent)); RedText = new UITextBox(); RedText.SetBackgroundTexture(null, 0, 0, 0, 0); RedText.SetSize(40, 22); RedText.Position = new Vector2(232, 50); RedText.OnChange += RecalcColor; Add(RedText); var redLabel = new UILabel(); redLabel.Position = RedText.Position - new Vector2(20, -4); redLabel.Caption = "R:"; Add(redLabel); GreenText = new UITextBox(); GreenText.SetBackgroundTexture(null, 0, 0, 0, 0); GreenText.SetSize(40, 22); GreenText.Position = new Vector2(232, 50 + 28); GreenText.OnChange += RecalcColor; Add(GreenText); var greenLabel = new UILabel(); greenLabel.Position = GreenText.Position - new Vector2(20, -4); greenLabel.Caption = "G:"; Add(greenLabel); BlueText = new UITextBox(); BlueText.SetBackgroundTexture(null, 0, 0, 0, 0); BlueText.SetSize(40, 22); BlueText.Position = new Vector2(232, 50 + 28 * 2); BlueText.OnChange += RecalcColor; Add(BlueText); var blueLabel = new UILabel(); blueLabel.Position = BlueText.Position - new Vector2(20, -4); blueLabel.Caption = "B:"; Add(blueLabel); HexText = new UITextBox(); HexText.SetBackgroundTexture(null, 0, 0, 0, 0); HexText.SetSize(68, 45); HexText.Alignment = TextAlignment.Center | TextAlignment.Middle; HexText.TextStyle = HexText.TextStyle.Clone(); HexText.TextStyle.Shadow = true; HexText.TextStyle.Size = 8; HexText.Position = new Vector2(208, 0); HexText.OnChange += HexText_OnChange; Add(HexText); InternalChange = 1; RecalcColor(null); InternalChange = 0; }
public UIChatPanel(VM vm, UILotControl owner) { this.vm = vm; this.Owner = owner; if (FSOEnvironment.SoftwareKeyboard) { //need a button to initiate chat history var btn = new UIButton(); btn.Caption = "Chat"; btn.Position = new Vector2(10, 10); btn.OnButtonClick += (state) => { HistoryDialog.Visible = !HistoryDialog.Visible; }; Add(btn); } Style = TextStyle.DefaultTitle.Clone(); Style.Size = 16; Style.Shadow = true; Labels = new List <UIChatBalloon>(); TextBox = new UITextBox(); TextBox.Visible = false; Add(TextBox); TextBox.Position = new Vector2(25, 25); TextBox.SetSize(GlobalSettings.Default.GraphicsWidth - 50, 25); TextBox.OnEnterPress += SendMessageElem; SelectionFillColor = new Color(0, 25, 70); //-- populate invalid areas -- //chat bubbles will be pushed out of these areas //when this happens, they will also begin displaying the name of the speaking avatar. InvalidAreas = new List <Rectangle>(); InvalidAreas.Add(new Rectangle(-100000, -100000, 100020, 200000 + GlobalSettings.Default.GraphicsHeight)); //left InvalidAreas.Add(new Rectangle(-100000, -100000, 200000 + GlobalSettings.Default.GraphicsWidth, 100020)); //top InvalidAreas.Add(new Rectangle(GlobalSettings.Default.GraphicsWidth - 20, -100000, 100020, 200000 + GlobalSettings.Default.GraphicsHeight)); //right InvalidAreas.Add(new Rectangle(-100000, GlobalSettings.Default.GraphicsHeight - 20, 200000 + GlobalSettings.Default.GraphicsWidth, 100020)); //bottom InvalidAreas.Add(new Rectangle(-100000, GlobalSettings.Default.GraphicsHeight - 230, 100230, 100230)); //ucp HistoryDialog = new UIChatDialog(); HistoryDialog.Position = new Vector2(20, 20); HistoryDialog.Visible = false; HistoryDialog.Opacity = 0.75f; HistoryDialog.OnSendMessage += SendMessage; this.Add(HistoryDialog); PropertyLog = new UIPropertyLog(); PropertyLog.Position = new Vector2(400, 20); PropertyLog.Visible = false; PropertyLog.Opacity = 0.75f; this.Add(PropertyLog); }
public override void GameResized() { base.GameResized(); InvalidAreas = new List <Rectangle>(); InvalidAreas.Add(new Rectangle(-100000, -100000, 100020, 200000 + GlobalSettings.Default.GraphicsHeight)); //left InvalidAreas.Add(new Rectangle(-100000, -100000, 200000 + GlobalSettings.Default.GraphicsWidth, 100020)); //top InvalidAreas.Add(new Rectangle(GlobalSettings.Default.GraphicsWidth - 20, -100000, 100020, 200000 + GlobalSettings.Default.GraphicsHeight)); //right InvalidAreas.Add(new Rectangle(-100000, GlobalSettings.Default.GraphicsHeight - 20, 200000 + GlobalSettings.Default.GraphicsWidth, 100020)); //bottom InvalidAreas.Add(new Rectangle(-100000, GlobalSettings.Default.GraphicsHeight - 230, 100230, 100230)); //ucp TextBox.SetSize(GlobalSettings.Default.GraphicsWidth - 50, 25); }
public override void GameResized() { base.GameResized(); AvatarList.Y = UIScreen.Current.ScreenHeight - 145; ListStripe.Position = new Vector2(0, UIScreen.Current.ScreenHeight - 145); SecondName.SetSize(UIScreen.Current.ScreenWidth, 60); if (ActiveSelection > -1) { AvatarOptions.X = UIScreen.Current.ScreenWidth / 2 - (Avatars.Count()) * 50 + ActiveSelection * 100 - 44; AvatarOptions.Y = UIScreen.Current.ScreenHeight - 145; } AvatarList.InitAvatarList(); }
public UINominationSelectContainer(NhoodCandidateList candidates) { var ui = RenderScript("fsodonatorlist.uis"); var listBg = ui.Create <UIImage>("ListBoxBackground"); AddAt(0, listBg); listBg.With9Slice(25, 25, 25, 25); listBg.Width += 110; listBg.Height += 50; /* * Dropdown = ui.Create<UIInboxDropdown>("PullDownMenuSetup"); * Dropdown.OnSearch += (query) => * { * FindController<GenericSearchController>()?.Search(query, false, (results) => * { * Dropdown.SetResults(results); * }); * }; * Dropdown.OnSelect += AddDonator; * Add(Dropdown);*/ RoommateListSlider.AttachButtons(RoommateListScrollUpButton, RoommateScrollDownButton, 1); RoommateListBox.AttachSlider(RoommateListSlider); RoommateListBox.Columns[1].Alignment = Framework.TextAlignment.Left | Framework.TextAlignment.Middle; DonatorsLabel.Caption = "Search"; DonatorsLabel.CaptionStyle = DonatorsLabel.CaptionStyle.Clone(); DonatorsLabel.CaptionStyle.Shadow = true; DonatorsLabel.Y -= 26; foreach (var child in GetChildren()) { child.Y -= 45; } SearchBox = new UITextBox(); SearchBox.X = RoommateListBox.X; SearchBox.Y = 20; SearchBox.SetSize(listBg.Width, 25); SearchBox.OnChange += SearchBox_OnChange; Add(SearchBox); Candidates = candidates; UpdateCandidateList(candidates); }
/// <summary> /// A UICheatTextbox with text /// </summary> /// <param name="initialText"></param> public UICheatTextbox(FSO.SimAntics.VM vm, string initialText) { ts1VM = vm; baseTextbox = new UITextBox() { CurrentText = initialText, FlashOnEmpty = true, MaxLines = 1, //Tooltip = "Cheaters never win", //FrameColor = Color.Transparent, ID = "UICheatTextboxBase", }; baseTexture = new Texture2D(GameFacade.GraphicsDevice, 1, 1); baseTexture.SetData(new Color[] { new Color((byte)67, (byte)93, (byte)90, (byte)255) }); baseTextbox.SetBackgroundTexture(baseTexture, 0, 0, 0, 0); Size = new Vector2(200, 23); baseTextbox.SetSize(200, 23); Add(baseTextbox); }
public void RefreshSize() { var w = Width; var h = m_Options.Height; h = Math.Max(h, Math.Max((int)IconSpace.Y - 25, m_MessageText == null ? 0 : m_MessageText.BoundingBox.Height) + 105); if (Buttons.Count > 0) { h += 175; } else { h += 32; } if (m_Options.TextEntry) { TextBox.X = 32; TextBox.Y = h - 54; TextBox.SetSize(w - 64, 25); h += 45; } var btnX = (w - ((Buttons.Count - 1) * 350)) / 2; var btnY = h - 125; foreach (UIButton button in Buttons) { button.Y = btnY; button.X = btnX - button.Width / 2; btnX += 350; } if (Height != h) { SetHeight(h); } //update bg with height }
public UIChatPanel(VM vm, UILotControl owner) { this.vm = vm; this.Owner = owner; Style = TextStyle.DefaultTitle.Clone(); Style.Size = 16; Style.Shadow = true; Labels = new List <UIChatBalloon>(); TextBox = new UITextBox(); TextBox.Visible = false; Add(TextBox); TextBox.Position = new Vector2(25, 25); TextBox.SetSize(GlobalSettings.Default.GraphicsWidth - 50, 25); TextBox.OnEnterPress += SendMessageElem; SelectionFillColor = new Color(0, 25, 70); //-- populate invalid areas -- //chat bubbles will be pushed out of these areas //when this happens, they will also begin displaying the name of the speaking avatar. InvalidAreas = new List <Rectangle>(); InvalidAreas.Add(new Rectangle(-100000, -100000, 100020, 200000 + GlobalSettings.Default.GraphicsHeight)); //left InvalidAreas.Add(new Rectangle(-100000, -100000, 200000 + GlobalSettings.Default.GraphicsWidth, 100020)); //top InvalidAreas.Add(new Rectangle(GlobalSettings.Default.GraphicsWidth - 20, -100000, 100020, 200000 + GlobalSettings.Default.GraphicsHeight)); //right InvalidAreas.Add(new Rectangle(-100000, GlobalSettings.Default.GraphicsHeight - 20, 200000 + GlobalSettings.Default.GraphicsWidth, 100020)); //bottom InvalidAreas.Add(new Rectangle(-100000, GlobalSettings.Default.GraphicsHeight - 230, 100230, 100230)); //ucp HistoryDialog = new UIChatDialog(); HistoryDialog.Position = new Vector2(20, 20); HistoryDialog.Visible = false; HistoryDialog.Opacity = 0.75f; HistoryDialog.OnSendMessage += SendMessage; this.Add(HistoryDialog); }
public UIFamilyCASPanel(List <VMAvatar> avatar) { Avatars = avatar; AvatarOptions = new UICategorySwitcher(); AvatarOptions.InitCategories(AvatarCategories); AvatarOptions.MainButton.Visible = false; AvatarOptions.OnCategorySelect += AvatarOptions_OnCategorySelect; Add(AvatarOptions); NameStripe = new UIDiagonalStripe(new Point(0, 75), UIDiagonalStripeSide.LEFT, UIStyle.Current.Bg); NameStripe.Position = new Vector2(UIScreen.Current.ScreenWidth, 30); Add(NameStripe); SecondName = new UITextBox(); SecondName.TextMargin = new Rectangle(); SecondName.SetSize(UIScreen.Current.ScreenWidth, 60); SecondName.Alignment = TextAlignment.Center; SecondName.TextStyle = SecondName.TextStyle.Clone(); SecondName.TextStyle.Size = 37; SecondName.TextStyle.Color = UIStyle.Current.SecondaryText; SecondName.Position = new Vector2(0, 40); Add(SecondName); ListStripe = new UIDiagonalStripe(new Point(0, 125), UIDiagonalStripeSide.RIGHT, UIStyle.Current.Bg); ListStripe.Position = new Vector2(0, UIScreen.Current.ScreenHeight - 145); Add(ListStripe); AvatarList = new UIAvatarListPanel(avatar); AvatarList.Y = UIScreen.Current.ScreenHeight - 145; AvatarList.OnSelection += AvatarList_OnSelection; Add(AvatarList); Reset(); ShowI = ShowI; }
public UIRelationshipDialog() : base(UIDialogStyle.Standard | UIDialogStyle.Close, true) { this.Caption = GameFacade.Strings.GetString("f106", "10"); //f_web_inbtn = 0x1972454856DDBAC, //f_web_outbtn = 0x3D3AEF0856DDBAC, InnerBackground = new UIImage(GetTexture((ulong)0x7A400000001)).With9Slice(13, 13, 13, 13); InnerBackground.Position = new Vector2(15, 65); InnerBackground.SetSize(510, 230); AddAt(3, InnerBackground); ResultsBox = new UIListBox(); ResultsBox.Columns = new UIListBoxColumnCollection(); for (int i = 0; i < 3; i++) { ResultsBox.Columns.Add(new UIListBoxColumn() { Width = 170 }); } ResultsBox.Position = new Vector2(25, 82); ResultsBox.SetSize(510, 230); ResultsBox.RowHeight = 40; ResultsBox.NumVisibleRows = 6; ResultsBox.SelectionFillColor = Color.TransparentBlack; Add(ResultsBox); var seat = new UIImage(GetTexture(0x19700000002)); seat.Position = new Vector2(28, 28); Add(seat); IncomingButton = new UIButton(GetTexture((ulong)0x1972454856DDBAC)); IncomingButton.Position = new Vector2(33, 33); IncomingButton.Tooltip = GameFacade.Strings.GetString("f106", "12"); Add(IncomingButton); OutgoingButton = new UIButton(GetTexture((ulong)0x3D3AEF0856DDBAC)); OutgoingButton.Position = new Vector2(33, 33); OutgoingButton.Tooltip = GameFacade.Strings.GetString("f106", "13"); Add(OutgoingButton); SearchBox = new UITextBox(); SearchBox.Position = new Vector2(550 - 170, 37); SearchBox.SetSize(150, 25); SearchBox.OnEnterPress += SearchBox_OnEnterPress; Add(SearchBox); SortLabel = new UILabel(); SortLabel.Caption = GameFacade.Strings.GetString("f106", "1"); SortLabel.Position = new Vector2(95, 30); SortLabel.CaptionStyle = SortLabel.CaptionStyle.Clone(); SortLabel.CaptionStyle.Size = 8; Add(SortLabel); SearchLabel = new UILabel(); SearchLabel.Caption = GameFacade.Strings.GetString("f106", "14"); SearchLabel.Alignment = Framework.TextAlignment.Right; SearchLabel.Position = new Vector2(550 - 230, 38); SearchLabel.Size = new Vector2(50, 1); Add(SearchLabel); SortFriendButton = new UIButton(GetTexture((ulong)0xCE300000001)); //gizmo_friendliestthumb = 0xCE300000001, SortFriendButton.Tooltip = GameFacade.Strings.GetString("f106", "2"); SortFriendButton.Position = new Vector2(95, 47); Add(SortFriendButton); SortEnemyButton = new UIButton(GetTexture((ulong)0xCE600000001)); //gizmo_meanestthumb = 0xCE600000001, SortEnemyButton.Tooltip = GameFacade.Strings.GetString("f106", "3"); SortEnemyButton.Position = new Vector2(115, 47) + (new Vector2(17 / 2f, 14) - new Vector2(SortEnemyButton.Texture.Width / 8, SortEnemyButton.Texture.Height)); Add(SortEnemyButton); SortAlmostFriendButton = new UIButton(GetTexture((ulong)0x31600000001)); //gizmo_top100defaultthumb = 0x31600000001, SortAlmostFriendButton.Tooltip = GameFacade.Strings.GetString("f106", "4"); SortAlmostFriendButton.Position = new Vector2(135, 47) + (new Vector2(17 / 2f, 14) - new Vector2(SortAlmostFriendButton.Texture.Width / 8, SortAlmostFriendButton.Texture.Height)); Add(SortAlmostFriendButton); SortAlmostEnemyButton = new UIButton(GetTexture((ulong)0xCE400000001)); //gizmo_infamousthumb = 0xCE400000001, SortAlmostEnemyButton.Tooltip = GameFacade.Strings.GetString("f106", "5"); SortAlmostEnemyButton.Position = new Vector2(155, 47) + (new Vector2(17 / 2f, 14) - new Vector2(SortAlmostEnemyButton.Texture.Width / 8, SortAlmostEnemyButton.Texture.Height)); Add(SortAlmostEnemyButton); SortRoommateButton = new UIButton(GetTexture((ulong)0x4B700000001)); //ucp far zoom SortRoommateButton.Tooltip = GameFacade.Strings.GetString("f106", "6"); SortRoommateButton.Position = new Vector2(175, 47) + (new Vector2(17 / 2f, 14) - new Vector2(SortRoommateButton.Texture.Width / 8, SortRoommateButton.Texture.Height)); Add(SortRoommateButton); //gizmo_scrollbarimg = 0x31000000001, //gizmo_scrolldownbtn = 0x31100000001, //gizmo_scrollupbtn = 0x31200000001, ResultsSlider = new UISlider(); ResultsSlider.Orientation = 1; ResultsSlider.Texture = GetTexture(0x31000000001); ResultsSlider.MinValue = 0; ResultsSlider.MaxValue = 2; ResultsSlider.X = 529; ResultsSlider.Y = 72; ResultsSlider.SetSize(0, 214f); Add(ResultsSlider); SliderUpButton = new UIButton(GetTexture(0x31200000001)); SliderUpButton.Position = new Vector2(526, 65); Add(SliderUpButton); SliderDownButton = new UIButton(GetTexture(0x31100000001)); SliderDownButton.Position = new Vector2(526, 287); Add(SliderDownButton); ResultsSlider.AttachButtons(SliderUpButton, SliderDownButton, 1f); ResultsBox.AttachSlider(ResultsSlider); SetSize(560, 320); SortFriendButton.OnButtonClick += (btn) => ChangeOrderFunc(OrderFriendly); SortEnemyButton.OnButtonClick += (btn) => ChangeOrderFunc(OrderEnemy); SortAlmostFriendButton.OnButtonClick += (btn) => ChangeOrderFunc(OrderAlmostFriendly); SortAlmostEnemyButton.OnButtonClick += (btn) => ChangeOrderFunc(OrderAlmostEnemy); SortRoommateButton.OnButtonClick += (btn) => ChangeOrderFunc(OrderRoommate); ChangeOrderFunc(OrderFriendly); IncomingButton.OnButtonClick += (btn) => SetOutgoing(false); OutgoingButton.OnButtonClick += (btn) => SetOutgoing(true); TargetIcon = new UIPersonButton(); TargetIcon.FrameSize = UIPersonButtonSize.SMALL; TargetIcon.Position = new Vector2(72, 35); Add(TargetIcon); CloseButton.OnButtonClick += CloseButton_OnButtonClick; FriendLabel = new UILabel(); FriendLabel.Position = new Vector2(35, 292); Add(FriendLabel); IncomingLabel = new UILabel(); IncomingLabel.Position = new Vector2(540 - 36, 292); IncomingLabel.Size = new Vector2(1, 1); IncomingLabel.Alignment = TextAlignment.Right; Add(IncomingLabel); SetOutgoing(true); }
public UIDebugMenu() : base(UIDialogStyle.Tall, true) { SetSize(500, 300); Caption = "Debug Tools"; Position = new Microsoft.Xna.Framework.Vector2( (GlobalSettings.Default.GraphicsWidth / 2.0f) - 250, (GlobalSettings.Default.GraphicsHeight / 2.0f) - 150 ); Add(new UIImage() { Texture = GetTexture(0x00000Cbfb00000001), Position = new Microsoft.Xna.Framework.Vector2(40, 95) }); ContentBrowserBtn = new UIButton(); ContentBrowserBtn.Caption = "Nhood Global Cycle"; ContentBrowserBtn.Position = new Microsoft.Xna.Framework.Vector2(160, 50); ContentBrowserBtn.Width = 300; ContentBrowserBtn.OnButtonClick += x => { UIAlert.Prompt("Force Cycle", "How many days in the future do you want neighbourhoods to process?", true, (response) => { uint result; if (!uint.TryParse(response, out result)) { return; } FindController <CoreGameScreenController>()?.NeighborhoodProtocol.PretendDate(ClientEpoch.Now + 60 * 60 * 24 * result, (code) => { }); }); }; Add(ContentBrowserBtn); var connectLocalBtn = new UIButton(); connectLocalBtn.Caption = (GlobalSettings.Default.UseCustomServer) ? "Use default server (TSO)" : "Use custom defined server"; connectLocalBtn.Position = new Microsoft.Xna.Framework.Vector2(160, 90); connectLocalBtn.Width = 300; connectLocalBtn.OnButtonClick += x => { GlobalSettings.Default.UseCustomServer = !GlobalSettings.Default.UseCustomServer; connectLocalBtn.Caption = (GlobalSettings.Default.UseCustomServer) ? "Use default server (TSO)" : "Use custom defined server"; GlobalSettings.Default.Save(); }; Add(connectLocalBtn); var cityPainterBtn = new UIButton(); cityPainterBtn.Caption = "City Painter"; cityPainterBtn.Position = new Microsoft.Xna.Framework.Vector2(160, 130); cityPainterBtn.Width = 150; cityPainterBtn.OnButtonClick += x => { var core = (GameFacade.Screens.CurrentUIScreen as CoreGameScreen); if (core == null) { return; } if (core.CityRenderer.Plugin == null) { core.CityRenderer.Plugin = new Rendering.City.Plugins.MapPainterPlugin(core.CityRenderer); cityPainterBtn.Caption = "Disable Painter"; } else { core.CityRenderer.Plugin = null; cityPainterBtn.Caption = "City Painter"; } }; Add(cityPainterBtn); var ngbhBtn = new UIButton(); ngbhBtn.Caption = "Ngbh Editor"; ngbhBtn.Position = new Microsoft.Xna.Framework.Vector2(160 + 150, 130); ngbhBtn.Width = 150; ngbhBtn.OnButtonClick += x => { var core = (GameFacade.Screens.CurrentUIScreen as CoreGameScreen); if (core == null) { return; } if (core.CityRenderer.Plugin == null) { core.CityRenderer.Plugin = new Rendering.City.Plugins.NeighbourhoodEditPlugin(core.CityRenderer); ngbhBtn.Caption = "Disable Editor"; } else { core.CityRenderer.Plugin = null; ngbhBtn.Caption = "Ngbh Editor"; } }; Add(ngbhBtn); var benchmarkBtn = new UIButton(); benchmarkBtn.Caption = "VM Performance Benchmark (100k ticks)"; benchmarkBtn.Position = new Microsoft.Xna.Framework.Vector2(160, 170); benchmarkBtn.Width = 300; benchmarkBtn.OnButtonClick += x => { var core = (GameFacade.Screens.CurrentUIScreen as IGameScreen); if (core == null || core.vm == null) { UIScreen.GlobalShowAlert(new UIAlertOptions() { Message = "A VM must be running to benchmark performance." }, true); return; } var watch = new Stopwatch(); watch.Start(); var vm = core.vm; var tick = vm.Scheduler.CurrentTickID + 1; for (int i = 0; i < 100000; i++) { vm.InternalTick(tick++); } watch.Stop(); UIScreen.GlobalShowAlert(new UIAlertOptions() { Message = "Ran 100k ticks in " + watch.ElapsedMilliseconds + "ms." }, true); }; Add(benchmarkBtn); var resyncBtn = new UIButton(); resyncBtn.Caption = "Lot Disconnect"; resyncBtn.Position = new Microsoft.Xna.Framework.Vector2(160, 210); resyncBtn.Width = 150; resyncBtn.OnButtonClick += x => { var kernel = FSOFacade.Kernel; if (kernel != null) { var reg = kernel.Get <Regulators.LotConnectionRegulator>(); reg.Client.Disconnect(); } /* * var core = (GameFacade.Screens.CurrentUIScreen as IGameScreen); * if (core == null || core.vm == null) * { * UIScreen.GlobalShowAlert(new UIAlertOptions() * { * Message = "A VM must be running to force a resync." * }, true); * return; * } * core.vm.SendCommand(new VMRequestResyncCmd()); */ }; Add(resyncBtn); var cityDCBtn = new UIButton(); cityDCBtn.Caption = "City Disconnect"; cityDCBtn.Position = new Microsoft.Xna.Framework.Vector2(160 + 150, 210); cityDCBtn.Width = 150; cityDCBtn.OnButtonClick += x => { var kernel = FSOFacade.Kernel; if (kernel != null) { var reg = kernel.Get <Regulators.CityConnectionRegulator>(); reg.Client.Disconnect(); } }; Add(cityDCBtn); serverNameBox = new UITextBox(); serverNameBox.X = 50; serverNameBox.Y = 300 - 54; serverNameBox.SetSize(500 - 100, 25); serverNameBox.CurrentText = GlobalSettings.Default.GameEntryUrl; Add(serverNameBox); }
public UIDebugMenu() : base(UIDialogStyle.Tall, true) { SetSize(500, 300); Caption = "Debug Tools"; Position = new Microsoft.Xna.Framework.Vector2( (GlobalSettings.Default.GraphicsWidth / 2.0f) - 250, (GlobalSettings.Default.GraphicsHeight / 2.0f) - 150 ); Add(new UIImage() { Texture = GetTexture(0x00000Cbfb00000001), Position = new Microsoft.Xna.Framework.Vector2(40, 95) }); ContentBrowserBtn = new UIButton(); ContentBrowserBtn.Caption = "Browse Content"; ContentBrowserBtn.Position = new Microsoft.Xna.Framework.Vector2(160, 50); ContentBrowserBtn.Width = 300; ContentBrowserBtn.OnButtonClick += x => { //ShowTool(new ContentBrowser()); }; Add(ContentBrowserBtn); var connectLocalBtn = new UIButton(); connectLocalBtn.Caption = (GlobalSettings.Default.UseCustomServer) ? "Use default server (TSO)" : "Use custom defined server"; connectLocalBtn.Position = new Microsoft.Xna.Framework.Vector2(160, 90); connectLocalBtn.Width = 300; connectLocalBtn.OnButtonClick += x => { GlobalSettings.Default.UseCustomServer = !GlobalSettings.Default.UseCustomServer; connectLocalBtn.Caption = (GlobalSettings.Default.UseCustomServer) ? "Use default server (TSO)" : "Use custom defined server"; GlobalSettings.Default.Save(); }; Add(connectLocalBtn); var cityPainterBtn = new UIButton(); cityPainterBtn.Caption = "Toggle City Painter"; cityPainterBtn.Position = new Microsoft.Xna.Framework.Vector2(160, 130); cityPainterBtn.Width = 300; cityPainterBtn.OnButtonClick += x => { var core = (GameFacade.Screens.CurrentUIScreen as CoreGameScreen); if (core == null) { return; } if (core.CityRenderer.Plugin == null) { core.CityRenderer.Plugin = new Rendering.City.Plugins.MapPainterPlugin(core.CityRenderer); cityPainterBtn.Caption = "Disable City Painter"; } else { core.CityRenderer.Plugin = null; cityPainterBtn.Caption = "Enable City Painter"; } }; Add(cityPainterBtn); var benchmarkBtn = new UIButton(); benchmarkBtn.Caption = "VM Performance Benchmark (100k ticks)"; benchmarkBtn.Position = new Microsoft.Xna.Framework.Vector2(160, 170); benchmarkBtn.Width = 300; benchmarkBtn.OnButtonClick += x => { var core = (GameFacade.Screens.CurrentUIScreen as IGameScreen); if (core == null || core.vm == null) { UIScreen.GlobalShowAlert(new UIAlertOptions() { Message = "A VM must be running to benchmark performance." }, true); return; } var watch = new Stopwatch(); watch.Start(); var vm = core.vm; var tick = vm.Scheduler.CurrentTickID + 1; for (int i = 0; i < 100000; i++) { vm.InternalTick(tick++); } watch.Stop(); UIScreen.GlobalShowAlert(new UIAlertOptions() { Message = "Ran 100k ticks in " + watch.ElapsedMilliseconds + "ms." }, true); }; Add(benchmarkBtn); var resyncBtn = new UIButton(); resyncBtn.Caption = "Force Resync"; resyncBtn.Position = new Microsoft.Xna.Framework.Vector2(160, 210); resyncBtn.Width = 300; resyncBtn.OnButtonClick += x => { var core = (GameFacade.Screens.CurrentUIScreen as IGameScreen); if (core == null || core.vm == null) { UIScreen.GlobalShowAlert(new UIAlertOptions() { Message = "A VM must be running to force a resync." }, true); return; } core.vm.SendCommand(new VMRequestResyncCmd()); }; Add(resyncBtn); serverNameBox = new UITextBox(); serverNameBox.X = 50; serverNameBox.Y = 300 - 54; serverNameBox.SetSize(500 - 100, 25); serverNameBox.CurrentText = GlobalSettings.Default.GameEntryUrl; Add(serverNameBox); }
public UIChatCategoryDialog(VMTSOChatChannel cat, bool isNew) : base(UIDialogStyle.OK | UIDialogStyle.Close, true) { Channel = cat; Caption = GameFacade.Strings.GetString("f113", "21") + cat.ID; var topVbox = new UIVBoxContainer(); var nameLabel = new UILabel(); nameLabel.Caption = GameFacade.Strings.GetString("f113", "22"); topVbox.Add(nameLabel); NameEdit = new UITextBox(); NameEdit.SetSize(200, 25); NameEdit.CurrentText = cat.Name; NameEdit.MaxChars = 8; topVbox.Add(NameEdit); var descLabel = new UILabel(); descLabel.Caption = GameFacade.Strings.GetString("f113", "23"); topVbox.Add(descLabel); DescEdit = new UITextEdit(); DescEdit.BackgroundTextureReference = UITextBox.StandardBackground; DescEdit.TextMargin = new Rectangle(8, 2, 8, 3); DescEdit.SetSize(400, 100); DescEdit.CurrentText = cat.Description; DescEdit.MaxChars = 256; DescEdit.MaxLines = 5; topVbox.Add(DescEdit); var flagLabel = new UILabel(); flagLabel.Caption = GameFacade.Strings.GetString("f113", "24"); topVbox.Add(flagLabel); var flagbox = new UIHBoxContainer(); for (var i = 0; i < 2; i++) { var caption = GameFacade.Strings.GetString("f113", (25 + i).ToString()); var check = new UIButton(GetTexture(0x0000083600000001)); check.Tooltip = caption; var flag = (VMTSOChatChannelFlags)(1 << i); check.OnButtonClick += x => { check.Selected = !check.Selected; cat.Flags ^= flag; }; check.Selected = (cat.Flags & flag) > 0; flagbox.Add(check); flagbox.Add(new UILabel { Caption = caption }); } topVbox.Add(flagbox); flagbox.AutoSize(); Add(topVbox); topVbox.AutoSize(); topVbox.Position = new Vector2(20, 35); UIVBoxContainer before = null; for (int j = 0; j < 2; j++) { var vbox = new UIVBoxContainer(); vbox.Add(new UILabel { Caption = (j == 0) ? GameFacade.Strings.GetString("f113", "35") : GameFacade.Strings.GetString("f113", "36") }); var viewMin = (j == 0); for (uint i = 0; i < 4; i++) { var hbox = new UIHBoxContainer(); var radio = new UIRadioButton(); radio.RadioGroup = (j == 0) ? "viewPerm" : "showPerm"; radio.RadioData = (VMTSOAvatarPermissions)i; radio.Selected = (viewMin)?(i == (int)cat.ViewPermMin): (i == (int)cat.SendPermMin); radio.Tooltip = GameFacade.Strings.GetString("f113", (37 + i).ToString()); radio.OnButtonClick += (btn) => { if (viewMin) { cat.ViewPermMin = (VMTSOAvatarPermissions)radio.RadioData; } else { cat.SendPermMin = (VMTSOAvatarPermissions)radio.RadioData; } }; hbox.Add(radio); hbox.Add(new UILabel { Caption = GameFacade.Strings.GetString("f113", (37 + i).ToString()) }); vbox.Add(hbox); } before = vbox; vbox.Position = new Vector2(20 + j * 200, topVbox.Size.Y + 50); Add(vbox); vbox.AutoSize(); } var buttonsHbox = new UIHBoxContainer(); if (!isNew) { var deleteButton = new UIButton(); deleteButton.Caption = GameFacade.Strings.GetString("f113", "33"); deleteButton.OnButtonClick += (btn) => { UIScreen.RemoveDialog(this); Channel.Flags |= VMTSOChatChannelFlags.Delete; OnDelete(); }; buttonsHbox.Add(deleteButton); } var setColorButton = new UIButton(); setColorButton.Caption = GameFacade.Strings.GetString("f113", "34"); setColorButton.CaptionStyle = setColorButton.CaptionStyle.Clone(); setColorButton.CaptionStyle.Color = cat.TextColor; setColorButton.CaptionStyle.Shadow = true; setColorButton.OnButtonClick += (btn) => { UIAlert alert = null; alert = UIScreen.GlobalShowAlert(new UIAlertOptions() { Title = "", Message = GameFacade.Strings.GetString("f113", "8"), Color = true, Buttons = new UIAlertButton[] { new UIAlertButton(UIAlertButtonType.OK, (btn2) => { //set the color var col = int.Parse(alert.ResponseText); cat.TextColor = new Color(col >> 16, (byte)(col >> 8), (byte)col); setColorButton.CaptionStyle.Color = cat.TextColor; setColorButton.Invalidate(); UIScreen.RemoveDialog(alert); }), new UIAlertButton(UIAlertButtonType.Cancel) } }, true); }; buttonsHbox.Add(setColorButton); buttonsHbox.AutoSize(); buttonsHbox.Position = new Vector2((440 - buttonsHbox.Size.X) / 2, topVbox.Size.Y + before.Size.Y + 65); Add(buttonsHbox); SetSize(440, (int)(topVbox.Size.Y + before.Size.Y + 115)); CloseButton.OnButtonClick += (btn) => { UIScreen.RemoveDialog(this); }; OKButton.OnButtonClick += (btn) => { Channel.Name = NameEdit.CurrentText; Channel.Description = DescEdit.CurrentText; UIScreen.RemoveDialog(this); }; }
public UIDebugMenu() : base(UIDialogStyle.Tall, true) { SetSize(500, 300); Caption = "Debug Tools"; Position = new Microsoft.Xna.Framework.Vector2( (GlobalSettings.Default.GraphicsWidth / 2.0f) - 250, (GlobalSettings.Default.GraphicsHeight / 2.0f) - 150 ); Add(new UIImage() { Texture = GetTexture(0x00000Cbfb00000001), Position = new Microsoft.Xna.Framework.Vector2(40, 95) }); ContentBrowserBtn = new UIButton(); ContentBrowserBtn.Caption = "Browse Content"; ContentBrowserBtn.Position = new Microsoft.Xna.Framework.Vector2(160, 50); ContentBrowserBtn.Width = 300; ContentBrowserBtn.OnButtonClick += x => { //ShowTool(new ContentBrowser()); }; Add(ContentBrowserBtn); var connectLocalBtn = new UIButton(); connectLocalBtn.Caption = (GlobalSettings.Default.UseCustomServer) ? "Use default server (TSO)" : "Use custom defined server"; connectLocalBtn.Position = new Microsoft.Xna.Framework.Vector2(160, 90); connectLocalBtn.Width = 300; connectLocalBtn.OnButtonClick += x => { GlobalSettings.Default.UseCustomServer = !GlobalSettings.Default.UseCustomServer; connectLocalBtn.Caption = (GlobalSettings.Default.UseCustomServer) ? "Use default server (TSO)" : "Use custom defined server"; GlobalSettings.Default.Save(); }; Add(connectLocalBtn); var cityPainterBtn = new UIButton(); cityPainterBtn.Caption = "Toggle City Painter"; cityPainterBtn.Position = new Microsoft.Xna.Framework.Vector2(160, 130); cityPainterBtn.Width = 300; cityPainterBtn.OnButtonClick += x => { var core = (GameFacade.Screens.CurrentUIScreen as CoreGameScreen); if (core == null) { return; } if (core.CityRenderer.Plugin == null) { core.CityRenderer.Plugin = new Rendering.City.Plugins.MapPainterPlugin(core.CityRenderer); cityPainterBtn.Caption = "Disable City Painter"; } else { core.CityRenderer.Plugin = null; cityPainterBtn.Caption = "Enable City Painter"; } }; Add(cityPainterBtn); serverNameBox = new UITextBox(); serverNameBox.X = 50; serverNameBox.Y = 300 - 54; serverNameBox.SetSize(500 - 100, 25); serverNameBox.CurrentText = GlobalSettings.Default.GameEntryUrl; Add(serverNameBox); }
public UISimCASPanel() { var ui = Content.Get().CustomUI; var gd = GameFacade.GraphicsDevice; SimTabButton = new UIStencilButton(ui.Get("cas_sim.png").Get(gd)); SimTabButton.Position = new Vector2(); SimTabButton.OnButtonClick += (btn) => { SetTab(0); }; Add(SimTabButton); PersonalityTabButton = new UIStencilButton(ui.Get("cas_per.png").Get(gd)); PersonalityTabButton.Position = new Vector2(0, 93); PersonalityTabButton.OnButtonClick += (btn) => { SetTab(1); }; Add(PersonalityTabButton); BioTabButton = new UIStencilButton(ui.Get("cas_bio.png").Get(gd)); BioTabButton.Position = new Vector2(0, 186); BioTabButton.OnButtonClick += (btn) => { SetTab(2); }; Add(BioTabButton); FirstNameTitle = new UILabel(); FirstNameTitle.Caption = "First Name"; FirstNameTitle.Position = new Vector2(96, 6); InitLabel(FirstNameTitle, 15); FirstNameTitle.CaptionStyle.Color = UIStyle.Current.SecondaryText; FirstNameTextBox = new UITextBox(); FirstNameTextBox.Position = new Vector2(94, 26); FirstNameTextBox.Alignment = TextAlignment.Center; FirstNameTextBox.SetSize(401, 48); FirstNameTextBox.TextStyle = FirstNameTextBox.TextStyle.Clone(); FirstNameTextBox.TextStyle.Color = UIStyle.Current.Text; FirstNameTextBox.TextStyle.Size = 25; Add(FirstNameTextBox); // SIM TAB SimGenderTitle = new UILabel(); SimGenderTitle.Caption = "Gender"; SimGenderTitle.Size = Vector2.One; SimGenderTitle.Position = new Vector2(113 + 32, 95); SimGenderTitle.Alignment = TextAlignment.Middle | TextAlignment.Center; InitLabel(SimGenderTitle, 15); SimAgeTitle = new UILabel(); SimAgeTitle.Caption = "Age"; SimAgeTitle.Size = Vector2.One; SimAgeTitle.Position = new Vector2(212 + 32, 95); SimAgeTitle.Alignment = TextAlignment.Middle | TextAlignment.Center; InitLabel(SimAgeTitle, 15); SimSkinTitle = new UILabel(); SimSkinTitle.Caption = "Skin Color"; SimSkinTitle.Size = Vector2.One; SimSkinTitle.Position = new Vector2(302 + 45, 95); SimSkinTitle.Alignment = TextAlignment.Middle | TextAlignment.Center; InitLabel(SimSkinTitle, 15); SimMaleBtn = new UIStencilButton(ui.Get("cas_male.png").Get(gd)); SimMaleBtn.OnButtonClick += (btn) => ChangeType(0, 'm'); SimMaleBtn.Position = new Vector2(113, 114); Add(SimMaleBtn); SimFemaleBtn = new UIStencilButton(ui.Get("cas_female.png").Get(gd)); SimFemaleBtn.OnButtonClick += (btn) => ChangeType(0, 'f'); SimFemaleBtn.Position = new Vector2(113, 191); Add(SimFemaleBtn); SimAdultBtn = new UIStencilButton(ui.Get("cas_adult.png").Get(gd)); SimAdultBtn.OnButtonClick += (btn) => ChangeType(1, 'a'); SimAdultBtn.Position = new Vector2(212, 114); Add(SimAdultBtn); SimChildBtn = new UIStencilButton(ui.Get("cas_child.png").Get(gd)); SimChildBtn.OnButtonClick += (btn) => ChangeType(1, 'c'); SimChildBtn.Position = new Vector2(212, 191); Add(SimChildBtn); SimSkinLgtBtn = new UIStencilButton(ui.Get("cas_skinlgt.png").Get(gd)); SimSkinLgtBtn.OnButtonClick += (btn) => ChangeSkin("lgt"); SimSkinLgtBtn.Position = new Vector2(302, 114); Add(SimSkinLgtBtn); SimSkinMedBtn = new UIStencilButton(ui.Get("cas_skinmed.png").Get(gd)); SimSkinMedBtn.OnButtonClick += (btn) => ChangeSkin("med"); SimSkinMedBtn.Position = new Vector2(302, 164); Add(SimSkinMedBtn); SimSkinDrkBtn = new UIStencilButton(ui.Get("cas_skindrk.png").Get(gd)); SimSkinDrkBtn.OnButtonClick += (btn) => ChangeSkin("drk"); SimSkinDrkBtn.Position = new Vector2(302, 214); Add(SimSkinDrkBtn); SimRandomBtn = new UIStencilButton(ui.Get("cas_rand.png").Get(gd)); SimRandomBtn.Position = new Vector2(405, 142); SimRandomBtn.OnButtonClick += SimRandomBtn_OnButtonClick; Add(SimRandomBtn); //PERSONALITY TAB PerNeatTitle = new UILabel(); PerNeatTitle.Position = new Vector2(99, 85); PerNeatTitle.Size = new Vector2(110, 1); PerNeatTitle.Alignment = TextAlignment.Right; PerNeatTitle.Caption = "Neat:"; InitLabel(PerNeatTitle, 15); PerOutgoingTitle = new UILabel(); PerOutgoingTitle.Position = new Vector2(99, 122); PerOutgoingTitle.Size = new Vector2(110, 1); PerOutgoingTitle.Alignment = TextAlignment.Right; PerOutgoingTitle.Caption = "Outgoing:"; InitLabel(PerOutgoingTitle, 15); PerActiveTitle = new UILabel(); PerActiveTitle.Position = new Vector2(99, 160); PerActiveTitle.Size = new Vector2(110, 1); PerActiveTitle.Alignment = TextAlignment.Right; PerActiveTitle.Caption = "Active:"; InitLabel(PerActiveTitle, 15); PerPlayfulTitle = new UILabel(); PerPlayfulTitle.Position = new Vector2(99, 200); PerPlayfulTitle.Size = new Vector2(110, 1); PerPlayfulTitle.Alignment = TextAlignment.Right; PerPlayfulTitle.Caption = "Playful:"; InitLabel(PerPlayfulTitle, 15); PerNiceTitle = new UILabel(); PerNiceTitle.Position = new Vector2(99, 238); PerNiceTitle.Size = new Vector2(110, 1); PerNiceTitle.Alignment = TextAlignment.Right; PerNiceTitle.Caption = "Nice:"; InitLabel(PerNiceTitle, 15); PersonalityTex = ui.Get("skill.png").Get(gd); for (int i = 0; i < 5; i++) { Personalities[i] = new UICASPersonalityBar(this); Personalities[i].Position = new Vector2(215, 87 + i * 38); Add(Personalities[i]); } //BIO TAB BioTitle = new UILabel(); BioTitle.Position = new Vector2(99, 85); BioTitle.Caption = "Bio:"; InitLabel(BioTitle, 15); BioBG = new UIImage(ui.Get("cas_bio_bg.png").Get(gd)).With9Slice(15, 15, 15, 15); BioBG.Position = new Vector2(99, 112); BioBG.SetSize(390, 152); Add(BioBG); BioEdit = new UITextEdit(); BioEdit.Position = new Vector2(107, 122); BioEdit.SetSize(371, 133); BioEdit.TextStyle = BioEdit.TextStyle.Clone(); BioEdit.TextStyle.Color = UIStyle.Current.Text; BioEdit.TextStyle.Size = 12; BioEdit.MaxLines = 7; Add(BioEdit); UpdateType(); SetTab(0); }