Esempio n. 1
0
        private void HandleHelpListAreaActions(string login, TMAction areaAction)
        {
            if (areaAction.IsAreaAction)
            {
                PagedDialogActions.DefaultDialogAction action = (PagedDialogActions.DefaultDialogAction)areaAction.AreaActionID;

                switch (action)
                {
                case PagedDialogActions.DefaultDialogAction.CloseDialog:
                    GetPluginSettings(login).AreaSettings.Reset((byte)Area.HelpList);
                    SendEmptyManiaLinkPageToLogin(login, HELP_LIST_PANEL_ID);
                    break;

                case PagedDialogActions.DefaultDialogAction.FirstPage:
                    SendHelpListPageToLogin(login, 0);
                    break;

                case PagedDialogActions.DefaultDialogAction.PrevPage:
                    ushort prevPageIndex = Convert.ToUInt16(Math.Max(0, GetAreaSettings(login, (byte)Area.HelpList).CurrentDialogPageIndex - 1));
                    SendHelpListPageToLogin(login, prevPageIndex);
                    break;

                case PagedDialogActions.DefaultDialogAction.NextPage:

                    ushort nextPageIndex = Convert.ToUInt16(GetAreaSettings(login, (byte)Area.HelpList).CurrentDialogPageIndex + 1);
                    SendHelpListPageToLogin(login, nextPageIndex);
                    break;

                case PagedDialogActions.DefaultDialogAction.LastPage:
                    SendHelpListPageToLogin(login, null);
                    break;
                }
            }
            else
            {
                //GuestListRowAction action = (GuestListRowAction)areaAction.RowActionID;

                //switch (action)
                //{
                //    case GuestListRowAction.RemovePlayer:
                //        RemoveGuestListPlayer(login, areaAction.RowIndex);
                //        break;
                //}
            }
        }
Esempio n. 2
0
        private void HandleTopSumsManiaLinkResponse(string login, int playerID, TMAction action)
        {
            if (!action.IsAreaAction)
            {
                return;
            }

            PagedDialogActions.DefaultDialogAction dialogAction = (PagedDialogActions.DefaultDialogAction)action.AreaActionID;

            switch (dialogAction)
            {
            case PagedDialogActions.DefaultDialogAction.CloseDialog:
                GetPluginSettings(login).AreaSettings.Reset((byte)Area.TopSums);
                SendEmptyManiaLinkPageToLogin(login, _topSumsManiaLinkPageID);
                break;

            case PagedDialogActions.DefaultDialogAction.FirstPage:
                SendTopSumsPageToLogin(login, 0);
                break;

            case PagedDialogActions.DefaultDialogAction.PrevPage:
                ushort prevPageIndex = Convert.ToUInt16(Math.Max(0, GetAreaSettings(login, (byte)Area.TopSums).CurrentDialogPageIndex - 1));
                SendTopSumsPageToLogin(login, prevPageIndex);
                break;

            case PagedDialogActions.DefaultDialogAction.NextPage:
                ushort nextPageIndex = Convert.ToUInt16(GetAreaSettings(login, (byte)Area.TopSums).CurrentDialogPageIndex + 1);
                SendTopSumsPageToLogin(login, nextPageIndex);
                break;

            case PagedDialogActions.DefaultDialogAction.LastPage:
                uint   topRanksCount = HostPlugin.RankingAdapter.GetTopRankingsCount();
                ushort lastPageIndex = Convert.ToUInt16(Math.Max(0, Math.Ceiling((double)topRanksCount / TopSumsSettings.MaxEntriesPerPage) - 1));
                SendTopSumsPageToLogin(login, lastPageIndex);
                break;
            }
        }
Esempio n. 3
0
        private void HandleLivePlayersAreaActions(string login, TMAction areaAction)
        {
            if (areaAction.IsAreaAction)
            {
                PagedDialogActions.DefaultDialogAction action = (PagedDialogActions.DefaultDialogAction)areaAction.AreaActionID;

                switch (action)
                {
                case PagedDialogActions.DefaultDialogAction.CloseDialog:
                    GetPluginSettings(login).AreaSettings.Reset((byte)Area.LivePlayersArea);
                    SendEmptyManiaLinkPageToLogin(login, LIVEPLAYERLIST_PANEL_ID);
                    break;

                case PagedDialogActions.DefaultDialogAction.FirstPage:
                    SendLivePlayerListPageToLogin(login, 0);
                    break;

                case PagedDialogActions.DefaultDialogAction.PrevPage:
                    ushort prevPageIndex = Convert.ToUInt16(Math.Max(0, GetAreaSettings(login, (byte)Area.LivePlayersArea).CurrentDialogPageIndex - 1));
                    SendLivePlayerListPageToLogin(login, prevPageIndex);
                    break;

                case PagedDialogActions.DefaultDialogAction.NextPage:
                    ushort nextPageIndex = Convert.ToUInt16(GetAreaSettings(login, (byte)Area.LivePlayersArea).CurrentDialogPageIndex + 1);
                    SendLivePlayerListPageToLogin(login, nextPageIndex);
                    break;

                case PagedDialogActions.DefaultDialogAction.LastPage:
                    SendLivePlayerListPageToLogin(login, null);
                    break;
                }
            }
            else
            {
                LivePlayerListRowAction action = (LivePlayerListRowAction)areaAction.RowActionID;

                switch (action)
                {
                case LivePlayerListRowAction.WarnPlayer:
                    LivePlayerList_WarnPlayer(login, areaAction.RowIndex);
                    break;

                case LivePlayerListRowAction.KickPlayer:
                    LivePlayerList_KickPlayer(login, areaAction.RowIndex);
                    break;

                case LivePlayerListRowAction.IgnorePlayer:
                    LivePlayerList_IgnorePlayer(login, areaAction.RowIndex);
                    break;

                case LivePlayerListRowAction.UnIgnorePlayer:
                    LivePlayerList_UnIgnorePlayer(login, areaAction.RowIndex);
                    break;

                case LivePlayerListRowAction.BanPlayer:
                    LivePlayerList_AddBannedPlayer(login, areaAction.RowIndex);
                    break;

                case LivePlayerListRowAction.UnBanPlayer:
                    LivePlayerList_RemoveBannedPlayer(login, areaAction.RowIndex);
                    break;

                case LivePlayerListRowAction.BlackListPlayer:
                    LivePlayerList_AddBlackListPlayer(login, areaAction.RowIndex);
                    break;

                case LivePlayerListRowAction.UnBlackListPlayer:
                    LivePlayerList_RemoveBlackListPlayer(login, areaAction.RowIndex);
                    break;

                case LivePlayerListRowAction.AddGuest:
                    LivePlayerList_AddGuestPlayer(login, areaAction.RowIndex);
                    break;

                case LivePlayerListRowAction.RemoveGuest:
                    LivePlayerList_RemoveGuestPlayer(login, areaAction.RowIndex);
                    break;

                case LivePlayerListRowAction.ForceSpectator:
                    LivePlayerList_ForceSpectatorPlayer(login, areaAction.RowIndex);
                    break;
                }
            }
        }