namespaces and guest game invitations
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
using AspShogiSockets.Extensions;
|
||||
using Gameboard.Shogi.Api.ServiceModels.Messages;
|
||||
using Gameboard.Shogi.Api.ServiceModels.Messages;
|
||||
using Gameboard.ShogiUI.Sockets.Extensions;
|
||||
using Gameboard.ShogiUI.Sockets.Repositories;
|
||||
using Gameboard.ShogiUI.Sockets.ServiceModels.Socket.Messages;
|
||||
using Gameboard.ShogiUI.Sockets.ServiceModels.Socket.Types;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using System.Net.WebSockets;
|
||||
using System.Threading.Tasks;
|
||||
using Websockets.Repositories;
|
||||
using Websockets.ServiceModels.Messages;
|
||||
using Websockets.ServiceModels.Types;
|
||||
|
||||
namespace Websockets.Managers.ClientActionHandlers
|
||||
namespace Gameboard.ShogiUI.Sockets.Managers.ClientActionHandlers
|
||||
{
|
||||
public class CreateGameHandler : IActionHandler
|
||||
{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System.Net.WebSockets;
|
||||
using Gameboard.ShogiUI.Sockets.ServiceModels.Socket.Types;
|
||||
using System.Net.WebSockets;
|
||||
using System.Threading.Tasks;
|
||||
using Websockets.ServiceModels.Types;
|
||||
|
||||
namespace Websockets.Managers.ClientActionHandlers
|
||||
namespace Gameboard.ShogiUI.Sockets.Managers.ClientActionHandlers
|
||||
{
|
||||
public interface IActionHandler
|
||||
{
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
using AspShogiSockets.Extensions;
|
||||
using Gameboard.Shogi.Api.ServiceModels.Messages;
|
||||
using Gameboard.Shogi.Api.ServiceModels.Messages;
|
||||
using Gameboard.ShogiUI.Sockets.Extensions;
|
||||
using Gameboard.ShogiUI.Sockets.Repositories;
|
||||
using Gameboard.ShogiUI.Sockets.ServiceModels.Socket.Messages;
|
||||
using Gameboard.ShogiUI.Sockets.ServiceModels.Socket.Types;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using System.Net.WebSockets;
|
||||
using System.Threading.Tasks;
|
||||
using Websockets.Repositories;
|
||||
using Websockets.ServiceModels.Messages;
|
||||
using Websockets.ServiceModels.Types;
|
||||
|
||||
namespace Websockets.Managers.ClientActionHandlers
|
||||
namespace Gameboard.ShogiUI.Sockets.Managers.ClientActionHandlers
|
||||
{
|
||||
public class JoinByCodeHandler : IActionHandler
|
||||
{
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
using Gameboard.Shogi.Api.ServiceModels.Messages;
|
||||
using Gameboard.ShogiUI.Sockets.Repositories;
|
||||
using Gameboard.ShogiUI.Sockets.ServiceModels.Socket.Messages;
|
||||
using Gameboard.ShogiUI.Sockets.ServiceModels.Socket.Types;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using System.Net.WebSockets;
|
||||
using System.Threading.Tasks;
|
||||
using Websockets.Repositories;
|
||||
using Websockets.ServiceModels.Messages;
|
||||
using Websockets.ServiceModels.Types;
|
||||
|
||||
namespace Websockets.Managers.ClientActionHandlers
|
||||
namespace Gameboard.ShogiUI.Sockets.Managers.ClientActionHandlers
|
||||
{
|
||||
public class JoinGameHandler : IActionHandler
|
||||
{
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using AspShogiSockets.Extensions;
|
||||
using Gameboard.ShogiUI.Sockets.Extensions;
|
||||
using Gameboard.ShogiUI.Sockets.Repositories;
|
||||
using Gameboard.ShogiUI.Sockets.ServiceModels.Socket.Messages;
|
||||
using Gameboard.ShogiUI.Sockets.ServiceModels.Socket.Types;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net.WebSockets;
|
||||
using System.Threading.Tasks;
|
||||
using Websockets.Repositories;
|
||||
using Websockets.ServiceModels.Messages;
|
||||
using Websockets.ServiceModels.Types;
|
||||
|
||||
namespace Websockets.Managers.ClientActionHandlers
|
||||
namespace Gameboard.ShogiUI.Sockets.Managers.ClientActionHandlers
|
||||
{
|
||||
public class ListGamesHandler : IActionHandler
|
||||
{
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using AspShogiSockets.Extensions;
|
||||
using Gameboard.ShogiUI.Sockets.Extensions;
|
||||
using Gameboard.ShogiUI.Sockets.Managers.Utility;
|
||||
using Gameboard.ShogiUI.Sockets.Repositories;
|
||||
using Gameboard.ShogiUI.Sockets.ServiceModels.Socket.Messages;
|
||||
using Gameboard.ShogiUI.Sockets.ServiceModels.Socket.Types;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using System.Linq;
|
||||
using System.Net.WebSockets;
|
||||
using System.Threading.Tasks;
|
||||
using Websockets.Managers.Utility;
|
||||
using Websockets.Repositories;
|
||||
using Websockets.ServiceModels.Messages;
|
||||
using Websockets.ServiceModels.Types;
|
||||
|
||||
namespace Websockets.Managers.ClientActionHandlers
|
||||
namespace Gameboard.ShogiUI.Sockets.Managers.ClientActionHandlers
|
||||
{
|
||||
public class LoadGameHandler : IActionHandler
|
||||
{
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using AspShogiSockets.Extensions;
|
||||
using Gameboard.Shogi.Api.ServiceModels.Messages;
|
||||
using Gameboard.Shogi.Api.ServiceModels.Messages;
|
||||
using Gameboard.ShogiUI.Sockets.Extensions;
|
||||
using Gameboard.ShogiUI.Sockets.Managers.Utility;
|
||||
using Gameboard.ShogiUI.Sockets.Repositories;
|
||||
using Gameboard.ShogiUI.Sockets.ServiceModels.Socket.Messages;
|
||||
using Gameboard.ShogiUI.Sockets.ServiceModels.Socket.Types;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using System.Net.WebSockets;
|
||||
using System.Threading.Tasks;
|
||||
using Websockets.Managers.Utility;
|
||||
using Websockets.Repositories;
|
||||
using Websockets.ServiceModels.Messages;
|
||||
using Websockets.ServiceModels.Types;
|
||||
|
||||
namespace Websockets.Managers.ClientActionHandlers
|
||||
namespace Gameboard.ShogiUI.Sockets.Managers.ClientActionHandlers
|
||||
{
|
||||
public class MoveHandler : IActionHandler
|
||||
{
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using AspShogiSockets.Extensions;
|
||||
using AspShogiSockets.Managers.Utility;
|
||||
using Gameboard.ShogiUI.Sockets.Extensions;
|
||||
using Gameboard.ShogiUI.Sockets.Managers.ClientActionHandlers;
|
||||
using Gameboard.ShogiUI.Sockets.Managers.Utility;
|
||||
using Gameboard.ShogiUI.Sockets.ServiceModels.Socket.Types;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
@@ -8,10 +10,8 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.WebSockets;
|
||||
using System.Threading.Tasks;
|
||||
using Websockets.Managers.ClientActionHandlers;
|
||||
using Websockets.ServiceModels.Types;
|
||||
|
||||
namespace Websockets.Managers
|
||||
namespace Gameboard.ShogiUI.Sockets.Managers
|
||||
{
|
||||
public interface ISocketCommunicationManager
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@ using System;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Websockets.Managers
|
||||
namespace Gameboard.ShogiUI.Sockets.Managers
|
||||
{
|
||||
public interface ISocketConnectionManager
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Websockets.Managers
|
||||
namespace Gameboard.ShogiUI.Sockets.Managers
|
||||
{
|
||||
public interface ISocketTokenManager
|
||||
{
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Websockets.ServiceModels.Interfaces;
|
||||
using Gameboard.ShogiUI.Sockets.ServiceModels.Socket.Interfaces;
|
||||
|
||||
namespace Websockets.Managers.Utility
|
||||
namespace Gameboard.ShogiUI.Sockets.Managers.Utility
|
||||
{
|
||||
public class JsonRequest
|
||||
public class JsonRequest
|
||||
{
|
||||
public IRequest Request { get; private set; }
|
||||
public string Json { get; private set; }
|
||||
public JsonRequest(IRequest request, string json)
|
||||
{
|
||||
public IRequest Request { get; private set; }
|
||||
public string Json { get; private set; }
|
||||
public JsonRequest(IRequest request, string json)
|
||||
{
|
||||
Request = request;
|
||||
Json = json;
|
||||
}
|
||||
Request = request;
|
||||
Json = json;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,67 +1,67 @@
|
||||
using Microsoft.FSharp.Core;
|
||||
using Websockets.ServiceModels.Types;
|
||||
using Gameboard.ShogiUI.Sockets.ServiceModels.Socket.Types;
|
||||
using Microsoft.FSharp.Core;
|
||||
using GameboardTypes = Gameboard.Shogi.Api.ServiceModels.Types;
|
||||
|
||||
namespace Websockets.Managers.Utility
|
||||
namespace Gameboard.ShogiUI.Sockets.Managers.Utility
|
||||
{
|
||||
public static class Mapper
|
||||
public static class Mapper
|
||||
{
|
||||
public static GameboardTypes.Move Map(Move source)
|
||||
{
|
||||
public static GameboardTypes.Move Map(Move source)
|
||||
{
|
||||
var from = source.From;
|
||||
var to = source.To;
|
||||
FSharpOption<GameboardTypes.PieceName> pieceFromCaptured = source.PieceFromCaptured switch
|
||||
{
|
||||
"B" => new FSharpOption<GameboardTypes.PieceName>(GameboardTypes.PieceName.Bishop),
|
||||
"G" => new FSharpOption<GameboardTypes.PieceName>(GameboardTypes.PieceName.GoldenGeneral),
|
||||
"K" => new FSharpOption<GameboardTypes.PieceName>(GameboardTypes.PieceName.King),
|
||||
"k" => new FSharpOption<GameboardTypes.PieceName>(GameboardTypes.PieceName.Knight),
|
||||
"L" => new FSharpOption<GameboardTypes.PieceName>(GameboardTypes.PieceName.Lance),
|
||||
"P" => new FSharpOption<GameboardTypes.PieceName>(GameboardTypes.PieceName.Pawn),
|
||||
"R" => new FSharpOption<GameboardTypes.PieceName>(GameboardTypes.PieceName.Rook),
|
||||
"S" => new FSharpOption<GameboardTypes.PieceName>(GameboardTypes.PieceName.SilverGeneral),
|
||||
_ => null
|
||||
};
|
||||
var target = new GameboardTypes.Move
|
||||
{
|
||||
Origin = new GameboardTypes.BoardLocation { X = from.X, Y = from.Y },
|
||||
Destination = new GameboardTypes.BoardLocation { X = to.X, Y = to.Y },
|
||||
IsPromotion = source.IsPromotion,
|
||||
PieceFromCaptured = pieceFromCaptured
|
||||
};
|
||||
return target;
|
||||
}
|
||||
|
||||
public static Move Map(GameboardTypes.Move source)
|
||||
{
|
||||
var origin = source.Origin;
|
||||
var destination = source.Destination;
|
||||
string pieceFromCaptured = null;
|
||||
if (source.PieceFromCaptured != null)
|
||||
{
|
||||
pieceFromCaptured = source.PieceFromCaptured.Value switch
|
||||
{
|
||||
GameboardTypes.PieceName.Bishop => "B",
|
||||
GameboardTypes.PieceName.GoldenGeneral => "G",
|
||||
GameboardTypes.PieceName.King => "K",
|
||||
GameboardTypes.PieceName.Knight => "k",
|
||||
GameboardTypes.PieceName.Lance => "L",
|
||||
GameboardTypes.PieceName.Pawn => "P",
|
||||
GameboardTypes.PieceName.Rook => "R",
|
||||
GameboardTypes.PieceName.SilverGeneral => "S",
|
||||
_ => ""
|
||||
};
|
||||
}
|
||||
|
||||
var target = new Move
|
||||
{
|
||||
From = new Coords { X = origin.X, Y = origin.Y },
|
||||
To = new Coords { X = destination.X, Y = destination.Y },
|
||||
IsPromotion = source.IsPromotion,
|
||||
PieceFromCaptured = pieceFromCaptured
|
||||
};
|
||||
|
||||
return target;
|
||||
}
|
||||
var from = source.From;
|
||||
var to = source.To;
|
||||
FSharpOption<GameboardTypes.PieceName> pieceFromCaptured = source.PieceFromCaptured switch
|
||||
{
|
||||
"B" => new FSharpOption<GameboardTypes.PieceName>(GameboardTypes.PieceName.Bishop),
|
||||
"G" => new FSharpOption<GameboardTypes.PieceName>(GameboardTypes.PieceName.GoldenGeneral),
|
||||
"K" => new FSharpOption<GameboardTypes.PieceName>(GameboardTypes.PieceName.King),
|
||||
"k" => new FSharpOption<GameboardTypes.PieceName>(GameboardTypes.PieceName.Knight),
|
||||
"L" => new FSharpOption<GameboardTypes.PieceName>(GameboardTypes.PieceName.Lance),
|
||||
"P" => new FSharpOption<GameboardTypes.PieceName>(GameboardTypes.PieceName.Pawn),
|
||||
"R" => new FSharpOption<GameboardTypes.PieceName>(GameboardTypes.PieceName.Rook),
|
||||
"S" => new FSharpOption<GameboardTypes.PieceName>(GameboardTypes.PieceName.SilverGeneral),
|
||||
_ => null
|
||||
};
|
||||
var target = new GameboardTypes.Move
|
||||
{
|
||||
Origin = new GameboardTypes.BoardLocation { X = from.X, Y = from.Y },
|
||||
Destination = new GameboardTypes.BoardLocation { X = to.X, Y = to.Y },
|
||||
IsPromotion = source.IsPromotion,
|
||||
PieceFromCaptured = pieceFromCaptured
|
||||
};
|
||||
return target;
|
||||
}
|
||||
|
||||
public static Move Map(GameboardTypes.Move source)
|
||||
{
|
||||
var origin = source.Origin;
|
||||
var destination = source.Destination;
|
||||
string pieceFromCaptured = null;
|
||||
if (source.PieceFromCaptured != null)
|
||||
{
|
||||
pieceFromCaptured = source.PieceFromCaptured.Value switch
|
||||
{
|
||||
GameboardTypes.PieceName.Bishop => "B",
|
||||
GameboardTypes.PieceName.GoldenGeneral => "G",
|
||||
GameboardTypes.PieceName.King => "K",
|
||||
GameboardTypes.PieceName.Knight => "k",
|
||||
GameboardTypes.PieceName.Lance => "L",
|
||||
GameboardTypes.PieceName.Pawn => "P",
|
||||
GameboardTypes.PieceName.Rook => "R",
|
||||
GameboardTypes.PieceName.SilverGeneral => "S",
|
||||
_ => ""
|
||||
};
|
||||
}
|
||||
|
||||
var target = new Move
|
||||
{
|
||||
From = new Coords { X = origin.X, Y = origin.Y },
|
||||
To = new Coords { X = destination.X, Y = destination.Y },
|
||||
IsPromotion = source.IsPromotion,
|
||||
PieceFromCaptured = pieceFromCaptured
|
||||
};
|
||||
|
||||
return target;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using Websockets.ServiceModels.Interfaces;
|
||||
using Websockets.ServiceModels.Types;
|
||||
using Gameboard.ShogiUI.Sockets.ServiceModels.Socket.Interfaces;
|
||||
using Gameboard.ShogiUI.Sockets.ServiceModels.Socket.Types;
|
||||
|
||||
namespace AspShogiSockets.Managers.Utility
|
||||
namespace Gameboard.ShogiUI.Sockets.Managers.Utility
|
||||
{
|
||||
public class Request : IRequest
|
||||
{
|
||||
public ClientAction Action { get; set; }
|
||||
public string PlayerName { get; set; }
|
||||
}
|
||||
public class Request : IRequest
|
||||
{
|
||||
public ClientAction Action { get; set; }
|
||||
public string PlayerName { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user