Exemple #1
0
        public void ProcessMouseMove(int x, int y)
        {
            _ArrowLeftSelected  = CHelper.IsInBounds(RectArrowLeft, x, y) && _Selection > 0;
            _ArrowRightSelected = CHelper.IsInBounds(RectArrowRight, x, y) && _Selection < _Values.Count - 1;

            if (SelectByHovering)
            {
                _SelectAtPos(x, y);
            }
        }
Exemple #2
0
        public Guid TilePlayerID(SMouseEvent mevent)
        {
            foreach (CTile tile in _Tiles)
            {
                if (CHelper.IsInBounds(tile.Avatar.Rect, mevent))
                {
                    return(tile.ProfileID);
                }
            }

            return(Guid.Empty);
        }
Exemple #3
0
        public int TilePlayerNr(SMouseEvent mevent)
        {
            foreach (CTile tile in _Tiles)
            {
                if (CHelper.IsInBounds(tile.Avatar.Rect, mevent))
                {
                    return(tile.ProfileID);
                }
            }

            return(-1);
        }
Exemple #4
0
        public CStatic TilePlayerAvatar(SMouseEvent mevent)
        {
            foreach (CTile tile in _Tiles)
            {
                if (CHelper.IsInBounds(tile.Avatar.Rect, mevent))
                {
                    return(tile.Avatar);
                }
            }

            return(new CStatic(_PartyModeID));
        }
Exemple #5
0
 public override bool IsMouseOverSelectedSong(SMouseEvent mEvent)
 {
     for (int i = 0; i < _Tiles.Count; i++)
     {
         if (!_Tiles[i].Selected)
         {
             continue;
         }
         return(CHelper.IsInBounds(_Tiles[i].Rect, mEvent) || CHelper.IsInBounds(_Texts[i].Rect, mEvent));
     }
     return(false);
 }
Exemple #6
0
        public bool IsOverTile(SMouseEvent mevent)
        {
            bool isOver = false;

            foreach (CTile tile in _Tiles)
            {
                if (CHelper.IsInBounds(tile.Avatar.Rect, mevent))
                {
                    isOver = true;
                }
            }
            return(isOver);
        }
Exemple #7
0
        private void _SelectAtPos(int x, int y)
        {
            if (_NeedsRevalidate)
            {
                _Revalidate();
            }
            int index = _VisibleElements.FindIndex(el => CHelper.IsInBounds(el.Bounds, x, y));

            if (index < 0)
            {
                return;
            }
            Selection = index + _GetCurOffset();
        }
Exemple #8
0
        private bool _IsMouseOverElement(int x, int y, CInteraction interact)
        {
            bool result = CHelper.IsInBounds(_GetRect(interact), x, y);

            if (result)
            {
                return(true);
            }
            if (interact.Type == EType.SelectSlide)
            {
                return(CHelper.IsInBounds(_SelectSlides[interact.Num].RectArrowLeft, x, y) ||
                       CHelper.IsInBounds(_SelectSlides[interact.Num].RectArrowRight, x, y));
            }
            return(false);
        }
Exemple #9
0
        public void HandleMouse(SMouseEvent mevent)
        {
            for (int i = 0; i < _Tiles.Count; i++)
            {
                if (CHelper.IsInBounds(_Tiles[i].Avatar.Rect, mevent))
                {
                    _ActualSelection = i;

                    if (Offset * _Tiles.Count + _ActualSelection < _VisibleProfiles.Count)
                    {
                        Selection = _VisibleProfiles[Offset * _Tiles.Count + _ActualSelection];
                    }
                    else
                    {
                        Selection = -1;
                    }
                }
            }
        }
Exemple #10
0
        public void HandleMouse(SMouseEvent mevent)
        {
            for (int i = 0; i < _Tiles.Count; i++)
            {
                if (CHelper.IsInBounds(_Tiles[i].Avatar.Rect, mevent) && _Tiles[i].ProfileID != Guid.Empty)
                {
                    _ActualSelection = i;

                    if (Offset * _Theme.Tiles.NumW + _ActualSelection < _VisibleProfiles.Count)
                    {
                        SelectedID = _VisibleProfiles.ElementAt(Offset * _Theme.Tiles.NumW + _ActualSelection);
                    }
                    else
                    {
                        SelectedID = Guid.Empty;
                    }
                }
            }
        }
Exemple #11
0
 public override bool HandleMouse(MouseEvent MouseEvent)
 {
     base.HandleMouse(MouseEvent);
     if (MouseEvent.LB)
     {
         SaveConfig();
         return(true);
     }
     else if (MouseEvent.Wheel > 0 && CHelper.IsInBounds(_ScreenArea, MouseEvent))
     {
         if (SelectSlides[htSelectSlides(SelectSlideVolume)].Selection - MouseEvent.Wheel >= 0)
         {
             SelectSlides[htSelectSlides(SelectSlideVolume)].SetSelectionByValueIndex(SelectSlides[htSelectSlides(SelectSlideVolume)].Selection - MouseEvent.Wheel);
         }
         else if (SelectSlides[htSelectSlides(SelectSlideVolume)].Selection - MouseEvent.Wheel < 0)
         {
             SelectSlides[htSelectSlides(SelectSlideVolume)].SetSelectionByValueIndex(0);
         }
         SaveConfig();
         return(true);
     }
     else if (MouseEvent.Wheel < 0 && CHelper.IsInBounds(_ScreenArea, MouseEvent))
     {
         if (SelectSlides[htSelectSlides(SelectSlideVolume)].Selection - MouseEvent.Wheel < SelectSlides[htSelectSlides(SelectSlideVolume)].NumValues)
         {
             SelectSlides[htSelectSlides(SelectSlideVolume)].SetSelectionByValueIndex(SelectSlides[htSelectSlides(SelectSlideVolume)].Selection - MouseEvent.Wheel);
         }
         else if (SelectSlides[htSelectSlides(SelectSlideVolume)].Selection - MouseEvent.Wheel >= SelectSlides[htSelectSlides(SelectSlideVolume)].NumValues)
         {
             SelectSlides[htSelectSlides(SelectSlideVolume)].SetSelectionByValueIndex(SelectSlides[htSelectSlides(SelectSlideVolume)].NumValues - 1);
         }
         SaveConfig();
         return(true);
     }
     else if (MouseEvent.RB)
     {
         //CGraphics.HidePopup(EPopupScreens.PopupPlayerControl);
         return(false);
     }
     return(true);
 }
Exemple #12
0
 public override bool HandleMouse(SMouseEvent mouseEvent)
 {
     base.HandleMouse(mouseEvent);
     if (mouseEvent.LB)
     {
         _SaveConfig();
         return(true);
     }
     if (mouseEvent.Wheel > 0 && CHelper.IsInBounds(ScreenArea, mouseEvent))
     {
         _SelectSlides[_SelectSlideVolume].Selection = _SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel;
         _SaveConfig();
         return(true);
     }
     if (mouseEvent.Wheel < 0 && CHelper.IsInBounds(ScreenArea, mouseEvent))
     {
         _SelectSlides[_SelectSlideVolume].Selection = _SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel;
         _SaveConfig();
         return(true);
     }
     return(!mouseEvent.RB);
 }
        private bool _IsMouseOver(int x, int y, CInteraction interact)
        {
            switch (interact.Type)
            {
            case EType.TButton:
                if (CHelper.IsInBounds(_Buttons[interact.Num].Rect, x, y))
                {
                    return(true);
                }
                break;

            case EType.TSelectSlide:
                if (CHelper.IsInBounds(_SelectSlides[interact.Num].Rect, x, y) ||
                    CHelper.IsInBounds(_SelectSlides[interact.Num].RectArrowLeft, x, y) ||
                    CHelper.IsInBounds(_SelectSlides[interact.Num].RectArrowRight, x, y))
                {
                    return(true);
                }
                break;
            }
            return(false);
        }
Exemple #14
0
        public void ProcessMouseLBClick(int x, int y)
        {
            _ArrowLeftSelected  = CHelper.IsInBounds(RectArrowLeft, x, y);
            _ArrowRightSelected = CHelper.IsInBounds(RectArrowRight, x, y);

            if (_ArrowLeftSelected)
            {
                PrevValue();
            }

            if (_ArrowRightSelected)
            {
                NextValue();
            }

            for (int i = 0; i < _ValueBounds.Count; i++)
            {
                if (CHelper.IsInBounds(_ValueBounds[i], x, y))
                {
                    int offset = _Selection - (int)_NumVisible / 2;

                    if (_ValueNames.Count - _NumVisible - offset < 0)
                    {
                        offset = _ValueNames.Count - _NumVisible;
                    }

                    if (offset < 0)
                    {
                        offset = 0;
                    }

                    Selection = i + offset;
                    _ValueBounds.Clear();
                    break;
                }
            }
        }
Exemple #15
0
        public override bool HandleMouse(SMouseEvent mouseEvent)
        {
            bool stopSelectingFast = false;

            if (_SelectingFast)
            {
                _NameSelections[_NameSelection].HandleMouse(mouseEvent);
            }
            else
            {
                base.HandleMouse(mouseEvent);
            }

            //Check if LeftButton is hold and Select-Mode inactive
            if (mouseEvent.LBH && _SelectedProfileID == Guid.Empty && !_SelectingFast)
            {
                //Save mouse-coords
                _OldMouseX = mouseEvent.X;
                _OldMouseY = mouseEvent.Y;
                //Check if mouse if over tile
                if (_NameSelections[_NameSelection].IsOverTile(mouseEvent))
                {
                    //Get player-number of tile
                    _SelectedProfileID = _NameSelections[_NameSelection].TilePlayerID(mouseEvent);
                    if (_SelectedProfileID != Guid.Empty)
                    {
                        //Update of Drag/Drop-Texture
                        CStatic selectedPlayer = _NameSelections[_NameSelection].TilePlayerAvatar(mouseEvent);
                        _ChooseAvatarStatic.Visible = true;
                        _ChooseAvatarStatic.MaxRect = selectedPlayer.Rect;
                        _ChooseAvatarStatic.Z       = CSettings.ZNear;
                        _ChooseAvatarStatic.Color   = new SColorF(1, 1, 1, 1);
                        _ChooseAvatarStatic.Texture = selectedPlayer.Texture;
                    }
                }
                else
                {
                    for (int i = 0; i < CGame.NumPlayers; i++)
                    {
                        if (CHelper.IsInBounds(_Statics[_PlayerStatic[i]].Rect, mouseEvent))
                        {
                            _SelectingSwitchNr = i;
                            _SelectedProfileID = CGame.Players[i].ProfileID;
                            //Update of Drag/Drop-Texture
                            CStatic selectedPlayer = _Statics[_PlayerStaticAvatar[i]];
                            _ChooseAvatarStatic.Visible = true;
                            _ChooseAvatarStatic.MaxRect = selectedPlayer.Rect;
                            _ChooseAvatarStatic.Z       = CSettings.ZNear;
                            _ChooseAvatarStatic.Color   = new SColorF(1, 1, 1, 1);
                            _ChooseAvatarStatic.Texture = selectedPlayer.Texture;
                            break;
                        }
                    }
                }
            }

            //Check if LeftButton is hold and Select-Mode active
            if (mouseEvent.LBH && _SelectedProfileID != Guid.Empty && !_SelectingFast)
            {
                //Update coords for Drag/Drop-Texture
                _ChooseAvatarStatic.X += mouseEvent.X - _OldMouseX;
                _ChooseAvatarStatic.Y += mouseEvent.Y - _OldMouseY;
                _OldMouseX             = mouseEvent.X;
                _OldMouseY             = mouseEvent.Y;
            }
            // LeftButton isn't hold anymore, but Select-Mode is still active -> "Drop" of Avatar
            else if (_SelectedProfileID != Guid.Empty && !_SelectingFast)
            {
                //Foreach Drop-Area
                for (int i = 0; i < _PlayerStatic.Length; i++)
                {
                    //Check first, if area is "Active"
                    if (!_Statics[_PlayerStatic[i]].Visible)
                    {
                        continue;
                    }
                    //Check if Mouse is in area
                    if (CHelper.IsInBounds(_Statics[_PlayerStatic[i]].Rect, mouseEvent))
                    {
                        if (_SelectingSwitchNr > -1 && CGame.Players[i].ProfileID != Guid.Empty)
                        {
                            _UpdateSelectedProfile(_SelectingSwitchNr, CGame.Players[i].ProfileID);
                        }
                        else if (_SelectingSwitchNr > -1)
                        {
                            _ResetPlayerSelection(_SelectingSwitchNr);
                        }

                        if (!CProfiles.IsProfileIDValid(_SelectedProfileID))
                        {
                            return(true);
                        }

                        _UpdateSelectedProfile(i, _SelectedProfileID);
                        break;
                    }
                    //Selected player is dropped out of area
                    if (_SelectingSwitchNr > -1)
                    {
                        _ResetPlayerSelection(_SelectingSwitchNr);
                    }
                }
                _SelectingSwitchNr = -1;
                _SelectedProfileID = Guid.Empty;
                //Reset variables
                _ChooseAvatarStatic.Visible = false;
            }

            if (mouseEvent.LB && _SelectingFast)
            {
                if (_NameSelections[_NameSelection].IsOverTile(mouseEvent))
                {
                    //Get player-number of tile
                    _SelectedProfileID = _NameSelections[_NameSelection].TilePlayerID(mouseEvent);
                    if (_SelectedProfileID != Guid.Empty)
                    {
                        if (!CProfiles.IsProfileIDValid(_SelectedProfileID))
                        {
                            return(true);
                        }

                        _UpdateSelectedProfile(_SelectingFastPlayerNr - 1, _SelectedProfileID);

                        _SelectingFastPlayerNr++;
                        if (_SelectingFastPlayerNr <= CGame.NumPlayers)
                        {
                            _NameSelections[_NameSelection].FastSelection(true, _SelectingFastPlayerNr);
                        }
                        else
                        {
                            stopSelectingFast = true;
                        }
                    }
                    else
                    {
                        stopSelectingFast = true;
                    }
                }
            }
            else if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent))
            {
                if (_Buttons[_ButtonBack].Selected)
                {
                    CGraphics.FadeTo(EScreen.Song);
                }
                else if (_Buttons[_ButtonStart].Selected)
                {
                    _StartSong();
                }
                else if (_Buttons[_ButtonNewProfile].Selected)
                {
                    CGraphics.ShowPopup(EPopupScreens.PopupNewPlayer);
                }
                else if (_Buttons["ButtonScrollUp"].Selected)
                {
                    _NameSelections[_NameSelection].UpdateList(_NameSelections[_NameSelection].Offset - 1);
                }
                else if (_Buttons["ButtonScrollDown"].Selected)
                {
                    _NameSelections[_NameSelection].UpdateList(_NameSelections[_NameSelection].Offset + 1);
                }
                else
                {
                    _UpdatePlayerNumber();
                }
                //Update Tiles-List
                _NameSelections[_NameSelection].UpdateList();
            }

            if (mouseEvent.LD && _NameSelections[_NameSelection].IsOverTile(mouseEvent) && !_SelectingFast)
            {
                _SelectedProfileID = _NameSelections[_NameSelection].TilePlayerID(mouseEvent);
                if (_SelectedProfileID != Guid.Empty)
                {
                    for (int i = 0; i < CGame.NumPlayers; i++)
                    {
                        if (CGame.Players[i].ProfileID == Guid.Empty)
                        {
                            if (!CProfiles.IsProfileIDValid(_SelectedProfileID))
                            {
                                return(true);
                            }

                            _UpdateSelectedProfile(i, _SelectedProfileID);
                            break;
                        }
                    }
                }
            }

            if (mouseEvent.RB && _SelectingFast)
            {
                stopSelectingFast = true;
            }
            else if (mouseEvent.RB)
            {
                bool exit = true;
                //Remove profile-selection
                for (int i = 0; i < CConfig.Config.Game.NumPlayers; i++)
                {
                    if (CHelper.IsInBounds(_Statics[_PlayerStatic[i]].Rect, mouseEvent))
                    {
                        _ResetPlayerSelection(i);
                        exit = false;
                    }
                }
                if (exit)
                {
                    CGraphics.FadeTo(EScreen.Song);
                }
            }

            if (mouseEvent.MB && _SelectingFast)
            {
                _SelectingFastPlayerNr++;
                if (_SelectingFastPlayerNr <= CGame.NumPlayers)
                {
                    _NameSelections[_NameSelection].FastSelection(true, _SelectingFastPlayerNr);
                }
                else
                {
                    stopSelectingFast = true;
                }
            }
            else if (mouseEvent.MB)
            {
                _ResetPlayerSelections();
                _SelectingFast           = true;
                _SelectingFastPlayerNr   = 1;
                _SelectingKeyboardActive = true;
                _NameSelections[_NameSelection].FastSelection(true, _SelectingFastPlayerNr);
            }

            //Check mouse-wheel for scrolling
            if (mouseEvent.Wheel != 0)
            {
                if (CHelper.IsInBounds(_NameSelections[_NameSelection].Rect, mouseEvent))
                {
                    int offset = _NameSelections[_NameSelection].Offset + mouseEvent.Wheel;
                    _NameSelections[_NameSelection].UpdateList(offset);
                }
            }

            if (stopSelectingFast)
            {
                _SelectingFast           = false;
                _SelectingFastPlayerNr   = 0;
                _SelectingKeyboardActive = false;
                _NameSelections[_NameSelection].FastSelection(false, -1);
            }
            return(true);
        }
Exemple #16
0
        public override bool HandleMouse(MouseEvent MouseEvent)
        {
            base.HandleMouse(MouseEvent);

            if (DragAndDropActive)
            {
                DragAndDropCover.Rect.X += MouseEvent.X - OldMousePosX;
                DragAndDropCover.Rect.Y += MouseEvent.Y - OldMousePosY;
            }
            OldMousePosX = MouseEvent.X;
            OldMousePosY = MouseEvent.Y;

            if (Playlists[htPlaylists(Playlist)].Visible && Playlists[htPlaylists(Playlist)].IsMouseOver(MouseEvent))
            {
                _PlaylistActive = true;
                Playlists[htPlaylists(Playlist)].Selected = _PlaylistActive;
                SongMenus[htSongMenus(SongMenu)].SetActive(!_PlaylistActive);
                ToggleSongOptions(ESongOptionsView.None);
            }
            else if (CHelper.IsInBounds(SongMenus[htSongMenus(SongMenu)].Rect, MouseEvent.X, MouseEvent.Y))
            {
                _PlaylistActive = false;
                Playlists[htPlaylists(Playlist)].Selected = _PlaylistActive;
                SongMenus[htSongMenus(SongMenu)].SetActive(!_PlaylistActive);
            }


            if (Playlists[htPlaylists(Playlist)].Visible && _PlaylistActive)
            {
                if (Playlists[htPlaylists(Playlist)].HandleMouse(MouseEvent))
                {
                    if (CPlaylists.NumPlaylists != SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistOpen)].NumValues)
                    {
                        UpdatePlaylistNames();
                    }
                    return(true);
                }
            }


            if (MouseEvent.RB)
            {
                if (_SongOptionsActive)
                {
                    ToggleSongOptions(ESongOptionsView.None);
                    return(true);
                }

                if (CSongs.Category < 0)
                {
                    CGraphics.FadeTo(EScreens.ScreenMain);
                    return(true);
                }
            }

            if (MouseEvent.MB)
            {
                if (CSongs.Category != -1)
                {
                    ToggleSongOptions(ESongOptionsView.None);
                    SongMenus[htSongMenus(SongMenu)].SetSelectedSong(CSongs.GetRandomSong());
                    return(true);
                }

                if (CSongs.Category == -1)
                {
                    ToggleSongOptions(ESongOptionsView.None);
                    SongMenus[htSongMenus(SongMenu)].SetSelectedCategory(CSongs.GetRandomCategory());
                    return(true);
                }
            }

            if (MouseEvent.LD)
            {
                if (CSongs.NumVisibleSongs > 0 && SongMenus[htSongMenus(SongMenu)].GetActualSelection() != -1)
                {
                    ToggleSongOptions(ESongOptionsView.None);
                    StartVisibleSong(SongMenus[htSongMenus(SongMenu)].GetActualSelection());
                    return(true);
                }
            }

            SongMenus[htSongMenus(SongMenu)].HandleMouse(ref MouseEvent);

            if (MouseEvent.LB)
            {
                if (IsMouseOver(MouseEvent))
                {
                    if (Buttons[htButtons(ButtonOpenOptions)].Selected)
                    {
                        ToggleSongOptions(ESongOptionsView.General);
                        return(true);
                    }

                    if (Buttons[htButtons(ButtonOptionsClose)].Selected)
                    {
                        ToggleSongOptions(ESongOptionsView.None);
                        return(true);
                    }

                    if (Buttons[htButtons(ButtonOptionsSing)].Selected)
                    {
                        ToggleSongOptions(ESongOptionsView.None);
                        StartSong(SongMenus[htSongMenus(SongMenu)].GetSelectedSong());
                        return(true);
                    }

                    if (Buttons[htButtons(ButtonOptionsPlaylist)].Selected)
                    {
                        ToggleSongOptions(ESongOptionsView.None);
                        OpenAndAddPlaylistAction();
                        return(true);
                    }

                    if (Buttons[htButtons(ButtonOptionsRandom)].Selected)
                    {
                        if (CSongs.Category != -1)
                        {
                            SongMenus[htSongMenus(SongMenu)].SetSelectedSong(CSongs.GetRandomSong());
                            return(true);
                        }
                    }

                    if (Buttons[htButtons(ButtonOptionsRandomCategory)].Selected)
                    {
                        if (CSongs.Category == -1)
                        {
                            SongMenus[htSongMenus(SongMenu)].SetSelectedCategory(CSongs.GetRandomCategory());
                            return(true);
                        }
                    }

                    if (Buttons[htButtons(ButtonOptionsSingAll)].Selected)
                    {
                        ToggleSongOptions(ESongOptionsView.None);
                        StartRandomAllSongs();
                        return(true);
                    }

                    if (Buttons[htButtons(ButtonOptionsSingAllVisible)].Selected)
                    {
                        ToggleSongOptions(ESongOptionsView.None);
                        StartRandomVisibleSongs();
                        return(true);
                    }

                    if (Buttons[htButtons(ButtonOptionsOpenPlaylist)].Selected)
                    {
                        ToggleSongOptions(ESongOptionsView.None);
                        OpenPlaylistAction();
                        return(true);
                    }
                }

                if (CSongs.NumVisibleSongs > 0 && SongMenus[htSongMenus(SongMenu)].GetActualSelection() != -1)
                {
                    if (SongMenus[htSongMenus(SongMenu)].GetSelectedSong() != -1 && !_SongOptionsActive)
                    {
                        ToggleSongOptions(ESongOptionsView.Song);
                        return(true);
                    }
                    else
                    {
                        ToggleSongOptions(ESongOptionsView.None);
                        return(true);
                    }
                }
            }

            if (MouseEvent.LBH)
            {
                if (!DragAndDropActive && Playlists[htPlaylists(Playlist)].Visible && CSongs.NumVisibleSongs > 0 && SongMenus[htSongMenus(SongMenu)].GetActualSelection() != -1)
                {
                    DragAndDropCover        = SongMenus[htSongMenus(SongMenu)].GetSelectedSongCover();
                    DragAndDropCover.Rect.Z = CSettings.zNear;
                    Playlists[htPlaylists(Playlist)].DragAndDropSongID = CSongs.VisibleSongs[SongMenus[htSongMenus(SongMenu)].GetActualSelection()].ID;
                    DragAndDropActive = true;
                    return(true);
                }
            }


            if (!MouseEvent.LBH && DragAndDropActive)
            {
                DragAndDropActive = false;
                Playlists[htPlaylists(Playlist)].DragAndDropSongID = -1;
                return(true);
            }

            return(true);
        }
Exemple #17
0
        public override bool HandleMouse(SMouseEvent mouseEvent)
        {
            bool stopSelectingFast = false;

            if (_SelectingFast)
            {
                _NameSelections[_NameSelection].HandleMouse(mouseEvent);
            }
            else
            {
                base.HandleMouse(mouseEvent);
            }

            //Check if LeftButton is hold and Select-Mode inactive
            if (mouseEvent.LBH && _SelectedProfileID < 0 && !_SelectingFast)
            {
                //Save mouse-coords
                _OldMouseX = mouseEvent.X;
                _OldMouseY = mouseEvent.Y;
                //Check if mouse if over tile
                if (_NameSelections[_NameSelection].IsOverTile(mouseEvent))
                {
                    //Get player-number of tile
                    _SelectedProfileID = _NameSelections[_NameSelection].TilePlayerNr(mouseEvent);
                    if (_SelectedProfileID != -1)
                    {
                        //Update of Drag/Drop-Texture
                        CStatic selectedPlayer = _NameSelections[_NameSelection].TilePlayerAvatar(mouseEvent);
                        _ChooseAvatarStatic.Visible = true;
                        _ChooseAvatarStatic.MaxRect = selectedPlayer.Rect;
                        _ChooseAvatarStatic.Z       = CBase.Settings.GetZNear();
                        _ChooseAvatarStatic.Color   = new SColorF(1, 1, 1, 1);
                        _ChooseAvatarStatic.Texture = selectedPlayer.Texture;
                    }
                }
            }
            //Check if LeftButton is hold and Select-Mode active
            if (mouseEvent.LBH && _SelectedProfileID >= 0 && !_SelectingFast)
            {
                //Update coords for Drag/Drop-Texture
                _ChooseAvatarStatic.X += mouseEvent.X - _OldMouseX;
                _ChooseAvatarStatic.Y += mouseEvent.Y - _OldMouseY;
                _OldMouseX             = mouseEvent.X;
                _OldMouseY             = mouseEvent.Y;
            }
            // LeftButton isn't hold anymore, but Select-Mode is still active -> "Drop" of Avatar
            else if (_SelectedProfileID >= 0 && !_SelectingFast)
            {
                //Check if mouse is in drop-area
                if (CHelper.IsInBounds(_SelectSlides[_SelectSlidePlayer].Rect, mouseEvent))
                {
                    if (!CBase.Profiles.IsProfileIDValid(_SelectedProfileID))
                    {
                        return(true);
                    }

                    _AddPlayer(_CurrentTeam, _SelectedProfileID);
                }

                //Reset variables
                _SelectedProfileID          = -1;
                _ChooseAvatarStatic.Visible = false;
            }
            if (mouseEvent.LB && _SelectingFast)
            {
                if (_NameSelections[_NameSelection].IsOverTile(mouseEvent))
                {
                    //Get player-number of tile
                    _SelectedProfileID = _NameSelections[_NameSelection].TilePlayerNr(mouseEvent);
                    if (_SelectedProfileID != -1)
                    {
                        if (!CBase.Profiles.IsProfileIDValid(_SelectedProfileID))
                        {
                            return(true);
                        }

                        _AddPlayer(_CurrentTeam, _SelectedProfileID);

                        if (!_ChangePlayerNumDynamic && _TeamList[_CurrentTeam].Count == _NumPlayerTeams[_CurrentTeam])
                        {
                            stopSelectingFast = true;
                        }
                        else if (_TeamList[_CurrentTeam].Count == _PartyMode.MaxPlayersPerTeam)
                        {
                            stopSelectingFast = true;
                        }
                    }
                    else
                    {
                        stopSelectingFast = true;
                    }
                }
            }

            else if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent))
            {
                if (_Buttons[_ButtonBack].Selected)
                {
                    Back();
                }

                if (_Buttons[_ButtonNext].Selected)
                {
                    Next();
                }

                if (_Buttons[_ButtonRandom].Selected)
                {
                    _SelectRandom();
                }

                if (_Buttons[_ButtonIncreaseTeams].Selected)
                {
                    IncreaseTeamNum();
                }

                if (_Buttons[_ButtonDecreaseTeams].Selected)
                {
                    DecreaseTeamNum();
                }

                if (_Buttons[_ButtonIncreasePlayer].Selected)
                {
                    IncreasePlayerNum(_CurrentTeam);
                }

                if (_Buttons[_ButtonDecreasePlayer].Selected)
                {
                    DecreasePlayerNum(_CurrentTeam);
                }

                if (_SelectSlides[_SelectSlideTeams].Selected)
                {
                    _OnChangeTeamSlide();
                }

                //Update Tiles-List
                _NameSelections[_NameSelection].UpdateList();
            }

            if (mouseEvent.LD && _NameSelections[_NameSelection].IsOverTile(mouseEvent) && !_SelectingFast)
            {
                _SelectedProfileID = _NameSelections[_NameSelection].TilePlayerNr(mouseEvent);
                if (_SelectedProfileID > -1)
                {
                    if (!CBase.Profiles.IsProfileIDValid(_SelectedProfileID))
                    {
                        return(true);
                    }

                    _AddPlayer(_CurrentTeam, _SelectedProfileID);
                }
            }

            if (mouseEvent.RB && _SelectingFast)
            {
                stopSelectingFast = true;
            }
            else if (mouseEvent.RB)
            {
                bool exit = true;
                if (_SelectSlides[_SelectSlidePlayer].Selected && _TeamList[_CurrentTeam].Count > _SelectSlides[_SelectSlidePlayer].Selection)
                {
                    int currentSelection = _SelectSlides[_SelectSlidePlayer].Selection;
                    int id = _TeamList[_CurrentTeam][currentSelection];
                    _RemovePlayer(_CurrentTeam, id);
                    _UpdatePlayerSlide();
                    exit = false;
                }

                if (exit)
                {
                    Back();
                }
            }

            if (mouseEvent.MB && _SelectingFast)
            {
                if (!_ChangePlayerNumDynamic && _TeamList[_CurrentTeam].Count == _NumPlayerTeams[_CurrentTeam])
                {
                    stopSelectingFast = true;
                }
                else if (_TeamList[_CurrentTeam].Count == _PartyMode.MaxPlayersPerTeam)
                {
                    stopSelectingFast = true;
                }
            }
            else if (mouseEvent.MB)
            {
                _SelectingFast           = true;
                _SelectingFastPlayerNr   = (_CurrentTeam + 1);
                _SelectingKeyboardActive = true;
                _NameSelections[_NameSelection].FastSelection(true, _SelectingFastPlayerNr);
            }

            //Check mouse-wheel for scrolling
            if (mouseEvent.Wheel != 0)
            {
                if (CHelper.IsInBounds(_NameSelections[_NameSelection].Rect, mouseEvent))
                {
                    int offset = _NameSelections[_NameSelection].Offset + mouseEvent.Wheel;
                    _NameSelections[_NameSelection].UpdateList(offset);
                }
            }

            if (stopSelectingFast)
            {
                _SelectingFast           = false;
                _SelectingFastPlayerNr   = 0;
                _SelectingKeyboardActive = false;
                _NameSelections[_NameSelection].FastSelection(false, -1);
            }
            return(true);
        }
Exemple #18
0
        public override bool HandleMouse(MouseEvent MouseEvent)
        {
            base.HandleMouse(MouseEvent);

            //Check if LeftButton is hold and Select-Mode inactive
            if (MouseEvent.LBH && !selectingMouseActive)
            {
                //Save mouse-coords
                OldMouseX = MouseEvent.X;
                OldMouseY = MouseEvent.Y;
                //Check if mouse if over tile
                if (NameSelections[htNameSelections(NameSelection)].isOverTile(MouseEvent))
                {
                    //Get player-number of tile
                    SelectedPlayerNr = NameSelections[htNameSelections(NameSelection)].TilePlayerNr(MouseEvent);
                    if (SelectedPlayerNr != -1)
                    {
                        //Activate mouse-selecting
                        selectingMouseActive = true;

                        //Update of Drag/Drop-Texture
                        CStatic SelectedPlayer = NameSelections[htNameSelections(NameSelection)].TilePlayerAvatar(MouseEvent);
                        chooseAvatarStatic.Visible = true;
                        chooseAvatarStatic.Rect    = SelectedPlayer.Rect;
                        chooseAvatarStatic.Rect.Z  = CSettings.zNear;
                        chooseAvatarStatic.Color   = new SColorF(1, 1, 1, 1);
                        chooseAvatarStatic.Texture = SelectedPlayer.Texture;
                    }
                }
            }

            //Check if LeftButton is hold and Select-Mode active
            if (MouseEvent.LBH && selectingMouseActive)
            {
                //Update coords for Drag/Drop-Texture
                chooseAvatarStatic.Rect.X += (MouseEvent.X - OldMouseX);
                chooseAvatarStatic.Rect.Y += (MouseEvent.Y - OldMouseY);
                OldMouseX = MouseEvent.X;
                OldMouseY = MouseEvent.Y;
            }
            // LeftButton isn't hold anymore, but Selec-Mode is still active -> "Drop" of Avatar
            else if (selectingMouseActive)
            {
                //Check if really a player was selected
                if (SelectedPlayerNr != -1)
                {
                    //Foreach Drop-Area
                    for (int i = 0; i < StaticPlayer.Length; i++)
                    {
                        //Check first, if area is "active"
                        if (Statics[htStatics(StaticPlayer[i])].Visible == true)
                        {
                            //Check if Mouse is in area
                            if (CHelper.IsInBounds(Statics[htStatics(StaticPlayer[i])].Rect, MouseEvent))
                            {
                                //Update Game-infos with new player
                                CGame.Player[i].Name       = CProfiles.Profiles[SelectedPlayerNr].PlayerName;
                                CGame.Player[i].Difficulty = CProfiles.Profiles[SelectedPlayerNr].Difficulty;
                                CGame.Player[i].ProfileID  = SelectedPlayerNr;
                                //Update config for default players.
                                CConfig.Players[i] = CProfiles.Profiles[SelectedPlayerNr].ProfileFile;
                                CConfig.SaveConfig();
                                //Update texture and name
                                Statics[htStatics(StaticPlayerAvatar[i])].Texture = chooseAvatarStatic.Texture;
                                Texts[htTexts(TextPlayer[i])].Text = CProfiles.Profiles[SelectedPlayerNr].PlayerName;
                                //Update profile-warning
                                CheckPlayers();
                                //Update Tiles-List
                                NameSelections[htNameSelections(NameSelection)].UpdateList();
                            }
                        }
                    }
                    SelectedPlayerNr = -1;
                }
                //Reset variables
                selectingMouseActive       = false;
                chooseAvatarStatic.Visible = false;
            }

            if (MouseEvent.LB && IsMouseOver(MouseEvent))
            {
            }

            if (MouseEvent.LB && IsMouseOver(MouseEvent))
            {
                bool processed = false;

                if (!processed && Buttons[htButtons(ButtonBack)].Selected)
                {
                    processed = true;
                    CGraphics.FadeTo(EScreens.ScreenSong);
                }

                if (!processed && Buttons[htButtons(ButtonStart)].Selected)
                {
                    processed = true;
                    StartSong();
                }

                if (!processed)
                {
                    UpdatePlayerNumber();
                }
                //Update Tiles-List
                NameSelections[htNameSelections(NameSelection)].UpdateList();
            }

            if (MouseEvent.RB)
            {
                bool exit = true;
                //Remove profile-selection
                for (int i = 0; i < CConfig.NumPlayer; i++)
                {
                    if (CHelper.IsInBounds(Statics[htStatics(StaticPlayer[i])].Rect, MouseEvent))
                    {
                        CGame.Player[i].ProfileID  = -1;
                        CGame.Player[i].Name       = String.Empty;
                        CGame.Player[i].Difficulty = EGameDifficulty.TR_CONFIG_EASY;
                        //Update config for default players.
                        CConfig.Players[i] = String.Empty;
                        CConfig.SaveConfig();
                        //Update texture and name
                        Statics[htStatics(StaticPlayerAvatar[i])].Texture = OriginalPlayerAvatarTextures[i];
                        Texts[htTexts(TextPlayer[i])].Text = CLanguage.Translate("TR_SCREENNAMES_PLAYER") + " " + (i + 1).ToString();
                        //Update profile-warning
                        CheckPlayers();
                        //Update Tiles-List
                        NameSelections[htNameSelections(NameSelection)].UpdateList();
                        exit = false;
                    }
                }
                if (exit)
                {
                    CGraphics.FadeTo(EScreens.ScreenSong);
                }
            }

            //Check mouse-wheel for scrolling
            if (MouseEvent.Wheel != 0)
            {
                if (CHelper.IsInBounds(NameSelections[htNameSelections(NameSelection)].Rect, MouseEvent))
                {
                    int offset = NameSelections[htNameSelections(NameSelection)]._Offset + MouseEvent.Wheel;
                    NameSelections[htNameSelections(NameSelection)].UpdateList(offset);
                }
            }
            return(true);
        }
Exemple #19
0
 public void ProcessMouseMove(int x, int y)
 {
     _ArrowLeftSelected  = CHelper.IsInBounds(RectArrowLeft, x, y);
     _ArrowRightSelected = CHelper.IsInBounds(RectArrowRight, x, y);
 }
Exemple #20
0
 public void ProcessMouseMove(int x, int y)
 {
     Selected = CHelper.IsInBounds(Rect, x, y);
 }
        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);
                }
            }
        }
Exemple #22
0
        public override bool HandleMouse(SMouseEvent mouseEvent)
        {
            base.HandleMouse(mouseEvent);

            if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent))
            {
                if (!_ExitPopupVisible)
                {
                    if (_Buttons[_ButtonNextRound].Selected)
                    {
                        _PartyMode.Next();
                    }
                    if (_Buttons[_ButtonBack].Selected && _PartyMode.GameData.CurrentRoundNr == 1)
                    {
                        _PartyMode.Back();
                    }
                    if (_Buttons[_ButtonExit].Selected && _PartyMode.GameData.CurrentRoundNr > 1)
                    {
                        _ShowPopup(true);
                    }
                    if (_Buttons[_ButtonPlayerScrollUp].Selected)
                    {
                        _ScrollPlayerTable(-1);
                    }
                    if (_Buttons[_ButtonPlayerScrollDown].Selected)
                    {
                        _ScrollPlayerTable(1);
                    }
                    if (_Buttons[_ButtonRoundsScrollUp].Selected)
                    {
                        _ScrollRoundsTable(-1);
                    }
                    if (_Buttons[_ButtonRoundsScrollDown].Selected)
                    {
                        _ScrollRoundsTable(1);
                    }
                }
                else
                {
                    if (_Buttons[_ButtonPopupYes].Selected)
                    {
                        _EndParty();
                    }
                    if (_Buttons[_ButtonPopupNo].Selected)
                    {
                        _ShowPopup(false);
                    }
                }
            }

            if (mouseEvent.RB)
            {
                if (!_ExitPopupVisible)
                {
                    if (_PartyMode.GameData.CurrentRoundNr == 1)
                    {
                        _PartyMode.Back();
                    }
                    else
                    {
                        _ShowPopup(true);
                    }
                }
                else
                {
                    _ShowPopup(false);
                }
            }

            if (mouseEvent.Wheel != 0)
            {
                if (CHelper.IsInBounds(_RoundsTableScrollArea, mouseEvent))
                {
                    _ScrollRoundsTable(mouseEvent.Wheel);
                }
                if (CHelper.IsInBounds(_PlayerTableScrollArea, mouseEvent))
                {
                    _ScrollPlayerTable(mouseEvent.Wheel);
                }
            }

            return(true);
        }
Exemple #23
0
        private static bool HandleInputs(CKeys keys, CMouse Mouse)
        {
            KeyEvent   KeyEvent        = new KeyEvent();
            MouseEvent MouseEvent      = new MouseEvent();
            KeyEvent   InputKeyEvent   = new KeyEvent();
            MouseEvent InputMouseEvent = new MouseEvent();

            bool PopupPlayerControlAllowed = _CurrentScreen != EScreens.ScreenOptionsRecord && _CurrentScreen != EScreens.ScreenSing &&
                                             _CurrentScreen != EScreens.ScreenSong && _CurrentScreen != EScreens.ScreenCredits;

            bool PopupVolumeControlAllowed = _CurrentScreen != EScreens.ScreenCredits;

            bool Resume               = true;
            bool EventsAvailable      = false;
            bool InputEventsAvailable = CInput.PollKeyEvent(ref InputKeyEvent);

            while ((EventsAvailable = keys.PollEvent(ref KeyEvent)) || InputEventsAvailable)
            {
                if (!EventsAvailable)
                {
                    KeyEvent = InputKeyEvent;
                }

                if (KeyEvent.Key == Keys.Left || KeyEvent.Key == Keys.Right || KeyEvent.Key == Keys.Up || KeyEvent.Key == Keys.Down)
                {
                    CSettings.MouseInactive();
                    _Cursor.FadeOut();
                }

                if (PopupPlayerControlAllowed && KeyEvent.Key == Keys.Tab)
                {
                    if (_CurrentPopupScreen == EPopupScreens.NoPopup && CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON)
                    {
                        ShowPopup(EPopupScreens.PopupPlayerControl);
                    }
                    else
                    {
                        HidePopup(EPopupScreens.PopupPlayerControl);
                    }
                }

                if (KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.F1))
                {
                    CSettings.GameState = EGameState.EditTheme;
                }
                else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.Enter))
                {
                    CSettings.bFullScreen = !CSettings.bFullScreen;
                }
                else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.P))
                {
                    CDraw.MakeScreenShot();
                }
                else
                {
                    if (!_Fading)
                    {
                        bool handled = false;
                        if (_CurrentPopupScreen != EPopupScreens.NoPopup)
                        {
                            handled = _PopupScreens[(int)_CurrentPopupScreen].HandleInput(KeyEvent);
                        }

                        if (!handled)
                        {
                            Resume &= _Screens[(int)_CurrentScreen].HandleInput(KeyEvent);
                        }
                    }
                }

                if (!EventsAvailable)
                {
                    InputEventsAvailable = CInput.PollKeyEvent(ref InputKeyEvent);
                }
            }

            InputEventsAvailable = CInput.PollMouseEvent(ref InputMouseEvent);

            while ((EventsAvailable = Mouse.PollEvent(ref MouseEvent)) || InputEventsAvailable)
            {
                if (!EventsAvailable)
                {
                    MouseEvent = InputMouseEvent;
                }

                if (MouseEvent.Wheel != 0)
                {
                    CSettings.MouseActive();
                    _Cursor.FadeIn();
                }

                UpdateMousePosition(MouseEvent.X, MouseEvent.Y);

                bool isOverPopupPlayerControl = CHelper.IsInBounds(_PopupScreens[(int)EPopupScreens.PopupPlayerControl].ScreenArea, MouseEvent);
                if (PopupPlayerControlAllowed && isOverPopupPlayerControl)
                {
                    if (_CurrentPopupScreen == EPopupScreens.NoPopup && CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON)
                    {
                        ShowPopup(EPopupScreens.PopupPlayerControl);
                    }
                }

                if (!isOverPopupPlayerControl && _CurrentPopupScreen == EPopupScreens.PopupPlayerControl)
                {
                    HidePopup(EPopupScreens.PopupPlayerControl);
                }

                bool isOverPopupVolumeControl = CHelper.IsInBounds(_PopupScreens[(int)EPopupScreens.PopupVolumeControl].ScreenArea, MouseEvent);
                if (PopupVolumeControlAllowed && isOverPopupVolumeControl)
                {
                    if (_CurrentPopupScreen == EPopupScreens.NoPopup)
                    {
                        ShowPopup(EPopupScreens.PopupVolumeControl);
                        _VolumePopupTimer.Reset();
                    }
                }

                if (!isOverPopupVolumeControl && _CurrentPopupScreen == EPopupScreens.PopupVolumeControl)
                {
                    HidePopup(EPopupScreens.PopupVolumeControl);
                    _VolumePopupTimer.Reset();
                }

                bool handled = false;
                if (_CurrentPopupScreen != EPopupScreens.NoPopup)
                {
                    handled = _PopupScreens[(int)_CurrentPopupScreen].HandleMouse(MouseEvent);
                }
                if (handled && _CurrentPopupScreen == EPopupScreens.PopupVolumeControl)
                {
                    _Screens[(int)_CurrentScreen].ApplyVolume();
                }


                if (!handled && !_Fading && (_Cursor.IsActive || MouseEvent.LB || MouseEvent.RB || MouseEvent.MB))
                {
                    Resume &= _Screens[(int)_CurrentScreen].HandleMouse(MouseEvent);
                }

                if (!EventsAvailable)
                {
                    InputEventsAvailable = CInput.PollMouseEvent(ref InputMouseEvent);
                }
            }
            return(Resume);
        }
Exemple #24
0
        public virtual bool IsMouseOverSelectedSong(SMouseEvent mEvent)
        {
            CStatic selCov = GetSelectedSongCover();

            return(selCov != null && CHelper.IsInBounds(selCov.Rect.Scale(SelectedTileZoomFactor), mEvent));
        }
Exemple #25
0
 public void ProcessMouseMove(int x, int y)
 {
     _ArrowLeftSelected  = CHelper.IsInBounds(RectArrowLeft, x, y) && _Selection > 0;
     _ArrowRightSelected = CHelper.IsInBounds(RectArrowRight, x, y) && _Selection < _ValueNames.Count - 1;
 }
        public override bool HandleMouse(ref SMouseEvent mouseEvent, SScreenSongOptions songOptions)
        {
            if (!songOptions.Selection.RandomOnly || (!CBase.Songs.IsInCategory() && songOptions.Selection.CategoryChangeAllowed))
            {
                if (mouseEvent.Wheel != 0 && CHelper.IsInBounds(_ScrollRect, mouseEvent))
                {
                    _UpdateList(_Offset + _NumW * mouseEvent.Wheel);
                }

                int  lastSelection     = _SelectionNr;
                int  i                 = 0;
                bool somethingSelected = false;
                foreach (CStatic tile in _Tiles)
                {
                    if (tile.Texture != _CoverBGTexture && CHelper.IsInBounds(tile.Rect, mouseEvent))
                    {
                        somethingSelected = true;
                        _SelectionNr      = i + _Offset;
                        if (!CBase.Songs.IsInCategory())
                        {
                            _PreviewNr = i + _Offset;
                        }
                        break;
                    }
                    i++;
                }
                //Reset selection only if we moved out of the rect to avoid loosing it when selecting random songs
                if (_MouseWasInRect && !somethingSelected)
                {
                    _SelectionNr = -1;
                }
                if (mouseEvent.Sender == ESender.WiiMote && _SelectionNr != lastSelection && _SelectionNr != -1)
                {
                    CBase.Controller.SetRumble(0.050f);
                }
            }
            _MouseWasInRect = CHelper.IsInBounds(Rect, mouseEvent);

            if (mouseEvent.RB)
            {
                if (CBase.Songs.IsInCategory() && CBase.Songs.GetNumCategories() > 0 && CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON &&
                    songOptions.Selection.CategoryChangeAllowed)
                {
                    _LeaveCategory();
                    return(true);
                }
                if (CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && !songOptions.Selection.PartyMode)
                {
                    CBase.Graphics.FadeTo(EScreen.Main);
                    return(true);
                }
            }
            else if (mouseEvent.LB)
            {
                if (_SelectionNr >= 0 && _MouseWasInRect)
                {
                    if (CBase.Songs.IsInCategory())
                    {
                        if (_PreviewNr == _SelectionNr)
                        {
                            return(false);
                        }
                        _PreviewSelectedSong();
                    }
                    else
                    {
                        EnterSelectedCategory();
                    }
                    return(true);
                }
            }
            return(false);
        }
Exemple #27
0
        public override bool HandleMouse(ref SMouseEvent mouseEvent, SScreenSongOptions songOptions)
        {
            if (!songOptions.Selection.RandomOnly || (!CBase.Songs.IsInCategory() && songOptions.Selection.CategoryChangeAllowed))
            {
                if (mouseEvent.Wheel != 0 && CHelper.IsInBounds(_ScrollRect, mouseEvent))
                {
                    _UpdateList(_Offset + mouseEvent.Wheel);
                    _UpdateTileSelection();
                }

                int lastSelection = _SelectionNr;
            }
            _MouseWasInRect = CHelper.IsInBounds(Rect, mouseEvent);
            if (mouseEvent.LB && !_DragTimer.IsRunning && (CHelper.IsInBounds(_ScrollRect, mouseEvent) || CHelper.IsInBounds(_ScrollBar.Rect, mouseEvent)))
            {
                _DragTimer.Start();
                _OldMouseY  = mouseEvent.Y;
                _DragActive = true;
                return(true);
            }
            else if (mouseEvent.RB)
            {
                if (CBase.Songs.IsInCategory() && CBase.Songs.GetNumCategories() > 0 && CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON &&
                    songOptions.Selection.CategoryChangeAllowed)
                {
                    _LeaveCategory();
                    return(true);
                }
                if (CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && !songOptions.Selection.PartyMode)
                {
                    CBase.Graphics.FadeTo(EScreen.Main);
                    return(true);
                }
            }
            if (mouseEvent.LBH && _DragActive && CHelper.IsInBounds(_ScrollBar.Rect, mouseEvent))
            {
                float ebarpos = mouseEvent.Y - _ScrollBar.Y - (_ScrollBarPointer.H / 2);
                float offset  = ((ebarpos / (_ScrollBar.H - _ScrollBarPointer.H)) * (CBase.Songs.GetNumSongsVisible() - _ListLength));
                _UpdateList((int)offset);
                _UpdateTileSelection();
            }
            else if (mouseEvent.LBH && _DragActive && CHelper.IsInBounds(_ScrollRect, mouseEvent))
            {
                _ListDragDiffY = _OldListDragDiffY + _OldMouseY - mouseEvent.Y;
                while (_ListDragDiffY > _Tile.H / 2)
                {
                    _UpdateList(_Offset + 1);
                    _UpdateTileSelection();
                    _ListDragDiffY -= _Tile.H;
                    _OldMouseY     -= (int)_Tile.H;
                }
                while (_ListDragDiffY < -_Tile.H / 2)
                {
                    _UpdateList(_Offset - 1);
                    _UpdateTileSelection();
                    _ListDragDiffY += _Tile.H;
                    _OldMouseY     += (int)_Tile.H;
                }

                return(true);
            }
            else if (_DragActive && _DragTimer.ElapsedMilliseconds >= 300)
            {
                if (_DragTimer.IsRunning)
                {
                    _DragTimer.Reset();
                }
                //_ListDragDiffY = 0;
                _OldListDragDiffY = _ListDragDiffY;
                _DragActive       = false;

                return(true);
            }
            else if (_DragActive && _ListDragDiffY - _OldListDragDiffY < 25 && _DragTimer.ElapsedMilliseconds < 200 && CHelper.IsInBounds(_ScrollRect, mouseEvent))
            {
                if (_DragTimer.IsRunning)
                {
                    _DragTimer.Reset();
                }
                //_ListDragDiffY = 0;
                _OldListDragDiffY = _ListDragDiffY;
                _DragActive       = false;

                int i = 0;
                foreach (CStatic tile in _Tiles)
                {
                    //create a rect including the cover and text of the song.
                    //(this way mouse over text should make a selection as well)
                    SRectF songRect = new SRectF(tile.Rect.X, tile.Rect.Y, Rect.W, tile.Rect.H, tile.Rect.Z);
                    if (tile.Visible && CHelper.IsInBounds(songRect, mouseEvent))
                    {
                        _SelectionNr = i - _LAdj + _Offset;
                        if (!CBase.Songs.IsInCategory())
                        {
                            _PreviewNr = i - _LAdj + _Offset;
                        }
                        if (_SelectionNr >= _Offset + _Tiles.Count - 2 * _LAdj - 1 || _SelectionNr <= _Offset)
                        {
                            _OldListDragDiffY = _ListDragDiffY = 0;
                        }
                        break;
                    }
                    i++;
                }
                if (_SelectionNr >= 0 && _MouseWasInRect)
                {
                    if (CBase.Songs.IsInCategory())
                    {
                        if (_PreviewNr != _SelectionNr)
                        {
                            _PreviewNr = _SelectionNr;
                            return(true);
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        EnterSelectedCategory();
                        return(true);
                    }
                }
            }
            else
            {
                if (_DragTimer.IsRunning)
                {
                    _DragTimer.Reset();
                }
                //_ListDragDiffY = 0;
                _OldListDragDiffY = _ListDragDiffY;
                _DragActive       = false;

                return(true);
            }
            return(false);
        }