public void UpdateCandidateList(NhoodCandidateList candidates) { IEnumerable <NhoodCandidate> sims = candidates.Candidates; var searchString = SearchBox.CurrentText.ToLowerInvariant(); if (SearchBox.CurrentText != "") { sims = sims.Where(x => x.Name.ToLowerInvariant().Contains(searchString)); } RoommateListBox.Items = sims.OrderBy(x => x.Name).Select(x => { var personBtn = new UIPersonButton() { AvatarId = x.ID, FrameSize = UIPersonButtonSize.SMALL }; personBtn.LogicalParent = this; UIRatingDisplay rating = null; if (x.Rating != uint.MaxValue) { rating = new UIRatingDisplay(true); rating.LogicalParent = this; rating.DisplayStars = x.Rating / 100f; rating.LinkAvatar = x.ID; } return(new UIListBoxItem( x, personBtn, x.Name, "", (object)rating ?? "" )); }).ToList(); }
/// <summary> /// Creates a new UIMessage instance. /// </summary> /// <param name="type">The type of message (IM, compose or read).</param> /// <param name="author">Author if type is read or IM, recipient if type is compose.</param> public UIMessageWindow() { var script = this.RenderScript("message.uis"); Messages = new List <IMEntry>(); BtnBackground = new UIImage(backgroundBtnImage); BtnBackground.X = 313; BtnBackground.Y = 216; this.AddAt(0, BtnBackground); TypeBackground = new UIImage(backgroundMessageImage); TypeBackground.X = 10; TypeBackground.Y = 12; this.AddAt(0, TypeBackground); Background = new UIImage(backgroundImage); this.AddAt(0, Background); UIUtils.MakeDraggable(Background, this, true); UIUtils.MakeDraggable(TypeBackground, this, true); LetterSubjectTextEdit.MaxLines = 1; LetterSubjectTextEdit.TextMargin = new Microsoft.Xna.Framework.Rectangle(2, 2, 2, 2); MessageSlider.AttachButtons(MessageScrollUpButton, MessageScrollDownButton, 1); MessageTextEdit.AttachSlider(MessageSlider); MessageTextEdit.OnChange += new ChangeDelegate(MessageTextEdit_OnChange); SendMessageButton.OnButtonClick += new ButtonClickDelegate(SendMessage); MessageTextEdit.OnEnterPress += new KeyPressDelegate(SendMessageEnter); SendMessageButton.Disabled = true; LetterSlider.AttachButtons(LetterScrollUpButton, LetterScrollDownButton, 1); LetterTextEdit.AttachSlider(LetterSlider); RespondLetterButton.OnButtonClick += new ButtonClickDelegate(RespondLetterButton_OnButtonClick); SendLetterButton.OnButtonClick += new ButtonClickDelegate(SendLetter); HistorySlider.AttachButtons(HistoryScrollUpButton, HistoryScrollDownButton, 1); HistoryTextEdit.AttachSlider(HistorySlider); HistoryTextEdit.TextStyle = HistoryTextEdit.TextStyle.Clone(); HistoryTextEdit.TextStyle.Size = 8; HistoryTextEdit.TextMargin = new Microsoft.Xna.Framework.Rectangle(3, 3, 3, 3); HistoryTextEdit.SetSize(333, 100); CloseButton.OnButtonClick += new ButtonClickDelegate(CloseButton_OnButtonClick); MinimizeButton.OnButtonClick += MinimizeButton_OnButtonClick; PersonButton = script.Create <UIPersonButton>("AvatarThumbnail"); PersonButton.FrameSize = UIPersonButtonSize.SMALL; Add(PersonButton); User = new Binding <UserReference>() .WithBinding(SimNameText, "Caption", "Name"); MyUser = new Binding <UserReference>(); User.ValueChanged += (x) => PersonButton.User.Value = x; Size = Background.Size.ToVector2(); }
public void UpdateList(List <uint> roommates) { while (RoommateButtons.Count > roommates.Count) { Remove(RoommateButtons[RoommateButtons.Count - 1]); RoommateButtons.RemoveAt(RoommateButtons.Count - 1); } while (roommates.Count > RoommateButtons.Count) { var btn = new UIPersonButton { FrameSize = UIPersonButtonSize.SMALL, X = RoommateButtons.Count * (20 + 6) //6 is gutter size }; Add(btn); RoommateButtons.Add(btn); } for (int i = 0; i < RoommateButtons.Count; i++) { if (RoommateButtons[i].AvatarId != roommates[i]) { RoommateButtons[i].AvatarId = roommates[i]; } } }
public void Init() { if (Icon != null) { return; } Icon = new UIPersonButton(); Icon.FrameSize = UIPersonButtonSize.LARGE; Icon.AvatarId = Rel.Relationship_TargetID; Add(Icon); }
public void UpdateList(HashSet <uint> roommates, HashSet <uint> buildRoommates) { while (RoommateButtons.Count > roommates.Count) { Remove(RoommateButtons[RoommateButtons.Count - 1]); Remove(CheckButtons[CheckButtons.Count - 1]); RoommateButtons.RemoveAt(RoommateButtons.Count - 1); CheckButtons.RemoveAt(CheckButtons.Count - 1); } while (roommates.Count > RoommateButtons.Count) { var btn = new UIPersonButton { FrameSize = UIPersonButtonSize.LARGE, X = RoommateButtons.Count * (34 + 6) //6 is gutter size }; Add(btn); RoommateButtons.Add(btn); var cbt = new UIButton { ImageStates = 6, Texture = GetTexture(0x0000049400000001), X = CheckButtons.Count * (34 + 6) + 9, //6 is gutter size, 10 is margin for checkbutton Y = 34 + 8 }; cbt.OnButtonClick += (e) => { OnCheckChange?.Invoke(CheckButtons.IndexOf((UIButton)e)); }; Add(cbt); CheckButtons.Add(cbt); } for (int i = 0; i < RoommateButtons.Count; i++) { var id = roommates.ElementAt(i); if (RoommateButtons[i].AvatarId != id) { RoommateButtons[i].AvatarId = id; } var builder = buildRoommates.Contains(id); CheckButtons[i].ForceState = Disabled ? (builder ? 5 : 4) : (builder?3:-1); CheckButtons[i].Tooltip = GameFacade.Strings.GetString("178", builder?"3":"4"); } }
/// <summary> /// Creates a new UIMessage instance. /// </summary> /// <param name="type">The type of message (IM, compose or read).</param> /// <param name="author">Author if type is read or IM, recipient if type is compose.</param> public UIMessageWindow() { var script = this.RenderScript("message.uis"); Messages = new List <IMEntry>(); BtnBackground = new UIImage(backgroundBtnImage); BtnBackground.X = 313; BtnBackground.Y = 216; this.AddAt(0, BtnBackground); TypeBackground = new UIImage(backgroundMessageImage); TypeBackground.X = 10; TypeBackground.Y = 12; this.AddAt(0, TypeBackground); Background = new UIImage(backgroundImage); this.AddAt(0, Background); UIUtils.MakeDraggable(Background, this, true); UIUtils.MakeDraggable(TypeBackground, this, true); LetterSubjectTextEdit.MaxLines = 1; LetterSubjectTextEdit.TextMargin = new Microsoft.Xna.Framework.Rectangle(2, 2, 2, 2); LetterSubjectTextEdit.MaxChars = 128; MessageSlider.AttachButtons(MessageScrollUpButton, MessageScrollDownButton, 1); MessageTextEdit.AttachSlider(MessageSlider); MessageTextEdit.OnChange += new ChangeDelegate(MessageTextEdit_OnChange); SendMessageButton.OnButtonClick += new ButtonClickDelegate(SendMessage); var emojis = new UIEmojiSuggestions(MessageTextEdit); DynamicOverlay.Add(emojis); MessageTextEdit.OnEnterPress += new KeyPressDelegate(SendMessageEnter); SendMessageButton.Disabled = true; LetterSlider.AttachButtons(LetterScrollUpButton, LetterScrollDownButton, 1); LetterTextEdit.AttachSlider(LetterSlider); LetterTextEdit.MaxChars = 1000; var emojis2 = new UIEmojiSuggestions(LetterTextEdit); DynamicOverlay.Add(emojis2); RespondLetterButton.OnButtonClick += new ButtonClickDelegate(RespondLetterButton_OnButtonClick); SendLetterButton.OnButtonClick += new ButtonClickDelegate(SendLetter); HistorySlider.AttachButtons(HistoryScrollUpButton, HistoryScrollDownButton, 1); HistoryTextEdit.AttachSlider(HistorySlider); HistoryTextEdit.BBCodeEnabled = true; HistoryTextEdit.TextStyle = HistoryTextEdit.TextStyle.Clone(); HistoryTextEdit.TextStyle.Size = 8; HistoryTextEdit.TextMargin = new Microsoft.Xna.Framework.Rectangle(3, 1, 3, 3); HistoryTextEdit.TextStyle.LineHeightModifier = -1; HistoryTextEdit.SetSize(333, 100); CloseButton.OnButtonClick += new ButtonClickDelegate(CloseButton_OnButtonClick); MinimizeButton.OnButtonClick += MinimizeButton_OnButtonClick; PersonButton = script.Create <UIPersonButton>("AvatarThumbnail"); PersonButton.FrameSize = UIPersonButtonSize.SMALL; Add(PersonButton); SpecialButton = new UIButton(); SpecialButton.Visible = false; SpecialButton.OnButtonClick += SpecialButton_OnButtonClick; Add(SpecialButton); User = new Binding <UserReference>() .WithBinding(SimNameText, "Caption", "Name"); MyUser = new Binding <UserReference>(); User.ValueChanged += (x) => PersonButton.User.Value = x; Size = Background.Size.ToVector2(); this.Opacity = GlobalSettings.Default.ChatWindowsOpacity; this.AddUpdateHook(ChatOpacityChangedListener); }
public UIMediumBulletinSummary(string type) : base(type) { var ui = Content.Content.Get().CustomUI; var gd = GameFacade.GraphicsDevice; var titleCaption = TextStyle.DefaultTitle.Clone(); titleCaption.Size = 9; titleCaption.Color = TitleColor; TitleLabel = new UILabel() { Wrapped = true, Size = new Vector2(107, 30), Alignment = TextAlignment.Center | TextAlignment.Middle, Position = new Vector2(22, 4), CaptionStyle = titleCaption, Caption = "", MaxLines = 2, }; Add(TitleLabel); var bodyCaption = TextStyle.DefaultTitle.Clone(); bodyCaption.Size = 8; bodyCaption.Color = BodyColor; bodyCaption.LineHeightModifier = -2; Body = new UILabel() { Wrapped = true, Size = new Vector2(108, 57), Position = new Vector2(21, 35), CaptionStyle = bodyCaption, Caption = "", MaxLines = 5, }; Add(Body); var dateCaption = titleCaption.Clone(); dateCaption.Size = 8; DateLabel = new UILabel() { Position = new Vector2(22, 97), CaptionStyle = dateCaption, Caption = DateTime.Now.ToShortDateString(), Alignment = TextAlignment.Left | TextAlignment.Top, Size = Vector2.One }; Add(DateLabel); PersonButton = new UIPersonButton() { FrameSize = UIPersonButtonSize.SMALL, Position = new Vector2(109, 93), }; Add(PersonButton); PromotedStar = new UIImage(ui.Get((type == "bulletin_large")? "bulletin_promote_l.png":"bulletin_promote_s.png").Get(gd)) { Position = new Vector2(114, -12) }; PromotedStar.UseTooltip(); PromotedStar.Tooltip = GameFacade.Strings.GetString("f120", "17"); PromotedStar.Visible = false; DynamicOverlay.Add(PromotedStar); }
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 void UpdateDonatorList() { var roomies = LotControl.vm.TSOState.Roommates; var roomiesNoOwner = new HashSet <uint>(roomies); roomiesNoOwner.Remove(LotControl.vm.TSOState.OwnerID); var canChange = (LotControl.ActiveEntity as VMAvatar)?.AvatarState?.Permissions >= VMTSOAvatarPermissions.Owner; var ui = Content.Content.Get().CustomUI; var btnTex = ui.Get("chat_cat.png").Get(GameFacade.GraphicsDevice); var btnCaption = TextStyle.DefaultLabel.Clone(); var checkTex = GetTexture(0x0000083600000001); btnCaption.Size = 8; btnCaption.Shadow = true; Dropdown.DropDownButton.Disabled = !canChange; Dropdown.MenuTextEdit.Mode = canChange ? UITextEditMode.Editor : UITextEditMode.ReadOnly; RoommateListBox.Items = roomiesNoOwner.Select(x => { var check = new UIButton(checkTex); check.Selected = LotControl.vm.TSOState.BuildRoommates.Contains(x); check.Disabled = !canChange; check.OnButtonClick += (btn) => { check.Selected = !check.Selected; LotControl.vm.SendCommand(new VMChangePermissionsCmd { TargetUID = x, Level = (check.Selected) ? VMTSOAvatarPermissions.BuildBuyRoommate : VMTSOAvatarPermissions.Roommate, }); }; var deleteBtn = new UIButton(btnTex) { Caption = "Delete", CaptionStyle = btnCaption }; deleteBtn.OnButtonClick += (btn) => { LotControl.vm.SendCommand(new VMChangePermissionsCmd { TargetUID = x, Level = VMTSOAvatarPermissions.Visitor, }); UpdateDonatorList(); }; var personBtn = new UIPersonButton() { AvatarId = x, FrameSize = UIPersonButtonSize.SMALL }; personBtn.LogicalParent = this; return(new UIListBoxItem( x, personBtn, LotControl.vm.TSOState.Names.GetNameForID(LotControl.vm, x), check, deleteBtn )); }).ToList(); LastRoommates = new HashSet <uint>(roomies); LastBuildRoommates = new HashSet <uint>(LotControl.vm.TSOState.BuildRoommates); }