public UILotButton() { DataService = FSOFacade.Kernel.Get <IClientDataService>(); NameLabel = new UILabel(); NameLabel.Y = 52; NameLabel.X = 2; NameLabel.Alignment = TextAlignment.Center; NameLabel.Size = new Vector2(76, 40); NameLabel.CaptionStyle = NameLabel.CaptionStyle.Clone(); NameLabel.CaptionStyle.Size = 9; NameLabel.Wrapped = true; Add(NameLabel); Target = new Binding <Lot>() .WithBinding(this, "NameLabel.Caption", "Lot_Name") .WithBinding(this, "BgImg", "Lot_IsOnline", x => { var online = (bool)x; return(GetTexture((ulong)((online) ? 0xC000000002 : 0xC200000002))); }) .WithBinding(this, "HoverImg", "Lot_IsOnline", x => { var online = (bool)x; return(GetTexture((ulong)((online) ? 0xC100000002 : 0xC300000002))); }); m_TooltipHandler = UIUtils.GiveTooltip(this); ClickHandler = ListenForMouse(new Rectangle(0, 0, 80, 50), new UIMouseEvent(OnMouseEvent)); }
public UICustomTooltipContainer(UICustomTooltip tooltip) { this.Tooltip = tooltip; Bounds = new Rectangle(0, 0, 0, 0); Mouse = ListenForMouse(Bounds, new Common.Rendering.Framework.IO.UIMouseEvent(OnMouse)); }
public UIMapWaypoint(UIMapWaypointStyle style) { DataService = FSOFacade.Kernel.Get <IClientDataService>(); Style = style; var network = FSOFacade.Kernel.Get <Network.Network>(); MyAvatar = new Binding <Avatar>(); MyLot = new Binding <Lot>(); switch (style) { case UIMapWaypointStyle.YouAreHere: // pinkish backgound BgImg = GetTexture((ulong)UIFileIDs.youarehereback); break; case UIMapWaypointStyle.YourHouseHere: BgImg = GetTexture((ulong)UIFileIDs.yourhousehereback); DataService.Get <Avatar>(network.MyCharacter).ContinueWith(x => { MyAvatar.Value = x.Result; if (x.Result != null && x.Result.Avatar_LotGridXY != 0 && (MyLot.Value == null || MyLot.Value.Lot_Location_Packed != x.Result.Avatar_LotGridXY)) { DataService.Request(MaskedStruct.AdmitInfo_Lot, x.Result.Avatar_LotGridXY).ContinueWith(y => { MyLot.Value = (Lot)y.Result; }); } }); break; } ClickHandler = ListenForMouse(new Rectangle(0, 0, SizeW, SizeH), new UIMouseEvent(OnMouseEvent)); }
private bool LastRectCutNotable = false; //set if the last rect cut made a noticable change to the cuts array. If true refresh regardless of new cut effect. /// <summary> /// Creates a new UILotControl instance. /// </summary> /// <param name="vm">A SimAntics VM instance.</param> /// <param name="World">A World instance.</param> public UILotControl(FSO.SimAntics.VM vm, LotView.World World) { this.vm = vm; this.World = World; ActiveEntity = vm.Entities.FirstOrDefault(x => x is VMAvatar); MouseEvt = this.ListenForMouse(new Microsoft.Xna.Framework.Rectangle(0, 0, GlobalSettings.Default.GraphicsWidth, GlobalSettings.Default.GraphicsHeight), OnMouse); Queue = new UIInteractionQueue(ActiveEntity, vm); this.Add(Queue); ObjectHolder = new UIObjectHolder(vm, World, this); Touch = new UILotControlTouchHelper(this); Add(Touch); SetupQuery(); ChatPanel = new UIChatPanel(vm, this); this.Add(ChatPanel); RMBCursor = GetTexture(0x24B00000001); //exploreanchor.bmp vm.OnChatEvent += Vm_OnChatEvent; vm.OnDialog += vm_OnDialog; vm.OnBreakpoint += Vm_OnBreakpoint; Cheats = new UICheatHandler(this); this.Add(Cheats); AvatarDS = new UIAvatarDataServiceUpdater(this); EODs = new UIEODController(this); }
public UITextEdit() { UIUtils.GiveTooltip(this); TextStyle = TextStyle.DefaultLabel; m_MouseEvent = ListenForMouse(new Rectangle(0, 0, 10, 10), new UIMouseEvent(OnMouseEvent)); }
private void InitCommon() { ClickHandler = ListenForMouse(GetBounds(), new UIMouseEvent(OnMouseEvent)); m_TooltipHandler = UIUtils.GiveTooltip(this); //buttons can have tooltips }
/// <summary> /// Creates a new UILotControl instance. /// </summary> /// <param name="vm">A SimAntics VM instance.</param> /// <param name="World">A World instance.</param> public UILotControl(FSO.SimAntics.VM vm, LotView.World World) { this.vm = vm; this.World = World; ActiveEntity = vm.Entities.FirstOrDefault(x => x is VMAvatar); MouseEvt = this.ListenForMouse(new Microsoft.Xna.Framework.Rectangle(0, 0, GlobalSettings.Default.GraphicsWidth, GlobalSettings.Default.GraphicsHeight), OnMouse); Queue = new UIInteractionQueue(ActiveEntity, vm); this.Add(Queue); ObjectHolder = new UIObjectHolder(vm, World, this); QueryPanel = new UIQueryPanel(World); QueryPanel.OnSellBackClicked += ObjectHolder.SellBack; QueryPanel.X = 177; QueryPanel.Y = GlobalSettings.Default.GraphicsHeight - 228; this.Add(QueryPanel); ChatPanel = new UIChatPanel(vm, this); this.Add(ChatPanel); vm.OnChatEvent += Vm_OnChatEvent; vm.OnDialog += vm_OnDialog; vm.OnBreakpoint += Vm_OnBreakpoint; Cheats = new UICheatHandler(this); EODs = new UIEODController(this); }
public UIColorPicker() { ClickHandler = ListenForMouse(new Rectangle(0, 0, 206, 128), new UIMouseEvent(OnMouseEvent)); RedText = new UITextBox(); RedText.SetBackgroundTexture(null, 0, 0, 0, 0); RedText.SetSize(40, 22); RedText.Position = new Vector2(232, 50); RedText.OnChange += RecalcColor; Add(RedText); var redLabel = new UILabel(); redLabel.Position = RedText.Position - new Vector2(20, -4); redLabel.Caption = "R:"; Add(redLabel); GreenText = new UITextBox(); GreenText.SetBackgroundTexture(null, 0, 0, 0, 0); GreenText.SetSize(40, 22); GreenText.Position = new Vector2(232, 50 + 28); GreenText.OnChange += RecalcColor; Add(GreenText); var greenLabel = new UILabel(); greenLabel.Position = GreenText.Position - new Vector2(20, -4); greenLabel.Caption = "G:"; Add(greenLabel); BlueText = new UITextBox(); BlueText.SetBackgroundTexture(null, 0, 0, 0, 0); BlueText.SetSize(40, 22); BlueText.Position = new Vector2(232, 50 + 28 * 2); BlueText.OnChange += RecalcColor; Add(BlueText); var blueLabel = new UILabel(); blueLabel.Position = BlueText.Position - new Vector2(20, -4); blueLabel.Caption = "B:"; Add(blueLabel); HexText = new UITextBox(); HexText.SetBackgroundTexture(null, 0, 0, 0, 0); HexText.SetSize(68, 45); HexText.Alignment = TextAlignment.Center | TextAlignment.Middle; HexText.TextStyle = HexText.TextStyle.Clone(); HexText.TextStyle.Shadow = true; HexText.TextStyle.Size = 8; HexText.Position = new Vector2(208, 0); HexText.OnChange += HexText_OnChange; Add(HexText); InternalChange = 1; RecalcColor(null); InternalChange = 0; }
public UIDragHandler(UIElement mouseTarget, UIElement dragControl) { UpdateHook = new UpdateHookDelegate(Update); MouseTarget = mouseTarget; DragControl = dragControl; MouseEvent = mouseTarget.ListenForMouse(mouseTarget.GetBounds(), new UIMouseEvent(DragMouseEvents)); }
public PrimitiveBox(BHAVInstruction inst, BHAVContainer master) { TreeBox = new TREEBox(null); Master = master; Instruction = inst; HitTest = ListenForMouse(new Rectangle(0, 0, Width, Height), new UIMouseEvent(MouseEvents)); PreparePrimitive(); }
private void InitializeMouse() { /** City Scene **/ UIContainer mouseHitArea = new UIContainer(); MouseHitAreaEventRef = mouseHitArea.ListenForMouse(new Rectangle(0, 0, ScreenWidth, ScreenHeight), new UIMouseEvent(MouseHandler)); AddAt(0, mouseHitArea); }
public void RemoveMouseListener(UIMouseEventRef item) { if (m_MouseRefs == null) { return; } m_MouseRefs.Remove(item); }
public BHAVContainer(BHAV target, EditorScope scope) { Scope = scope; EditTarget = target; EditTargetTree = scope.ActiveTree; Init(); HitTest = ListenForMouse(new Rectangle(Int32.MinValue / 2, Int32.MinValue / 2, Int32.MaxValue, Int32.MaxValue), new UIMouseEvent(DragMouseEvents)); }
public UITextBox() { this.SetBackgroundTexture( GetTexture((ulong)TSOClient.FileIDs.UIFileIDs.dialog_textboxbackground), 13, 13, 13, 13); TextMargin = new Rectangle(8, 3, 8, 5); m_MouseEvent = ListenForMouse(new Rectangle(0, 0, 10, 10), new UIMouseEvent(OnMouseEvent)); }
public UIUpgradeThermo() { var ui = Content.Content.Get().CustomUI; var gd = GameFacade.GraphicsDevice; BgSlice = ui.Get("up_thermo_slice.png").Get(gd); FillSlice = ui.Get("up_thermo_slice_active.png").Get(gd); Highlight = ui.Get("up_thermo_highlight.png").Get(gd); ClickHandler = ListenForMouse(new Rectangle(-14, -14, (int)28, (int)28), MouseHandler); }
public UITouchScroll(Func <int> lengthProvider, Func <int, UITSContainer> elemProvider) : base() { var ui = Content.Get().CustomUI; ScrollEdgeL = ui.Get("scroll_edge_l.png").Get(GameFacade.GraphicsDevice); ScrollEdgeR = ui.Get("scroll_edge_r.png").Get(GameFacade.GraphicsDevice); HitTest = ListenForMouse(new Rectangle(0, 0, (int)Size.X, (int)Size.Y), new UIMouseEvent(MouseEvents)); LengthProvider = lengthProvider; ElemProvider = elemProvider; }
public Color HSVMod = new Color(0, 255, 255, 255); //hue, saturation, value, alpha public UIAbstractStickyContainer(string texName) { var ui = Content.Content.Get().CustomUI; var gd = GameFacade.GraphicsDevice; ShadowImg = ui.Get(texName + "_shad.png").Get(gd); BackgroundImg = ui.Get(texName + "_bg.png").Get(gd); Size = new Vector2(ShadowImg.Width, ShadowImg.Height); MouseEvent = ListenForMouse(new Rectangle(ShadowImg.Width / 8, 0, (int)(ShadowImg.Width * 0.75f), ShadowImg.Height), MouseEvt); InternalBefore = true; }
public UITextEdit() { TextStyle = TextStyle.DefaultLabel; //this.SetBackgroundTexture( // GetTexture((ulong)TSOClient.FileIDs.UIFileIDs.dialog_textboxbackground), // 13, 13, 13, 13); //TextMargin = new Rectangle(8, 3, 8, 5); m_MouseEvent = ListenForMouse(new Rectangle(0, 0, 10, 10), new UIMouseEvent(OnMouseEvent)); }
public UIEmojiSuggestion(string emojiName, UIEmojiSuggestions parent) { PxWhite = TextureGenerator.GetPxWhite(GameFacade.GraphicsDevice); Style = TextStyle.DefaultLabel.Clone(); Style.Size = 8; EmojiName = emojiName; Owner = parent; Emoji = GameFacade.Emojis.GetEmoji(GameFacade.Emojis.EmojiFromName(emojiName)).Item2; ClickHandler = ListenForMouse(new Rectangle(0, 0, 200, 22), new UIMouseEvent(MouseEvent)); }
public BHAVContainer(BHAV target, EditorScope scope) { Scope = scope; EditTarget = target; Selected = new List <PrimitiveBox>(); Primitives = new List <PrimitiveBox>(); RealPrim = new List <PrimitiveBox>(); byte i = 0; foreach (var inst in EditTarget.Instructions) { var ui = new PrimitiveBox(inst, i++, this); Primitives.Add(ui); RealPrim.Add(ui); this.Add(ui); } var RealPrims = new List <PrimitiveBox>(Primitives); foreach (var prim in RealPrims) { if (prim.Instruction.FalsePointer > 252 && prim.Returns != PrimitiveReturnTypes.Done) { var dest = new PrimitiveBox((prim.Instruction.FalsePointer == 254) ? PrimBoxType.True : PrimBoxType.False, this); Primitives.Add(dest); this.Add(dest); prim.FalseUI = dest; } else if (prim.Instruction.FalsePointer < RealPrim.Count) { prim.FalseUI = RealPrim[prim.Instruction.FalsePointer]; } if (prim.Instruction.TruePointer > 252) { var dest = new PrimitiveBox((prim.Instruction.TruePointer == 254) ? PrimBoxType.True : PrimBoxType.False, this); Primitives.Add(dest); this.Add(dest); prim.TrueUI = dest; } else if (prim.Instruction.TruePointer < RealPrim.Count) { prim.TrueUI = RealPrim[prim.Instruction.TruePointer]; } } CleanPosition(); HitTest = ListenForMouse(new Rectangle(Int32.MinValue / 2, Int32.MinValue / 2, Int32.MaxValue, Int32.MaxValue), new UIMouseEvent(DragMouseEvents)); }
public UIComboBox() { this.SetBackgroundTexture( GetTexture((ulong)TSOVille.FileIDs.UIFileIDs.dialog_textboxbackground), 13, 13, 13, 13); TextMargin = new Rectangle(8, 3, 8, 5); lstCombo = new UIListBox(); lstCombo.Items = items; m_MouseEvent = ListenForMouse(new Rectangle(0, 0, 10, 10), new UIMouseEvent(OnMouseEvent)); }
public UIUpgradeItem(UILotControl parent, VMEntity ent, int level) { LotParent = parent; var ui = Content.Content.Get().CustomUI; var gd = GameFacade.GraphicsDevice; Entity = ent; Level = level; Background = new UIImage(ui.Get(((level % 2) == 0) ? "up_item_panel.png" : "up_item_panel_alt.png").Get(gd)); Add(Background); Title = new UILabel(); Title.Alignment = TextAlignment.Right | TextAlignment.Top; Title.CaptionStyle = TextStyle.Create(Color.White, 12, true); Title.Position = new Vector2(512, 12); Title.Size = Vector2.One; Add(Title); TitlePrice = new UILabel(); TitlePrice.Position = new Microsoft.Xna.Framework.Vector2(512, 12); TitlePrice.CaptionStyle = TextStyle.Create(new Color(115, 255, 115), 12, true); TitlePrice.Alignment = TextAlignment.Right | TextAlignment.Top; TitlePrice.Size = Vector2.One; Add(TitlePrice); Description = new UILabel(); Description.Position = new Vector2(512, 31); Description.CaptionStyle = TextStyle.Create(TextStyle.DefaultLabel.Color, 9, true); Description.Alignment = TextAlignment.Right | TextAlignment.Top; Description.Size = Vector2.One; Add(Description); Ads = new UILabel(); Ads.Position = new Vector2(512, 47); Ads.CaptionStyle = TextStyle.Create(Color.White, 9, true); Ads.Alignment = TextAlignment.Right | TextAlignment.Top; Ads.Size = Vector2.One; Add(Ads); UpgradedTick = new UIImage(ui.Get("up_tick.png").Get(gd)); UpgradedTick.Position = new Vector2(494, 12); Add(UpgradedTick); Render(); Size = new Vector2(Background.Width, Background.Height); ClickHandler = ListenForMouse(new Rectangle(6, 6, (int)Background.Width - 12, (int)Background.Height - 12), MouseHandler); }
/// <summary> /// Creates a new UILotControl instance. /// </summary> /// <param name="vm">A SimAntics VM instance.</param> /// <param name="World">A World instance.</param> public UILotControl(TSO.Simantics.VM vm, World World) { this.vm = vm; this.World = World; ActiveEntity = vm.Entities.FirstOrDefault(x => x is VMAvatar); MouseEvt = this.ListenForMouse(new Microsoft.Xna.Framework.Rectangle(0, 0, GlobalSettings.Default.GraphicsWidth, GlobalSettings.Default.GraphicsHeight), OnMouse); testimg = new UIImage(); testimg.X = 20; testimg.Y = 20; this.Add(testimg); Queue = new UIInteractionQueue(ActiveEntity); this.Add(Queue); }
public UISkillBar() { if (SkillLevelTex == null) { SkillLevelTex = new Texture2D[9]; for (int i = 0; i < 9; i++) { SkillLevelTex[i] = GetTexture(0x00000CB600000001 + (ulong)i * 0x100000000); } } ClickHandler = ListenForMouse(new Rectangle(0, 0, m_Width, m_Height), new UIMouseEvent(OnMouseEvent)); m_TooltipHandler = UIUtils.GiveTooltip(this); //buttons can have tooltips }
public PrimitiveBox(PrimBoxType mode, BHAVContainer master) { Type = mode; if (mode == PrimBoxType.True) { InstPtr = 254; } else { InstPtr = 255; } Master = master; Nodes = new PrimitiveNode[0]; Width = 32; Height = 32; HitTest = ListenForMouse(new Rectangle(0, 0, Width, Height), new UIMouseEvent(MouseEvents)); }
/** * Mouse utilities */ public UIMouseEventRef ListenForMouse(Rectangle region, UIMouseEvent callback) { var newRegion = new UIMouseEventRef() { Callback = callback, Region = region, Element = this }; if (m_MouseRefs == null) { m_MouseRefs = new List <UIMouseEventRef>(); } m_MouseRefs.Add(newRegion); return(newRegion); }
public UILotButton() { DataService = FSOFacade.Kernel.Get <IClientDataService>(); NameLabel = new UILabel(); NameLabel.Y = 52; NameLabel.X = 2; NameLabel.Alignment = TextAlignment.Center; NameLabel.Size = new Vector2(76, 40); NameLabel.CaptionStyle = NameLabel.CaptionStyle.Clone(); NameLabel.CaptionStyle.Size = 9; NameLabel.Wrapped = true; Add(NameLabel); Target = new Binding <Lot>() .WithBinding(this, "NameLabel.Caption", "Lot_Name") .WithBinding(this, "ThumbImg", "Lot_Thumbnail", x => { if (ThumbImg != null) { ThumbImg.Dispose(); } var thumb = ((cTSOGenericData)x)?.Data; if (((thumb?.Length) ?? 0) == 0) { return(null); } return(ImageLoader.FromStream(GameFacade.GraphicsDevice, new MemoryStream(thumb))); }) .WithBinding(this, "BgImg", "Lot_IsOnline", x => { var online = (bool)x; return(GetTexture((ulong)((online) ? 0xC000000002 : 0xC200000002))); }) .WithBinding(this, "HoverImg", "Lot_IsOnline", x => { var online = (bool)x; return(GetTexture((ulong)((online) ? 0xC100000002 : 0xC300000002))); }); m_TooltipHandler = UIUtils.GiveTooltip(this); ClickHandler = ListenForMouse(new Rectangle(0, 0, 80, 50), new UIMouseEvent(OnMouseEvent)); }
public UIRatingSummaryPanel() { Body = new UITextEdit(); Body.TextStyle = Body.TextStyle.Clone(); Body.TextStyle.Size = 9; Body.TextStyle.LineHeightModifier = -4; Body.Position = new Vector2(5, 5); Body.SetSize(118, 81); Body.MaxLines = 5; Body.Mode = UITextEditMode.ReadOnly; Body.Position = new Vector2(7, 3); Body.BBCodeEnabled = true; Body.RemoveMouseEvent(); Add(Body); Body.Tooltip = GameFacade.Strings.GetString("f115", "94"); NameLabel = new UILabel(); NameLabel.CaptionStyle = NameLabel.CaptionStyle.Clone(); NameLabel.CaptionStyle.Size = 9; NameLabel.Position = new Vector2(122, 77); NameLabel.Alignment = TextAlignment.Right | TextAlignment.Top; NameLabel.Size = new Vector2(1, 1); NameLabel.CaptionStyle.Size = 9; Add(NameLabel); Rating = new UIRatingDisplay(true); Rating.Position = new Vector2(7, 80); 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"); }); Size = new Vector2(128, 96); ClickHandler = ListenForMouse(new Rectangle(0, 0, 128, 96), new UIMouseEvent(OnMouseEvent)); }
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 { Type = NodeType.False }; Nodes[1] = new PrimitiveNode { Type = NodeType.True }; Title = new UILabel { Alignment = TextAlignment.Middle | TextAlignment.Center, Y = 0, X = 0 }; this.Add(Title); Title.CaptionStyle = TextStyle.DefaultLabel.Clone(); Title.CaptionStyle.Font = Client.GameFacade.EdithFont; Title.CaptionStyle.Size = 14; BodyTextStyle = TextStyle.DefaultLabel.Clone(); BodyTextStyle.Font = 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 UIPickupPanel() { TitleLabel = new UILabel(); TitleLabel.Position = new Vector2(450, 14); TitleLabel.CaptionStyle = TitleLabel.CaptionStyle.Clone(); TitleLabel.CaptionStyle.Size = 19; TitleLabel.CaptionStyle.Color = UIStyle.Current.SecondaryText; Add(TitleLabel); SubtextLabel = new UILabel(); SubtextLabel.Position = new Vector2(450, 44); SubtextLabel.CaptionStyle = SubtextLabel.CaptionStyle.Clone(); SubtextLabel.CaptionStyle.Size = 12; SubtextLabel.CaptionStyle.Color = UIStyle.Current.Text; Add(SubtextLabel); CancelButton = new UICatButton(Content.Get().CustomUI.Get("cat_cancel.png").Get(GameFacade.GraphicsDevice)); CancelButton.Position = new Vector2(174, 31); CancelButton.OnButtonClick += CancelButton_OnButtonClick; Add(CancelButton); ClickHandler = ListenForMouse(new Rectangle(0, 0, 400, 128), new UIMouseEvent(OnMouseEvent)); }
/** * Mouse utilities */ public UIMouseEventRef ListenForMouse(Rectangle region, UIMouseEvent callback) { var newRegion = new UIMouseEventRef() { Callback = callback, Region = region, Element = this }; if (m_MouseRefs == null) { m_MouseRefs = new List<UIMouseEventRef>(); } m_MouseRefs.Add(newRegion); return newRegion; }
/// <summary> /// Listen for mouse events on the whole image /// </summary> /// <param name="callback"></param> public void ListenForMouse(UIMouseEvent callback) { m_MouseEvent = ListenForMouse(new Rectangle(0, 0, (int)Width, (int)Height), callback); }
public UIClickableLabel() { ClickHandler = ListenForMouse(new Rectangle(0, 0, 10, 10), new UIMouseEvent(OnMouseEvent)); }
/// <summary> /// /// </summary> /// <param name="Texture"></param> public UIButton(Texture2D Texture) { this.Texture = Texture; ClickHandler = ListenForMouse(new Rectangle(0, 0, m_Width, m_Texture.Height), new UIMouseEvent(OnMouseEvent)); m_TooltipHandler = UIUtils.GiveTooltip(this); //buttons can have tooltips }
public void HandleMouseEvents(UpdateState state) { var mouseBtnDown = state.MouseState.LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Pressed; var mouseDif = mouseBtnDown != LastMouseDownState; LastMouseDownState = mouseBtnDown; if (mouseDif) { if (mouseBtnDown) { if (LastMouseDown != null) { /** We already have mouse down on an object **/ return; } if (LastMouseOver != null) { LastMouseDown = LastMouseOver; LastMouseDown.Callback(UIMouseEventType.MouseDown, state); } } else { if (LastMouseDown != null) { LastMouseDown.Callback(UIMouseEventType.MouseUp, state); LastMouseDown = null; } } } if (state.MouseEvents.Count > 0) { var topMost = state.MouseEvents.OrderByDescending(x => x.Element.Depth).First(); /** Same element **/ if (LastMouseOver == topMost) { return; } if (LastMouseOver != null) { LastMouseOver.Callback(UIMouseEventType.MouseOut, state); } topMost.Callback(UIMouseEventType.MouseOver, state); LastMouseOver = topMost; } else { if (LastMouseOver != null) { LastMouseOver.Callback(UIMouseEventType.MouseOut, state); LastMouseOver = null; } } }
public UIBlocker() { MouseEvt = this.ListenForMouse(new Microsoft.Xna.Framework.Rectangle(0, 0, 10, 10), OnMouse); SetSize(GlobalSettings.Default.GraphicsWidth, GlobalSettings.Default.GraphicsHeight); }
private int _Orientation = 1; //0 is horizontal, 1 is vertical #endregion Fields #region Constructors public UISlider() { m_ThumbEvent = this.ListenForMouse(new Rectangle(0, 0, 0, 0), new UIMouseEvent(OnThumbClick)); }
/// <summary> /// Creates a new UILotControl instance. /// </summary> /// <param name="vm">A SimAntics VM instance.</param> /// <param name="World">A World instance.</param> public UILotControl(TSO.Simantics.VM vm, World World) { this.vm = vm; this.World = World; ActiveEntity = vm.Entities.FirstOrDefault(x => x is VMAvatar); MouseEvt = this.ListenForMouse(new Microsoft.Xna.Framework.Rectangle(0, 0, GlobalSettings.Default.GraphicsWidth, GlobalSettings.Default.GraphicsHeight), OnMouse); testimg = new UIImage(); testimg.X = 20; testimg.Y = 20; this.Add(testimg); Queue = new UIInteractionQueue(ActiveEntity); this.Add(Queue); ObjectHolder = new UIObjectHolder(vm, World, this); QueryPanel = new UIQueryPanel(World); QueryPanel.OnSellBackClicked += ObjectHolder.SellBack; QueryPanel.X = 177; QueryPanel.Y = GlobalSettings.Default.GraphicsHeight - 228; this.Add(QueryPanel); vm.OnDialog += vm_OnDialog; }
public UIInteraction(bool Active) { SetActive(Active); m_TooltipHandler = UIUtils.GiveTooltip(this); ClickHandler = ListenForMouse(new Rectangle(0, 0, 45, 45), new UIMouseEvent(MouseEvt)); }