コード例 #1
0
ファイル: UIChatDialog.cs プロジェクト: terrynoya/FreeSO
        /// <summary>
        /// Handle mouse events for dragging and resizing
        /// </summary>
        /// <param name="evt"></param>
        private void DragMouseEvents(UIMouseEventType evt, UpdateState state)
        {
            switch (evt)
            {
            case UIMouseEventType.MouseDown:
                /** Start drag **/
                var position = this.GetMousePosition(state.MouseState);

                m_dragOffset = position;
                m_doResizeX  = position.X > Width - 20;
                m_doResizeY  = position.Y > Height - 20;
                m_doDrag     = !(m_doResizeX || m_doResizeY);
                if (!m_doDrag)
                {
                    m_dragOffset = Size - m_dragOffset;
                }
                break;

            case UIMouseEventType.MouseUp:
                /** Stop drag **/
                m_doDrag    = false;
                m_doResizeX = false;
                m_doResizeY = false;
                break;
            }
        }
コード例 #2
0
ファイル: UILotButton.cs プロジェクト: JDrocks450/FreeSO
        private void OnMouseEvent(UIMouseEventType type, UpdateState state)
        {
            switch (type)
            {
            case UIMouseEventType.MouseOver:
                m_isOver = true;
                break;

            case UIMouseEventType.MouseOut:
                m_isOver = false;
                break;

            case UIMouseEventType.MouseDown:
                m_isDown = true;
                break;

            case UIMouseEventType.MouseUp:
                if (m_isDown)
                {
                    OnButtonClick();
                    HITVM.Get().PlaySoundEvent(UISounds.Click);
                }
                m_isDown = false;
                break;
            }
        }
コード例 #3
0
 void MouseEvt(UIMouseEventType type, UpdateState state)
 {
     if (type == UIMouseEventType.MouseDown)
     {
         OnMouseEvent(this);                                     //pass to parents to handle
     }
 }
コード例 #4
0
 public void MouseEvent(UIMouseEventType type, UpdateState state)
 {
     if (type == UIMouseEventType.MouseOut)
     {
         m_LastWheelPos = null;
     }
 }
コード例 #5
0
        private void MouseHandler(UIMouseEventType type, UpdateState state)
        {
            //todo: change handler to game engine when in simulation mode.

            CityRenderer.UIMouseEvent(type.ToString()); //all the city renderer needs are events telling it if the mouse is over it or not.
            //if the mouse is over it, the city renderer will handle the rest.
        }
コード例 #6
0
 private void OnMouse(UIMouseEventType type, UpdateState state)
 {
     if (OnMouseEvt != null)
     {
         OnMouseEvt(type, state);
     }
 }
コード例 #7
0
        private void OnMouseEvent(UIMouseEventType type, UpdateState update)
        {
            if (OnDoubleClick != null && DoubleClicker.TryDoubleClick(type, update))
            {
                OnDoubleClick(null);
                return;
            }

            switch (type)
            {
            case UIMouseEventType.MouseOver:
                m_MouseOver = true;
                break;

            case UIMouseEventType.MouseOut:
                m_MouseOver = false;
                break;

            case UIMouseEventType.MouseUp:
                /** Click **/
                var row = GetRowUnderMouse(update);
                if (row != -1)
                {
                    /** Cant deselect once selected **/
                    InternalSelect(row);
                }
                break;
            }
        }
コード例 #8
0
 public void HandleMouseEvent(UIMouseEventType type, UpdateState state)
 {
     if (type == UIMouseEventType.MouseDown)
     {
         SetExpanded(!Expand);
     }
 }
コード例 #9
0
ファイル: UIUtils.cs プロジェクト: yuripourre-forks/FreeSO
        /// <summary>
        /// Handle mouse events for dragging
        /// </summary>
        /// <param name="evt"></param>
        private void DragMouseEvents(UIMouseEventType evt, UpdateState state)
        {
            switch (evt)
            {
            case UIMouseEventType.MouseDown:
                if (BringToFront)
                {
                    DragControl.Parent.Add(DragControl);
                }
                /** Start drag **/
                m_doDrag = true;
                DragControl.AddUpdateHook(UpdateHook);

                var position = DragControl.GetMousePosition(state.MouseState);
                m_dragOffsetX = position.X;
                m_dragOffsetY = position.Y;
                break;

            case UIMouseEventType.MouseUp:
                /** Stop drag **/
                m_doDrag = false;
                DragControl.RemoveUpdateHook(UpdateHook);
                break;
            }
        }
コード例 #10
0
ファイル: UIClickableLabel.cs プロジェクト: jwofles/ForkSO
        private void OnMouseEvent(UIMouseEventType type, UpdateState state)
        {
            switch (type)
            {
            case UIMouseEventType.MouseOver:
                //m_isOver = true;
                break;

            case UIMouseEventType.MouseOut:
                //m_isOver = false;
                break;

            case UIMouseEventType.MouseDown:
                m_isDown = true;
                break;

            case UIMouseEventType.MouseUp:
                if (m_isDown)
                {
                    if (OnButtonClick != null)
                    {
                        OnButtonClick(this);
                        //GameFacade.SoundManager.PlayUISound(1);
                    }
                }
                m_isDown = false;
                break;
            }
            OnMouseEvtExt?.Invoke(type, state);
        }
コード例 #11
0
        /// <summary>
        /// Handle mouse events for dragging and resizing
        /// </summary>
        /// <param name="evt"></param>
        private void DragMouseEvents(UIMouseEventType evt, UpdateState state)
        {
            switch (evt)
            {
            case UIMouseEventType.MouseDown:
                /** Start drag **/
                var position = this.GetMousePosition(state.MouseState);

                m_dragOffset = position;
                m_doResizeX  = position.X > Width - 20;
                m_doResizeY  = position.Y > Height - 20;
                m_doDrag     = !(m_doResizeX || m_doResizeY);
                if (!m_doDrag)
                {
                    m_dragOffset = Size - m_dragOffset;
                }
                break;

            case UIMouseEventType.MouseUp:
                /** Stop drag **/
                m_doDrag    = false;
                m_doResizeX = false;
                m_doResizeY = false;
                GlobalSettings.Default.ChatSizeX     = this.Size.X;
                GlobalSettings.Default.ChatSizeY     = this.Size.Y;
                GlobalSettings.Default.ChatLocationX = this.X;
                GlobalSettings.Default.ChatLocationY = this.Y;
                GlobalSettings.Default.Save();
                break;
            }
        }
コード例 #12
0
 private void OnMouse(UIMouseEventType type, UpdateState state)
 {
     if (type == UIMouseEventType.MouseOver)
     {
         if (isDown)
         {
             return;
         }
         color = Color.Red;
     }
     else if (type == UIMouseEventType.MouseOut)
     {
         if (isDown)
         {
             return;
         }
         color = Color.White;
     }
     else if (type == UIMouseEventType.MouseDown)
     {
         color  = Color.Blue;
         isDown = true;
     }
     else if (type == UIMouseEventType.MouseUp)
     {
         isDown = false;
         color  = Color.Green;
     }
 }
コード例 #13
0
        private void OnMouseEvent(UIMouseEventType type, UpdateState state)
        {
            switch (type)
            {
                case UIMouseEventType.MouseOver:
                    //m_isOver = true;
                    break;

                case UIMouseEventType.MouseOut:
                    //m_isOver = false;
                    break;

                case UIMouseEventType.MouseDown:
                    m_isDown = true;
                    break;

                case UIMouseEventType.MouseUp:
                    if (m_isDown)
                    {
                        if (OnButtonClick != null)
                        {
                            OnButtonClick(this);
                            //GameFacade.SoundManager.PlayUISound(1);
                        }
                    }
                    m_isDown = false;
                    break;
            }
        }
コード例 #14
0
 private void OnMouseEvent(UIMouseEventType type, UpdateState state)
 {
     if (type == UIMouseEventType.MouseDown)
     {
         OnResponse?.Invoke(true);
     }
 }
コード例 #15
0
 private void OnMouse(UIMouseEventType type, UpdateState state)
 {
     if (type == UIMouseEventType.MouseOver)
     {
         MouseIsOn = true;
     }
     else if (type == UIMouseEventType.MouseOut)
     {
         MouseIsOn = false;
         Tooltip   = null;
     }
     else if (type == UIMouseEventType.MouseDown)
     {
         if (PieMenu == null)
         {
             //get new pie menu, make new pie menu panel for it
             if (ObjectHover != 0)
             {
                 if (InteractionsAvailable)
                 {
                     HITVM.Get().PlaySoundEvent(UISounds.PieMenuAppear);
                     var obj  = vm.GetObjectById(ObjectHover);
                     var menu = obj.GetPieMenu(vm, ActiveEntity);
                     if (menu.Count != 0)
                     {
                         PieMenu = new UIPieMenu(menu, obj, ActiveEntity, this);
                         this.Add(PieMenu);
                         PieMenu.X = state.MouseState.X;
                         PieMenu.Y = state.MouseState.Y;
                         PieMenu.UpdateHeadPosition(state.MouseState.X, state.MouseState.Y);
                     }
                 }
                 else
                 {
                     HITVM.Get().PlaySoundEvent(UISounds.Error);
                     GameFacade.Screens.TooltipProperties.Show     = true;
                     GameFacade.Screens.TooltipProperties.Opacity  = 1;
                     GameFacade.Screens.TooltipProperties.Position = new Vector2(state.MouseState.X,
                                                                                 state.MouseState.Y);
                     GameFacade.Screens.Tooltip = GameFacade.Strings.GetString("159", "0");
                     GameFacade.Screens.TooltipProperties.UpdateDead = false;
                     ShowTooltip = true;
                 }
             }
         }
         else
         {
             PieMenu.RemoveSimScene();
             this.Remove(PieMenu);
             PieMenu = null;
         }
     }
     else if (type == UIMouseEventType.MouseUp)
     {
         GameFacade.Screens.TooltipProperties.Show    = false;
         GameFacade.Screens.TooltipProperties.Opacity = 0;
         ShowTooltip = false;
     }
 }
コード例 #16
0
 private void MouseHandler(UIMouseEventType type, UpdateState state)
 {
     if (CityRenderer != null)
     {
         CityRenderer.UIMouseEvent(type.ToString());                       //all the city renderer needs are events telling it if the mouse is over it or not.
     }
     //if the mouse is over it, the city renderer will handle the rest.
 }
コード例 #17
0
 private void MouseEvents(UIMouseEventType evt, UpdateState state)
 {
     switch (evt)
     {
     case UIMouseEventType.MouseDown:
         MouseDrag = true;
         break;
     }
 }
コード例 #18
0
ファイル: UIButton.cs プロジェクト: yuripourre-forks/FreeSO
        protected void OnMouseEvent(UIMouseEventType type, UpdateState state)
        {
            if ((m_Disabled || Opacity < 1f) && type != UIMouseEventType.MouseOut)
            {
                return;
            }
            Invalidate();
            switch (type)
            {
            case UIMouseEventType.MouseOver:
                m_isOver = true;
                if (!m_isDown)
                {
                    CurrentFrame = 2;
                    if (OnButtonHover != null)
                    {
                        OnButtonHover(this);
                    }
                }
                break;

            case UIMouseEventType.MouseOut:
                m_isOver = false;
                if (!m_isDown)
                {
                    CurrentFrame = 0;
                    if (OnButtonExit != null)
                    {
                        OnButtonExit(this);
                    }
                }
                break;

            case UIMouseEventType.MouseDown:
                m_isDown     = true;
                CurrentFrame = 1;
                if (OnButtonDown != null)
                {
                    OnButtonDown(this);
                }
                break;

            case UIMouseEventType.MouseUp:
                if (m_isDown)
                {
                    if (OnButtonClick != null)
                    {
                        OnButtonClick(this);
                        HITVM.Get().PlaySoundEvent(UISounds.Click);
                    }
                }
                m_isDown     = false;
                CurrentFrame = m_isOver ? 2 : 0;
                break;
            }
        }
コード例 #19
0
 public void MouseEvt(UIMouseEventType type, UpdateState state)
 {
     if (type == UIMouseEventType.MouseDown)
     {
         MouseOn = true;
     }
     else if (type == UIMouseEventType.MouseUp)
     {
         MouseOn = false;
     }
 }
コード例 #20
0
        public void OnMouseEvent(UIMouseEventType type, UpdateState state)
        {
            switch (type)
            {
            case UIMouseEventType.MouseDown:
                MouseDown = true;
                break;

            case UIMouseEventType.MouseUp:
                MouseDown = false;
                break;
            }
        }
コード例 #21
0
        private void OnMouse(UIMouseEventType type, UpdateState state)
        {
            switch (type)
            {
            case UIMouseEventType.MouseOver:
                Tooltip.Visible = true;
                break;

            case UIMouseEventType.MouseOut:
                Tooltip.Visible = false;
                break;
            }
        }
コード例 #22
0
        private void OnMouseEvent(UIMouseEventType type, UpdateState state)
        {
            if (m_Disabled)
            {
                return;
            }

            switch (type)
            {
            case UIMouseEventType.MouseOver:
                m_isOver = true;
                if (!m_isDown)
                {
                    m_CurrentFrame = 2;
                    if (OnButtonHover != null)
                    {
                        OnButtonHover(this);
                    }
                }
                break;

            case UIMouseEventType.MouseOut:
                m_isOver = false;
                if (!m_isDown)
                {
                    m_CurrentFrame = 0;
                }
                break;

            case UIMouseEventType.MouseDown:
                m_isDown       = true;
                m_CurrentFrame = 1;
                break;

            case UIMouseEventType.MouseUp:
                if (m_isDown)
                {
                    if (OnButtonClick != null)
                    {
                        OnButtonClick(this);
                        HITVM.Get().PlaySoundEvent(UISounds.Click);
                    }
                }
                m_isDown       = false;
                m_CurrentFrame = m_isOver ? 2 : 0;
                break;
            }

            CalculateState();
        }
コード例 #23
0
        public void MouseEvent(UIMouseEventType type, UpdateState state)
        {
            switch (type)
            {
            case UIMouseEventType.MouseOver:
                Owner.ClearSelection();
                Selected = true;
                break;

            case UIMouseEventType.MouseDown:
                Owner.SelectBestTerm();
                break;
            }
        }
コード例 #24
0
        private void MouseEvents(UIMouseEventType evt, UpdateState state)
        {
            switch (evt)
            {
            case UIMouseEventType.MouseOver:
                Master.HoverPrim = this;
                break;

            case UIMouseEventType.MouseOut:
                if (Master.HoverPrim == this)
                {
                    Master.HoverPrim = null;
                }
                break;

            case UIMouseEventType.MouseDown:
                state.InputManager.SetFocus(null);
                Master.Select(this);

                if (DoubleClickTime > 0 && Type == TREEBoxType.Primitive && Descriptor is SubroutineDescriptor)
                {
                    var subD = (SubroutineDescriptor)Descriptor;
                    FSO.Client.Debug.IDEHook.IDE.IDEOpenBHAV(Master.Scope.GetBHAV(subD.PrimID), Master.Scope.Object);
                }
                DoubleClickTime = 25;
                m_doDrag        = true;
                var position = this.GetMousePosition(state.MouseState);
                m_doResize    = Resizable && position.X > Width - 10 && position.Y > Height - 10;
                m_dragOffsetX = position.X;
                m_dragOffsetY = position.Y;
                break;

            case UIMouseEventType.MouseUp:
                m_doDrag = false;     //should probably just release when mouse is up in any case.
                Master.Editor.QueueCommand(new UpdateBoxPosCommand(this));
                if (TextEdit != null)
                {
                    state.InputManager.SetFocus(TextEdit);
                }
                break;

            default:
                break;
            }

            if ((evt == UIMouseEventType.MouseOut || evt == UIMouseEventType.MouseOver) && CommentNode != null)
            {
                CommentNode.MouseEvent(evt, state);
            }
        }
コード例 #25
0
 private void MouseEvt(UIMouseEventType type, UpdateState state)
 {
     if (type == UIMouseEventType.MouseDown && OnMouseEvent != null)
     {
         OnMouseEvent(this);                                                             //pass to parents to handle
     }
     if (type == UIMouseEventType.MouseOver)
     {
         SetHover(true);
     }
     if (type == UIMouseEventType.MouseOut)
     {
         SetHover(false);
     }
 }
コード例 #26
0
 public void MouseEvent(UIMouseEventType type, UpdateState state)
 {
     if (type == UIMouseEventType.MouseDown)
     {
         Touch.MiceDown.Add(state.CurrentMouseID);
     }
     else if (type == UIMouseEventType.MouseUp)
     {
         Touch.MiceDown.Remove(state.CurrentMouseID);
     }
     else if (type == UIMouseEventType.MouseOut)
     {
         LastWheelPos = null;
     }
 }
コード例 #27
0
        /**
         * Interaction Functionality
         */
        public void OnMouseEvent(UIMouseEventType evt, UpdateState state)
        {
            switch (evt)
            {
            case UIMouseEventType.MouseUp:
                state.InputManager.SetFocus(this);
                break;

            case UIMouseEventType.MouseOver:
                break;

            case UIMouseEventType.MouseOut:
                break;
            }
        }
コード例 #28
0
        private void DragMouseEvents(UIMouseEventType evt, UpdateState state)
        {
            switch (evt)
            {
            case UIMouseEventType.MouseDown:
                m_doDrag = true;
                var position = this.GetMousePosition(state.MouseState);
                m_dragOffsetX = position.X;
                m_dragOffsetY = position.Y;
                break;

            case UIMouseEventType.MouseUp:
                m_doDrag = false;     //should probably just release when mouse is up in any case.
                break;
            }
        }
コード例 #29
0
        private void OnMouseEvent(UIMouseEventType type, UpdateState state)
        {
            if (m_Disabled)
            {
                return;
            }

            switch (type)
            {
            case UIMouseEventType.MouseOver:
                m_isOver = true;
                if (!m_isDown)
                {
                    m_CurrentFrame = 2;
                }
                break;

            case UIMouseEventType.MouseOut:
                m_isOver = false;
                if (!m_isDown)
                {
                    m_CurrentFrame = 0;
                }
                break;

            case UIMouseEventType.MouseDown:
                m_isDown       = true;
                m_CurrentFrame = 1;
                break;

            case UIMouseEventType.MouseUp:
                if (m_isDown)
                {
                    if (OnButtonClick != null)
                    {
                        OnButtonClick(this);
                        GameFacade.SoundManager.PlayUISound(1);
                    }
                }
                m_isDown       = false;
                m_CurrentFrame = m_isOver ? 2 : 0;
                break;
            }

            CalculateState();
        }
コード例 #30
0
        private void OnMouse(UIMouseEventType type, UpdateState state)
        {
            if (!vm.Ready)
            {
                return;
            }

            if (type == UIMouseEventType.MouseOver)
            {
                if (QueryPanel.Mode == 1)
                {
                    QueryPanel.Active = false;
                }
                MouseIsOn = true;
            }
            else if (type == UIMouseEventType.MouseOut)
            {
                MouseIsOn = false;
                GameFacade.Cursor.SetCursor(CursorType.Normal);
                Tooltip = null;
            }
            else if (type == UIMouseEventType.MouseDown)
            {
                Touch.MiceDown.Add(state.CurrentMouseID);
            }
            else if (type == UIMouseEventType.MouseUp)
            {
                Touch.MiceDown.Remove(state.CurrentMouseID);
                if (!LiveMode)
                {
                    if (CustomControl != null)
                    {
                        CustomControl.MouseUp(state);
                    }
                    else
                    {
                        ObjectHolder.MouseUp(state);
                    }
                    return;
                }
                state.UIState.TooltipProperties.Show    = false;
                state.UIState.TooltipProperties.Opacity = 0;
                ShowTooltip = false;
                TipIsError  = false;
            }
        }
コード例 #31
0
        public bool TryDoubleClick(UIMouseEventType type, UpdateState update)
        {
            if (type == UIMouseEventType.MouseUp)
            {
                var now = (long)(DateTime.Now - new DateTime(1970, 1, 1)).TotalMilliseconds;
                if (now - LastClick < 500 && IsMouseClose(LastMousePosition, update.MouseState.Position))
                {
                    LastClick         = now;
                    LastMousePosition = update.MouseState.Position;
                    return(true);
                }
                LastClick         = now;
                LastMousePosition = update.MouseState.Position;
            }

            return(false);
        }
コード例 #32
0
        /// <summary>
        /// Handle mouse events for dragging
        /// </summary>
        /// <param name="evt"></param>
        private void DragMouseEvents(UIMouseEventType evt, UpdateState state)
        {
            switch (evt)
            {
                case UIMouseEventType.MouseDown:
                    /** Start drag **/
                    m_doDrag = true;
                    DragControl.AddUpdateHook(UpdateHook);

                    var position = DragControl.GetMousePosition(state.MouseState);
                    m_dragOffsetX = position.X;
                    m_dragOffsetY = position.Y;
                    break;

                case UIMouseEventType.MouseUp:
                    /** Stop drag **/
                    m_doDrag = false;
                    DragControl.RemoveUpdateHook(UpdateHook);
                    break;
            }
        }
コード例 #33
0
 private void OnMouse(UIMouseEventType type, UpdateState state)
 {
     if (type == UIMouseEventType.MouseOver)
     {
         if (isDown) { return; }
         color = Color.Red;
     }
     else if (type == UIMouseEventType.MouseOut)
     {
         if (isDown) { return; }
         color = Color.White;
     }
     else if (type == UIMouseEventType.MouseDown)
     {
         color = Color.Blue;
         isDown = true;
     }
     else if (type == UIMouseEventType.MouseUp)
     {
         isDown = false;
         color = Color.Green;
     }
 }
コード例 #34
0
ファイル: UITextEdit.cs プロジェクト: RHY3756547/FreeSO
        /**
         * Interaction Functionality
         */
        public void OnMouseEvent(UIMouseEventType evt, UpdateState state)
        {
            if (m_IsReadOnly) { return; }

            switch (evt)
            {
                case UIMouseEventType.MouseDown:
                    /**
                     * Hit test, work out where selection should begin
                     */
                    var position = this.GetMousePosition(state.MouseState);
                    var index = this.HitTestText(position);

                    Control_SetSelectionStart(
                        Control_GetSelectableIndex(index, -1)
                    );
                    SelectionEnd = -1;
                    m_IsDraggingSelection = true;

                    state.InputManager.SetFocus(this);
                    break;

                case UIMouseEventType.MouseOver:
                    break;

                case UIMouseEventType.MouseOut:
                    break;

                case UIMouseEventType.MouseUp:
                    m_IsDraggingSelection = false;
                    break;
            }
        }
コード例 #35
0
ファイル: UIButton.cs プロジェクト: ddfczm/Project-Dollhouse
        private void OnMouseEvent(UIMouseEventType type, UpdateState state)
        {
            if (m_Disabled) { return; }

            switch (type)
            {
                case UIMouseEventType.MouseOver:
                    m_isOver = true;
                    if (!m_isDown)
                    {
                        m_CurrentFrame = 2;
                        if (OnButtonHover != null)
                        {
                            OnButtonHover(this);
                        }
                    }
                    break;

                case UIMouseEventType.MouseOut:
                    m_isOver = false;
                    if (!m_isDown)
                    {
                        m_CurrentFrame = 0;
                    }
                    break;

                case UIMouseEventType.MouseDown:
                    m_isDown = true;
                    m_CurrentFrame = 1;
                    break;

                case UIMouseEventType.MouseUp:
                    if (m_isDown)
                    {
                        if (OnButtonClick != null)
                        {
                            OnButtonClick(this);
                            HITVM.Get().PlaySoundEvent(UISounds.Click);
                        }
                    }
                    m_isDown = false;
                    m_CurrentFrame = m_isOver ? 2 : 0;
                    break;
            }

            CalculateState();
        }
コード例 #36
0
        private void OnMouseEvent(UIMouseEventType type, UpdateState state)
        {
            if (m_Disabled) { return; }

            switch (type)
            {
                case UIMouseEventType.MouseOver:
                    m_isOver = true;
                    if (!m_isDown)
                    {
                        m_CurrentFrame = 2;
                    }
                    break;

                case UIMouseEventType.MouseOut:
                    m_isOver = false;
                    if (!m_isDown)
                    {
                        m_CurrentFrame = 0;
                    }
                    break;

                case UIMouseEventType.MouseDown:
                    m_isDown = true;
                    m_CurrentFrame = 1;
                    break;

                case UIMouseEventType.MouseUp:
                    if (m_isDown)
                    {
                        if (OnButtonClick != null)
                        {
                            OnButtonClick(this);
                            GameFacade.SoundManager.PlayUISound(1);
                        }
                    }
                    m_isDown = false;
                    m_CurrentFrame = m_isOver ? 2 : 0;
                    break;
            }

            CalculateState();
        }
コード例 #37
0
ファイル: BHAVContainer.cs プロジェクト: Daribon/FreeSO
        private void DragMouseEvents(UIMouseEventType evt, UpdateState state)
        {
            switch (evt)
            {
                case UIMouseEventType.MouseDown:
                    m_doDrag = true;
                    var position = this.GetMousePosition(state.MouseState);
                    m_dragOffsetX = position.X;
                    m_dragOffsetY = position.Y;
                    break;

                case UIMouseEventType.MouseUp:
                    m_doDrag = false; //should probably just release when mouse is up in any case.
                    break;
            }
        }
コード例 #38
0
        private void MouseHandler(UIMouseEventType type, UpdateState state)
        {
            //todo: change handler to game engine when in simulation mode.

            CityRenderer.UIMouseEvent(type.ToString()); //all the city renderer needs are events telling it if the mouse is over it or not.
            //if the mouse is over it, the city renderer will handle the rest.
        }
コード例 #39
0
ファイル: UIImage.cs プロジェクト: RHY3756547/FreeSO
 private void BlockMouseEvent(UIMouseEventType type, UpdateState state)
 {
     //do nothing! that's the whole idea of blocking input
 }
コード例 #40
0
ファイル: UILotControl.cs プロジェクト: RHY3756547/FreeSO
        private void OnMouse(UIMouseEventType type, UpdateState state)
        {
            if (!vm.Ready) return;

            if (type == UIMouseEventType.MouseOver)
            {
                if (QueryPanel.Mode == 1) QueryPanel.Active = false;
                MouseIsOn = true;
            }
            else if (type == UIMouseEventType.MouseOut)
            {
                MouseIsOn = false;
                Tooltip = null;
            }
            else if (type == UIMouseEventType.MouseDown)
            {
                if (!LiveMode)
                {
                    if (CustomControl != null) CustomControl.MouseDown(state);
                    else ObjectHolder.MouseDown(state);
                    return;
                }
                if (PieMenu == null && ActiveEntity != null)
                {
                    VMEntity obj;
                    //get new pie menu, make new pie menu panel for it
                    var tilePos = World.State.WorldSpace.GetTileAtPosWithScroll(new Vector2(state.MouseState.X, state.MouseState.Y) / FSOEnvironment.DPIScaleFactor);

                    LotTilePos targetPos = LotTilePos.FromBigTile((short)tilePos.X, (short)tilePos.Y, World.State.Level);
                    if (vm.Context.SolidToAvatars(targetPos).Solid) targetPos = LotTilePos.OUT_OF_WORLD;

                    GotoObject.SetPosition(targetPos, Direction.NORTH, vm.Context);

                    bool objSelected = ObjectHover > 0 && InteractionsAvailable;
                    if (objSelected || (GotoObject.Position != LotTilePos.OUT_OF_WORLD && ObjectHover <= 0))
                    {
                        HITVM.Get().PlaySoundEvent(UISounds.PieMenuAppear);
                        if (objSelected)
                        {
                            obj = vm.GetObjectById(ObjectHover);
                        } else
                        {
                            obj = GotoObject;
                        }
                        obj = obj.MultitileGroup.GetInteractionGroupLeader(obj);

                        var menu = obj.GetPieMenu(vm, ActiveEntity, false);
                        if (menu.Count != 0)
                        {
                            PieMenu = new UIPieMenu(menu, obj, ActiveEntity, this);
                            this.Add(PieMenu);
                            PieMenu.X = state.MouseState.X / FSOEnvironment.DPIScaleFactor;
                            PieMenu.Y = state.MouseState.Y / FSOEnvironment.DPIScaleFactor;
                            PieMenu.UpdateHeadPosition(state.MouseState.X, state.MouseState.Y);
                        }
                    }
                    else
                    {
                        HITVM.Get().PlaySoundEvent(UISounds.Error);
                        state.UIState.TooltipProperties.Show = true;
                        state.UIState.TooltipProperties.Color = Color.Black;
                        state.UIState.TooltipProperties.Opacity = 1;
                        state.UIState.TooltipProperties.Position = new Vector2(state.MouseState.X,
                            state.MouseState.Y);
                        state.UIState.Tooltip = GameFacade.Strings.GetString("159", "0");
                        state.UIState.TooltipProperties.UpdateDead = false;
                        ShowTooltip = true;
                        TipIsError = true;
                    }
                }
                else
                {
                    if (PieMenu != null) PieMenu.RemoveSimScene();
                    this.Remove(PieMenu);
                    PieMenu = null;
                }
            }
            else if (type == UIMouseEventType.MouseUp)
            {
                if (!LiveMode)
                {
                    if (CustomControl != null) CustomControl.MouseUp(state);
                    else ObjectHolder.MouseUp(state);
                    return;
                }
                state.UIState.TooltipProperties.Show = false;
                state.UIState.TooltipProperties.Opacity = 0;
                ShowTooltip = false;
                TipIsError = false;
            }
        }
コード例 #41
0
ファイル: UICatalogItem.cs プロジェクト: RHY3756547/FreeSO
 private void MouseEvt(UIMouseEventType type, UpdateState state)
 {
     if (type == UIMouseEventType.MouseDown && OnMouseEvent != null) OnMouseEvent(this); //pass to parents to handle
     if (type == UIMouseEventType.MouseOver) SetHover(true);
     if (type == UIMouseEventType.MouseOut) SetHover(false);
 }
コード例 #42
0
ファイル: UIBlocker.cs プロジェクト: RHY3756547/FreeSO
 private void OnMouse(UIMouseEventType type, UpdateState state)
 {
     if (OnMouseEvt != null) OnMouseEvt(type, state);
 }
コード例 #43
0
 private void OnMouse(UIMouseEventType type, UpdateState state)
 {
 }
コード例 #44
0
        private void OnThumbClick(UIMouseEventType type, UpdateState state)
        {
            switch (type)
            {
                case UIMouseEventType.MouseDown:
                    m_ThumbDown = true;
                    m_ThumbMouseOffset = this.GetMousePosition(state.MouseState);

                    var layout = m_LayoutCache.Calculate("layout", x => CalculateLayout());
                    var buttonPosition = m_LayoutCache.Calculate("btn", x => CalculateButtonPosition(layout));
                    buttonPosition = GlobalPoint(buttonPosition);

                    m_ThumbMouseOffset.X -= buttonPosition.X;
                    m_ThumbMouseOffset.Y -= buttonPosition.Y;
                    break;

                case UIMouseEventType.MouseUp:
                    m_ThumbDown = false;
                    break;
            }
        }
コード例 #45
0
ファイル: PrimitiveBox.cs プロジェクト: RHY3756547/FreeSO
        private void MouseEvents(UIMouseEventType evt, UpdateState state)
        {
            switch (evt)
            {
                case UIMouseEventType.MouseOver:
                    Master.HoverPrim = this;
                    break;
                case UIMouseEventType.MouseOut:
                    if (Master.HoverPrim == this) Master.HoverPrim = null;
                    break;
                case UIMouseEventType.MouseDown:
                    Master.Select(this);

                    if (DoubleClickTime > 0 && Type == PrimBoxType.Primitive && Descriptor is SubroutineDescriptor)
                    {
                        var subD = (SubroutineDescriptor)Descriptor;
                        FSO.Client.Debug.IDEHook.IDE.IDEOpenBHAV(Master.Scope.GetBHAV(subD.PrimID), Master.Scope.Object);
                    }
                    DoubleClickTime = 25;
                    m_doDrag = true;
                    var position = this.GetMousePosition(state.MouseState);
                    m_dragOffsetX = position.X;
                    m_dragOffsetY = position.Y;
                    break;

                case UIMouseEventType.MouseUp:
                    m_doDrag = false; //should probably just release when mouse is up in any case.
                    break;
                default:
                    break;
            }
        }
コード例 #46
0
ファイル: PrimitiveNode.cs プロジェクト: RHY3756547/FreeSO
 private void MouseEvents(UIMouseEventType evt, UpdateState state)
 {
     switch (evt)
     {
         case UIMouseEventType.MouseDown:
             MouseDrag = true;
             break;
     }
 }
コード例 #47
0
ファイル: UITextBox.cs プロジェクト: RHY3756547/FreeSO
        /**
         * Interaction Functionality
         */
        public void OnMouseEvent(UIMouseEventType evt, UpdateState state)
        {
            switch (evt)
            {
                case UIMouseEventType.MouseUp:
                    state.InputManager.SetFocus(this);
                    break;

                case UIMouseEventType.MouseOver:
                    break;

                case UIMouseEventType.MouseOut:
                    break;
            }
        }
コード例 #48
0
ファイル: UIDialog.cs プロジェクト: Daribon/FreeSO
        /// <summary>
        /// Handle mouse events for dragging
        /// </summary>
        /// <param name="evt"></param>
        private void DragMouseEvents(UIMouseEventType evt, UpdateState state)
        {
            switch (evt)
            {
                case UIMouseEventType.MouseDown:
                    /** Start drag **/
                    m_doDrag = true;
                    var position = this.GetMousePosition(state.MouseState);

                    m_dragOffsetX = position.X;
                    m_dragOffsetY = position.Y;
                    break;

                case UIMouseEventType.MouseUp:
                    /** Stop drag **/
                    m_doDrag = false;
                    break;
            }
        }
コード例 #49
0
 private void OnMouse(UIMouseEventType type, UpdateState state)
 {
     if (type == UIMouseEventType.MouseOver)
     {
         if (QueryPanel.Mode == 1) QueryPanel.Active = false;
         MouseIsOn = true;
     }
     else if (type == UIMouseEventType.MouseOut)
     {
         MouseIsOn = false;
         Tooltip = null;
     }
     else if (type == UIMouseEventType.MouseDown)
     {
         if (!LiveMode)
         {
             if (CustomControl != null) CustomControl.MouseDown(state);
             else ObjectHolder.MouseDown(state);
             return;
         }
         if (PieMenu == null)
         {
             //get new pie menu, make new pie menu panel for it
                 if (ObjectHover != 0 && InteractionsAvailable)
                 {
                     HITVM.Get().PlaySoundEvent(UISounds.PieMenuAppear);
                     var obj = vm.GetObjectById(ObjectHover);
                     var menu = obj.GetPieMenu(vm, ActiveEntity);
                     if (menu.Count != 0)
                     {
                         PieMenu = new UIPieMenu(menu, obj, ActiveEntity, this);
                         this.Add(PieMenu);
                         PieMenu.X = state.MouseState.X;
                         PieMenu.Y = state.MouseState.Y;
                         PieMenu.UpdateHeadPosition(state.MouseState.X, state.MouseState.Y);
                     }
                 }
                 else
                 {
                     HITVM.Get().PlaySoundEvent(UISounds.Error);
                     GameFacade.Screens.TooltipProperties.Show = true;
                     GameFacade.Screens.TooltipProperties.Opacity = 1;
                     GameFacade.Screens.TooltipProperties.Position = new Vector2(state.MouseState.X,
                         state.MouseState.Y);
                     GameFacade.Screens.Tooltip = GameFacade.Strings.GetString("159", "0");
                     GameFacade.Screens.TooltipProperties.UpdateDead = false;
                     ShowTooltip = true;
                 }
         }
         else
         {
             PieMenu.RemoveSimScene();
             this.Remove(PieMenu);
             PieMenu = null;
         }
     }
     else if (type == UIMouseEventType.MouseUp)
     {
         if (!LiveMode)
         {
             if (CustomControl != null) CustomControl.MouseUp(state);
             else ObjectHolder.MouseUp(state);
             return;
         }
         GameFacade.Screens.TooltipProperties.Show = false;
         GameFacade.Screens.TooltipProperties.Opacity = 0;
         ShowTooltip = false;
     }
 }
コード例 #50
0
 private void MouseEvt(UIMouseEventType type, UpdateState state)
 {
     if (type == UIMouseEventType.MouseDown) OnMouseEvent(this); //pass to parents to handle
 }
コード例 #51
0
ファイル: CoreGameScreen.cs プロジェクト: RHY3756547/FreeSO
 private void MouseHandler(UIMouseEventType type, UpdateState state)
 {
     if (CityRenderer != null) CityRenderer.UIMouseEvent(type.ToString()); //all the city renderer needs are events telling it if the mouse is over it or not.
     //if the mouse is over it, the city renderer will handle the rest.
 }