Explorar el Código

Migrate callback to Enum structure

Tigran hace 4 años
padre
commit
a8590c539a
Se han modificado 29 ficheros con 127 adiciones y 351 borrados
  1. 6 3
      MafiaTelegramBot.sln.DotSettings.user
  2. 7 0
      MafiaTelegramBot/Game/GameRoles/Role.cs
  3. 0 9
      MafiaTelegramBot/MafiaTelegramBot.csproj
  4. 4 4
      MafiaTelegramBot/Models/Bot.cs
  5. 10 4
      MafiaTelegramBot/Models/Commands/Command.cs
  6. 2 2
      MafiaTelegramBot/Models/Commands/CustomMessageHandlers/ChangeNicknameHandler.cs
  7. 5 4
      MafiaTelegramBot/Models/Commands/CustomMessageHandlers/CreateRoomHandler.cs
  8. 2 2
      MafiaTelegramBot/Models/Commands/CustomMessageHandlers/EnterPrivateCodeHandler.cs
  9. 1 1
      MafiaTelegramBot/Models/Inlines/ChangeNickNameQuery.cs
  10. 1 1
      MafiaTelegramBot/Models/Inlines/ConnectToPrivateRoomQuery.cs
  11. 1 1
      MafiaTelegramBot/Models/Inlines/ConnectToPublicRoomQuery.cs
  12. 1 1
      MafiaTelegramBot/Models/Inlines/ConnectToSelectedRoomQuery.cs
  13. 3 3
      MafiaTelegramBot/Models/Inlines/MakeExtendedGameQuery.cs
  14. 4 4
      MafiaTelegramBot/Models/Inlines/MakeNormalGameQuery.cs
  15. 2 2
      MafiaTelegramBot/Models/Inlines/MakePrivateRoomQuery.cs
  16. 2 2
      MafiaTelegramBot/Models/Inlines/MakePublicRoomQuery.cs
  17. 6 3
      MafiaTelegramBot/Models/Inlines/Query.cs
  18. 1 1
      MafiaTelegramBot/Models/Inlines/SetPlayersMaximumQuery.cs
  19. 2 2
      MafiaTelegramBot/Models/Inlines/SettingsProfileQuery.cs
  20. 1 1
      MafiaTelegramBot/Models/Inlines/SettingsRoomQuery.cs
  21. 2 2
      MafiaTelegramBot/Models/Inlines/ShopMenuQuery.cs
  22. 2 2
      MafiaTelegramBot/Models/Inlines/ShowMyRolesQuery.cs
  23. 1 1
      MafiaTelegramBot/Models/Replies/Reply.cs
  24. 6 9
      MafiaTelegramBot/Models/UpdateModel.cs
  25. 20 0
      MafiaTelegramBot/Resources/Callback.cs
  26. 23 23
      MafiaTelegramBot/Resources/Keyboards.cs
  27. 12 0
      MafiaTelegramBot/Resources/Roles.cs
  28. 0 198
      MafiaTelegramBot/Resources/callback.Designer.cs
  29. 0 66
      MafiaTelegramBot/Resources/callback.resx

+ 6 - 3
MafiaTelegramBot.sln.DotSettings.user

@@ -1,8 +1,11 @@
 <wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
 	<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=MafiaTelegramBot_002Fappsettings/@EntryIndexedValue">True</s:Boolean>
-	<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=MafiaTelegramBot_002FResources_002Fcallback/@EntryIndexedValue">False</s:Boolean>
-	<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=MafiaTelegramBot_002FResources_002Fkeyboard/@EntryIndexedValue">False</s:Boolean>
-	<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=MafiaTelegramBot_002FResources_002Fstrings/@EntryIndexedValue">True</s:Boolean>
+	
+	<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=MafiaTelegramBot_002FResources_002Fkeyboard/@EntryIndexedValue">True</s:Boolean>
+	
+	
+	
+	<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=MafiaTelegramBot_002FResources_002Fstrings/@EntryIndexedValue">False</s:Boolean>
 	<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=MafiaTelegramBot_002Fstrings/@EntryIndexedValue">True</s:Boolean>
 	
 	<s:Boolean x:Key="/Default/ResxEditorPersonal/Initialized/@EntryValue">True</s:Boolean>

+ 7 - 0
MafiaTelegramBot/Game/GameRoles/Role.cs

@@ -0,0 +1,7 @@
+namespace MafiaTelegramBot.Game.Roles
+{
+    public abstract class Role
+    {
+        protected abstract Resources.Roles RoleKey { get; }
+    }
+}

+ 0 - 9
MafiaTelegramBot/MafiaTelegramBot.csproj

@@ -21,10 +21,6 @@
         <Generator>ResXFileCodeGenerator</Generator>
         <LastGenOutput>keyboard.Designer.cs</LastGenOutput>
       </EmbeddedResource>
-      <EmbeddedResource Update="Resources\callback.resx">
-        <Generator>ResXFileCodeGenerator</Generator>
-        <LastGenOutput>callback.Designer.cs</LastGenOutput>
-      </EmbeddedResource>
     </ItemGroup>
 
     <ItemGroup>
@@ -38,11 +34,6 @@
         <AutoGen>True</AutoGen>
         <DependentUpon>keyboard.resx</DependentUpon>
       </Compile>
-      <Compile Update="Resources\callback.Designer.cs">
-        <DesignTime>True</DesignTime>
-        <AutoGen>True</AutoGen>
-        <DependentUpon>callback.resx</DependentUpon>
-      </Compile>
     </ItemGroup>
 
 </Project>

+ 4 - 4
MafiaTelegramBot/Models/Bot.cs

@@ -61,14 +61,14 @@ namespace MafiaTelegramBot.Models
             //TODO fill inline keyboard array
             _queriesList = new List<Query>
             {
-                new MyRolesQuery(),
-                new ShopQuery(),
+                new ShowMyRolesQuery(),
+                new ShopMenuQuery(),
                 new MakePrivateRoomQuery(),
                 new MakePublicRoomQuery(),
-                new MakeStandartGameQuery(),
+                new MakeNormalGameQuery(),
                 new MakeExtendedGameQuery(),
                 new MakePublicRoomQuery(),
-                new SettingsQuery(),
+                new SettingsProfileQuery(),
                 new ChangeNickNameQuery(),
                 new SettingsRoomQuery(),
                 new ConnectToPrivateRoomQuery(),

+ 10 - 4
MafiaTelegramBot/Models/Commands/Command.cs

@@ -7,14 +7,20 @@ using Telegram.Bot.Types.Enums;
 
 namespace MafiaTelegramBot.Models.Commands
 {
-    public abstract class Command : UpdateModel
+    public abstract class Command : UpdateModel<string>
     {
         private static readonly Dictionary<string, Command> CustomHandlers = new()
         {
-            {"UsersThatChangesNickname", new ChangeNicknameCommand()},
-            {"UsersThatCreatesRoom", new CreateRoomCommand()},
-            {"UserThatEntersPrivateCode", new EnterPrivateRoomCommand()},
+            {"UsersThatChangesNickname", new ChangeNicknameHandler()},
+            {"UsersThatCreatesRoom", new CreateRoomHandler()},
+            {"UserThatEntersPrivateCode", new EnterPrivateCodeHandler()},
         };
+
+        protected override bool IsMatches(string command)
+        {
+            return command == Name;
+        }
+
         public static async Task<Message> Update(Update update)
         {
             var chatId = update.Message.Chat.Id;

+ 2 - 2
MafiaTelegramBot/Models/Commands/CustomMessageHandlers/ChangeNicknameCommand.cs → MafiaTelegramBot/Models/Commands/CustomMessageHandlers/ChangeNicknameHandler.cs

@@ -4,9 +4,9 @@ using Telegram.Bot.Types;
 
 namespace MafiaTelegramBot.Models.Commands.CustomMessageHandlers
 {
-    public class ChangeNicknameCommand : Command
+    public class ChangeNicknameHandler : Command
     {
-        protected override string Name => "ChangeNicknameCommand";
+        protected override string Name => "ChangeNicknameHandler";
 
         protected override async Task<Message> Execute(Update update)
         {

+ 5 - 4
MafiaTelegramBot/Models/Commands/CustomMessageHandlers/CreateRoomCommand.cs → MafiaTelegramBot/Models/Commands/CustomMessageHandlers/CreateRoomHandler.cs

@@ -7,19 +7,20 @@ using Telegram.Bot.Types;
 
 namespace MafiaTelegramBot.Models.Commands.CustomMessageHandlers
 {
-    public class CreateRoomCommand : Command
+    public class CreateRoomHandler : Command
     {
-        protected override string Name => "CreateRoomCommand";
+        protected override string Name => "CreateRoomHandler";
 
         protected override async Task<Message> Execute(Update update)
         {
             var param = Bot.UsersThatCreatesRoom[UserId];
+            var isExtended = param[1] == Callback.MakeExtendedGame.ToString();
             Bot.UsersThatCreatesRoom.Remove(UserId);
             var user = await UserDao.GetUserById(UserId);
             var roomName = update.Message.Text;
             var resultCode = param[0] == "public"
-                ? await RoomController.CreateNewGame(user, roomName, param[1] == callback.extended)
-                : await RoomController.CreateNewGame(user, roomName, param[1] == callback.extended, RoomEncrypter.Encrypt(roomName));
+                ? await RoomController.CreateNewGame(user, roomName, isExtended)
+                : await RoomController.CreateNewGame(user, roomName, isExtended, RoomEncrypter.Encrypt(roomName));
             var result = resultCode == ResultCode.CodeOk
                 ? await Bot.SendWithMarkdown2(ChatId, $"{strings.room_with_name} _*{roomName}*_ {strings.was_created}", Keyboards.OwnerGameMenu)
                 : await Utilities.GetResultCodeMessage(resultCode, ChatId);

+ 2 - 2
MafiaTelegramBot/Models/Commands/CustomMessageHandlers/EnterPrivateRoomCommand.cs → MafiaTelegramBot/Models/Commands/CustomMessageHandlers/EnterPrivateCodeHandler.cs

@@ -6,9 +6,9 @@ using Telegram.Bot.Types;
 
 namespace MafiaTelegramBot.Models.Commands.CustomMessageHandlers
 {
-    public class EnterPrivateRoomCommand : Command
+    public class EnterPrivateCodeHandler : Command
     {
-        protected override string Name => "EnterPrivateRoomCommand";
+        protected override string Name => "EnterPrivateCodeHandler";
 
         protected override async Task<Message> Execute(Update update)
         {

+ 1 - 1
MafiaTelegramBot/Models/Inlines/ChangeNickNameQuery.cs

@@ -6,7 +6,7 @@ namespace MafiaTelegramBot.Models.Inlines
 {
     public class ChangeNickNameQuery : Query
     {
-        protected override string Name => callback.change_nick_name;
+        protected override Callback Name => Callback.ChangeNickName;
 
         protected override async Task<Message> Execute(Update update)
         {

+ 1 - 1
MafiaTelegramBot/Models/Inlines/ConnectToPrivateRoomQuery.cs

@@ -6,7 +6,7 @@ namespace MafiaTelegramBot.Models.Inlines
 {
     public class ConnectToPrivateRoomQuery : Query
     {
-        protected override string Name => callback.connect_to_private_room;
+        protected override Callback Name => Callback.ConnectToPrivateRoom;
 
         protected override async Task<Message> Execute(Update update)
         {

+ 1 - 1
MafiaTelegramBot/Models/Inlines/ConnectToPublicRoomQuery.cs

@@ -7,7 +7,7 @@ namespace MafiaTelegramBot.Models.Inlines
 {
     public class ConnectToPublicRoomQuery : Query
     {
-        protected override string Name => callback.connect_to_public_room;
+        protected override Callback Name => Callback.ConnectToPublicRoom;
 
         protected override async Task<Message> Execute(Update update)
         {

+ 1 - 1
MafiaTelegramBot/Models/Inlines/ConnectToSelectedRoomQuery.cs

@@ -9,7 +9,7 @@ namespace MafiaTelegramBot.Models.Inlines
 {
     public class ConnectToSelectedRoomQuery : Query
     {
-        protected override string Name => callback.connect_to_selected_room;
+        protected override Callback Name => Callback.ConnectToSelectedRoom;
 
         protected override async Task<Message> Execute(Update update)
         {

+ 3 - 3
MafiaTelegramBot/Models/Inlines/MakeExtendedGameQuery.cs

@@ -7,7 +7,7 @@ namespace MafiaTelegramBot.Models.Inlines
 {
     public class MakeExtendedGameQuery : Query
     {
-        protected override string Name => callback.extended;
+        protected override Callback Name => Callback.MakeExtendedGame;
 
         protected override async Task<Message> Execute(Update update)
         {
@@ -17,8 +17,8 @@ namespace MafiaTelegramBot.Models.Inlines
             var user = await UserDao.GetUserById(UserId);
             if (user.GetRoomKey() != "")
                 return await Bot.SendWithMarkdown2(ChatId, strings.user_already_in_game);
-            if (Bot.UsersThatCreatesRoom.TryAdd(UserId, new[] {param[2], Name}))
-                Bot.UsersThatCreatesRoom[UserId] = new[] {param[2], Name};
+            if (Bot.UsersThatCreatesRoom.TryAdd(UserId, new[] {param[2], Name.ToString()}))
+                Bot.UsersThatCreatesRoom[UserId] = new[] {param[2], Name.ToString()};
             return await Bot.SendWithMarkdown2(ChatId, strings.enter_room_name);
         }
     }

+ 4 - 4
MafiaTelegramBot/Models/Inlines/MakeStandartGameQuery.cs → MafiaTelegramBot/Models/Inlines/MakeNormalGameQuery.cs

@@ -5,9 +5,9 @@ using Telegram.Bot.Types;
 
 namespace MafiaTelegramBot.Models.Inlines
 {
-    public class MakeStandartGameQuery : Query
+    public class MakeNormalGameQuery : Query
     {
-        protected override string Name => callback.standart;
+        protected override Callback Name => Callback.MakeNormalGame;
 
         protected override async Task<Message> Execute(Update update)
         {
@@ -17,8 +17,8 @@ namespace MafiaTelegramBot.Models.Inlines
             var user = await UserDao.GetUserById(UserId);
             if (user.GetRoomKey() != "")
                 return await Bot.SendWithMarkdown2(ChatId, strings.user_already_in_game);
-            if (Bot.UsersThatCreatesRoom.TryAdd(UserId, new[] {param[2], Name}))
-                Bot.UsersThatCreatesRoom[UserId] = new[] {param[2], Name};
+            if (Bot.UsersThatCreatesRoom.TryAdd(UserId, new[] {param[2], Name.ToString()}))
+                Bot.UsersThatCreatesRoom[UserId] = new[] {param[2], Name.ToString()};
             return await Bot.SendWithMarkdown2(ChatId, strings.enter_room_name);
         }
     }

+ 2 - 2
MafiaTelegramBot/Models/Inlines/MakePrivateRoomQuery.cs

@@ -7,7 +7,7 @@ namespace MafiaTelegramBot.Models.Inlines
 {
     public class MakePrivateRoomQuery : Query
     {
-        protected override string Name => callback.make_private_room;
+        protected override Callback Name => Callback.MakePrivateRoom;
 
         protected override async Task<Message> Execute(Update update)
         {
@@ -15,7 +15,7 @@ namespace MafiaTelegramBot.Models.Inlines
             var user = await UserDao.GetUserById(UserId);
             if (user.GetRoomKey() != "")
                 return await Bot.SendWithMarkdown2(ChatId, strings.user_already_in_game);
-            return await Bot.SendWithMarkdown2(ChatId, strings.choose_game_type, Keyboards.StandartExtendedKeyboard(UserId, "private"));
+            return await Bot.SendWithMarkdown2(ChatId, strings.choose_game_type, Keyboards.NormalExtendedKeyboard(UserId, "private"));
         }
     }
 }

+ 2 - 2
MafiaTelegramBot/Models/Inlines/MakePublicRoomQuery.cs

@@ -7,7 +7,7 @@ namespace MafiaTelegramBot.Models.Inlines
 {
     public class MakePublicRoomQuery : Query
     {
-        protected override string Name => callback.make_public_room;
+        protected override Callback Name => Callback.MakePublicRoom;
 
         protected override async Task<Message> Execute(Update update)
         { 
@@ -15,7 +15,7 @@ namespace MafiaTelegramBot.Models.Inlines
             var user = await UserDao.GetUserById(UserId);
             if (user.GetRoomKey() != "")
                 return await Bot.SendWithMarkdown2(ChatId, strings.user_already_in_game);
-            return await Bot.SendWithMarkdown2(ChatId, strings.choose_game_type, Keyboards.StandartExtendedKeyboard(UserId, "public"));
+            return await Bot.SendWithMarkdown2(ChatId, strings.choose_game_type, Keyboards.NormalExtendedKeyboard(UserId, "public"));
         }
     }
 }

+ 6 - 3
MafiaTelegramBot/Models/Inlines/Query.cs

@@ -1,15 +1,18 @@
 #nullable enable
 using System.Threading.Tasks;
+using MafiaTelegramBot.Resources;
 using Telegram.Bot.Types;
 using Telegram.Bot.Types.Enums;
+using static System.Enum;
 
 namespace MafiaTelegramBot.Models.Inlines
 {
-    public abstract class Query : UpdateModel
+    public abstract class Query : UpdateModel<Callback>
     {
-        protected override bool Contains(string command)
+        protected override bool IsMatches(string command)
         {
-            return command == Name;
+            if (TryParse(command, out Callback res)) return Name == res;
+            return false;
         }
         public static async Task<Message> Update(Update update)
         {

+ 1 - 1
MafiaTelegramBot/Models/Inlines/SetPlayersMaximumQuery.cs

@@ -8,7 +8,7 @@ namespace MafiaTelegramBot.Models.Inlines
 {
     public class SetPlayersMaximumQuery : Query
     {
-        protected override string Name => callback.set_players_maximum;
+        protected override Callback Name => Callback.SetPlayersMaximum;
 
         protected override async Task<Message> Execute(Update update)
         {

+ 2 - 2
MafiaTelegramBot/Models/Inlines/SettingsQuery.cs → MafiaTelegramBot/Models/Inlines/SettingsProfileQuery.cs

@@ -5,9 +5,9 @@ using Telegram.Bot.Types;
 
 namespace MafiaTelegramBot.Models.Inlines
 {
-    public class SettingsQuery : Query
+    public class SettingsProfileQuery : Query
     {
-        protected override string Name => callback.settings_profile;
+        protected override Callback Name => Callback.SettingsProfile;
 
         protected override async Task<Message> Execute(Update update)
         {

+ 1 - 1
MafiaTelegramBot/Models/Inlines/SettingsRoomQuery.cs

@@ -6,7 +6,7 @@ namespace MafiaTelegramBot.Models.Inlines
 {
     public class SettingsRoomQuery : Query
     {
-        protected override string Name => callback.settings_room;
+        protected override Callback Name => Callback.SettingsRoom;
 
         protected override async Task<Message> Execute(Update update)
         {

+ 2 - 2
MafiaTelegramBot/Models/Inlines/ShopQuery.cs → MafiaTelegramBot/Models/Inlines/ShopMenuQuery.cs

@@ -4,9 +4,9 @@ using Telegram.Bot.Types;
 
 namespace MafiaTelegramBot.Models.Inlines
 {
-    public class ShopQuery : Query
+    public class ShopMenuQuery : Query
     {
-        protected override string Name => callback.shop;
+        protected override Callback Name => Callback.ShopMenu;
 
         protected override async Task<Message> Execute(Update update)
         {

+ 2 - 2
MafiaTelegramBot/Models/Inlines/MyRolesQuery.cs → MafiaTelegramBot/Models/Inlines/ShowMyRolesQuery.cs

@@ -4,9 +4,9 @@ using Telegram.Bot.Types;
 
 namespace MafiaTelegramBot.Models.Inlines
 {
-    public class MyRolesQuery : Query
+    public class ShowMyRolesQuery : Query
     {
-        protected override string Name => callback.my_roles;
+        protected override Callback Name => Callback.ShowMyRoles;
 
         protected override async Task<Message> Execute(Update update)
         {

+ 1 - 1
MafiaTelegramBot/Models/Replies/Reply.cs

@@ -5,7 +5,7 @@ using Telegram.Bot.Types.Enums;
 
 namespace MafiaTelegramBot.Models.Replies
 {
-    public abstract class Reply : UpdateModel
+    public abstract class Reply : UpdateModel<string>
     {
         public static async Task<Message> Update(Update update)
         {

+ 6 - 9
MafiaTelegramBot/Models/UpdateModel.cs

@@ -7,23 +7,20 @@ using Telegram.Bot.Types;
 
 namespace MafiaTelegramBot.Models
 {
-    public abstract class UpdateModel : ICloneable
+    public abstract class UpdateModel<T> : ICloneable
     {
-        protected abstract string Name { get; }
+        protected abstract T Name { get; }
         protected long ChatId { get; private set; }
         protected long UserId { get; private set; }
 
         protected abstract Task<Message> Execute(Update update);
 
-        protected virtual bool Contains(string command)
-        {
-            return command.Contains(Name);
-        }
+        protected abstract bool IsMatches(String command);
 
-        protected static UpdateModel? FirstOrDefault(IReadOnlyList<UpdateModel> list, string data)
+        protected static UpdateModel<T>? FirstOrDefault(IReadOnlyList<UpdateModel<T>> list, string data)
         {
             return (from item in list
-                where item.Contains(data)
+                where item.IsMatches(data)
                 select item).FirstOrDefault();
         }
 
@@ -34,7 +31,7 @@ namespace MafiaTelegramBot.Models
 
         public object? Clone(long chatId, long userId)
         {
-            var clone = (UpdateModel?) MemberwiseClone();
+            var clone = (UpdateModel<T>?) MemberwiseClone();
             if(clone == null) return clone;
             clone.ChatId = chatId;
             clone.UserId = userId;

+ 20 - 0
MafiaTelegramBot/Resources/Callback.cs

@@ -0,0 +1,20 @@
+namespace MafiaTelegramBot.Resources
+{
+    public enum Callback
+    {
+        ChangeNickName,
+        ConnectToPrivateRoom,
+        ConnectToPublicRoom,
+        MakePublicRoom,
+        MakePrivateRoom,
+        MakeExtendedGame,
+        MakeNormalGame,
+        ShopMenu,
+        ShowMyRoles,
+        SettingsProfile,
+        NormalRoomType,
+        SettingsRoom,
+        ConnectToSelectedRoom,
+        SetPlayersMaximum
+    }
+}

+ 23 - 23
MafiaTelegramBot/Resources/Keyboards.cs

@@ -32,8 +32,8 @@ namespace MafiaTelegramBot.Resources
         {
             return new(new[]
             {
-                new[] {InlineKeyboardButton.WithCallbackData(strings.connect_to_public_room, $"{callback.connect_to_public_room}|{userId}")},
-                new[] {InlineKeyboardButton.WithCallbackData(strings.connect_to_private_room, $"{callback.connect_to_private_room}|{userId}")}
+                new[] {InlineKeyboardButton.WithCallbackData(strings.connect_to_public_room, $"{Callback.ConnectToPublicRoom}|{userId}")},
+                new[] {InlineKeyboardButton.WithCallbackData(strings.connect_to_private_room, $"{Callback.ConnectToPrivateRoom}|{userId}")}
             });
         }
 
@@ -41,8 +41,8 @@ namespace MafiaTelegramBot.Resources
         {
             return new(new[]
             {
-                new[] {InlineKeyboardButton.WithCallbackData(strings.make_public_room, $"{callback.make_public_room}|{userId}")},
-                new[] {InlineKeyboardButton.WithCallbackData(strings.make_private_room, $"{callback.make_private_room}|{userId}")}
+                new[] {InlineKeyboardButton.WithCallbackData(strings.make_public_room, $"{Callback.MakePublicRoom}|{userId}")},
+                new[] {InlineKeyboardButton.WithCallbackData(strings.make_private_room, $"{Callback.MakePrivateRoom}|{userId}")}
             });
         }
 
@@ -51,25 +51,25 @@ namespace MafiaTelegramBot.Resources
             return new (new[]
             {
                 new[] {
-                    InlineKeyboardButton.WithCallbackData(strings.minimum_players_count, $"{callback.set_players_maximum}|{userId}|6"),
+                    InlineKeyboardButton.WithCallbackData(strings.minimum_players_count, $"{Callback.SetPlayersMaximum}|{userId}|6"),
                 },
                 new[] {
-                    InlineKeyboardButton.WithCallbackData("7", $"{callback.set_players_maximum}|{userId}|7"),
-                    InlineKeyboardButton.WithCallbackData("8", $"{callback.set_players_maximum}|{userId}|8"),
-                    InlineKeyboardButton.WithCallbackData("9", $"{callback.set_players_maximum}|{userId}|9"),
+                    InlineKeyboardButton.WithCallbackData("7", $"{Callback.SetPlayersMaximum}|{userId}|7"),
+                    InlineKeyboardButton.WithCallbackData("8", $"{Callback.SetPlayersMaximum}|{userId}|8"),
+                    InlineKeyboardButton.WithCallbackData("9", $"{Callback.SetPlayersMaximum}|{userId}|9"),
                 },
                 new[] {
-                    InlineKeyboardButton.WithCallbackData("10", $"{callback.set_players_maximum}|{userId}|10"),
-                    InlineKeyboardButton.WithCallbackData("11", $"{callback.set_players_maximum}|{userId}|11"),
-                    InlineKeyboardButton.WithCallbackData("12", $"{callback.set_players_maximum}|{userId}|12"),
+                    InlineKeyboardButton.WithCallbackData("10", $"{Callback.SetPlayersMaximum}|{userId}|10"),
+                    InlineKeyboardButton.WithCallbackData("11", $"{Callback.SetPlayersMaximum}|{userId}|11"),
+                    InlineKeyboardButton.WithCallbackData("12", $"{Callback.SetPlayersMaximum}|{userId}|12"),
                 },
                 new[] {
-                    InlineKeyboardButton.WithCallbackData("13", $"{callback.set_players_maximum}|{userId}|13"),
-                    InlineKeyboardButton.WithCallbackData("14", $"{callback.set_players_maximum}|{userId}|14"),
-                    InlineKeyboardButton.WithCallbackData("15", $"{callback.set_players_maximum}|{userId}|15"),
+                    InlineKeyboardButton.WithCallbackData("13", $"{Callback.SetPlayersMaximum}|{userId}|13"),
+                    InlineKeyboardButton.WithCallbackData("14", $"{Callback.SetPlayersMaximum}|{userId}|14"),
+                    InlineKeyboardButton.WithCallbackData("15", $"{Callback.SetPlayersMaximum}|{userId}|15"),
                 },
                 new[] {
-                    InlineKeyboardButton.WithCallbackData(strings.maximum_players_count, $"{callback.set_players_maximum}|{userId}|16"),
+                    InlineKeyboardButton.WithCallbackData(strings.maximum_players_count, $"{Callback.SetPlayersMaximum}|{userId}|16"),
                 }
             });
         }
@@ -79,27 +79,27 @@ namespace MafiaTelegramBot.Resources
             return new (new[]
             {
                 new[] {
-                    InlineKeyboardButton.WithCallbackData(strings.shop, $"{callback.shop}|{userId}"),
-                    InlineKeyboardButton.WithCallbackData(strings.my_roles, $"{callback.my_roles}|{userId}")
+                    InlineKeyboardButton.WithCallbackData(strings.shop, $"{Callback.ShopMenu}|{userId}"),
+                    InlineKeyboardButton.WithCallbackData(strings.my_roles, $"{Callback.ShowMyRoles}|{userId}")
                 },
-                new[] {InlineKeyboardButton.WithCallbackData(strings.settings, $"{callback.settings_profile}|{userId}")}
+                new[] {InlineKeyboardButton.WithCallbackData(strings.settings, $"{Callback.SettingsProfile}|{userId}")}
             });
         }
 
-        public static InlineKeyboardMarkup StandartExtendedKeyboard(long userId, string type)
+        public static InlineKeyboardMarkup NormalExtendedKeyboard(long userId, string type)
         {
             return new (new[]
             {
                 new[] {
-                    InlineKeyboardButton.WithCallbackData(strings.standart, $"{callback.standart}|{userId}|{type}"),
-                    InlineKeyboardButton.WithCallbackData(strings.extended, $"{callback.extended}|{userId}|{type}")
+                    InlineKeyboardButton.WithCallbackData(strings.standart, $"{Callback.MakeNormalGame}|{userId}|{type}"),
+                    InlineKeyboardButton.WithCallbackData(strings.extended, $"{Callback.MakeExtendedGame}|{userId}|{type}")
                 }
             });
         }
 
         public static InlineKeyboardMarkup ChangeNameKeyboard(long userId)
         {
-            return new(InlineKeyboardButton.WithCallbackData(strings.change_name, $"{callback.change_nick_name}|{userId}"));
+            return new(InlineKeyboardButton.WithCallbackData(strings.change_name, $"{Callback.ChangeNickName}|{userId}"));
         }
 
         public static InlineKeyboardMarkup RoomsKeyboard(List<GameRoom> rooms, long userId)
@@ -111,7 +111,7 @@ namespace MafiaTelegramBot.Resources
                 {
                     Text =
                         $"{rooms[i].RoomName} ({rooms[i].Players.Values.Count.ToString()}/{rooms[i].MaxPlayers.ToString()})",
-                    CallbackData = $"{callback.connect_to_selected_room}|{userId}|{RoomEncrypter.FullToShort(rooms[i].RoomName)}"
+                    CallbackData = $"{Callback.ConnectToSelectedRoom}|{userId}|{RoomEncrypter.FullToShort(rooms[i].RoomName)}"
                 };
             }
             return new InlineKeyboardMarkup(inlineButtons);

+ 12 - 0
MafiaTelegramBot/Resources/Roles.cs

@@ -0,0 +1,12 @@
+namespace MafiaTelegramBot.Resources
+{
+    public enum Roles
+    {
+        Doctor, //Доктор
+        Mafia, //Мафия
+        Don, //Дон
+        Cop, //Комиссар
+        Villager, //Мирный житель
+        Hooker, //Проститутка
+    }
+}

+ 0 - 198
MafiaTelegramBot/Resources/callback.Designer.cs

@@ -1,198 +0,0 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-//     This code was generated by a tool.
-//     Runtime Version:4.0.30319.42000
-//
-//     Changes to this file may cause incorrect behavior and will be lost if
-//     the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace MafiaTelegramBot.Resources {
-    using System;
-    
-    
-    /// <summary>
-    ///   A strongly-typed resource class, for looking up localized strings, etc.
-    /// </summary>
-    // This class was auto-generated by the StronglyTypedResourceBuilder
-    // class via a tool like ResGen or Visual Studio.
-    // To add or remove a member, edit your .ResX file then rerun ResGen
-    // with the /str option, or rebuild your VS project.
-    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
-    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
-    internal class callback {
-        
-        private static global::System.Resources.ResourceManager resourceMan;
-        
-        private static global::System.Globalization.CultureInfo resourceCulture;
-        
-        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
-        internal callback() {
-        }
-        
-        /// <summary>
-        ///   Returns the cached ResourceManager instance used by this class.
-        /// </summary>
-        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
-        internal static global::System.Resources.ResourceManager ResourceManager {
-            get {
-                if (object.ReferenceEquals(resourceMan, null)) {
-                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MafiaTelegramBot.Resources.callback", typeof(callback).Assembly);
-                    resourceMan = temp;
-                }
-                return resourceMan;
-            }
-        }
-        
-        /// <summary>
-        ///   Overrides the current thread's CurrentUICulture property for all
-        ///   resource lookups using this strongly typed resource class.
-        /// </summary>
-        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
-        internal static global::System.Globalization.CultureInfo Culture {
-            get {
-                return resourceCulture;
-            }
-            set {
-                resourceCulture = value;
-            }
-        }
-        
-        /// <summary>
-        ///   Looks up a localized string similar to change_nick_name.
-        /// </summary>
-        internal static string change_nick_name {
-            get {
-                return ResourceManager.GetString("change_nick_name", resourceCulture);
-            }
-        }
-        
-        /// <summary>
-        ///   Looks up a localized string similar to connect_to_private_room.
-        /// </summary>
-        internal static string connect_to_private_room {
-            get {
-                return ResourceManager.GetString("connect_to_private_room", resourceCulture);
-            }
-        }
-        
-        /// <summary>
-        ///   Looks up a localized string similar to connect_to_public_room.
-        /// </summary>
-        internal static string connect_to_public_room {
-            get {
-                return ResourceManager.GetString("connect_to_public_room", resourceCulture);
-            }
-        }
-        
-        /// <summary>
-        ///   Looks up a localized string similar to connect_to_selected_room.
-        /// </summary>
-        internal static string connect_to_selected_room {
-            get {
-                return ResourceManager.GetString("connect_to_selected_room", resourceCulture);
-            }
-        }
-        
-        /// <summary>
-        ///   Looks up a localized string similar to decrease_number_of_players.
-        /// </summary>
-        internal static string decrease_number_of_players {
-            get {
-                return ResourceManager.GetString("decrease_number_of_players", resourceCulture);
-            }
-        }
-        
-        /// <summary>
-        ///   Looks up a localized string similar to extended.
-        /// </summary>
-        internal static string extended {
-            get {
-                return ResourceManager.GetString("extended", resourceCulture);
-            }
-        }
-        
-        /// <summary>
-        ///   Looks up a localized string similar to increase_number_of_players.
-        /// </summary>
-        internal static string increase_number_of_players {
-            get {
-                return ResourceManager.GetString("increase_number_of_players", resourceCulture);
-            }
-        }
-        
-        /// <summary>
-        ///   Looks up a localized string similar to make_private_room.
-        /// </summary>
-        internal static string make_private_room {
-            get {
-                return ResourceManager.GetString("make_private_room", resourceCulture);
-            }
-        }
-        
-        /// <summary>
-        ///   Looks up a localized string similar to make_public_room.
-        /// </summary>
-        internal static string make_public_room {
-            get {
-                return ResourceManager.GetString("make_public_room", resourceCulture);
-            }
-        }
-        
-        /// <summary>
-        ///   Looks up a localized string similar to my_roles.
-        /// </summary>
-        internal static string my_roles {
-            get {
-                return ResourceManager.GetString("my_roles", resourceCulture);
-            }
-        }
-        
-        /// <summary>
-        ///   Looks up a localized string similar to set_players_maximum.
-        /// </summary>
-        internal static string set_players_maximum {
-            get {
-                return ResourceManager.GetString("set_players_maximum", resourceCulture);
-            }
-        }
-        
-        /// <summary>
-        ///   Looks up a localized string similar to settings_profile.
-        /// </summary>
-        internal static string settings_profile {
-            get {
-                return ResourceManager.GetString("settings_profile", resourceCulture);
-            }
-        }
-        
-        /// <summary>
-        ///   Looks up a localized string similar to settings_room.
-        /// </summary>
-        internal static string settings_room {
-            get {
-                return ResourceManager.GetString("settings_room", resourceCulture);
-            }
-        }
-        
-        /// <summary>
-        ///   Looks up a localized string similar to shop.
-        /// </summary>
-        internal static string shop {
-            get {
-                return ResourceManager.GetString("shop", resourceCulture);
-            }
-        }
-        
-        /// <summary>
-        ///   Looks up a localized string similar to standart.
-        /// </summary>
-        internal static string standart {
-            get {
-                return ResourceManager.GetString("standart", resourceCulture);
-            }
-        }
-    }
-}

+ 0 - 66
MafiaTelegramBot/Resources/callback.resx

@@ -1,66 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<root>
-    <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
-        <xsd:element name="root" msdata:IsDataSet="true">
-            
-        </xsd:element>
-    </xsd:schema>
-    <resheader name="resmimetype">
-        <value>text/microsoft-resx</value>
-    </resheader>
-    <resheader name="version">
-        <value>1.3</value>
-    </resheader>
-    <resheader name="reader">
-        <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
-    </resheader>
-    <resheader name="writer">
-        <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
-    </resheader>
-    <data name="change_nick_name" xml:space="preserve">
-        <value>change_nick_name</value>
-    </data>
-    <data name="connect_to_private_room" xml:space="preserve">
-        <value>connect_to_private_room</value>
-    </data>
-    <data name="decrease_number_of_players" xml:space="preserve">
-        <value>decrease_number_of_players</value>
-    </data>
-    <data name="increase_number_of_players" xml:space="preserve">
-        <value>increase_number_of_players</value>
-    </data>
-    <data name="connect_to_public_room" xml:space="preserve">
-        <value>connect_to_public_room</value>
-    </data>
-    <data name="make_public_room" xml:space="preserve">
-        <value>make_public_room</value>
-    </data>
-    <data name="make_private_room" xml:space="preserve">
-        <value>make_private_room</value>
-    </data>
-    <data name="extended" xml:space="preserve">
-        <value>extended</value>
-    </data>
-    <data name="shop" xml:space="preserve">
-        <value>shop</value>
-    </data>
-    <data name="my_roles" xml:space="preserve">
-        <value>my_roles</value>
-    </data>
-    <data name="settings_profile" xml:space="preserve">
-        <value>settings_profile</value>
-    </data>
-    <data name="standart" xml:space="preserve">
-        <value>standart</value>
-    </data>
-    <data name="settings_room" xml:space="preserve">
-        <value>settings_room</value>
-    </data>
-    <data name="connect_to_selected_room" xml:space="preserve">
-        <value>connect_to_selected_room</value>
-    </data>
-    <data name="set_players_maximum" xml:space="preserve">
-        <value>set_players_maximum</value>
-    </data>
-</root>