예제 #1
0
        public override void HandleMouse(ref MouseEvent MouseEvent)
        {
            base.HandleMouse(ref MouseEvent);

            int  i             = 0;
            bool sel           = false;
            int  lastselection = _actualSelection;

            foreach (CStatic tile in _Tiles)
            {
                if ((tile.Texture.index != _CoverTexture.index) && CHelper.IsInBounds(tile.Rect, MouseEvent) && !sel)
                {
                    if (MouseEvent.LB || CSongs.Category == -1)
                    {
                        if (_PreviewSelected == i + _Offset)
                        {
                            _Locked = _PreviewSelected;
                        }
                        else
                        {
                            _PreviewSelected = i + _Offset;
                            _Locked          = -1;
                        }
                    }
                    tile.Selected    = true;
                    _actualSelection = i + _Offset;
                    sel = true;
                }
                else
                {
                    tile.Selected = false;
                }
                i++;
            }

            if (MouseEvent.Sender == ESender.WiiMote && _actualSelection != lastselection && _actualSelection != -1)
            {
                CInput.SetRumble(0.050f);
            }

            if (!sel)
            {
                _actualSelection = -1;
            }

            if ((MouseEvent.RB) && (CSongs.NumCategories > 0) && CSongs.Category >= 0 && CSongs.Tabs == EOffOn.TR_CONFIG_ON)
            {
                ShowCategories();
                return;
            }
            else if (MouseEvent.RB && CSongs.Tabs == EOffOn.TR_CONFIG_OFF)
            {
                CGraphics.FadeTo(EScreens.ScreenMain);
            }
            else if (_PreviewSelected != -1 && MouseEvent.LB && CSongs.Category != -1)
            {
                if (CHelper.IsInBounds(_CoverBig.Rect, MouseEvent) || CHelper.IsInBounds(_TextBG.Rect, MouseEvent))
                {
                    _Locked = _PreviewSelected;
                }
            }
            else if ((MouseEvent.LB) && (CSongs.Category == -1))
            {
                foreach (CStatic tile in _Tiles)
                {
                    if ((tile.Texture.index != _CoverTexture.index) && CHelper.IsInBounds(tile.Rect, MouseEvent))
                    {
                        EnterCategory(_PreviewSelected);
                        return;
                    }
                }
            }

            if (MouseEvent.Wheel > 0)
            {
                if (CHelper.IsInBounds(_ScrollRect, MouseEvent))
                {
                    if (CSongs.Category >= 0 && CSongs.NumVisibleSongs > _Offset + _NumW * MouseEvent.Wheel + _NumW * (_NumH - 1) ||
                        CSongs.Category < 0 && CSongs.NumCategories > _Offset + _NumW * MouseEvent.Wheel + _NumW * (_NumH - 1))
                    {
                        _Offset += _NumW * MouseEvent.Wheel;
                        UpdateList(_Offset);
                    }
                }
            }

            if (MouseEvent.Wheel < 0)
            {
                if (CHelper.IsInBounds(_ScrollRect, MouseEvent))
                {
                    _Offset += _NumW * MouseEvent.Wheel;
                    if (_Offset < 0)
                    {
                        _Offset = 0;
                    }
                    UpdateList(_Offset);
                }
            }
        }