/// <summary> /// Constructs a new UIDialog instance. /// </summary> /// <param name="Screen">A UIScreen instance.</param> /// <param name="Pos">A Vector2 instance specifying the position of this dialog.</param> /// <param name="IsTall">Will this dialog use a tall background template?</param> /// <param name="IsDraggable">Is this dialog draggable?</param> /// <param name="HasExitButton">Does this dialog have an exit button?</param> public UIDialog(UIScreen Screen, Vector2 Pos, bool IsTall, bool IsDraggable, bool HasExitButton) : base(Screen) { Position = Pos; m_IsDraggable = IsDraggable; m_HasExitBtn = HasExitButton; //TODO: Find a way to NOT hardcode these references. Texture2D Tex = (IsTall != false) ? FileManager.GetTexture((ulong)FileIDs.UIFileIDs.dialog_backgroundtemplatetall, true) : FileManager.GetTexture((ulong)FileIDs.UIFileIDs.dialog_backgroundtemplate, true); Texture2D CloseBtnBackground = (IsTall != false) ? FileManager.GetTexture((ulong)FileIDs.UIFileIDs.dialog_closebtnbackgroundtall) : FileManager.GetTexture((ulong)FileIDs.UIFileIDs.dialog_closebtnbackground); Image = new UIImage(Tex, Screen, null); if (IsTall != false) Image.Slicer = new NineSlicer(new Vector2(0, 0), Tex.Width, Tex.Height, 41, 41, 66, 40); else Image.Slicer = new NineSlicer(new Vector2(0, 0), Tex.Width, Tex.Height, 41, 41, 60, 40); Image.Position = new Vector2(Pos.X, Pos.Y); m_CloseBtnBack = new UIImage(CloseBtnBackground, Screen, null); m_CloseBtnBack.Position = Position + new Vector2(Image.Slicer.Width - m_CloseBtnBack.Texture.Width, 0); Texture2D CloseButtonTex = FileManager.GetTexture((ulong)FileIDs.UIFileIDs.dialog_closebtn); m_CloseButton = new UIButton("CloseBtn", CloseButtonTex, Position + new Vector2(Image.Slicer.Width - (CloseButtonTex.Width / 2.5f), 9f), Screen, null); m_CloseButton.OnButtonClicked += CloseButton_OnButtonClicked; }
public UISlider(AddSliderNode Node, ParserState State, UIScreen Screen) : base(Screen) { Name = Node.Name; m_ID = Node.ID; Position = new Vector2(Node.SliderPosition.Numbers[0], Node.SliderPosition.Numbers[1]); if (!State.InSharedPropertiesGroup) { Image = m_Screen.GetImage(Node.Image); Image.Position = Position; } else { Image = m_Screen.GetImage(State.Image); Image.Position = Position; } if (Node.MinimumValue != null) m_Minimumvalue = (int)Node.MinimumValue; if (Node.MaximumValue != null) m_MaximumValue = (int)Node.MaximumValue; if (!State.InSharedPropertiesGroup) { m_Size = new Vector2(Node.Size.Numbers[0], Node.Size.Numbers[1]); m_Orientation = (SliderOrientation)Node.Orientation; } else { m_Size = State.Size; m_Orientation = (SliderOrientation)State.Orientation; } }
void Start() { if (!playerGO) print ("Player Ship not registerd with UI"); MenuOn(); uiScreen = UIScreen.MenuOn; Time.timeScale = 0f; }
protected void Show(UIScreen screen) { HideAllUIScreens(); screen.Show(); TimeManager.Paused = true; screenStack.Clear(); screenStack.Push(screen); }
public WillWrightDiag(UIImage Img, UIScreen Screen, Vector2 Position) : base(Screen, Position, true, true, true) { m_WillWrightImg = Img; m_WillWrightImg.Position = Position; Image.SetSize(m_WillWrightImg.Texture.Width + 50, m_WillWrightImg.Texture.Height + 55); CenterAround(m_WillWrightImg, -22, -42); }
private DisplayInformation() { #if __ANDROID__ _metrics = Plugin.CurrentActivity.CrossCurrentActivity.Current.Activity.Resources.DisplayMetrics; #elif __IOS__ || __TVOS__ _screen = UIApplication.SharedApplication.KeyWindow.Screen; #endif }
private UISelectHouseView SelWallsPanel; //select view panel that is created when clicking the current walls mode #endregion Fields #region Constructors public UIUCP(UIScreen owner) { this.RenderScript("ucp.uis"); Game = (CoreGameScreen)owner; Background = new UIImage(BackgroundGameImage); this.AddAt(0, Background); Background.BlockInput(); BackgroundMatchmaker = new UIImage(BackgroundMatchmakerImage); BackgroundMatchmaker.Y = 81; this.AddAt(0, BackgroundMatchmaker); BackgroundMatchmaker.BlockInput(); TimeText.Caption = "12:00 am"; TimeText.CaptionStyle = TimeText.CaptionStyle.Clone(); TimeText.CaptionStyle.Shadow = true; MoneyText.Caption = "§0"; MoneyText.CaptionStyle = TimeText.CaptionStyle.Clone(); MoneyText.CaptionStyle.Shadow = true; CurrentPanel = -1; OptionsModeButton.OnButtonClick += new ButtonClickDelegate(OptionsModeButton_OnButtonClick); LiveModeButton.OnButtonClick += new ButtonClickDelegate(LiveModeButton_OnButtonClick); BuyModeButton.OnButtonClick += new ButtonClickDelegate(BuyModeButton_OnButtonClick); BuildModeButton.OnButtonClick += BuildModeButton_OnButtonClick; ZoomOutButton.OnButtonClick += new ButtonClickDelegate(ZoomControl); ZoomInButton.OnButtonClick += new ButtonClickDelegate(ZoomControl); PhoneButton.OnButtonClick += new ButtonClickDelegate(PhoneButton_OnButtonClick); CloseZoomButton.OnButtonClick += new ButtonClickDelegate(SetCityZoom); MediumZoomButton.OnButtonClick += new ButtonClickDelegate(SetCityZoom); FarZoomButton.OnButtonClick += new ButtonClickDelegate(SetCityZoom); NeighborhoodButton.OnButtonClick += new ButtonClickDelegate(SetCityZoom); WorldButton.OnButtonClick += new ButtonClickDelegate(SetCityZoom); HouseViewSelectButton.OnButtonClick += new ButtonClickDelegate(WallsViewPopup); WallsDownButton.OnButtonClick += new ButtonClickDelegate(WallsViewPopup); WallsUpButton.OnButtonClick += new ButtonClickDelegate(WallsViewPopup); WallsCutawayButton.OnButtonClick += new ButtonClickDelegate(WallsViewPopup); RoofButton.OnButtonClick += new ButtonClickDelegate(WallsViewPopup); RotateClockwiseButton.OnButtonClick += new ButtonClickDelegate(RotateClockwise); RotateCounterClockwiseButton.OnButtonClick += new ButtonClickDelegate(RotateCounterClockwise); FirstFloorButton.OnButtonClick += FirstFloor; SecondFloorButton.OnButtonClick += SecondFloor; SecondFloorButton.Selected = (Game.Level == Game.Stories); FirstFloorButton.Selected = (Game.Level == 1); SetInLot(false); SetMode(UCPMode.CityMode); }
/// <summary> /// Copy constructor for the UIControl class. /// This constructor will deep copy another UIControl instance. /// </summary> /// <param name="Ctrl">A UIControl instance to copy.</param> /// <param name="Screen">A UIScreen instance that this UIControl belongs to.</param> public UIControl(UIControl Ctrl, UIScreen Screen) : base(Screen) { Image = Ctrl.Image; Position = Ctrl.Position; m_Size = Ctrl.Size; m_LeftArrowImage = Ctrl.m_LeftArrowImage; m_RightArrowImage = Ctrl.m_RightArrowImage; m_ThumbSize = Ctrl.m_ThumbSize; m_ThumbMargins = Ctrl.m_ThumbMargins; m_ThumbImageSize = Ctrl.m_ThumbImageSize; m_ThumbImageOffsets = Ctrl.m_ThumbImageOffsets; m_ThumbButtonImage = Ctrl.m_ThumbButtonImage; }
/// <summary> /// Initializes a new instance of the <see cref="MessageBoxModal"/> class. /// </summary> /// <param name="owner">The screen that owns the message box.</param> public MessageBoxModal(UIScreen owner) { Contract.Require(owner, nameof(owner)); var uv = owner.Ultraviolet; var screenFactory = uv.TryGetFactoryMethod<MessageBoxScreenFactory>(); if (screenFactory == null) throw new InvalidOperationException(PresentationStrings.FactoryMethodMissing.Format(typeof(MessageBoxScreenFactory).Name)); screen = screenFactory(this, owner); if (screen == null) throw new InvalidOperationException(PresentationStrings.FactoryMethodInvalidResult.Format(typeof(MessageBoxScreenFactory).Name)); }
/// <summary> /// Constructs a new ExitDialog instance. /// </summary> /// <param name="Screen">A UIScreen instance.</param> /// <param name="Position">The position of this ExitDialog.</param> /// <param name="Walker">A TreeWalker instance.</param> /// <param name="ScriptPath">The path to the script which defines this ExitDialog.</param> public ExitDialog(UIScreen Screen, Vector2 Position, TreeWalker Walker, string ScriptPath) : base(Screen, Position, true, true, true) { Walker.Initialize(ScriptPath); m_Elements = Walker.Elements; m_Controls = Walker.Controls; m_ReloginButton = (UIButton)m_Elements["ReLoginButton"]; m_ExitButton = (UIButton)m_Elements["ExitButton"]; m_CancelButton = (UIButton)m_Elements["CancelButton"]; m_TitleText = (UILabel)m_Elements["TitleText"]; m_MessageText = (UILabel)m_Elements["MessageText"]; }
uint[] PixelData = new uint[1]; // Delare an Array of 1 just to store data for one pixel #endregion Fields #region Constructors public UIElement(string Name, Vector2 Position, Vector2 Size, UIScreen Screen, UIElement Parent = null) { this.Name = Name; m_Size = Size; if (Parent != null) { m_Parent = Parent; m_Position += Parent.m_Position; } else m_Position = Position; m_Screen = Screen; }
// Editor public override bool OnMenuActionGUI(UIMenuItem item) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.BeginVertical(); GUILayout.Label("Open Screen Action"); int oldSelected = mSelected; mSelected = EditorGUILayout.Popup("Screen to Open", mSelected, item.ParentScreen.ScreenMenu.mScreenListNames.ToArray()); if (oldSelected != mSelected || mScreenToOpen == null) { mScreenToOpen = item.ParentScreen.ScreenMenu.mScreenList[mSelected]; } EditorGUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); return (base.OnMenuActionGUI(item)); }
// Editor public override bool OnMenuActionGUI(UIMenuItem item) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.BeginVertical(); GUILayout.Label("Close Screen Action"); int oldSelected = Selected; Selected = EditorGUILayout.Popup("Screen to Close", Selected, item.ParentScreen.ScreenMenu.mScreenListNames.ToArray()); if (oldSelected != Selected || ScreenToClose == null) { ScreenToClose = item.ParentScreen.ScreenMenu.mScreenList[Selected]; } EditorGUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); return (base.OnMenuActionGUI(item)); }
public static void EditScreen(UIScreen screen) { EditorGUILayout.LabelField("Menu List", screen.mMenuItems.Count.ToString() + " menu item(s) on this screen."); AddMenuItem(screen); if (screen.mMenuItems != null) { for ( int i = 0; i < screen.mMenuItems.Count; i++) { if (DisplayMenuItem(i,screen.mMenuItems[i], screen) == false) { EditorUtility.SetDirty(screen); break; } } } }
public UIControl(SetControlPropsNode Node, UIScreen Screen, UIParser.ParserState State) : base(Screen) { Name = Node.Control; if (!State.InSharedPropertiesGroup) { if (Node.Image != "") Image = m_Screen.GetImage(Node.Image, false); } else { if(State.Image != "") Image = m_Screen.GetImage(State.Image, true); if (State.LeftArrowImage != "") m_LeftArrowImage = State.LeftArrowImage; if (State.RightArrowImage != "") m_RightArrowImage = State.RightArrowImage; } if (Node.PositionAssignment != null) Position = new Vector2(Node.PositionAssignment[0], Node.PositionAssignment[1]); if(Node.Size != null) m_Size = new Vector2(Node.Size.Numbers[0], Node.Size.Numbers[1]); if(Node.ThumbSize != null) m_ThumbSize = new Vector2(Node.ThumbSize.Numbers[0], Node.ThumbSize.Numbers[1]); if (Node.ThumbMargins != null) m_ThumbMargins = new Vector2(Node.ThumbMargins.Numbers[0], Node.ThumbMargins.Numbers[1]); if (Node.ThumbImageSize != null) m_ThumbImageSize = new Vector2(Node.ThumbImageSize.Numbers[0], Node.ThumbImageSize.Numbers[1]); if (Node.ThumbImageOffsets != null) m_ThumbImageOffsets = new Vector2(Node.ThumbImageOffsets.Numbers[0], Node.ThumbImageOffsets.Numbers[1]); if (Node.ThumbButtonImage != null) m_ThumbButtonImage = Node.ThumbButtonImage; }
//************************************************************************* // EditScreen(UIScreen screen) - called from MenuEditor //************************************************************************* public static void UpdateScreen(UIScreen screen) { if ( screen.mIsViewing ) { for(int i = 0; i < screen.mMenuItems.Count; i++) { UIMenuItem item = screen.mMenuItems[i]; if (item != null) { item.ItemPositionState = UIMenuItemPositionState.OnScreen; item.UpdatePosition(); } else { screen.mMenuItems.RemoveAt(i); } } } else { for(int i = 0; i < screen.mMenuItems.Count; i++) { UIMenuItem item = screen.mMenuItems[i]; if (item != null) { item.ItemPositionState = UIMenuItemPositionState.OffScreen; item.UpdatePosition(); } else { screen.mMenuItems.RemoveAt(i); } } } }
public void DoUpdate(string branch, string version, string url) { View.LoginDialog.Visible = false; View.LoginProgress.Visible = false; var str = GlobalSettings.Default.ClientVersion; var split = str.LastIndexOf('-'); int verNum = 0; string curBranch = str; if (split != -1) { int.TryParse(str.Substring(split + 1), out verNum); curBranch = str.Substring(0, split); } _UpdaterAlert = UIScreen.GlobalShowAlert(new UIAlertOptions { Title = GameFacade.Strings.GetString("f101", "3"), Message = GameFacade.Strings.GetString("f101", "4", new string[] { version, branch, verNum.ToString(), curBranch }), Width = 500, Buttons = UIAlertButton.YesNo(x => { UIScreen.RemoveDialog(_UpdaterAlert); var downloader = new UIWebDownloaderDialog(GameFacade.Strings.GetString("f101", "1"), new DownloadItem[] { new DownloadItem { Url = url, DestPath = "PatchFiles/patch.zip", Name = GameFacade.Strings.GetString("f101", "10") } }); downloader.OnComplete += (bool success) => { UIScreen.RemoveDialog(downloader); UIScreen.GlobalShowAlert(new UIAlertOptions { Title = GameFacade.Strings.GetString("f101", "3"), Message = GameFacade.Strings.GetString("f101", "13"), Buttons = UIAlertButton.Ok(y => { RestartGamePatch(); }) }, true); }; GameThread.NextUpdate(y => UIScreen.GlobalShowDialog(downloader, true)); }, x => { GameThread.NextUpdate(state => { UIScreen.RemoveDialog(_UpdaterAlert); if (state.ShiftDown) { _UpdaterAlert = UIScreen.GlobalShowAlert(new UIAlertOptions { Title = GameFacade.Strings.GetString("f101", "11"), Message = GameFacade.Strings.GetString("f101", "12"), Width = 500, Buttons = UIAlertButton.Ok(y => { Regulator.AsyncTransition("AvatarData"); UIScreen.RemoveDialog(_UpdaterAlert); View.LoginDialog.Visible = true; View.LoginProgress.Visible = true; }) }, true); } else { View.LoginDialog.Visible = true; View.LoginProgress.Visible = true; Regulator.AsyncReset(); } }); }) }, true); }
public UITextEdit(AddTextEditNode Node, ParserState State, UIScreen Screen) : base(Screen) { Name = Node.Name; m_ID = Node.ID; m_KeyboardInput = true; //UITextEdit needs to receive input from keyboard! if (!State.InSharedPropertiesGroup) { if (Node.TextEditPosition.Numbers.Count > 0) { Position = new Vector2(Node.TextEditPosition.Numbers[0], Node.TextEditPosition.Numbers[1]) + Screen.Position; m_TextPosition = Position; } if (State.InSharedPropertiesGroup) m_Size = State.Size; else { m_Size = new Vector2(); m_Size.X = Node.Size.Numbers[0]; m_Size.Y = Node.Size.Numbers[1]; } if (Node.Tooltip != "") Tooltip = m_Screen.GetString(Node.Tooltip); Transparent = (Node.Transparent == 1) ? true : false; if (Node.Lines != null) m_NumLines = (int)Node.Lines; if (Node.Capacity != null) m_MaxChars = (int)Node.Capacity; if (Node.Alignment != null) m_Alignment = (TextEditAlignment)Node.Alignment; if (Node.FlashOnEmpty != null) m_FlashOnEmpty = (Node.FlashOnEmpty == 1) ? true : false; if (Node.FrameOnFocus != null) m_FrameOnFocus = (Node.FrameOnFocus == 1) ? true : false; if (State.InSharedPropertiesGroup) TextColor = State.Color; else TextColor = new Color(Node.Color.Numbers[0], Node.Color.Numbers[1], Node.Color.Numbers[2]); if (Node.BackColor != null) { m_BackColor = new Color(Node.Color.Numbers[0], Node.Color.Numbers[1], Node.Color.Numbers[2]); /*Image = new UIImage(FileManager.GetTexture((ulong)FileIDs.UIFileIDs.dialog_textboxbackground), m_Screen); if(Position != null) Image.Position = Position; Image.Slicer = new NineSlicer(new Vector2(0, 0), (int)Image.Texture.Width, (int)Image.Texture.Width, 15, 15, 15, 15); Image.SetSize((int)Size.X, (int)Size.Y);*/ } else { m_BackColor = new Color(57, 81, 110, 255); /*Image = new UIImage(FileManager.GetTexture((ulong)FileIDs.UIFileIDs.dialog_textboxbackground), m_Screen); if(Position != null) Image.Position = Position; Image.Slicer = new NineSlicer(new Vector2(0, 0), (int)Image.Texture.Width, Image.Texture.Height, 15, 15, 15, 15); Image.SetSize((int)Size.X, (int)Size.Y);*/ } if (Node.Mode != null) m_Mode = (Node.Mode == "kReadOnly") ? TextEditMode.ReadOnly : TextEditMode.Insert; if (Node.ScrollbarImage != string.Empty) m_ScrollbarImage = m_Screen.GetImage(Node.ScrollbarImage).Image.Texture; if (Node.ScrollbarGutter != null) m_ScrollbarWidth = (int)Node.ScrollbarGutter; if (Node.ScrollbarType != null) m_ScrollbarType = (ScrollbarType)Node.ScrollbarType; if (Node.ResizeForExactLineHeight != null) m_ResizeForExactLineHeight = (Node.ResizeForExactLineHeight == 1) ? true : false; if (Node.EnableIME != null) m_EnableInputModeEditing = (Node.EnableIME == 1) ? true : false; if (Node.CursorColor != null) m_CursorColor = new Color(Node.CursorColor.Numbers[0], Node.CursorColor.Numbers[1], Node.CursorColor.Numbers[2]); if (Node.FrameColor != null) m_FrameColor = new Color(Node.FrameColor.Numbers[0], Node.FrameColor.Numbers[1], Node.FrameColor.Numbers[2]); } else { if (State.BackColor != null) m_BackColor = State.BackColor; if (State.Color != null) TextColor = State.Color; if (State.CursorColor != null) m_CursorColor = State.CursorColor; if (State.Position != null) { Position = new Vector2(State.Position[0], State.Position[1]) + Screen.Position; m_TextPosition = Position; //Image.Position = Position; } if (State.Tooltip != "") Tooltip = State.Tooltip; } m_Lines.Add(new RenderableText() { SBuilder = new StringBuilder(), Position = m_TextPosition, Visible = true }); int Font = 0; if (Node.Font != 0) Font = Node.Font; else Font = State.Font; switch(Font) { case 9: m_Font = Screen.Font9px; break; case 10: m_Font = Screen.Font10px; break; case 12: m_Font = Screen.Font12px; break; case 14: m_Font = Screen.Font14px; break; case 16: m_Font = Screen.Font16px; break; } m_Cursor.Position = Position; m_CursorVisibilityTimer = new Timer(100); m_CursorVisibilityTimer.Enabled = true; m_CursorVisibilityTimer.Elapsed += M_CursorVisibilityTimer_Elapsed; m_CursorVisibilityTimer.Start(); m_Screen.Manager.OnTextInput += Manager_OnTextInput; }
/// <summary> /// Constructs a new UIImage instance. /// </summary> /// <param name="Node">A DefineImageNode instance, as generated by an Abstract Syntax Tree (see UIScreen.cs).</param> /// <param name="Screen">A UIScreen instance.</param> public UIImage(DefineImageNode Node, UIScreen Screen) : base(Screen) { Name = Node.Name; Texture = FileManager.GetTexture(ulong.Parse(Node.AssetID, System.Globalization.NumberStyles.HexNumber)); m_Loaded = true; }
/// <summary> /// Constructs a UIElement from a Screen instance and an optional UIElement that acts as a parent. /// </summary> /// <param name="Screen">A Screen instance.</param> /// <param name="Parent">(Optional) UIElement that acts as a parent.</param> /// <param name="Path"> (Optional) Path to a UI script that will create this UI element.</param> public UIElement(UIScreen Screen, UIElement Parent = null, string Path = "") { m_Screen = Screen; if (Parent != null) m_Parent = Parent; }
/// <summary> /// Constructs a new instance of UISkinBrowser. /// </summary> /// <param name="Screen">A UIScreen instance that this UISkinBrowser belongs to.</param> /// <param name="Ctrl">A UIControl instance that this UISkinBrowser should be created from.</param> /// <param name="SkinType">The type of skin initially displayed by this UISkinBrowser. 0 = light, 1 = medium, 2 = dark.</param> public UISkinBrowser(UIScreen Screen, UIControl Ctrl, int SkinType, AvatarSex Sex) : base(Ctrl, Screen) { Position = Position + Screen.Position; m_SelectedSkintype = (Elements.SkinType)SkinType; m_Sex = Sex; m_SkinBrowserArrowLeft = new UIButton("SkinBrowserArrowLeft", FileManager.GetTexture((ulong)FileIDs.UIFileIDs.person_edit_skinbrowserarrowleft), Position + new Vector2(5, Size.Y - 70), Screen); m_SkinBrowserArrowLeft.OnButtonClicked += M_SkinBrowserArrowLeft_OnButtonClicked; m_SkinBrowserArrowRight = new UIButton("SkinBrowserArrowRight", FileManager.GetTexture((ulong)FileIDs.UIFileIDs.person_edit_skinbrowserarrowright), Position + new Vector2(Size.X - 45, Size.Y - 70), Screen); m_SkinBrowserArrowRight.OnButtonClicked += M_SkinBrowserArrowRight_OnButtonClicked; }
/// <summary> /// Adds a UIScreen instance to this ScreenManager's list of screens. /// This function is called from Lua. /// </summary> /// <param name="Screen">The UIScreen instance to be added.</param> public void AddScreen(UIScreen Screen) { /*if (currentScreen != null) { mainUI.Remove(currentScreen); }*/ /** Add screen on top **/ mainUI.Add(Screen); /** Bring dialogs to top **/ mainUI.Add(dialogContainer); /** Bring debug to the top **/ mainUI.Add(debugButton); Screen.OnShow(); m_Screens.Add(Screen); currentScreen = Screen; }
public virtual void OnReturn(UIScreen previousScreen) { gameObject.SetActive (true); }
/// <summary> /// Constructs a new UIButton instance. /// </summary> /// <param name="Name">Name of button.</param> /// <param name="Tex">Texture used to display this button.</param> /// <param name="Position">Button's position.</param> /// <param name="Screen">This button's screen.</param> public UIButton(string Name, Texture2D Tex, Vector2 Pos, UIScreen Screen, UIElement Parent = null) : base(Screen, Parent) { base.Name = Name; Position = Pos; Image = new UIImage(Tex, Screen, null); Image.Position = new Vector2(Pos.X, Pos.Y); //Initialize to second frame in the image. m_SourcePosition = new Vector2((Tex.Width / 4) * 2, 0.0f); m_Size = new Vector2(); m_Size.X = Tex.Width / 4; m_Size.Y = Tex.Height; }
internal GraphicsAdapter(UIScreen screen) { _screen = screen; }
public UISandboxSelector() : base(UIDialogStyle.Close, true) { if (GlobalSettings.Default.DebugBody == 0) { GameThread.NextUpdate(x => FSOFacade.Controller.ShowPersonCreation(null)); } var ui = this.RenderScript("bookmarks.uis"); Caption = "Host a lot on :37564"; //var background = ui.Create<UIImage>("BookmarkBackground"); //SimsTab = ui.Create<UIImage>("SimsTab"); //AddAt(0, SimsTab); //IgnoreTab = ui.Create<UIImage>("IgnoreTab"); //AddAt(0, IgnoreTab); //IgnoreTab.Visible = false; //AddAt(0, ui.Create<UIImage>("Tab1Background")); //AddAt(0, ui.Create<UIImage>("Tab2Background")); var listBg = ui.Create <UIImage>("ListBoxBackground"); AddAt(4, listBg); //AddAt(0, background); //UIUtils.MakeDraggable(background, this, true); listBg.With9Slice(25, 25, 25, 25); listBg.Height += 180; BookmarkListBox.VisibleRows += 10; BookmarkListSlider.SetSize(10, 170 + 180); BookmarkScrollDownButton.Y += 180; BookmarkListSlider.AttachButtons(BookmarkListScrollUpButton, BookmarkScrollDownButton, 1); BookmarkListBox.AttachSlider(BookmarkListSlider); BookmarkListBox.OnDoubleClick += BookmarkListBox_OnDoubleClick; BookmarkListBoxColors = ui.Create <UIListBoxTextStyle>("BookmarkListBoxColors", BookmarkListBox.FontStyle); Remove(CloseButton); Remove(SimsTabButton); Remove(IgnoreTabButton); base.CloseButton.OnButtonClick += CloseButton_OnButtonClick; //IgnoreTabButton.OnButtonClick += (btn) => { ChangeType(BookmarkType.IGNORE_AVATAR); }; //SimsTabButton.OnButtonClick += (btn) => { ChangeType(BookmarkType.AVATAR); }; populateWithXMLHouses(); var joinButton = new UIButton(); joinButton.Caption = "Join a server"; joinButton.OnButtonClick += (btn) => { UIAlert alert = null; alert = UIScreen.GlobalShowAlert(new UIAlertOptions() { Message = "Enter the address of the server you wish to connect to. (can optionally include port, eg localhost:6666)", Width = 400, TextEntry = true, Buttons = new UIAlertButton[] { new UIAlertButton(UIAlertButtonType.Cancel, (btn2) => { UIScreen.RemoveDialog(alert); }), new UIAlertButton(UIAlertButtonType.OK, (btn2) => { UIScreen.RemoveDialog(alert); var addr = alert.ResponseText; if (!addr.Contains(':')) { addr += ":37564"; } UIScreen.RemoveDialog(this); LotSwitch(addr, true); }) } }, true); alert.ResponseText = "127.0.0.1"; }; joinButton.Width = 190; joinButton.X = 25; joinButton.Y = 500 - 50; Add(joinButton); var casButton = new UIButton(); casButton.Caption = "CAS"; casButton.OnButtonClick += (btn) => { if (UIScreen.Current is SandboxGameScreen) { ((SandboxGameScreen)UIScreen.Current).CleanupLastWorld(); } FSOFacade.Controller.ShowPersonCreation(null); }; casButton.Width = 50; casButton.X = 300 - (25 + 50); casButton.Y = 500 - 50; Add(casButton); SetSize(300, 500); }
private void CloseButton_OnButtonClick(UIElement button) { UIScreen.RemoveDialog(this); }
public override void Update(UpdateState state) { base.Update(state); if (!vm.Ready || vm.Context.Architecture == null) { return; } //handling smooth scaled zoom if (FSOEnvironment.Enable3D) { var s3d = ((WorldStateRC)World.State); s3d.Zoom3D += ((9.75f - (TargetZoom - 0.25f) * 10) - s3d.Zoom3D) / 10; } else { float BaseScale; WorldZoom targetZoom; if (TargetZoom < 0.5f) { targetZoom = WorldZoom.Far; BaseScale = 0.25f; } else if (TargetZoom < 1f) { targetZoom = WorldZoom.Medium; BaseScale = 0.5f; } else { targetZoom = WorldZoom.Near; BaseScale = 1f; } World.BackbufferScale = TargetZoom / BaseScale; if (World.State.Zoom != targetZoom) { World.State.Zoom = targetZoom; } WorldConfig.Current.SmoothZoom = false; } if (ActiveEntity == null || ActiveEntity.Dead || ActiveEntity.PersistID != SelectedSimID) { ActiveEntity = vm.Entities.FirstOrDefault(x => x is VMAvatar && x.PersistID == SelectedSimID); //try and hook onto a sim if we have none selected. //if (ActiveEntity == null) ActiveEntity = vm.Entities.FirstOrDefault(x => x is VMAvatar); if (!FoundMe && ActiveEntity != null) { vm.Context.World.State.CenterTile = new Vector2(ActiveEntity.VisualPosition.X, ActiveEntity.VisualPosition.Y); vm.Context.World.State.ScrollAnchor = null; FoundMe = true; } Queue.QueueOwner = ActiveEntity; } if (GotoObject == null) { GotoObject = vm.Context.CreateObjectInstance(GOTO_GUID, LotTilePos.OUT_OF_WORLD, Direction.NORTH, true).Objects[0]; } //update plumbbob var plumb = Content.Get().RCMeshes.Get("arrow.fsom"); foreach (VMAvatar avatar in vm.Context.ObjectQueries.Avatars) { if (avatar.Avatar == null) { continue; } var isActive = (avatar == ActiveEntity); if ((avatar.Avatar.HeadObject == plumb) != isActive) { avatar.Avatar.HeadObject = (avatar == ActiveEntity) ? plumb : null; avatar.Avatar.HeadObjectSpeedyVel = 0.2f; } avatar.Avatar.HeadObjectRotation += 3f / FSOEnvironment.RefreshRate; if (isActive) { avatar.Avatar.HeadObjectRotation += avatar.Avatar.HeadObjectSpeedyVel; avatar.Avatar.HeadObjectSpeedyVel *= 0.98f; } else if (avatar.GetValue(FSO.SimAntics.Model.VMStackObjectVariable.Category) == 87) { avatar.Avatar.HeadObject = Content.Get().RCMeshes.Get("star.fsom"); } } /* * if (ActiveEntity != null && BlockingDialog != null) * { * //are we still waiting on a blocking dialog? if not, cancel. * if (ActiveEntity.Thread != null && (ActiveEntity.Thread.BlockingState == null || !(ActiveEntity.Thread.BlockingState is VMDialogResult))) * { * BlockingDialog.Close(); * LastDialogID = 0; * BlockingDialog = null; * } * }*/ if (Visible) { if (ShowTooltip) { state.UIState.TooltipProperties.UpdateDead = false; } bool scrolled = false; if (RMBScroll) { World.State.ScrollAnchor = null; Vector2 scrollBy = new Vector2(); if (state.TouchMode) { scrollBy = new Vector2(RMBScrollX - state.MouseState.X, RMBScrollY - state.MouseState.Y); RMBScrollX = state.MouseState.X; RMBScrollY = state.MouseState.Y; scrollBy /= 128f; scrollBy /= FSOEnvironment.DPIScaleFactor; } else { scrollBy = new Vector2(state.MouseState.X - RMBScrollX, state.MouseState.Y - RMBScrollY); scrollBy *= 0.0005f; var angle = (Math.Atan2(state.MouseState.X - RMBScrollX, (RMBScrollY - state.MouseState.Y) * 2) / Math.PI) * 4; angle += 8; angle %= 8; CursorType type = CursorType.ArrowUp; switch ((int)Math.Round(angle)) { case 0: type = CursorType.ArrowUp; break; case 1: type = CursorType.ArrowUpRight; break; case 2: type = CursorType.ArrowRight; break; case 3: type = CursorType.ArrowDownRight; break; case 4: type = CursorType.ArrowDown; break; case 5: type = CursorType.ArrowDownLeft; break; case 6: type = CursorType.ArrowLeft; break; case 7: type = CursorType.ArrowUpLeft; break; } GameFacade.Cursor.SetCursor(type); } World.Scroll(scrollBy * (60f / FSOEnvironment.RefreshRate)); scrolled = true; } if (MouseIsOn) { if (state.MouseState.RightButton == ButtonState.Pressed) { if (RMBScroll == false) { RMBScroll = true; RMBScrollX = state.MouseState.X; RMBScrollY = state.MouseState.Y; } } else { if (!scrolled && GlobalSettings.Default.EdgeScroll && !state.TouchMode) { scrolled = World.TestScroll(state); } } } if (state.MouseState.RightButton != ButtonState.Pressed) { if (RMBScroll) { GameFacade.Cursor.SetCursor(CursorType.Normal); } RMBScroll = false; } if (!LiveMode && PieMenu != null) { PieMenu.RemoveSimScene(); this.Remove(PieMenu); PieMenu = null; } if (state.NewKeys.Contains(Keys.F8)) { UIMobileAlert alert = null; alert = new UIMobileAlert(new UIAlertOptions() { Title = "Debug Lot Thumbnail", Message = "Arch Value: " + VMArchitectureStats.GetArchValue(vm.Context.Architecture), Buttons = UIAlertButton.Ok((btn) => UIScreen.RemoveDialog(alert)) }); Texture2D roofless = null; var thumb = World.GetLotThumb(GameFacade.GraphicsDevice, (tex) => roofless = FSO.Common.Utils.TextureUtils.Decimate(tex, GameFacade.GraphicsDevice, 2, false)); thumb = FSO.Common.Utils.TextureUtils.Decimate(thumb, GameFacade.GraphicsDevice, 2, false); alert.SetIcon(thumb, thumb.Width, thumb.Height); UIScreen.GlobalShowDialog(alert, true); } if (LiveMode) { LiveModeUpdate(state, scrolled); } else if (CustomControl != null) { if (FSOEnvironment.SoftwareKeyboard) { CustomControl.MousePosition = new Point(UIScreen.Current.ScreenWidth / 2, UIScreen.Current.ScreenHeight / 2); } else { CustomControl.Modifiers = 0; if (state.CtrlDown) { CustomControl.Modifiers |= UILotControlModifiers.CTRL; } if (state.ShiftDown) { CustomControl.Modifiers |= UILotControlModifiers.SHIFT; } CustomControl.MousePosition = state.MouseState.Position; } CustomControl.Update(state, scrolled); } else { ObjectHolder.Update(state, scrolled); } //set cutaway around mouse UpdateCutaway(state); if (RMBScrollX == int.MinValue) { Dummy(); //cannon fodder for mono AOT compilation: never called but gives these constructors a meaning in life } } }
void vm_OnDialog(FSO.SimAntics.Model.VMDialogInfo info) { if (info != null && ((info.DialogID == LastDialogID && info.DialogID != 0 && info.Block))) { return; } //return if same dialog as before, or not ours if ((info == null || info.Block) && BlockingDialog != null) { //cancel current dialog because it's no longer valid UIScreen.RemoveDialog(BlockingDialog); LastDialogID = 0; BlockingDialog = null; } if (info == null) { return; //return if we're just clearing a dialog. } var options = new UIAlertOptions { Title = info.Title, Message = info.Message, Width = 325 + (int)(info.Message.Length / 3.5f), Alignment = TextAlignment.Left, TextSize = 12 }; var b0Event = (info.Block) ? new ButtonClickDelegate(DialogButton0) : null; var b1Event = (info.Block) ? new ButtonClickDelegate(DialogButton1) : null; var b2Event = (info.Block) ? new ButtonClickDelegate(DialogButton2) : null; VMDialogType type = (info.Operand == null) ? VMDialogType.Message : info.Operand.Type; switch (type) { default: case VMDialogType.Message: options.Buttons = new UIAlertButton[] { new UIAlertButton(UIAlertButtonType.OK, b0Event, info.Yes) }; break; case VMDialogType.YesNo: options.Buttons = new UIAlertButton[] { new UIAlertButton(UIAlertButtonType.Yes, b0Event, info.Yes), new UIAlertButton(UIAlertButtonType.No, b1Event, info.No), }; break; case VMDialogType.YesNoCancel: options.Buttons = new UIAlertButton[] { new UIAlertButton(UIAlertButtonType.Yes, b0Event, info.Yes), new UIAlertButton(UIAlertButtonType.No, b1Event, info.No), new UIAlertButton(UIAlertButtonType.Cancel, b2Event, info.Cancel), }; break; case VMDialogType.TextEntry: options.Buttons = new UIAlertButton[] { new UIAlertButton(UIAlertButtonType.OK, b0Event, info.Yes) }; options.TextEntry = true; break; case VMDialogType.NumericEntry: if (!vm.TS1) { goto case VMDialogType.TextEntry; } else { goto case VMDialogType.TS1Neighborhood; } case VMDialogType.TS1Vacation: case VMDialogType.TS1Neighborhood: case VMDialogType.TS1StudioTown: case VMDialogType.TS1Magictown: TS1NeighSelector = new UINeighborhoodSelectionPanel((ushort)VMDialogPrivateStrings.TypeToNeighID[type]); Parent.Add(TS1NeighSelector); ((TS1GameScreen)Parent).Bg.Visible = true; ((TS1GameScreen)Parent).LotControl.Visible = false; TS1NeighSelector.OnHouseSelect += HouseSelected; return; case VMDialogType.TS1PhoneBook: var phone = new UICallNeighborAlert(((VMAvatar)info.Caller).GetPersonData(FSO.SimAntics.Model.VMPersonDataVariable.NeighborId), vm); BlockingDialog = phone; UIScreen.GlobalShowDialog(phone, true); phone.OnResult += (result) => { vm.SendCommand(new VMNetDialogResponseCmd { ActorUID = info.Caller.PersistID, ResponseCode = (byte)((result > 0) ? 1 : 0), ResponseText = result.ToString() }); BlockingDialog = null; }; return; } var alert = new UIMobileAlert(options); UIScreen.GlobalShowDialog(alert, true); if (info.Block) { BlockingDialog = alert; LastDialogID = info.DialogID; } var entity = info.Icon; if (entity is VMGameObject) { var objects = entity.MultitileGroup.Objects; ObjectComponent[] objComps = new ObjectComponent[objects.Count]; for (int i = 0; i < objects.Count; i++) { objComps[i] = (ObjectComponent)objects[i].WorldUI; } var thumb = World.GetObjectThumb(objComps, entity.MultitileGroup.GetBasePositions(), GameFacade.GraphicsDevice); alert.SetIcon(thumb, 256, 256); } }
protected void ShowModal(UIScreen screen) { screen.Show(); TimeManager.Paused = true; screenStack.Push(screen); }
public virtual void OnLeave(UIScreen newScreen) { gameObject.SetActive (false); }
public override void Update(FSO.Common.Rendering.Framework.Model.UpdateState state) { GameFacade.Game.IsFixedTimeStep = (vm == null || vm.Ready); Visible = (World?.State as FSO.LotView.RC.WorldStateRC)?.CameraMode != true; GameFacade.Game.IsMouseVisible = Visible; base.Update(state); if (state.NewKeys.Contains(Keys.D1)) { ChangeSpeedTo(1); } if (state.NewKeys.Contains(Keys.D2)) { ChangeSpeedTo(2); } if (state.NewKeys.Contains(Keys.D3)) { ChangeSpeedTo(3); } if (state.NewKeys.Contains(Keys.P)) { ChangeSpeedTo(0); } if (state.NewKeys.Contains(Keys.F12)) { ChangeSpeedTo(1); //running 10000 ticks var timer = new System.Diagnostics.Stopwatch(); timer.Start(); for (int i = 0; i < 10000; i++) { vm.Tick(); } timer.Stop(); UIScreen.GlobalShowDialog(new UIMobileAlert(new UIAlertOptions() { Title = "Benchmark", Message = "10000 ticks took " + timer.ElapsedMilliseconds + "ms." }), true); } if (World != null) { //stub smooth zoom? } if (SwitchLot > 0) { if (!Downtown) { SavedLot = vm.Save(); } if (SwitchLot == ActiveFamily.HouseNumber && SavedLot != null) { Downtown = false; InitializeLot(SavedLot); SavedLot = null; } else { Downtown = true; InitializeLot(Content.Get().Neighborhood.GetHousePath(SwitchLot), false); } SwitchLot = -1; } //vm.Context.Clock.Hours = 12; if (vm != null) { vm.Update(); } //SaveHouseButton_OnButtonClick(null); }
/// <summary> /// Shows the modal and returns a <see cref="Task"/> which completes when /// the modal is closed. /// </summary> /// <param name="window">The window in which to show the modal.</param> /// <param name="screen">The screen on which the modal will be opened.</param> /// <param name="duration">The amount of time over which to transition the screen's state, or <see langword="null"/> to use the default transition time.</param> /// <returns>A <see cref="Task"/> which completes when the modal is closed.</returns> private void Open(IUltravioletWindow window, UIScreen screen, TimeSpan? duration = null) { var screenStack = screen.Ultraviolet.GetUI().GetScreens(window); if (screen.State != UIPanelState.Closed) screenStack.Close(screen, TimeSpan.Zero); if (!hooked) { screen.Closed += onClosedHandler; hooked = true; } screenStack.Open(screen, duration); }
/// <summary> /// Pushes a new UI menu to the UI stack. /// </summary> /// <param name="ui"></param> public void PushUI(UIScreen ui) { ui.Initialize(initializer); uiStack.Add(ui); }
public void RemoveScreen(UIScreen Screen) { if (Screen == currentScreen) { currentScreen = null; } Screen.OnHide(); mainUI.Remove(Screen); m_Screens.Remove(Screen); /** Put the previous screen back into the UI **/ if (m_Screens.Count > 0) { currentScreen = m_Screens.Last(); mainUI.AddAt(0, currentScreen); } }
void ForceDC() { UIScreen.RemoveDialog(this); FSOFacade.Controller.Disconnect(false); }
public override void Exit() { base.Exit(); UIScreen.ExitAnimation(); }
void CloseButton_OnButtonClick(UIElement button) { CallingVM.SendCommand(new VMNetTimeoutNotifyCmd()); UIScreen.RemoveDialog(this); }
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); }; }
void AddScreen(UIScreen screen) { this.screen.Add(screen); }
/// <summary> /// Constructs a new UIImage instance. /// </summary> /// <param name="Tex">Texture to create image from.</param> /// <param name="Screen">UIScreen instance.</param> /// <param name="Parent">Parent of this UIImage instance, may be null.</param> public UIImage(Texture2D Tex, UIScreen Screen, UIElement Parent = null) : base(Screen, Parent) { Texture = Tex; m_Loaded = true; }
public Question5State(GameController controller, StateMachine stateMachine, UIScreen uiScreen) : base(controller, stateMachine, uiScreen) { this.UIScreen.Initialization(null); }
void Awake() { mainScreen = this; }
protected State(GameController controller, StateMachine stateMachine, UIScreen uiScreen) { this.Controller = controller; this.StateMachine = stateMachine; this.UIScreen = uiScreen; }
private float m_XScale = 1.0f; //Used to scale buttons to fit text. #endregion Fields #region Constructors public UIButton(AddButtonNode Node, ParserState State, UIScreen Screen) : base(Screen) { Name = Node.Name; m_ID = Node.ID; m_Screen = Screen; if (!State.InSharedPropertiesGroup) { if (Node.Image != null) { Image = m_Screen.GetImage(Node.Image, false); //Initialize to second frame in the image. m_SourcePosition = new Vector2((Image.Texture.Width / (4)) * 2, 0.0f); m_Size = new Vector2(); m_Size.X = (Image.Texture.Width) / (4); m_Size.Y = Image.Texture.Height; Position = new Vector2(Node.ButtonPosition.Numbers[0], Node.ButtonPosition.Numbers[1]) + m_Screen.Position; } else { Image = new UIImage(FileManager.GetTexture((ulong)FileIDs.UIFileIDs.buttontiledialog), m_Screen); //Initialize to second frame in the image. m_SourcePosition = new Vector2((Image.Texture.Width / 4) * 2, 0.0f); m_Size = new Vector2(); m_Size.X = (Image.Texture.Width) / (4); m_Size.Y = Image.Texture.Height; Position = new Vector2(Node.ButtonPosition.Numbers[0], Node.ButtonPosition.Numbers[1]) + m_Screen.Position; } } else { if (State.Image != "") { Image = m_Screen.GetImage(State.Image, true); //Initialize to second frame in the image. m_SourcePosition = new Vector2((Image.Texture.Width / 4) * 2, 0.0f); m_Size = new Vector2(); m_Size.X = Image.Texture.Width / 4; m_Size.Y = Image.Texture.Height; Position = new Vector2(Node.ButtonPosition.Numbers[0], Node.ButtonPosition.Numbers[1]) + m_Screen.Position; } else { if (State.TextButton) { m_Text = State.Caption; //Text buttons always use this image. Image = new UIImage(FileManager.GetTexture((ulong)FileIDs.UIFileIDs.buttontiledialog), m_Screen); //Initialize to second frame in the image. m_SourcePosition = new Vector2((Image.Texture.Width / 4) * 2, 0.0f); m_Size = new Vector2(); m_Size.X = Image.Texture.Width / 4; m_Size.Y = Image.Texture.Height; } else { Image = m_Screen.GetImage(Node.Image, false); //Initialize to second frame in the image. m_SourcePosition = new Vector2((Image.Texture.Width / (4)) * 2, 0.0f); m_Size = new Vector2(); m_Size.X = (Image.Texture.Width) / (4); m_Size.Y = Image.Texture.Height; Position = new Vector2(Node.ButtonPosition.Numbers[0], Node.ButtonPosition.Numbers[1]) + m_Screen.Position; } Position = new Vector2(Node.ButtonPosition.Numbers[0], Node.ButtonPosition.Numbers[1]) + m_Screen.Position; } if (State.Tooltip != "") Tooltip = m_Screen.GetString(State.Tooltip); } if (Node.TextHighlighted != null) m_IsTextHighlighted = (Node.TextHighlighted == 1) ? true : false; if (Node.Font != null) { int FontSize = (int)Node.Font; switch (FontSize) { case 9: m_Font = Screen.Font9px; break; case 10: m_Font = Screen.Font10px; break; case 12: m_Font = Screen.Font12px; break; case 14: m_Font = Screen.Font14px; break; case 16: m_Font = Screen.Font16px; break; } } else if(State.Font != 0) { switch (State.Font) { case 9: m_Font = Screen.Font9px; break; case 10: m_Font = Screen.Font10px; break; case 12: m_Font = Screen.Font12px; break; case 14: m_Font = Screen.Font14px; break; case 16: m_Font = Screen.Font16px; break; default: m_Font = Screen.Font12px; break; } } if (Node.TextColor != null) { TextColor = new Color(); TextColor.A = 255; TextColor.R = (byte)Node.TextColor.Numbers[0]; TextColor.G = (byte)Node.TextColor.Numbers[1]; TextColor.B = (byte)Node.TextColor.Numbers[2]; } else { TextColor = State.TextColor; TextColor.A = 255; } if (Node.TextColorSelected != null) { TextColorSelected = new Color(); TextColorSelected.A = 255; TextColorSelected.R = (byte)Node.TextColorSelected.Numbers[0]; TextColorSelected.G = (byte)Node.TextColorSelected.Numbers[1]; TextColorSelected.B = (byte)Node.TextColorSelected.Numbers[2]; } else { TextColorSelected = State.TextColorSelected; TextColorSelected.A = 255; } if (Node.TextColorHighlighted != null) { TextColorHighlighted = new Color(); TextColorHighlighted.A = 255; TextColorHighlighted.R = (byte)Node.TextColorHighlighted.Numbers[0]; TextColorHighlighted.G = (byte)Node.TextColorHighlighted.Numbers[1]; TextColorHighlighted.B = (byte)Node.TextColorHighlighted.Numbers[2]; } else { TextColorHighlighted = State.TextColorHighlighted; TextColorHighlighted.A = 255; } if (Node.TextColorDisabled != null) { TextColorDisabled = new Color(); TextColorDisabled.A = 255; TextColorDisabled.R = (byte)Node.TextColorDisabled.Numbers[0]; TextColorDisabled.G = (byte)Node.TextColorDisabled.Numbers[1]; TextColorDisabled.B = (byte)Node.TextColorDisabled.Numbers[2]; } else { TextColorDisabled = State.TextColorDisabled; TextColorDisabled.A = 255; } if (Node.TextButton != null) m_IsTextButton = (Node.TextButton == 1) ? true : false; else m_IsTextButton = m_IsTextButton = State.TextButton; if (m_IsTextButton) { if (Node.Text != string.Empty) m_Text = m_Screen.GetString(Node.Text); else m_Text = m_Screen.GetString(State.Caption); m_TextPosition = Position; if (m_Size.X != 0) ScaleToText(); } if (Node.Tooltip != "") Tooltip = m_Screen.GetString(Node.Tooltip); if (Node.Tracking != null) Tracking = (int)Node.Tracking; }
void CloseButton_OnButtonClick(UIElement button) { //todo: special behaviour? UIScreen.RemoveDialog(this); }