public UIBHAVEditor(BHAV target, EditorScope scope) { BHAVView = new BHAVContainer(target, scope); PlacingName = new UILabel(); PlacingName.Alignment = TextAlignment.Center; PlacingName.Size = new Vector2(1, 1); PlacingName.CaptionStyle = TextStyle.DefaultLabel.Clone(); PlacingName.CaptionStyle.Font = FSO.Client.GameFacade.EdithFont; PlacingName.CaptionStyle.Size = 14; PlacingName.CaptionStyle.Color = new Color(0, 102, 26); PlacingName.Caption = "Placing Report Metric"; PlacingDesc = new UILabel(); PlacingDesc.Alignment = TextAlignment.Center; PlacingDesc.Size = new Vector2(1, 1); PlacingDesc.CaptionStyle = TextStyle.DefaultLabel.Clone(); PlacingDesc.CaptionStyle.Font = FSO.Client.GameFacade.EdithFont; PlacingDesc.CaptionStyle.Size = 12; PlacingDesc.CaptionStyle.Color = new Color(0, 102, 26); PlacingDesc.Caption = "Press ESC to cancel."; this.Add(BHAVView); this.Add(PlacingName); this.Add(PlacingDesc); }
public LoginScreen() { PlayBackgroundMusic(new string[] { "none" }); /** * Scale the whole screen to 1024 */ BackgroundCtnr = new UIContainer(); BackgroundCtnr.ScaleX = BackgroundCtnr.ScaleY = ScreenWidth / 800.0f; /** Background image **/ Background = new UIImage(GetTexture((ulong)FileIDs.UIFileIDs.setup)); Background.ID = "Background"; BackgroundCtnr.Add(Background); /** Client version **/ var lbl = new UILabel(); lbl.Caption = "Version " + GlobalSettings.Default.ClientVersion; lbl.X = 20; lbl.Y = 558; BackgroundCtnr.Add(lbl); this.Add(BackgroundCtnr); /** Progress bar **/ LoginProgress = new UILoginProgress(); LoginProgress.X = (ScreenWidth - (LoginProgress.Width + 20)); LoginProgress.Y = (ScreenHeight - (LoginProgress.Height + 20)); LoginProgress.Opacity = 0.9f; this.Add(LoginProgress); /** Login dialog **/ LoginDialog = new UILoginDialog(this); LoginDialog.Opacity = 0.9f; //Center LoginDialog.X = (ScreenWidth - LoginDialog.Width) / 2; LoginDialog.Y = (ScreenHeight - LoginDialog.Height) / 2; this.Add(LoginDialog); NetworkFacade.Controller.OnNetworkError += new NetworkErrorDelegate(Controller_OnNetworkError); NetworkFacade.Controller.OnLoginProgress += new OnProgressDelegate(Controller_OnLoginProgress); NetworkFacade.Controller.OnLoginStatus += new OnLoginStatusDelegate(Controller_OnLoginStatus); var gameplayButton = new UIButton() { Caption = "Simantics & Lot Debug", Y = 10, Width = 200, X = 10 }; this.Add(gameplayButton); gameplayButton.OnButtonClick += new ButtonClickDelegate(gameplayButton_OnButtonClick); }
public UIGameTitle() { Background = new UIImage(GetTexture((ulong)0x000001A700000002)); Background.With9Slice(40, 40, 0, 0); this.AddAt(0, Background); Background.BlockInput(); Label = new UILabel(); Label.CaptionStyle = TextStyle.DefaultLabel.Clone(); Label.CaptionStyle.Size = 11; Label.Alignment = TextAlignment.Middle; this.Add(Label); SetTitle("Not Blazing Falls"); }
public UILoginProgress() : base(UIDialogStyle.Standard, false) { this.SetSize(400, 180); this.Caption = GameFacade.Strings.GetString("210", "1"); /** * Label background */ var bgImg = new UIImage(UITextBox.StandardBackground) { X = 20, Y = 120 }; bgImg.SetSize(360, 27); this.Add(bgImg); m_ProgressBar = new UIProgressBar() { X = 20, Y = 66, Value = 0 }; m_ProgressBar.SetSize(360, 27); this.Add(m_ProgressBar); this.Add(new UILabel { Caption = GameFacade.Strings.GetString("210", "2"), X = 20, Y = 44 }); this.Add(new UILabel { Caption = GameFacade.Strings.GetString("210", "3"), X = 20, Y = 97 }); m_ProgressLabel = new UILabel{ Caption = GameFacade.Strings.GetString("210", "4"), X = 31, Y = 122 }; this.Add(m_ProgressLabel); }
/// <summary> /// Creates a new CityTransitionScreen. /// </summary> /// <param name="SelectedCity">The city being transitioned to.</param> /// <param name="CharacterCreated">If transitioning from CreateASim, this should be true. /// A CharacterCreateCity packet will be sent to the CityServer. Otherwise, this should be false. /// A CityToken packet will be sent to the CityServer.</param> public CityTransitionScreen(CityInfo SelectedCity, bool CharacterCreated) { m_SelectedCity = SelectedCity; m_CharacterCreated = CharacterCreated; /** * Scale the whole screen to 1024 */ m_BackgroundCtnr = new UIContainer(); m_BackgroundCtnr.ScaleX = m_BackgroundCtnr.ScaleY = ScreenWidth / 800.0f; /** Background image **/ m_Background = new UIImage(GetTexture((ulong)FileIDs.UIFileIDs.setup)); m_Background.ID = "Background"; m_BackgroundCtnr.Add(m_Background); var lbl = new UILabel(); lbl.Caption = "Version " + GlobalSettings.Default.ClientVersion; lbl.X = 20; lbl.Y = 558; m_BackgroundCtnr.Add(lbl); this.Add(m_BackgroundCtnr); m_LoginProgress = new UILoginProgress(); m_LoginProgress.X = (ScreenWidth - (m_LoginProgress.Width + 20)); m_LoginProgress.Y = (ScreenHeight - (m_LoginProgress.Height + 20)); m_LoginProgress.Opacity = 0.9f; this.Add(m_LoginProgress); /*lock(NetworkFacade.Controller) NetworkFacade.Controller.OnNetworkError += new NetworkErrorDelegate(Controller_OnNetworkError);*/ lock (NetworkFacade.Client) { lock (NetworkFacade.Client.ClientEncryptor) { LoginArgsContainer LoginArgs = new LoginArgsContainer(); LoginArgs.Username = NetworkFacade.Client.ClientEncryptor.Username; LoginArgs.Password = Convert.ToBase64String(PlayerAccount.Hash); LoginArgs.Enc = NetworkFacade.Client.ClientEncryptor; NetworkFacade.Client = new NetworkClient(SelectedCity.IP, SelectedCity.Port, GonzoNet.Encryption.EncryptionMode.AESCrypto, true); //This might not fix decryption of cityserver's packets, but it shouldn't make things worse... NetworkFacade.Client.ClientEncryptor = LoginArgs.Enc; //THIS IS IMPORTANT - THIS NEEDS TO BE COPIED AFTER IT HAS BEEN RECREATED FOR //THE RECONNECTION TO WORK! LoginArgs.Client = NetworkFacade.Client; NetworkFacade.Client.OnConnected += new OnConnectedDelegate(Client_OnConnected); NetworkFacade.Controller.Reconnect(ref NetworkFacade.Client, SelectedCity, LoginArgs); } } lock (NetworkFacade.Controller) { NetworkFacade.Controller.OnCharacterCreationStatus += new OnCharacterCreationStatusDelegate(Controller_OnCharacterCreationStatus); NetworkFacade.Controller.OnCityTransferProgress += new OnCityTransferProgressDelegate(Controller_OnCityTransfer); NetworkFacade.Controller.OnLoginNotifyCity += new OnLoginNotifyCityDelegate(Controller_OnLoginNotifyCity); NetworkFacade.Controller.OnLoginSuccessCity += new OnLoginSuccessCityDelegate(Controller_OnLoginSuccessCity); NetworkFacade.Controller.OnLoginFailureCity += new OnLoginFailureCityDelegate(Controller_OnLoginFailureCity); NetworkFacade.Controller.OnNetworkError += new NetworkErrorDelegate(Controller_OnNetworkError); } }
public UIBHAVEditor(BHAV target, EditorScope scope, VMEntity debugEnt) { if (debugEnt != null) { DebugMode = true; DebugEntity = debugEnt; } ContainerByID = new Dictionary<ushort, BHAVContainer>(); BHAVView = new BHAVContainer(target, scope); ContainerByID.Add(target.ChunkID, BHAVView); this.Add(BHAVView); PlacingName = new UILabel(); PlacingName.Alignment = TextAlignment.Center; PlacingName.Size = new Vector2(1, 1); PlacingName.CaptionStyle = TextStyle.DefaultLabel.Clone(); PlacingName.CaptionStyle.Font = FSO.Client.GameFacade.EdithFont; PlacingName.CaptionStyle.Size = 14; PlacingName.CaptionStyle.Color = new Color(0, 102, 26); PlacingName.Caption = "Placing Report Metric"; PlacingDesc = new UILabel(); PlacingDesc.Alignment = TextAlignment.Center; PlacingDesc.Size = new Vector2(1, 1); PlacingDesc.CaptionStyle = TextStyle.DefaultLabel.Clone(); PlacingDesc.CaptionStyle.Font = FSO.Client.GameFacade.EdithFont; PlacingDesc.CaptionStyle.Size = 12; PlacingDesc.CaptionStyle.Color = new Color(0, 102, 26); PlacingDesc.Caption = "Press ESC to cancel."; this.Add(PlacingName); this.Add(PlacingDesc); if (DebugMode) { DebugFrame = debugEnt.Thread.Stack.LastOrDefault(); UpdateDebugPointer(DebugFrame); DebugGo = new UIButton(); DebugGo.Caption = "Go"; DebugGo.Position = new Vector2(15, 15); Add(DebugGo); DebugGo.OnButtonClick += DebugButtonClick; DebugStepOver = new UIButton(); DebugStepOver.Caption = "Step Over"; DebugStepOver.Position = new Vector2(83, 15); Add(DebugStepOver); DebugStepOver.OnButtonClick += DebugButtonClick; DebugStepIn = new UIButton(); DebugStepIn.Caption = "Step In"; DebugStepIn.Position = new Vector2(193, 15); Add(DebugStepIn); DebugStepIn.OnButtonClick += DebugButtonClick; DebugStepOut = new UIButton(); DebugStepOut.Caption = "Step Out"; DebugStepOut.Position = new Vector2(293, 15); Add(DebugStepOut); DebugStepOut.OnButtonClick += DebugButtonClick; DebugTrue = new UIButton(); DebugTrue.Caption = "Return True"; DebugTrue.Position = new Vector2(402, 15); Add(DebugTrue); DebugTrue.OnButtonClick += DebugButtonClick; DebugFalse = new UIButton(); DebugFalse.Caption = "Return False"; DebugFalse.Position = new Vector2(522, 15); Add(DebugFalse); DebugFalse.OnButtonClick += DebugButtonClick; } }
public override void Update(UpdateState state) { if (!VM.UseWorld) return; if (state.NewKeys.Contains(Keys.Enter)) { if (!TextBox.Visible) TextBox.Clear(); TextBox.Visible = !TextBox.Visible; } var avatars = vm.Entities.Where(x => (x is VMAvatar)).ToList(); while (avatars.Count < Labels.Count) { Remove(Labels[Labels.Count - 1]); Labels.RemoveAt(Labels.Count - 1); } while (avatars.Count > Labels.Count) { var label = new UILabel(); label.CaptionStyle = Style.Clone(); label.CaptionStyle.Color = Colours[Labels.Count % Colours.Length]; label.Alignment = TextAlignment.Center | TextAlignment.Middle; Add(label); Labels.Add(label); } for (int i=0; i<Labels.Count; i++) { var label = Labels[i]; var avatar = avatars[i]; label.Caption = ((VMAvatar)avatar).Message; label.Position = ((AvatarComponent)avatar.WorldUI).LastScreenPos + new Vector2(0, -175) / (1<<(3-(int)vm.Context.World.State.Zoom)); TextAlignment alignment = 0; if (label.Position.X < Margin) { alignment |= TextAlignment.Left; label.Position = new Vector2(Margin, label.Position.Y); } else if (label.Position.X > GlobalSettings.Default.GraphicsWidth-Margin) { alignment |= TextAlignment.Right; label.Position = new Vector2(GlobalSettings.Default.GraphicsWidth-Margin, label.Position.Y); } else { alignment |= TextAlignment.Center; } if (label.Position.Y < Margin) { alignment |= TextAlignment.Top; label.Position = new Vector2(label.Position.X, Margin); } else if (label.Position.Y > GlobalSettings.Default.GraphicsHeight - Margin) { alignment |= TextAlignment.Bottom; label.Position = new Vector2(label.Position.X, GlobalSettings.Default.GraphicsHeight - Margin); } else { alignment |= TextAlignment.Middle; } label.Alignment = alignment; label.Size = new Vector2(1, 1); } base.Update(state); }
public LoadingScreen() { /** * Scale the whole screen to 1024 */ BackgroundCtnr = new UIContainer(); BackgroundCtnr.ScaleX = BackgroundCtnr.ScaleY = ScreenWidth / 800.0f; /** Background image **/ Background = new UIImage(GetTexture((ulong)FileIDs.UIFileIDs.setup)); BackgroundCtnr.Add(Background); //TODO: Letter spacing is a bit wrong on this label var lbl = new UILabel(); lbl.Caption = GameFacade.Strings.GetString("154", "5"); lbl.X = 0; lbl.Size = new Microsoft.Xna.Framework.Vector2(800, 100); lbl.Y = 508; var style = lbl.CaptionStyle.Clone(); style.Size = 17; lbl.CaptionStyle = style; BackgroundCtnr.Add(lbl); this.Add(BackgroundCtnr); ProgressLabel1 = new UILabel { X = 0, Y = 550, Size = new Microsoft.Xna.Framework.Vector2(800, 100), CaptionStyle = style }; ProgressLabel2 = new UILabel { X = 0, Y = 550, Size = new Microsoft.Xna.Framework.Vector2(800, 100), CaptionStyle = style }; BackgroundCtnr.Add(ProgressLabel1); BackgroundCtnr.Add(ProgressLabel2); PreloadLabels = new string[]{ GameFacade.Strings.GetString("155", "6"), GameFacade.Strings.GetString("155", "7"), GameFacade.Strings.GetString("155", "8"), GameFacade.Strings.GetString("155", "9") }; CurrentPreloadLabel = 0; AnimateLabel("", PreloadLabels[0]); CheckProgressTimer = new Timer(); CheckProgressTimer.Interval = 5; CheckProgressTimer.Elapsed += new ElapsedEventHandler(CheckProgressTimer_Elapsed); CheckProgressTimer.Start(); //GameFacade.Screens.Tween.To(rect, 10.0f, new Dictionary<string, float>() { // {"X", 500.0f} //}, TweenQuad.EaseInOut); }
public PrimitiveBox(BHAVInstruction inst, byte ptr, BHAVContainer master) { Type = PrimBoxType.Primitive; Instruction = inst; Descriptor = PrimitiveRegistry.GetDescriptor(inst.Opcode); Operand = (VMPrimitiveOperand)Activator.CreateInstance(Descriptor.OperandType); Operand.Read(inst.Operand); InstPtr = ptr; Nodes = new PrimitiveNode[2]; Nodes[0] = new PrimitiveNode(); Nodes[0].Type = NodeType.False; Nodes[1] = new PrimitiveNode(); Nodes[1].Type = NodeType.True; Title = new UILabel(); Title.Alignment = TextAlignment.Middle | TextAlignment.Center; Title.Y = 0; Title.X = 0; this.Add(Title); Title.CaptionStyle = TextStyle.DefaultLabel.Clone(); Title.CaptionStyle.Font = FSO.Client.GameFacade.EdithFont; Title.CaptionStyle.Size = 14; BodyTextStyle = TextStyle.DefaultLabel.Clone(); BodyTextStyle.Font = FSO.Client.GameFacade.EdithFont; BodyTextStyle.Size = 12; this.Add(Nodes[0]); this.Add(Nodes[1]); HitTest = ListenForMouse(new Rectangle(0, 0, Width, Height), new UIMouseEvent(MouseEvents)); Master = master; UpdateDisplay(); }
public DebugTypeFaceScreen() { var msg = "The quick brown fox jumps over the lazy dog"; var sizes = new int[] { 10, 12, 14, 16, 20 }; this.Add(new UILabel() { X = 10.0f, Y = 30.0f, Caption = "Metric calculation test: Green bar is Y 0, Red bar is calculated baseline" }); var greenTexture = TextureUtils.TextureFromColor(GameFacade.GraphicsDevice, Color.Green); var redTexture = TextureUtils.TextureFromColor(GameFacade.GraphicsDevice, Color.Red); var grayTexture = TextureUtils.TextureFromColor(GameFacade.GraphicsDevice, Color.Gray); var yPosition = 100.0f; for (var i = 0; i < sizes.Length; i++) { var pxSize = sizes[i]; var label = new UILabel(); label.Caption = msg; label.CaptionStyle = TextStyle.DefaultLabel.Clone(); label.CaptionStyle.Size = pxSize; label.X = 10; label.Y = yPosition; /** Origin line **/ var origLine = new UIImage(greenTexture); origLine.SetSize(800.0f, 1.0f); origLine.X = 10; origLine.Y = yPosition; this.Add(origLine); var baseLine = new UIImage(redTexture); baseLine.SetSize(800.0f, 1.0f); baseLine.X = 10; baseLine.Y = yPosition + label.CaptionStyle.BaselineOffset; this.Add(baseLine); yPosition += (float)Math.Round(label.CaptionStyle.MeasureString(msg).Y); yPosition += 20.0f; this.Add(label); } this.Add(new UILabel() { X = 10.0f, Y = yPosition + 30.0f, Caption = "Alignment calculation test" }); var alignments = new TextAlignment[]{ TextAlignment.Center, TextAlignment.Right, TextAlignment.Middle, TextAlignment.Middle | TextAlignment.Center, TextAlignment.Middle | TextAlignment.Right }; yPosition += 60.0f; sizes = new int[] { 10 }; for (var i = 0; i < sizes.Length; i++) { var pxSize = sizes[i]; foreach (var align in alignments) { var label = new UILabel(); label.Caption = msg; label.CaptionStyle = TextStyle.DefaultLabel.Clone(); label.CaptionStyle.Size = pxSize; label.Size = new Vector2(800.0f, 50.0f); label.Alignment = align; label.X = 10; label.Y = yPosition; var area = new UIImage(grayTexture); area.SetSize(800.0f, 50.0f); area.X = 10; area.Y = yPosition; this.Add(area); ///** Origin line **/ //var origLine = new UIImage(greenTexture); //origLine.SetSize(800.0f, 1.0f); //origLine.X = 10; //origLine.Y = yPosition; //this.Add(origLine); //var baseLine = new UIImage(redTexture); //baseLine.SetSize(800.0f, 1.0f); //baseLine.X = 10; //baseLine.Y = yPosition + label.CaptionStyle.BaselineOffset; //this.Add(baseLine); yPosition += 50.0f;//(float)Math.Round(label.CaptionStyle.MeasureString(msg).Y); yPosition += 20.0f; this.Add(label); } } }
public LoadingScreen() : base() { HITVM.Get().PlaySoundEvent(UIMusic.LoadLoop); /** * Scale the whole screen to 1024 */ BackgroundCtnr = new UIContainer(); var scale = ScreenHeight / 600.0f; BackgroundCtnr.ScaleX = BackgroundCtnr.ScaleY = scale; /** Background image **/ Texture2D setupTex; if (File.Exists(Path.Combine(FSOEnvironment.ContentDir, "setup.png"))) { using (var logostrm = File.OpenRead(Path.Combine(FSOEnvironment.ContentDir, "setup.png"))) setupTex = ImageLoader.FromStream(GameFacade.GraphicsDevice, logostrm); } else setupTex = GetTexture((ulong)FileIDs.UIFileIDs.setup); Background = new UIImage(setupTex); var bgScale = 600f / setupTex.Height; Background.SetSize(setupTex.Width * bgScale, 600); Background.X = (800 - bgScale * setupTex.Width) / 2; BackgroundCtnr.Add(Background); BackgroundCtnr.X = (ScreenWidth - (800 * scale)) / 2; Texture2D splashSeg; using (var logostrm = File.OpenRead(Path.Combine(FSOEnvironment.ContentDir, "Textures/splashSeg.png"))) splashSeg = ImageLoader.FromStream(GameFacade.GraphicsDevice, logostrm); var bgEdge = new UIImage(splashSeg).With9Slice(64, 64, 1, 1); BackgroundCtnr.AddAt(0,bgEdge); bgEdge.Y = -1; bgEdge.X = Background.X-64; bgEdge.SetSize(Background.Width+64*2, Background.Height + 2); //TODO: Letter spacing is a bit wrong on this label var lbl = new UILabel(); lbl.Caption = GameFacade.Strings.GetString("154", "5"); lbl.X = 0; lbl.Size = new Microsoft.Xna.Framework.Vector2(800, 100); lbl.Y = 508; var style = lbl.CaptionStyle.Clone(); style.Size = 17; lbl.CaptionStyle = style; BackgroundCtnr.Add(lbl); this.Add(BackgroundCtnr); ProgressLabel1 = new UILabel { X = 0, Y = 550, Size = new Microsoft.Xna.Framework.Vector2(800, 100), CaptionStyle = style }; ProgressLabel2 = new UILabel { X = 0, Y = 550, Size = new Microsoft.Xna.Framework.Vector2(800, 100), CaptionStyle = style }; BackgroundCtnr.Add(ProgressLabel1); BackgroundCtnr.Add(ProgressLabel2); PreloadLabels = new string[]{ GameFacade.Strings.GetString("155", "6"), GameFacade.Strings.GetString("155", "7"), GameFacade.Strings.GetString("155", "8"), GameFacade.Strings.GetString("155", "9") }; CurrentPreloadLabel = 0; AnimateLabel("", PreloadLabels[0]); CheckProgressTimer = new Timer(); CheckProgressTimer.Interval = 5; CheckProgressTimer.Elapsed += new ElapsedEventHandler(CheckProgressTimer_Elapsed); CheckProgressTimer.Start(); //GameFacade.Screens.Tween.To(rect, 10.0f, new Dictionary<string, float>() { // {"X", 500.0f} //}, TweenQuad.EaseInOut); }
public void P_Players(string evt, string txt) { var split = txt.Split('\n'); int[] items = new int[4]; var labels = new UILabel[] { labelStation1, labelStation2, labelStation3, labelStation4 }; for (int i=0; i<4; i++) { if (!int.TryParse(split[i], out items[i])) return; var avatar = (VMAvatar)Controller.Lot.vm.GetObjectById((short)items[i]); if (avatar == null) { if (Players[i] != null) Remove(Players[i]); Players[i] = null; } else if (Players[i] == null || Players[i].Avatar != avatar) { if (Players[i] != null) Remove(Players[i]); Players[i] = new UIPersonIcon((VMAvatar)avatar, Controller.Lot.vm, true); var bgs = new UIImage[] { PersonBG1, PersonBG2, PersonBG3, PersonBG4 }; Players[i].Position = bgs[i].Position + new Microsoft.Xna.Framework.Vector2(2, 2); Add(Players[i]); } string caption = ""; if (avatar == null) caption = Script.GetString("strNoContributor"); else { if (i == 0) caption = Script.GetString("strBody") + avatar.GetPersonData(VMPersonDataVariable.BodySkill) / 100; else if (i == 2) caption = Script.GetString("strCharisma") + avatar.GetPersonData(VMPersonDataVariable.CharismaSkill) / 100; else caption = Script.GetString("strCooking") + avatar.GetPersonData(VMPersonDataVariable.CookingSkill) / 100; } labels[i].Caption = caption; } }