Base class for all UIElements. This class has all the common stuff that user interface components have. This includes: X,Y, ScaleX, ScaleY, Visible, Parent etc. The UIElement has its own coordinate space. You can imagine that when you draw a texture inside a UIElement you are drawing it at 0,0 within the UIElement. This is then translated by the engine to screen coordinates.
Inheritance: IDepthProvider
Esempio n. 1
0
 void button_OnButtonClick(UIElement button)
 {
     if (data != null)
     {
         owner.SelectedItem = data;
     }
 }
Esempio n. 2
0
 public void Draw(UIElement ui, SpriteBatch batch)
 {
     if (((ITextControl)ui).DrawCursor)
     {
         batch.Draw(Texture, Position, null, Color, 0, Vector2.Zero, Scale, SpriteEffects.None, 0);
     }
 }
Esempio n. 3
0
        public UIDragHandler(UIElement mouseTarget, UIElement dragControl)
        {
            UpdateHook = new UpdateHookDelegate(Update);

            MouseTarget = mouseTarget;
            DragControl = dragControl;
            MouseEvent = mouseTarget.ListenForMouse(mouseTarget.GetBounds(), new UIMouseEvent(DragMouseEvents));
        }
Esempio n. 4
0
        /// <summary>
        /// Adds a UIElement at a specific depth in the container
        /// </summary>
        /// <param name="index"></param>
        /// <param name="child"></param>
        public void AddAt(int index, UIElement child)
        {
            lock (Children)
            {
                if (Children.Contains(child))
                {
                    Children.Remove(child);
                }

                Children.Insert(index, child);
                child.Parent = this;
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Adds a popup dialog
        /// </summary>
        /// <param name="dialog"></param>
        public static void ShowDialog(UIElement dialog, bool modal)
        {
            GameFacade.Screens.AddDialog(new DialogReference
            {
                Dialog = dialog,
                Modal = modal
            });

            if (dialog is UIDialog)
            {
                ((UIDialog)dialog).CenterAround(UIScreen.Current);
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Adds a UIElement at the top most position in the container
        /// </summary>
        /// <param name="child"></param>
        public void Add(UIElement child)
        {
            if (child == null) { return; }

            lock (Children)
            {
                if (Children.Contains(child))
                {
                    Children.Remove(child);
                }
                Children.Add(child);
                child.Parent = this;
            }
        }
Esempio n. 7
0
        private void SetSelected(UIElement element)
        {
            if (element == null)
            {
                propertyBox.Enabled = false;
                return;
            }

            propertyBox.Enabled = true;
            Selected = element;

            valueX.Value = (decimal)element.X;
            valueY.Value = (decimal)element.Y;
            valueScaleX.Value = (decimal)element.ScaleX;
            valueScaleY.Value = (decimal)element.ScaleY;
            valueAlpha.Value = (decimal)element.Opacity;
        }
Esempio n. 8
0
 /// <summary>
 /// Player selected "yes" to buy a new lot.
 /// </summary>
 private void BuyPropertyAlert_OnButtonClick(UIElement Button)
 {
     Network.UIPacketSenders.SendLotPurchaseRequest(Network.NetworkFacade.Client, (short)m_SelTileTmp[0], (short)m_SelTileTmp[1]);
     UIScreen.RemoveDialog(m_BuyPropertyAlert);
 }
Esempio n. 9
0
        private void PieButtonClick(UIElement button)
        {
            int index = m_PieButtons.IndexOf((UIButton)button);
            if (index == -1) return; //bail! this isn't meant to happen!
            var action = m_CurrentItem.Children.ElementAt(index).Value;
            HITVM.Get().PlaySoundEvent(UISounds.PieMenuSelect);

            if (action.Category) {
                m_CurrentItem = action;
                RenderMenu();
            } else {

                if (m_Obj == m_Parent.GotoObject)
                {
                    m_Parent.vm.SendCommand(new VMNetGotoCmd
                    {
                        Interaction = action.ID,
                        ActorUID = m_Caller.PersistID,
                        x = m_Obj.Position.x,
                        y = m_Obj.Position.y,
                        level = m_Obj.Position.Level
                    });
                }
                else
                {
                    if (Debug.IDEHook.IDE != null && ShiftDown) {
                        if (m_Obj.TreeTable.InteractionByIndex.ContainsKey((uint)action.ID)) {
                            var act = m_Obj.TreeTable.InteractionByIndex[(uint)action.ID];
                            ushort ActionID = act.ActionFunction;

                            var function = m_Obj.GetBHAVWithOwner(ActionID, m_Parent.vm.Context);

                            Debug.IDEHook.IDE.IDEOpenBHAV(
                                function.bhav,
                                m_Obj.Object
                            );
                        }
                    }
                    else
                    {
                        m_Parent.vm.SendCommand(new VMNetInteractionCmd
                        {
                            Interaction = action.ID,
                            ActorUID = m_Caller.PersistID,
                            CalleeID = m_Obj.ObjectID,
                            Param0 = action.Param0
                        });
                    }
                }
                HITVM.Get().PlaySoundEvent(UISounds.QueueAdd);
                m_Parent.ClosePie();

            }
        }
Esempio n. 10
0
 public void Show(UIElement button)
 {
     Shown = true;
     icon.Visible = false;
     window.Visible = true;
     Alert = false;
     parent.ReorderIcons();
 }
Esempio n. 11
0
 private void SendMessageEnter(UIElement element)
 {
     //remove newline first
     if (MessageType != UIMessageType.IM) return; //cannot send on enter for letters (or during read mode :|)
     MessageTextEdit.CurrentText = MessageTextEdit.CurrentText.Substring(0, MessageTextEdit.CurrentText.Length - 2);
     SendMessage(this);
 }
Esempio n. 12
0
        private void SendLetter(UIElement button)
        {
            if (MessageType != UIMessageType.Compose) return;
            UIMessageController controller = (UIMessageController)GameFacade.MessageController;

            controller.SendLetter(LetterTextEdit.CurrentText, LetterSubjectTextEdit.CurrentText, Author.GUID);
        }
Esempio n. 13
0
 private void MessageTextEdit_OnChange(UIElement TextEdit)
 {
     UITextEdit edit = (UITextEdit)TextEdit;
     SendMessageButton.Disabled = (edit.CurrentText.Length == 0);
 }
Esempio n. 14
0
 private void CloseButton_OnButtonClick(UIElement button)
 {
     //hide self.
     Visible = false;
 }
Esempio n. 15
0
 private void ChatEntryTextEdit_OnChange(UIElement TextEdit)
 {
     UITextEdit edit = (UITextEdit)TextEdit;
     OKButton.Disabled = (edit.CurrentText.Length == 0);
 }
Esempio n. 16
0
 private void ErrorReturnAlert(UIElement button)
 {
     GameFacade.Controller.ShowPersonSelection();
 }
Esempio n. 17
0
 /// <summary>
 /// User closed the UIMessage window.
 /// </summary>
 private void CloseButton_OnButtonClick(UIElement button)
 {
     Parent.Remove(this);
 }
Esempio n. 18
0
        private void SendMessage(UIElement button)
        {
            OKButton.Disabled = true;
            if (ChatEntryTextEdit.CurrentText.Length == 0) return;

            if (OnSendMessage != null) OnSendMessage(ChatEntryTextEdit.CurrentText);
            ChatEntryTextEdit.CurrentText = "";
        }
Esempio n. 19
0
 private void RespondLetterButton_OnButtonClick(UIElement button)
 {
     if (MessageType != UIMessageType.Read) return;
     SetType(UIMessageType.Compose);
 }
Esempio n. 20
0
 private void SendMessageEnter(UIElement element)
 {
     //remove newline first
     ChatEntryTextEdit.CurrentText = ChatEntryTextEdit.CurrentText.Substring(0, ChatEntryTextEdit.CurrentText.Length - 2);
     SendMessage(this);
 }
Esempio n. 21
0
        private void SendMessage(UIElement button)
        {
            if (MessageType != UIMessageType.IM) return;
            SendMessageButton.Disabled = true;
            if (MessageTextEdit.CurrentText.Length == 0) return; //if they somehow get past the disabled button or press enter, don't send an empty message.

            AddMessage("Current User", MessageTextEdit.CurrentText);

            UIMessageController controller = GameFacade.MessageController;

            if (!String.IsNullOrEmpty(Author.GUID))
            {
                lock (MessageTextEdit.CurrentText)
                {
                    controller.SendMessage(MessageTextEdit.CurrentText, Author.GUID);
                    MessageTextEdit.CurrentText = "";
                }
            }
            else
            {
                UIAlertOptions Options = new UIAlertOptions();
                Options.Message = "Couldn't find player! Maybe their GUID wasn't sent from the server. Try reopening a chat window to this user.";
                Options.Title = "Player Offline";
                UI.Framework.UIScreen.ShowAlert(Options, true);
            }
        }
Esempio n. 22
0
 private void SendMessage(UIElement element)
 {
     string message = TextBox.CurrentText;
     message = message.Replace("\r\n", "");
     if (message != "")
     {
         vm.SendCommand(new VMNetChatCmd
         {
             CallerID = Owner.ActiveEntity.ObjectID,
             Message = message
         });
     }
     TextBox.Clear();
 }
Esempio n. 23
0
 public void Close(UIElement button)
 {
     parent.RemoveMessageGroup(this);
 }
Esempio n. 24
0
 void exitBtn_OnButtonClick(UIElement button)
 {
     GameFacade.Kill();
     /*var exitDialog = new UIExitDialog();
     Parent.Add(exitDialog);*/
 }
Esempio n. 25
0
 void BackButtonPress(UIElement button)
 {
     if (m_CurrentItem.Parent == null) return; //shouldn't ever be...
     m_CurrentItem = m_CurrentItem.Parent;
     HITVM.Get().PlaySoundEvent(UISounds.PieMenuSelect);
     RenderMenu();
 }
Esempio n. 26
0
 void loginBtn_OnButtonClick(UIElement button)
 {
     m_LoginScreen.Login();
     //GameFacade.Controller.ShowPersonSelection();
 }
Esempio n. 27
0
 void PieButtonHover(UIElement button)
 {
     int index = m_PieButtons.IndexOf((UIButton)button);
     //todo, make sim look at button
     HITVM.Get().PlaySoundEvent(UISounds.PieMenuHighlight);
 }
Esempio n. 28
0
 /*void m_TxtPass_OnTabPress(UIElement element)
 {
     GameFacade.Screens.inputManager.SetFocus(m_TxtAccName);
 }*/
 void m_TxtAccName_OnTabPress(UIElement element)
 {
     GameFacade.Screens.inputManager.SetFocus(m_TxtPass);
 }
Esempio n. 29
0
 public void SellBack(UIElement button)
 {
     if (Holding == null) return;
     if (Holding.IsBought)
     {
         vm.SendCommand(new VMNetDeleteObjectCmd
         {
             ObjectID = Holding.MoveTarget,
             CleanupAll = true
         });
         HITVM.Get().PlaySoundEvent(UISounds.MoneyBack);
     }
     OnDelete(Holding, null); //TODO: cleanup callbacks which don't need updatestate into another delegate. will do when refactoring for online
     ClearSelected();
 }
Esempio n. 30
0
 private void DebugButtonClick(UIElement button)
 {
     if (button == DebugGo)
         if (DebugEntity.Thread.ThreadBreak == VMThreadBreakMode.Active)
             DebugEntity.Thread.ThreadBreak = VMThreadBreakMode.Immediate;
         else
             DebugEntity.Thread.ThreadBreak = VMThreadBreakMode.Active;
     else if (button == DebugStepIn)
         DebugEntity.Thread.ThreadBreak = VMThreadBreakMode.StepIn;
     else if (button == DebugStepOver)
         DebugEntity.Thread.ThreadBreak = VMThreadBreakMode.StepOver;
     else if (button == DebugStepOut)
         DebugEntity.Thread.ThreadBreak = VMThreadBreakMode.StepOut;
     else if (button == DebugTrue)
         DebugEntity.Thread.ThreadBreak = VMThreadBreakMode.ReturnTrue;
     else if (button == DebugFalse)
         DebugEntity.Thread.ThreadBreak = VMThreadBreakMode.ReturnFalse;
     else return;
 }