public UILoginDialog(LoginScreen loginScreen) : base(UIDialogStyle.Standard, true) { this.m_LoginScreen = loginScreen; this.Caption = GameFacade.Strings.GetString("UIText", "209", "1"); SetSize(350, 225); m_TxtAccName = UITextEdit.CreateTextBox(); m_TxtAccName.X = 20; m_TxtAccName.Y = 72; m_TxtAccName.MaxChars = 16; m_TxtAccName.SetSize(310, 27); m_TxtAccName.CurrentText = "username"; this.Add(m_TxtAccName); m_TxtPass = UITextEdit.CreateTextBox(); m_TxtPass.X = 20; m_TxtPass.Y = 128; m_TxtPass.MaxChars = 16; m_TxtPass.CurrentText = "password"; m_TxtPass.SetSize(310, 27); this.Add(m_TxtPass); /** Login button **/ var loginBtn = new UIButton { X = 116, Y = 170, Width = 100, ID = "LoginButton", Caption = GameFacade.Strings.GetString("UIText", "209", "2") }; this.Add(loginBtn); loginBtn.OnButtonClick += new ButtonClickDelegate(loginBtn_OnButtonClick); var exitBtn = new UIButton { X = 226, Y = 170, Width = 100, ID = "ExitButton", Caption = GameFacade.Strings.GetString("UIText", "209", "3") }; this.Add(exitBtn); exitBtn.OnButtonClick += new ButtonClickDelegate(exitBtn_OnButtonClick); this.Add(new UILabel { Caption = GameFacade.Strings.GetString("UIText", "209", "4"), X = 24, Y = 50 }); this.Add(new UILabel { Caption = GameFacade.Strings.GetString("UIText", "209", "5"), X = 24, Y = 106 }); }
private void ChatEntryTextEdit_OnChange(UIElement TextEdit) { UITextEdit edit = (UITextEdit)TextEdit; OKButton.Disabled = (edit.CurrentText.Length == 0); }
public SASScreen(ScreenManager Manager, SpriteBatch SBatch) : base(Manager, "SAS", SBatch, new Vector2(0, 0), new Vector2(GlobalSettings.Default.ScreenWidth, GlobalSettings.Default.ScreenHeight), GlobalSettings.Default.StartupPath + "\\" + "gamedata\\uiscripts\\personselection.uis") { m_BackgroundImg = (UIBackgroundImage)m_PResult.Elements["\"BackgroundImage\""]; AdultAvatar Avatar = new AdultAvatar(Manager.Device, Manager.HeadShader); Avatar.ChangeOutfit(FileManager.Instance.GetOutfit((ulong)FileIDs.OutfitsFileIDs.fab001_sl__pjs4), Vitaboy.SkinType.Medium); Avatar.SetHead(FileManager.Instance.GetOutfit((ulong)FileIDs.OutfitsFileIDs.fah002_mom), Vitaboy.SkinType.Medium); AddAvatar(Avatar, 1); VitaboyScreen VScreen = new VitaboyScreen(Manager, new Vector2(0, 0), new Vector2(GlobalSettings.Default.ScreenWidth, GlobalSettings.Default.ScreenHeight)); VScreen.AddSim(m_Avatars[0]); Manager.AddScreen(VScreen); TabBackgroundImg1 = m_PResult.Elements["\"TabBackgroundImage1\""].Image; TabBackgroundImg2 = m_PResult.Elements["\"TabBackgroundImage2\""].Image; TabBackgroundImg3 = m_PResult.Elements["\"TabBackgroundImage3\""].Image; SimCreateButtonImage = (UIImage)m_PResult.Elements["\"SimCreateButtonImage\""]; SimSelectButtonImage = (UIImage)m_PResult.Elements["\"SimSelectButtonImage\""]; DescriptionTabBackgroundImg1 = m_PResult.Elements["\"DescriptionTabBackgroundImage1\""].Image; DescriptionTabBackgroundImg1.Visible = m_Avatars.Count >= 1 ? true : false; DescriptionTabBackgroundImg2 = m_PResult.Elements["\"DescriptionTabBackgroundImage2\""].Image; DescriptionTabBackgroundImg2.Visible = m_Avatars.Count >= 2 ? true : false; DescriptionTabBackgroundImg3 = m_PResult.Elements["\"DescriptionTabBackgroundImage3\""].Image; DescriptionTabBackgroundImg3.Visible = m_Avatars.Count == 3 ? true : false; DescriptionTabImage1 = m_PResult.Elements["\"DescriptionTabImage1\""].Image; DescriptionTabImage1.Visible = m_Avatars.Count >= 1 ? true : false; DescriptionTabImage2 = m_PResult.Elements["\"DescriptionTabImage2\""].Image; DescriptionTabImage2.Visible = m_Avatars.Count >= 2 ? true : false; DescriptionTabImage3 = m_PResult.Elements["\"DescriptionTabImage3\""].Image; DescriptionTabImage3.Visible = m_Avatars.Count == 3 ? true : false; EnterTabImage1 = m_PResult.Elements["\"EnterTabImage1\""].Image; EnterTabImage1.Visible = false; EnterTabImage2 = m_PResult.Elements["\"EnterTabImage2\""].Image; EnterTabImage2.Visible = false; EnterTabImage3 = m_PResult.Elements["\"EnterTabImage3\""].Image; EnterTabImage3.Visible = false; EnterTabBackgroundImage1 = m_PResult.Elements["\"EnterTabBackgroundImage1\""].Image; EnterTabBackgroundImage1.Visible = false; EnterTabBackgroundImage2 = m_PResult.Elements["\"EnterTabBackgroundImage2\""].Image; EnterTabBackgroundImage2.Visible = false; EnterTabBackgroundImage3 = m_PResult.Elements["\"EnterTabBackgroundImage3\""].Image; EnterTabBackgroundImage3.Visible = false; //DefaultHouseImg = (UIImage)m_Elements["\"DefaultHouseImage\""].Image; //Not used?? CreditsBackgroundImg = m_PResult.Controls["\"CreditsButtonBackgroundImage\""].Image; //CityThumbnailBusyImg = m_Controls["\"CityThumbnailBusyImage\""].Image; //Not used?? CityButtonTemplateImage = (UIImage)m_PResult.Elements["\"CityButtonTemplateImage\""]; m_ExitButton = (UIButton)m_PResult.Elements["\"ExitButton\""]; m_ExitButton.OnButtonClicked += M_ExitButton_OnButtonClicked; m_ExitDialog = new ExitDialog(this, new Vector2(250, 250), m_Walker, GlobalSettings.Default.StartupPath + "gamedata\\uiscripts\\exitdialog.uis"); m_ExitDialog.Visible = false; RegisterElement(m_ExitDialog); m_EnterTabBtn1 = (UIButton)m_PResult.Elements["\"EnterTabButton1\""]; m_EnterTabBtn1.OnButtonClicked += EnterTabBtn1_OnButtonClicked; m_EnterTabBtn1.Enabled = m_Avatars.Count >= 1 ? true : false; m_EnterTabBtn2 = (UIButton)m_PResult.Elements["\"EnterTabButton2\""]; m_EnterTabBtn2.OnButtonClicked += EnterTabBtn2_OnButtonClicked; m_EnterTabBtn2.Enabled = m_Avatars.Count >= 2 ? true : false; m_EnterTabBtn3 = (UIButton)m_PResult.Elements["\"EnterTabButton3\""]; m_EnterTabBtn3.OnButtonClicked += EnterTabBtn3_OnButtonClicked; m_EnterTabBtn3.Enabled = m_Avatars.Count == 3 ? true : false; m_DescriptionTabBtn1 = (UIButton)m_PResult.Elements["\"DescriptionTabButton1\""]; m_DescriptionTabBtn1.OnButtonClicked += DescriptionTabBtn1_OnButtonClicked; m_DescriptionTabBtn1.Enabled = m_Avatars.Count >= 1 ? true : false; m_DescriptionTabBtn2 = (UIButton)m_PResult.Elements["\"DescriptionTabButton2\""]; m_DescriptionTabBtn2.OnButtonClicked += DescriptionTabBtn2_OnButtonClicked; m_DescriptionTabBtn2.Enabled = m_Avatars.Count >= 2 ? true : false; m_DescriptionTabBtn3 = (UIButton)m_PResult.Elements["\"DescriptionTabButton3\""]; m_DescriptionTabBtn3.OnButtonClicked += DescriptionTabBtn3_OnButtonClicked; m_DescriptionTabBtn3.Enabled = m_Avatars.Count == 3 ? true : false; m_AvatarButton1 = (UIButton)m_PResult.Elements["\"AvatarButton1\""]; //m_AvatarButton1.AddImage(SimCreateButtonImage); m_AvatarButton2 = (UIButton)m_PResult.Elements["\"AvatarButton2\""]; UIImage SimCreateButtonImg2 = new UIImage(SimCreateButtonImage); m_AvatarButton2.AddImage(SimCreateButtonImg2); m_AvatarButton3 = (UIButton)m_PResult.Elements["\"AvatarButton3\""]; UIImage SimCreateButtonImg3 = new UIImage(SimCreateButtonImage); m_AvatarButton3.AddImage(SimCreateButtonImg3); m_CityButton1 = (UIButton)m_PResult.Elements["\"CityButton1\""]; m_CityButton1.AddImage(GetImage("\"CityButtonTemplateImage\"", true)); m_CityButton1.Visible = false; m_CityButton2 = (UIButton)m_PResult.Elements["\"CityButton2\""]; m_CityButton2.AddImage(GetImage("\"CityButtonTemplateImage\"", true)); m_CityButton2.Visible = false; m_CityButton3 = (UIButton)m_PResult.Elements["\"CityButton3\""]; m_CityButton3.AddImage(GetImage("\"CityButtonTemplateImage\"", true)); m_CityButton3.Visible = false; m_HouseButton1 = (UIButton)m_PResult.Elements["\"HouseButton1\""]; m_HouseButton1.AddImage(GetImage("\"HouseButtonTemplateImage\"", true)); m_HouseButton1.Visible = false; m_HouseButton2 = (UIButton)m_PResult.Elements["\"HouseButton2\""]; m_HouseButton2.AddImage(GetImage("\"HouseButtonTemplateImage\"", true)); m_HouseButton2.Visible = false; m_HouseButton3 = (UIButton)m_PResult.Elements["\"HouseButton3\""]; m_HouseButton3.AddImage(GetImage("\"HouseButtonTemplateImage\"", true)); m_HouseButton3.Visible = false; m_NewAvatarButton1 = (UIButton)m_PResult.Elements["\"NewAvatarButton1\""]; m_NewAvatarButton1.Image = SimSelectButtonImage; m_NewAvatarButton1.Visible = m_Avatars.Count >= 1 ? false : true; m_NewAvatarButton2 = (UIButton)m_PResult.Elements["\"NewAvatarButton2\""]; m_NewAvatarButton2.Image = SimCreateButtonImage; m_NewAvatarButton2.Visible = m_Avatars.Count >= 2 ? false : true; m_NewAvatarButton3 = (UIButton)m_PResult.Elements["\"NewAvatarButton3\""]; m_NewAvatarButton3.Image = SimCreateButtonImage; m_NewAvatarButton3.Visible = m_Avatars.Count == 3 ? false : true; m_DeleteAvatarButton1 = (UIButton)m_PResult.Elements["\"DeleteAvatarButton1\""]; m_DeleteAvatarButton1.Visible = m_Avatars.Count >= 1 ? true : false; m_DeleteAvatarButton2 = (UIButton)m_PResult.Elements["\"DeleteAvatarButton2\""]; m_DeleteAvatarButton2.Visible = m_Avatars.Count >= 2 ? true : false; m_DeleteAvatarButton3 = (UIButton)m_PResult.Elements["\"DeleteAvatarButton3\""]; m_DeleteAvatarButton3.Visible = m_Avatars.Count == 3 ? true : false; m_PersonDescriptionText1 = (UITextEdit)m_PResult.Elements["\"PersonDescriptionText1\""]; m_PersonDescriptionText1.Visible = m_Avatars.Count >= 1 ? true : false; m_PersonDescriptionText2 = (UITextEdit)m_PResult.Elements["\"PersonDescriptionText2\""]; m_PersonDescriptionText2.Visible = m_Avatars.Count >= 2 ? true : false; m_PersonDescriptionText3 = (UITextEdit)m_PResult.Elements["\"PersonDescriptionText3\""]; m_PersonDescriptionText3.Visible = m_Avatars.Count == 3 ? true : false; m_PersonDescriptionScrollUpBtn1 = (UIButton)m_PResult.Elements["\"PersonDescriptionScrollUpButton1\""]; m_PersonDescriptionScrollUpBtn1.Visible = m_PersonDescriptionText1.Visible ? true : false; m_PersonDescriptionScrollUpBtn2 = (UIButton)m_PResult.Elements["\"PersonDescriptionScrollUpButton2\""]; m_PersonDescriptionScrollUpBtn2.Visible = m_PersonDescriptionText2.Visible ? true : false; m_PersonDescriptionScrollUpBtn3 = (UIButton)m_PResult.Elements["\"PersonDescriptionScrollUpButton3\""]; m_PersonDescriptionScrollUpBtn3.Visible = m_PersonDescriptionText3.Visible ? true : false; m_PersonDescriptionScrollDownBtn1 = (UIButton)m_PResult.Elements["\"PersonDescriptionScrollDownButton1\""]; m_PersonDescriptionScrollDownBtn1.Visible = m_PersonDescriptionText1.Visible ? true : false; m_PersonDescriptionScrollDownBtn2 = (UIButton)m_PResult.Elements["\"PersonDescriptionScrollDownButton2\""]; m_PersonDescriptionScrollDownBtn2.Visible = m_PersonDescriptionText2.Visible ? true : false; m_PersonDescriptionScrollDownBtn3 = (UIButton)m_PResult.Elements["\"PersonDescriptionScrollDownButton3\""]; m_PersonDescriptionScrollDownBtn3.Visible = m_PersonDescriptionText3.Visible ? true : false; m_CityNameText1 = (UILabel)m_PResult.Elements["\"CityNameText1\""]; m_CityNameText1.Visible = false; m_CityNameText2 = (UILabel)m_PResult.Elements["\"CityNameText2\""]; m_CityNameText2.Visible = false; m_CityNameText3 = (UILabel)m_PResult.Elements["\"CityNameText3\""]; m_CityNameText3.Visible = false; //TODO: Assign captions to these if a sim has a house... m_HouseNameText1 = (UILabel)m_PResult.Elements["\"HouseNameText1\""]; m_HouseNameText2 = (UILabel)m_PResult.Elements["\"HouseNameText2\""]; m_HouseNameText3 = (UILabel)m_PResult.Elements["\"HouseNameText3\""]; m_CreditsButton = (UIButton)m_PResult.Elements["\"CreditsButton\""]; HitVM.PlayEvent("bkground_selectasim"); foreach (KeyValuePair <string, UIElement> KVP in m_PResult.Elements) { RegisterElement(KVP.Value); } }
public UIEmojiSuggestions(UITextEdit parent) { Watching = parent; Watching.OnEnterPress += Watching_OnEnterPress; }
public UILoginDialog(LoginScreen loginScreen) : base(UIDialogStyle.Standard, true) { this.m_LoginScreen = loginScreen; this.Caption = GameFacade.Strings.GetString("UIText", "209", "1"); SetSize(350, 225); m_TxtAccName = UITextEdit.CreateTextBox(); m_TxtAccName.X = 20; m_TxtAccName.Y = 72; m_TxtAccName.MaxChars = 16; m_TxtAccName.SetSize(310, 27); m_TxtAccName.CurrentText = "username"; m_TxtAccName.OnTabPress += new KeyPressDelegate(m_TxtAccName_OnTabPress); this.Add(m_TxtAccName); m_TxtPass = UITextEdit.CreateTextBox(); m_TxtPass.X = 20; m_TxtPass.Y = 128; m_TxtPass.MaxChars = 16; m_TxtPass.CurrentText = "password"; m_TxtPass.SetSize(310, 27); //m_TxtPass.OnTabPress += new KeyPressDelegate(m_TxtPass_OnTabPress); m_TxtPass.OnEnterPress += new KeyPressDelegate(loginBtn_OnButtonClick); this.Add(m_TxtPass); /** Login button **/ var loginBtn = new UIButton { X = 116, Y = 170, Width = 100, ID = "LoginButton", Caption = GameFacade.Strings.GetString("UIText", "209", "2") }; this.Add(loginBtn); loginBtn.OnButtonClick += new ButtonClickDelegate(loginBtn_OnButtonClick); var exitBtn = new UIButton { X = 226, Y = 170, Width = 100, ID = "ExitButton", Caption = GameFacade.Strings.GetString("UIText", "209", "3") }; this.Add(exitBtn); exitBtn.OnButtonClick += new ButtonClickDelegate(exitBtn_OnButtonClick); this.Add(new UILabel { Caption = GameFacade.Strings.GetString("UIText", "209", "4"), X = 24, Y = 50 }); this.Add(new UILabel { Caption = GameFacade.Strings.GetString("UIText", "209", "5"), X = 24, Y = 106 }); GameFacade.Screens.inputManager.SetFocus(m_TxtAccName); }
private void InitUIAssets() { // add the cash out button (and background) and machine balance information, ubiquitious to all objects CashOutButtonSeat = new UIImage(ButtonSeatTexture) { X = 60, Y = 90 }; AddAt(0, CashOutButtonSeat); CashOutButton = new UIButton(CashOutTexture) { X = 63, Y = 93, Tooltip = GameFacade.Strings["UIText", "259", "10"] // "Click to cash out" }; Add(CashOutButton); CashOutButton.OnButtonClick += OnCashoutButtonClick; MachineBalanceTextBack = new UIImage(TextBackTexture) { X = 100, Y = 90 }; AddAt(0, MachineBalanceTextBack); MachineBalanceText = new UITextEdit() { Size = new Vector2(85, 20), X = 104, Y = 94, Alignment = TextAlignment.Center, Mode = UITextEditMode.ReadOnly, CurrentText = "$" + ObjectBalance, Tooltip = GameFacade.Strings.GetString("f110", "35") // "Cash in object" }; var textStyle = MachineBalanceText.TextStyle.Clone(); textStyle.Size = 12; MachineBalanceText.TextStyle = textStyle; Add(MachineBalanceText); // add more assets depending on machine type switch (Type) { case ManageEODObjectTypes.SlotMachine: { // add the on/off button, and the odds slider OnOffButton = new UIButton(GetTexture(0x0000049C00000001)) { Tooltip = GameFacade.Strings["UIText", "259", "12"], // "Current Odds" X = 175, Y = 60 }; Add(OnOffButton); OnOffButton.OnButtonClick += OnOffButtonClick; // initiate OnOffButton if (ObjectIsOn) { OnOffButton.Tooltip = GameFacade.Strings["UIText", "259", "14"]; // "Turn Off" OnOffButton.ForceState = 1; } else { OnOffButton.Tooltip = GameFacade.Strings["UIText", "259", "13"]; // "Turn On" OnOffButton.ForceState = 0; } // the slider for the odds OddsSlider = new UISlider() { Texture = GetTexture(0x00000CA400000001), Tooltip = ObjectOdds + "%", Size = new Vector2(100, 1), MinValue = 80, MaxValue = 110, Orientation = 0, X = 286, Y = 104 }; Add(OddsSlider); OddsSlider.Value = ObjectOdds; OddsSlider.OnChange += OddsChangeHandler; // add slot machine labels OnOff = new UILabel() { Size = new Vector2(100, 21), X = 70, Y = 55, _Alignment = 1, Caption = GameFacade.Strings["UIText", "259", "20"], // "Turn On/Off" CaptionStyle = textStyle }; Add(OnOff); Odds = new UILabel() { Size = new Vector2(120, 21), X = 278, Y = 55, _Alignment = 1, Caption = GameFacade.Strings["UIText", "259", "7"], // "Set the Odds" CaptionStyle = textStyle }; Add(Odds); Player = new UILabel() { Size = new Vector2(80, 21), X = 380, Y = 94, _Alignment = 1, Caption = GameFacade.Strings["UIText", "259", "9"], // "Player" CaptionStyle = textStyle }; Add(Player); House = new UILabel() { Size = new Vector2(80, 21), X = 220, Y = 94, _Alignment = 1, Caption = GameFacade.Strings["UIText", "259", "8"], // "House" CaptionStyle = textStyle }; Add(House); // FreeSO exclusive CurrentOdds = new UITextEdit() { Size = new Vector2(45, 20), X = Odds.X + 46, Y = 79, Mode = UITextEditMode.ReadOnly, CurrentText = ObjectOdds + "%" }; Add(CurrentOdds); break; } default: { // minor adjustments MachineBalanceTextBack.Y -= 6; MachineBalanceText.Y -= 6; CashOutButton.Y -= 6; CashOutButtonSeat.Y -= 6; // label for machine balance MachineBalanceLabel = new UILabel() { Size = new Vector2(100, 21), X = 82, Y = 57, Caption = GameFacade.Strings.GetString("f110", "35") + ":", // "Cash in object:" CaptionStyle = textStyle }; Add(MachineBalanceLabel); // text field and back for minimum bet MinimumBetTextBack = new UIImage(TextBackTexture) { X = 338, Y = 62 }; Add(MinimumBetTextBack); MinimumBetText = new UITextEdit() { Size = new Vector2(65, 20), X = MinimumBetTextBack.X + 14, Y = MinimumBetTextBack.Y + 4, Alignment = TextAlignment.Center, Mode = UITextEditMode.ReadOnly, CurrentText = "$" + ObjectMinimumPlayerBet, TextStyle = textStyle, Tooltip = GameFacade.Strings.GetString("f110", "13") // "Min bet" }; Add(MinimumBetText); // text field and back for maximum bet MaximumBetTextBack = new UIImage(TextBackTexture) { X = MinimumBetTextBack.X, Y = MinimumBetTextBack.Y + 33 }; Add(MaximumBetTextBack); MaximumBetText = new UITextEdit() { Size = new Vector2(65, 20), X = MaximumBetTextBack.X + 14, Y = MaximumBetTextBack.Y + 4, Alignment = TextAlignment.Center, Mode = UITextEditMode.ReadOnly, CurrentText = "$" + ObjectMaximumPlayerBet, TextStyle = textStyle, Tooltip = GameFacade.Strings.GetString("f110", "14") // "Max bet" }; Add(MaximumBetText); // button and back for minimum bet EditMinimumBetButtonSeat = new UIImage(ButtonSeatTexture) { X = MinimumBetTextBack.X - 32, Y = MinimumBetTextBack.Y, }; Add(EditMinimumBetButtonSeat); EditMinimumBetButton = new UIButton(EditAmountTexture) { X = EditMinimumBetButtonSeat.X + 3, Y = EditMinimumBetButtonSeat.Y + 3, Tooltip = GameFacade.Strings.GetString("f110", "15") + GameFacade.Strings.GetString("f110", "13"), // "Edit Min bet" }; EditMinimumBetButtonSeat.ScaleX = EditMinimumBetButtonSeat.ScaleY = (EditMinimumBetButton.Size / CashOutButton.Size).X; Add(EditMinimumBetButton); // button and back for maximum bet EditMaximumBetButtonSeat = new UIImage(ButtonSeatTexture) { X = MaximumBetTextBack.X - 32, Y = MaximumBetTextBack.Y }; Add(EditMaximumBetButtonSeat); EditMaximumBetButton = new UIButton(EditAmountTexture) { X = EditMaximumBetButtonSeat.X + 3, Y = EditMaximumBetButtonSeat.Y + 3, Tooltip = GameFacade.Strings.GetString("f110", "15") + GameFacade.Strings.GetString("f110", "14"), // "Edit Max bet" }; EditMaximumBetButtonSeat.ScaleX = EditMaximumBetButtonSeat.ScaleY = (EditMaximumBetButton.Size / CashOutButton.Size).X; Add(EditMaximumBetButton); // label for minimum bet MinimumBetLabel = new UILabel() { Size = new Vector2(60, 21), X = EditMinimumBetButtonSeat.X - 70, Y = MinimumBetText.Y, Alignment = TextAlignment.Right, Caption = GameFacade.Strings.GetString("f110", "13") + ":", // "Min bet:" CaptionStyle = textStyle }; Add(MinimumBetLabel); // label for maximum bet MaximumBetLabel = new UILabel() { Size = new Vector2(60, 21), X = EditMaximumBetButtonSeat.X - 70, Y = MaximumBetText.Y, Alignment = TextAlignment.Right, Caption = GameFacade.Strings.GetString("f110", "14") + ":", // "Max bet:" CaptionStyle = textStyle }; Add(MaximumBetLabel); // liseners for editing bet buttons EditMinimumBetButton.OnButtonClick += OnEditMinimumClick; EditMaximumBetButton.OnButtonClick += OnEditMaximumClick; // tweak for Hold'em Casino if (Type.Equals(ManageEODObjectTypes.HoldEmCasino)) { var offset = new Vector2(6, -18); MinimumBetTextBack.Position += offset; MinimumBetText.Position += offset; MinimumBetLabel.Position += offset; EditMinimumBetButtonSeat.Position += offset; EditMinimumBetButton.Position += offset; MaximumBetTextBack.Position += offset; MaximumBetText.Position += offset; MaximumBetLabel.Position += offset; EditMaximumBetButtonSeat.Position += offset; EditMaximumBetButton.Position += offset; MachineBalanceTextBack.X -= 20; MachineBalanceText.X -= 20; CashOutButton.X -= 20; CashOutButtonSeat.X -= 20; MachineBalanceLabel.X -= 20; MinimumBetLabel.Caption = GameFacade.Strings.GetString("f110", "36") + ":"; // "Min Ante Bet" MaximumBetLabel.Caption = GameFacade.Strings.GetString("f110", "37") + ":"; // "Max Ante Bet" EditMinimumBetButton.Tooltip = GameFacade.Strings.GetString("f110", "15") + GameFacade.Strings.GetString("f110", "36") + ":"; // "Edit Min Ante Bet" EditMaximumBetButton.Tooltip = GameFacade.Strings.GetString("f110", "15") + GameFacade.Strings.GetString("f110", "37") + ":"; // "Edit Min Ante Bet" /* Add Max Side Bet stuff */ // label for maximum side bet MaximumSideBetTextBack = new UIImage(TextBackTexture) { X = MaximumBetTextBack.X, Y = MaximumBetTextBack.Y + 33 }; Add(MaximumSideBetTextBack); MaximumSideBetText = new UITextEdit() { Size = new Vector2(65, 20), X = MaximumSideBetTextBack.X + 14, Y = MaximumSideBetTextBack.Y + 4, Alignment = TextAlignment.Center, Mode = UITextEditMode.ReadOnly, CurrentText = "$" + ObjectMaximumPlayerSideBet, TextStyle = textStyle, Tooltip = GameFacade.Strings.GetString("f110", "38") // "Max Side Bet" }; Add(MaximumSideBetText); EditMaximumSideBetButtonSeat = new UIImage(ButtonSeatTexture) { X = MaximumSideBetTextBack.X - 32, Y = MaximumSideBetTextBack.Y, }; Add(EditMaximumSideBetButtonSeat); EditMaximumSideBetButton = new UIButton(EditAmountTexture) { X = EditMaximumSideBetButtonSeat.X + 3, Y = EditMaximumSideBetButtonSeat.Y + 3, Tooltip = GameFacade.Strings.GetString("f110", "15") + GameFacade.Strings.GetString("f110", "38"), // "Edit Max Side Bet" }; EditMaximumSideBetButtonSeat.ScaleX = EditMaximumSideBetButtonSeat.ScaleY = (EditMaximumSideBetButton.Size / CashOutButton.Size).X; Add(EditMaximumSideBetButton); MaximumSideBetLabel = new UILabel() { Size = new Vector2(60, 21), X = EditMaximumSideBetButtonSeat.X - 70, Y = MaximumSideBetText.Y, Alignment = TextAlignment.Right, Caption = GameFacade.Strings.GetString("f110", "38") + ":", // "Max Side Bet:" CaptionStyle = textStyle }; Add(MaximumSideBetLabel); EditMaximumSideBetButton.OnButtonClick += OnEditSideClick; } break; } } InputAllowed = true; }
public UIFullRatingItem(uint ratingID) { RatingID = ratingID; Body = new UITextEdit(); Body.TextStyle = Body.TextStyle.Clone(); Body.TextStyle.Size = 8; Body.TextStyle.Color = Color.White; Body.SetSize(454, 42); Body.MaxLines = 3; Body.Mode = UITextEditMode.ReadOnly; Body.Position = new Vector2(15, 20); Body.BBCodeEnabled = true; Body.RemoveMouseEvent(); Add(Body); StarLabel = new UILabel(); StarLabel.Position = new Vector2(75, 4); StarLabel.Alignment = TextAlignment.Left | TextAlignment.Top; StarLabel.Size = new Vector2(1, 1); Add(StarLabel); NameLabel = new UILabel(); NameLabel.Position = new Vector2(465, 4); NameLabel.Alignment = TextAlignment.Right | TextAlignment.Top; NameLabel.Size = new Vector2(1, 1); Add(NameLabel); Rating = new UIRatingDisplay(true); Rating.Position = new Vector2(9, 7); Add(Rating); CurrentRating = new Binding <MayorRating>() .WithBinding(this, "Message", "MayorRating_Comment") .WithBinding(this, "HalfStars", "MayorRating_HalfStars") .WithBinding(this, "Name", "MayorRating_FromAvatar", (object id) => { return(((uint)id == 0) ? "Anon" : "unknown"); }); var ui = Content.Content.Get().CustomUI; var btnTex = ui.Get("chat_cat.png").Get(GameFacade.GraphicsDevice); var btnCaption = TextStyle.DefaultLabel.Clone(); btnCaption.Size = 8; btnCaption.Shadow = true; if (GameFacade.EnableMod) { DeleteButton = new UIButton(btnTex); DeleteButton.Caption = "Delete"; DeleteButton.CaptionStyle = btnCaption; DeleteButton.OnButtonClick += DeletePost; DeleteButton.Width = 64; DeleteButton.X = 135; DeleteButton.Y = 4; Add(DeleteButton); } Size = new Vector2(475, 70); PxWhite = TextureGenerator.GetPxWhite(GameFacade.GraphicsDevice); }
public CASScreen(ScreenManager Manager, SpriteBatch SBatch) : base(Manager, "CAS", SBatch, new Vector2(0, 0), new Vector2(GlobalSettings.Default.ScreenWidth, GlobalSettings.Default.ScreenHeight), GlobalSettings.Default.StartupPath + "\\" + "gamedata\\uiscripts\\personselectionedit.uis") { m_BackgroundImg = (UIBackgroundImage)m_PResult.Elements["\"BackgroundImage\""]; m_CancelBtn = (UIButton)m_PResult.Elements["\"CancelButton\""]; m_AcceptBtn = (UIButton)m_PResult.Elements["\"AcceptButton\""]; m_DescriptionScrollUpBtn = (UIButton)m_PResult.Elements["\"DescriptionScrollUpButton\""]; m_DescriptionScrollUpBtn.OnButtonClicked += M_DescriptionScrollUpBtn_OnButtonClicked; m_DescriptionScrollUpBtn.Enabled = false; m_DescriptionScrollDownBtn = (UIButton)m_PResult.Elements["\"DescriptionScrollDownButton\""]; m_DescriptionScrollDownBtn.OnButtonClicked += M_DescriptionScrollDownBtn_OnButtonClicked; m_DescriptionScrollDownBtn.Enabled = false; m_ExitBtn = (UIButton)m_PResult.Elements["\"ExitButton\""]; m_ExitBtn.OnButtonClicked += M_ExitBtn_OnButtonClicked; m_FemaleBtn = (UIButton)m_PResult.Elements["\"FemaleButton\""]; m_FemaleBtn.OnButtonClicked += M_FemaleBtn_OnButtonClicked; m_MaleBtn = (UIButton)m_PResult.Elements["\"MaleButton\""]; m_MaleBtn.OnButtonClicked += M_MaleBtn_OnButtonClicked; m_SkinLightBtn = (UIButton)m_PResult.Elements["\"SkinLightButton\""]; m_SkinLightBtn.OnButtonClicked += M_SkinLightBtn_OnButtonClicked; m_SkinMediumBtn = (UIButton)m_PResult.Elements["\"SkinMediumButton\""]; m_SkinMediumBtn.OnButtonClicked += M_SkinMediumBtn_OnButtonClicked; m_SkinDarkBtn = (UIButton)m_PResult.Elements["\"SkinDarkButton\""]; m_SkinDarkBtn.OnButtonClicked += M_SkinDarkBtn_OnButtonClicked; m_HeadSkinBrowser = new UIHeadBrowser(this, m_PResult.Controls["\"HeadSkinBrowser\""], 1, AvatarSex.Female); m_HeadSkinBrowser.OnButtonClicked += M_HeadSkinBrowser_OnButtonClicked; m_HeadSkinBrowser.DrawOrder = (int)DrawOrderEnum.UI; RegisterElement(m_HeadSkinBrowser); m_BodySkinBrowser = new UIBodyBrowser(this, m_PResult.Controls["\"BodySkinBrowser\""], 1, AvatarSex.Female); m_BodySkinBrowser.OnButtonClicked += M_BodySkinBrowser_OnButtonClicked; m_BodySkinBrowser.DrawOrder = (int)DrawOrderEnum.UI; RegisterElement(m_BodySkinBrowser); AdultAvatar Avatar = new AdultAvatar(Manager.Device, Manager.HeadShader); Avatar.ChangeOutfit(FileManager.Instance.GetOutfit((ulong)FileIDs.OutfitsFileIDs.fab001_sl__pjs4), Vitaboy.SkinType.Medium); Avatar.SetHead(FileManager.Instance.GetOutfit((ulong)FileIDs.OutfitsFileIDs.fah002_mom), (Vitaboy.SkinType)m_CurrentSkinType); Avatar.ShouldRotate = true; m_Avatar = new Sim(Manager.Device, Manager.RenderCamera, Avatar); m_VitaboyScreen = new VitaboyScreen(Manager, new Vector2(0, 0), new Vector2(GlobalSettings.Default.ScreenWidth, GlobalSettings.Default.ScreenHeight)); m_VitaboyScreen.AddSim(m_Avatar); m_ExitDialog = new ExitDialog(this, new Vector2(250, 250), m_Walker, GlobalSettings.Default.StartupPath + "gamedata\\uiscripts\\exitdialog.uis"); m_ExitDialog.Visible = false; RegisterElement(m_ExitDialog); m_NameTextEdit = new TextBox(new Rectangle(22, 52, 230, 18), 64, "", Manager.Device, 9, StandardTxtColor, StandardTxtColor, 30, this, false); m_NameTextEdit.Name = "NameTextEdit"; //This should be set for all UIElements that need to receive input. m_NameTextEdit.DrawOrder = (int)DrawOrderEnum.UI; m_DescriptionTextEdit = (UITextEdit)m_PResult.Elements["\"DescriptionTextEdit\""]; m_DescriptionTextEdit.DrawOrder = (int)DrawOrderEnum.UI; KeyboardInput.Initialize(Manager, 500f, 20); HitVM.PlayEvent("bkground_createasim"); Manager.AddScreen(m_VitaboyScreen); foreach (KeyValuePair <string, UIElement> KVP in m_PResult.Elements) { RegisterElement(KVP.Value); } }
private void MessageTextEdit_OnChange(UIElement TextEdit) { UITextEdit edit = (UITextEdit)TextEdit; SendMessageButton.Disabled = (edit.CurrentText.Length == 0); }
protected override void InitUI() { BarGraphs = new UINewspaperPctBar[8]; for (int i = 0; i < 8; i++) { BarGraphs[i] = new UINewspaperPctBar(GameFacade.Strings.GetString("f108", (i + 1).ToString()), 0, 0, i == 7); BarGraphs[i].Position = new Vector2(80 + 45 * i, 45 + 187); Add(BarGraphs[i]); } GraphTab = new UINewspaperGraphTab(); GraphTab.Position = new Vector2(0, 187); Add(GraphTab); FrontTab = new UINewspaperCover(); FrontTab.Position = new Vector2(0, 187); FrontTab.OnShowNewsItem += FrontTab_OnShowNewsItem; Add(FrontTab); FrontTabBtn = new UIButton(GetTexture((ulong)GameContent.FileIDs.UIFileIDs.eod_dc_newcardbtn)); FrontTabBtn.Position = new Vector2(33 + 21, 55 + 5 + 187); FrontTabBtn.OnButtonClick += (btn) => SetTab(0); FrontTabBtn.Tooltip = GameFacade.Strings.GetString("f108", "14"); Add(FrontTabBtn); var ui = Content.Content.Get().CustomUI; BarTabBtn = new UIButton(ui.Get("eod_news_bar.png").Get(GameFacade.GraphicsDevice)); BarTabBtn.Position = new Vector2(33, 55 + 37 + 187); BarTabBtn.Tooltip = GameFacade.Strings.GetString("f108", "15"); BarTabBtn.OnButtonClick += (btn) => SetTab(1); Add(BarTabBtn); GraphTabBtn = new UIButton(ui.Get("eod_news_line.png").Get(GameFacade.GraphicsDevice)); GraphTabBtn.Position = new Vector2(38, 55 + 71 + 187); GraphTabBtn.Tooltip = GameFacade.Strings.GetString("f108", "16"); GraphTabBtn.OnButtonClick += (btn) => SetTab(2); Add(GraphTabBtn); TopBg = new UIImage(GetTexture((ulong)GameContent.FileIDs.UIFileIDs.eod_signs_readback)); TopBg.Position = new Vector2(20, 93); Add(TopBg); TopSlider = new UISlider(); TopSlider.Texture = GetTexture((ulong)GameContent.FileIDs.UIFileIDs.eod_signs_slider); TopSlider.Orientation = 1; TopSlider.SetSize(TopSlider.Texture.Width, 105); TopSlider.Position = new Vector2(425, 103); Add(TopSlider); TopText = new UITextEdit(); TopText.SetSize(366, 107 - 12); TopText.TextMargin = new Rectangle(12, 12, 12, 12); TopText.Position = new Vector2(53, 95); TopText.TextStyle = TopText.TextStyle.Clone(); TopText.TextStyle.LineHeightModifier = -3; TopText.CurrentText = GameFacade.Strings.GetString("f108", "19"); Add(TopText); TopText.AttachSlider(TopSlider); SetTab(0); OnContract(); }
public PrimitiveBox(TREEBox box, BHAVContainer master) { TreeBox = box; Master = master; Nodes = new PrimitiveNode[0]; ApplyBoxPosition(); HitTest = ListenForMouse(new Rectangle(0, 0, Width, Height), new UIMouseEvent(MouseEvents)); Texture2D sliceTex = null; switch (Type) { case TREEBoxType.Primitive: Instruction = master.GetInstruction(box.TrueID); PreparePrimitive(); break; case TREEBoxType.True: case TREEBoxType.False: RecenterSize(32, 32); break; case TREEBoxType.Label: sliceTex = EditorResource.Get().LabelBox; Nodes = new PrimitiveNode[2]; Nodes[0] = new PrimitiveNode(); Nodes[0].Visible = false; Nodes[1] = new PrimitiveNode(); Nodes[1].Type = NodeType.Done; this.Add(Nodes[0]); this.Add(Nodes[1]); TextEdit = new UITextEdit(); TextEdit.OnChange += (elem) => { CommentChanged(); }; TextEdit.OnFocusOut += TextEdit_OnFocusOut; TextEdit.TextStyle = EditorResource.Get().TitleStyle; TextEdit.Alignment = TextAlignment.Center; TextEdit.CurrentText = TreeBox.Comment; TextEdit.NoFocusPassthrough += MouseEvents; Add(TextEdit); CommentResized(); break; case TREEBoxType.Goto: sliceTex = EditorResource.Get().GotoBox; Title = new UILabel(); Title.Alignment = TextAlignment.Middle | TextAlignment.Center; Title.Y = 0; Title.X = 0; this.Add(Title); Title.CaptionStyle = EditorResource.Get().TitleStyle; UpdateGotoLabel(); break; case TREEBoxType.Comment: sliceTex = EditorResource.Get().CommentBox; TextEdit = new UITextEdit(); TextEdit.OnChange += (elem) => { CommentChanged(); }; TextEdit.OnFocusOut += TextEdit_OnFocusOut; TextEdit.TextStyle = EditorResource.Get().CommentStyle; TextEdit.CurrentText = TreeBox.Comment; TextEdit.NoFocusPassthrough += MouseEvents; Add(TextEdit); CommentResized(); break; } if (sliceTex != null) { var sliceW = sliceTex.Width / 3; var sliceH = sliceTex.Height / 3; SliceBg = new UIImage(sliceTex).With9Slice(sliceW, sliceW, sliceH, sliceH); SliceBg.Width = Width; SliceBg.Height = Height; Add(SliceBg); } }
public UIVoteCandidate(bool alignment, UIVoteContainer container) { var ui = Content.Content.Get().CustomUI; var gd = GameFacade.GraphicsDevice; Background = new UIImage(ui.Get("vote_bg_9slice.png").Get(gd)).With9Slice(15, 15, 15, 15); Background.Position = new Vector2(alignment ? 5 : 32, 16); Background.SetSize(539, 77); Add(Background); AvaBackground = new UIImage(ui.Get("vote_ava_bg.png").Get(gd)); AvaBackground.Position = new Vector2(alignment ? 499 : 0, 0); Add(AvaBackground); CheckButton = new UIButton(ui.Get("vote_check.png").Get(gd)); CheckButton.Position = new Vector2(alignment ? 15 : 518, 34); CheckButton.OnButtonClick += (btn) => { container.SetSelected(this); }; Add(CheckButton); Avatar = new UIBigPersonButton(); Avatar.ScaleX = Avatar.ScaleY = 108f / 170; Add(Avatar); Avatar.Position = new Vector2(alignment ? 502 : 2, 2); //range: [75, 501] NameLabel = new UILabel(); NameLabel.Position = new Vector2(75 + 2, 16); NameLabel.Size = new Vector2(426 - 4, 1); NameLabel.CaptionStyle = NameLabel.CaptionStyle.Clone(); NameLabel.CaptionStyle.Shadow = true; NameLabel.CaptionStyle.Color = Color.White; NameLabel.CaptionStyle.Size = 16; NameLabel.Alignment = alignment ? TextAlignment.Right : TextAlignment.Left; Add(NameLabel); SubtitleLabel = new UILabel(); SubtitleLabel.Position = new Vector2(75 + 6, 39); SubtitleLabel.Size = new Vector2(426 - 12, 1); SubtitleLabel.Alignment = alignment ? TextAlignment.Right : TextAlignment.Left; Add(SubtitleLabel); MessageLabel = new UITextEdit(); MessageLabel.Position = new Vector2(75 + 4, 56); MessageLabel.Size = new Vector2(426 - 8, 35); MessageLabel.Mode = UITextEditMode.ReadOnly; MessageLabel.Alignment = TextAlignment.Top | (alignment ? TextAlignment.Right : TextAlignment.Left); MessageLabel.TextStyle = MessageLabel.TextStyle.Clone(); MessageLabel.TextStyle.Size = 8; MessageLabel.BBCodeEnabled = true; MessageLabel.TextStyle.LineHeightModifier = -3; MessageLabel.TextStyle.Color = Color.White; Add(MessageLabel); Rating = new UIRatingDisplay(true); Rating.Visible = false; Rating.Y = 28 + 14; Add(Rating); /* * NameLabel.Caption = "VERY LONG NAMEMEMEMEMMEE"; * SubtitleLabel.Caption = "Running for 2nd Term"; * MessageLabel.CurrentText = "If you vote for me, I personally vow to avoid polluting the water supply. It will be hard, but I believe that with your votes I might find any restraint whatsoever."; * Avatar.AvatarId = 887; */ Alignment = alignment; }
public CASScreen(ScreenManager Manager, SpriteBatch SBatch) : base(Manager, "CAS", SBatch, new Vector2(0, 0), new Vector2(GlobalSettings.Default.ScreenWidth, GlobalSettings.Default.ScreenHeight), GlobalSettings.Default.StartupPath + "\\" + "gamedata\\uiscripts\\personselectionedit.uis") { m_BackgroundImg = (UIImage)m_PResult.Elements["\"BackgroundImage\""]; m_CancelBtn = (UIButton)m_PResult.Elements["\"CancelButton\""]; m_AcceptBtn = (UIButton)m_PResult.Elements["\"AcceptButton\""]; m_DescriptionScrollUpBtn = (UIButton)m_PResult.Elements["\"DescriptionScrollUpButton\""]; m_DescriptionScrollUpBtn.OnButtonClicked += M_DescriptionScrollUpBtn_OnButtonClicked; m_DescriptionScrollUpBtn.Enabled = false; m_DescriptionScrollDownBtn = (UIButton)m_PResult.Elements["\"DescriptionScrollDownButton\""]; m_DescriptionScrollDownBtn.OnButtonClicked += M_DescriptionScrollDownBtn_OnButtonClicked; m_DescriptionScrollDownBtn.Enabled = false; m_ExitBtn = (UIButton)m_PResult.Elements["\"ExitButton\""]; m_ExitBtn.OnButtonClicked += M_ExitBtn_OnButtonClicked; m_FemaleBtn = (UIButton)m_PResult.Elements["\"FemaleButton\""]; m_FemaleBtn.OnButtonClicked += M_FemaleBtn_OnButtonClicked; m_MaleBtn = (UIButton)m_PResult.Elements["\"MaleButton\""]; m_MaleBtn.OnButtonClicked += M_MaleBtn_OnButtonClicked; m_SkinLightBtn = (UIButton)m_PResult.Elements["\"SkinLightButton\""]; m_SkinLightBtn.OnButtonClicked += M_SkinLightBtn_OnButtonClicked; m_SkinMediumBtn = (UIButton)m_PResult.Elements["\"SkinMediumButton\""]; m_SkinMediumBtn.OnButtonClicked += M_SkinMediumBtn_OnButtonClicked; m_SkinDarkBtn = (UIButton)m_PResult.Elements["\"SkinDarkButton\""]; m_SkinDarkBtn.OnButtonClicked += M_SkinDarkBtn_OnButtonClicked; m_HeadSkinBrowser = new UIHeadBrowser(this, m_PResult.Controls["\"HeadSkinBrowser\""], 1, AvatarSex.Female); m_HeadSkinBrowser.OnButtonClicked += M_HeadSkinBrowser_OnButtonClicked; m_BodySkinBrowser = new UIBodyBrowser(this, m_PResult.Controls["\"BodySkinBrowser\""], 1, AvatarSex.Female); m_BodySkinBrowser.OnButtonClicked += M_BodySkinBrowser_OnButtonClicked; AdultAvatar Avatar = new AdultAvatar(Manager.Device, Manager.HeadShader); Avatar.ChangeOutfit(FileManager.GetOutfit((ulong)FileIDs.OutfitsFileIDs.fab001_sl__pjs4), Vitaboy.SkinType.Medium); Avatar.SetHead(FileManager.GetOutfit((ulong)FileIDs.OutfitsFileIDs.fah002_mom), (Vitaboy.SkinType)m_CurrentSkinType); Avatar.ShouldRotate = true; m_Avatar = new Sim(Manager.Device, Manager.RenderCamera, Avatar); m_VitaboyScreen = new VitaboyScreen(Manager, new Vector2(0, 0), new Vector2(GlobalSettings.Default.ScreenWidth, GlobalSettings.Default.ScreenHeight)); m_VitaboyScreen.AddSim(m_Avatar); m_ExitDialog = new ExitDialog(this, new Vector2(250, 250), m_Walker, GlobalSettings.Default.StartupPath + "gamedata\\uiscripts\\exitdialog.uis"); m_ExitDialog.Visible = false; m_DescriptionTextEdit = (UITextEdit)m_PResult.Elements["\"DescriptionTextEdit\""]; HitVM.PlayEvent("bkground_createasim"); Manager.AddScreen(m_VitaboyScreen); }
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); }
private void InitPlayerUI() { // custom textures var gd = GameFacade.GraphicsDevice; // try to get custom horizontal textures for lights try { AbstractTextureRef lightsframe1hRef = new FileTextureRef("Content/Textures/EOD/Buzzer/eod_lightsframe1.png"); Lightsframe1Tex = lightsframe1hRef.Get(gd); AbstractTextureRef lightsframe2hRef = new FileTextureRef("Content/Textures/EOD/Buzzer/eod_lightsframe2.png"); Lightsframe2Tex = lightsframe2hRef.Get(gd); AbstractTextureRef lightsframebackhRef = new FileTextureRef("Content/Textures/EOD/Buzzer/eod_lightsframeback.png"); LightsframebackTex = lightsframebackhRef.Get(gd); AbstractTextureRef lightsframebluehRef = new FileTextureRef("Content/Textures/EOD/Buzzer/eod_lightsframeblue.png"); LightsframeblueTex = lightsframebluehRef.Get(gd); AbstractTextureRef lightsframeredhRef = new FileTextureRef("Content/Textures/EOD/Buzzer/eod_lightsframered.png"); LightsframeredTex = lightsframeredhRef.Get(gd); } catch (Exception e) { Lightsframe1Tex = null; Lightsframe2Tex = null; LightsframebackTex = null; LightsframeblueTex = null; LightsframeredTex = null; } PlayerLightFrame = new ContestantLightsFrame(Lightsframe1Tex, Lightsframe2Tex, LightsframebackTex, LightsframeblueTex, LightsframeredTex) { X = 110, Y = 52 }; Add(PlayerLightFrame); // buzzer PlayerBuzzerBack = new UIImage(BuzzerbtnBackTexture) { X = 173, Y = 85 }; Add(PlayerBuzzerBack); PlayerBuzzer = new UIButton(BuzzerbtnTexture) { X = PlayerBuzzerBack.X + 1, Y = PlayerBuzzerBack.Y - 10 }; Add(PlayerBuzzer); PlayerBuzzer.OnButtonClick += PlayerBuzzerClickedHandler; // score - read only PlayerScoreBack = new UIImage(PlayerScoreBackTexture) { X = 310, Y = 88, Tooltip = GameFacade.Strings.GetString("f127", "2") // "Player Score" }; PlayerScoreBack.UseTooltip(); Add(PlayerScoreBack); PlayerScore = new UITextEdit() { Mode = UITextEditMode.ReadOnly, Alignment = TextAlignment.Center, Size = new Vector2(80, 20), X = PlayerScoreBack.X - 2, Y = PlayerScoreBack.Y + 5, CurrentText = "0", Tooltip = GameFacade.Strings.GetString("f127", "2") // "Player Score" }; Add(PlayerScore); }
public UILoginDialog(Action login) : base(UIDialogStyle.Standard, true) { this.Login = login; this.Caption = GameFacade.Strings.GetString("UIText", "209", "1"); SetSize(350, 225); m_TxtAccName = UITextEdit.CreateTextBox(); m_TxtAccName.X = 20; m_TxtAccName.Y = 72; m_TxtAccName.MaxChars = 32; m_TxtAccName.SetSize(310, 27); m_TxtAccName.CurrentText = GlobalSettings.Default.LastUser; m_TxtAccName.OnChange += M_TxtAccName_OnChange; m_TxtAccName.OnTabPress += new KeyPressDelegate(m_TxtAccName_OnTabPress); m_TxtAccName.OnEnterPress += new KeyPressDelegate(loginBtn_OnButtonClick); this.Add(m_TxtAccName); m_TxtPass = UITextEdit.CreateTextBox(); m_TxtPass.X = 20; m_TxtPass.Y = 128; m_TxtPass.MaxChars = 64; m_TxtPass.SetSize(310, 27); m_TxtPass.Password = true; m_TxtPass.OnChange += M_TxtAccName_OnChange; //m_TxtPass.OnTabPress += new KeyPressDelegate(m_TxtPass_OnTabPress); m_TxtPass.OnEnterPress += new KeyPressDelegate(loginBtn_OnButtonClick); m_TxtPass.OnShiftTabPress += new KeyPressDelegate(m_TxtPass_OnShiftTabPress); this.Add(m_TxtPass); /** Login button **/ var loginBtn = new UIButton { X = 116, Y = 170, Width = 100, ID = "LoginButton", Caption = GameFacade.Strings.GetString("UIText", "209", "2") }; this.Add(loginBtn); loginBtn.OnButtonClick += new ButtonClickDelegate(loginBtn_OnButtonClick); var exitBtn = new UIButton { X = 226, Y = 170, Width = 100, ID = "ExitButton", Caption = GameFacade.Strings.GetString("UIText", "209", "3") }; this.Add(exitBtn); exitBtn.OnButtonClick += new ButtonClickDelegate(exitBtn_OnButtonClick); this.Add(new UILabel { Caption = GameFacade.Strings.GetString("UIText", "209", "4"), X = 24, Y = 50 }); this.Add(new UILabel { Caption = GameFacade.Strings.GetString("UIText", "209", "5"), X = 24, Y = 106 }); GameFacade.Screens.inputManager.SetFocus(m_TxtAccName); RefreshBlink(); }
/// <summary> /// Walks a generated AST (Abstract Syntax Tree) and creates the elements of this UIScreen. /// </summary> /// <param name="State">A ParserState instance.</param> /// <param name="node">The root node of the AST.</param> private void WalkTree(UIParser.ParserState State, AstNode node, ref ParseResult Result) { NodeType NType = (NodeType)Enum.Parse(typeof(NodeType), node.ToString(), true); switch (NType) { case NodeType.DefineImage: //Defines an image and loads a texture for it. DefineImageNode ImgNode = (DefineImageNode)UINode.GetNode(node); UIImage Img = new UIImage(ImgNode, m_Screen); Result.Elements.Add(ImgNode.Name, Img); break; case NodeType.DefineString: //Defines a string with a name. DefineStringNode StrNode = (DefineStringNode)UINode.GetNode(node); Result.Strings.Add(StrNode.Name, StringManager.StrTable(State.CurrentStringTable)[StrNode.StrIndex]); break; case NodeType.AddButton: //Defines a button. AddButtonNode ButtonNode = (AddButtonNode)UINode.GetNode(node); UIButton Btn = new UIButton(ButtonNode, Result, m_Screen); Result.Elements.Add(ButtonNode.Name, Btn); break; case NodeType.AddText: AddTextNode TextNode = (AddTextNode)UINode.GetNode(node); UILabel Lbl = new UILabel(TextNode, Result, m_Screen); Result.Elements.Add(TextNode.Name, Lbl); break; case NodeType.AddTextEdit: AddTextEditNode TextEditNode = (AddTextEditNode)UINode.GetNode(node); UITextEdit Txt = new UITextEdit(TextEditNode, State, m_Screen); Result.Elements.Add(TextEditNode.Name, Txt); break; case NodeType.AddSlider: AddSliderNode SliderNode = (AddSliderNode)UINode.GetNode(node); UISlider Slider = new UISlider(SliderNode, State, m_Screen); Result.Elements.Add(SliderNode.Name, Slider); break; case NodeType.SetSharedProperties: //Assigns a bunch of shared properties to declarations following the statement. State.InSharedPropertiesGroup = true; SetSharedPropsNode SharedPropsNode = (SetSharedPropsNode)UINode.GetNode(node); if (SharedPropsNode.StringTable != null) { State.CurrentStringTable = (int)SharedPropsNode.StringTable; } if (SharedPropsNode.ControlPosition != null) { State.Position[0] = SharedPropsNode.ControlPosition.Numbers[0]; State.Position[1] = SharedPropsNode.ControlPosition.Numbers[1]; break; } if (SharedPropsNode.Color != null) { State.Color = new Color(); State.Color.R = (byte)SharedPropsNode.Color.Numbers[0]; State.Color.G = (byte)SharedPropsNode.Color.Numbers[1]; State.Color.B = (byte)SharedPropsNode.Color.Numbers[2]; } if (SharedPropsNode.TextColor != null) { State.TextColor = new Color(); State.TextColor.R = (byte)SharedPropsNode.TextColor.Numbers[0]; State.TextColor.G = (byte)SharedPropsNode.TextColor.Numbers[1]; State.TextColor.B = (byte)SharedPropsNode.TextColor.Numbers[2]; } if (SharedPropsNode.TextColorSelected != null) { State.TextColorSelected = new Color(); State.TextColorSelected.R = (byte)SharedPropsNode.TextColorSelected.Numbers[0]; State.TextColorSelected.G = (byte)SharedPropsNode.TextColorSelected.Numbers[1]; State.TextColorSelected.B = (byte)SharedPropsNode.TextColorSelected.Numbers[2]; } if (SharedPropsNode.TextColorHighlighted != null) { State.TextColorHighlighted = new Color(); State.TextColorHighlighted.R = (byte)SharedPropsNode.TextColorHighlighted.Numbers[0]; State.TextColorHighlighted.G = (byte)SharedPropsNode.TextColorHighlighted.Numbers[1]; State.TextColorHighlighted.B = (byte)SharedPropsNode.TextColorHighlighted.Numbers[2]; } if (SharedPropsNode.TextColorDisabled != null) { State.TextColorDisabled = new Color(); State.TextColorDisabled.R = (byte)SharedPropsNode.TextColorDisabled.Numbers[0]; State.TextColorDisabled.G = (byte)SharedPropsNode.TextColorDisabled.Numbers[1]; State.TextColorDisabled.B = (byte)SharedPropsNode.TextColorDisabled.Numbers[2]; } if (SharedPropsNode.BackColor != null) { State.BackColor = new Color(); State.BackColor.R = (byte)SharedPropsNode.BackColor.Numbers[0]; State.BackColor.G = (byte)SharedPropsNode.BackColor.Numbers[1]; State.BackColor.B = (byte)SharedPropsNode.BackColor.Numbers[2]; } if (SharedPropsNode.CursorColor != null) { State.CursorColor = new Color(); State.CursorColor.R = (byte)SharedPropsNode.CursorColor.Numbers[0]; State.CursorColor.G = (byte)SharedPropsNode.CursorColor.Numbers[1]; State.CursorColor.B = (byte)SharedPropsNode.CursorColor.Numbers[2]; } if (SharedPropsNode.TextButton) { State.TextButton = true; } if (SharedPropsNode.Opaque != null) { State.IsOpaque = (SharedPropsNode.Opaque == 1) ? true : false; } if (SharedPropsNode.Transparent != null) { State.IsTransparent = (SharedPropsNode.Transparent == 1) ? true : false; } if (SharedPropsNode.Alignment != null) { State.Alignment = (int)SharedPropsNode.Alignment; } if (SharedPropsNode.Image != "") { State.Image = SharedPropsNode.Image; } if (SharedPropsNode.Tooltip != "") { State.Tooltip = SharedPropsNode.Tooltip; } if (SharedPropsNode.Text != "") { State.Caption = SharedPropsNode.Text; } if (SharedPropsNode.Size != null) { State.Size = new Vector2(SharedPropsNode.Size.Numbers[0], SharedPropsNode.Size.Numbers[1]); } if (SharedPropsNode.Orientation != null) { State.Orientation = (int)SharedPropsNode.Orientation; } if (SharedPropsNode.Font != null) { State.Font = (int)SharedPropsNode.Font; } if (SharedPropsNode.Opaque != null) { State.Opaque = (int)SharedPropsNode.Opaque; } break; case NodeType.SetControlProperties: //Sets a bunch of properties to a specified control. SetControlPropsNode ControlPropsNode = (SetControlPropsNode)UINode.GetNode(node); UIControl Ctrl = new UIControl(ControlPropsNode, m_Screen, State); Result.Controls.Add(ControlPropsNode.Control, Ctrl); if (State.InSharedPropertiesGroup) { UIElement Test = new UIElement(m_Screen, null); //Script implicitly created an object... :\ if (!Result.Elements.TryGetValue(ControlPropsNode.Control, out Test)) { Result.Elements.Add(ControlPropsNode.Control, new UIElement(m_Screen, null)); if (Ctrl.Image != null) { Result.Elements[ControlPropsNode.Control].Image = new UIImage(Ctrl.Image); } Result.Elements[ControlPropsNode.Control].Position = Ctrl.Position; } } break; case NodeType.End: State.InSharedPropertiesGroup = false; State.Image = ""; //Reset State.TextButton = false; //Reset State.Color = new Color(); State.Caption = ""; State.Size = new Vector2(0, 0); State.Alignment = 0; State.Font = 0; //TODO: Reset more? break; } foreach (AstNode child in node.ChildNodes) { WalkTree(State, child, ref Result); } }
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 { 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 { Caption = GameFacade.Strings.GetString("f113", "23") }; topVbox.Add(descLabel); DescEdit = new UITextEdit { BackgroundTextureReference = UITextBox.StandardBackground, 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 { 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)) { 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 { RadioGroup = (j == 0) ? "viewPerm" : "showPerm", RadioData = (VMTSOAvatarPermissions)i, Selected = viewMin ? (i == (int)cat.ViewPermMin) : (i == (int)cat.SendPermMin), 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 { Caption = GameFacade.Strings.GetString("f113", "33") }; deleteButton.OnButtonClick += (btn) => { UIScreen.RemoveDialog(this); Channel.Flags |= VMTSOChatChannelFlags.Delete; OnDelete(); }; buttonsHbox.Add(deleteButton); } var setColorButton = new UIButton { 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); }; }