74 lines
2.1 KiB
C#
74 lines
2.1 KiB
C#
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.SignalR;
|
|
using Microsoft.Extensions.Caching.Memory;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using WebAPI.Models.IceBreak;
|
|
|
|
namespace WebAPI.Hubs
|
|
{
|
|
|
|
public class BaseHub : Hub
|
|
{
|
|
//private const string GAME_ROOM_KEY = "GameRooms";
|
|
//private const string GAME_ROOM_ID_KEY = "GameRoomId";
|
|
//private const string PLAYER_INFO_KEY = "GameRoomId";
|
|
//private readonly IMemoryCache memoryCache;
|
|
|
|
//public List<GameRoom> GameRooms
|
|
//{
|
|
// get
|
|
// {
|
|
|
|
// if (memoryCache.Get<List<GameRoom>>(GAME_ROOM_KEY) == null)
|
|
// {
|
|
// memoryCache.Set(GAME_ROOM_KEY, new List<GameRoom>());
|
|
// }
|
|
// return memoryCache.Get<List<GameRoom>>(GAME_ROOM_KEY);
|
|
// }
|
|
// set => memoryCache.Set(GAME_ROOM_KEY, value);
|
|
//}
|
|
|
|
|
|
//public string GameRoomId
|
|
//{
|
|
// get
|
|
// {
|
|
|
|
// if (memoryCache.Get<string>(GAME_ROOM_ID_KEY) == null)
|
|
// {
|
|
// memoryCache.Set(GAME_ROOM_ID_KEY, string.Empty);
|
|
// }
|
|
// return memoryCache.Get<string>(GAME_ROOM_ID_KEY);
|
|
// }
|
|
// set => memoryCache.Set(GAME_ROOM_ID_KEY, value);
|
|
//}
|
|
|
|
|
|
//public GamePlayer PlayerInfo
|
|
//{
|
|
|
|
// get
|
|
// {
|
|
// //this.Context.User
|
|
// var name = HttpContext.Session.GetString("12");
|
|
// if (HttpContext.Session.GetString("PlayerInfo") == null)
|
|
// {
|
|
// HttpContext.Session["PlayerInfo"] = new GamePlayer();
|
|
// }
|
|
// return (GamePlayer)HttpContext.Session["PlayerInfo"];
|
|
// }
|
|
// set => HttpContext.Session["PlayerInfo"] = value;
|
|
//}
|
|
|
|
|
|
|
|
//public BaseHub(IMemoryCache memoryCache)
|
|
//{
|
|
// this.memoryCache = memoryCache;
|
|
//}
|
|
}
|
|
}
|