1111
This commit is contained in:
@@ -31,8 +31,7 @@ public class GameMapService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public async Task<List<game_city_map>> GetCityMap(int cityId)
|
||||
{
|
||||
@@ -147,6 +146,22 @@ public class GameMapService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
||||
return data;
|
||||
}
|
||||
|
||||
public async Task<UserOnMap> GetUserOnMapInfo(string userId)
|
||||
{
|
||||
var onMap = await GetUserOnMap(userId);
|
||||
var mapInfo = await GetMapInfo(onMap.mapId);
|
||||
var cityInfo = await GetCityInfo((int)mapInfo.cityId);
|
||||
int isOnline =
|
||||
onMap.upTime > (TimeExtend.GetTimeStampBySeconds(DateTime.Now.AddMinutes(0 - GameConfig.OnLineTime)))
|
||||
? 1
|
||||
: 0;
|
||||
return new UserOnMap()
|
||||
{
|
||||
mapId = mapInfo.mapId, mapName = mapInfo.mapName, cityId = cityInfo.cityId, cityName = cityInfo.cityName,
|
||||
isOnline = isOnline
|
||||
};
|
||||
}
|
||||
|
||||
public async Task UpdateUserOnMap(string userId, string ip, string mapId)
|
||||
{
|
||||
unit_user_online onLine = new unit_user_online();
|
||||
@@ -320,7 +335,7 @@ public class GameMapService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
||||
#endregion
|
||||
|
||||
#region 自动寻路
|
||||
|
||||
|
||||
private async Task<List<game_city>> GetCityDataExcludeParent()
|
||||
{
|
||||
string key = string.Format(BaseCache.BaseCacheKeys, "MapPathData", "CityParent");
|
||||
@@ -332,8 +347,10 @@ public class GameMapService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
||||
|
||||
await redis.SetAsync(key, data);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
private async Task<List<game_city_map>> GetAllMaoToData()
|
||||
{
|
||||
string key = string.Format(BaseCache.BaseCacheKeys, "MapPathData", "CityInterCityPortal");
|
||||
@@ -343,7 +360,7 @@ public class GameMapService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
||||
}
|
||||
|
||||
List<game_city_map> result = new List<game_city_map>();
|
||||
|
||||
|
||||
var cityData = await GetCityDataExcludeParent();
|
||||
foreach (var item in cityData)
|
||||
{
|
||||
@@ -356,9 +373,11 @@ public class GameMapService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
await redis.SetAsync(key, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 城市信息
|
||||
/// </summary>
|
||||
@@ -378,7 +397,7 @@ public class GameMapService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
||||
{
|
||||
var cityTemp = new CityNode(city.cityId, city.cityName, new Point((int)mdMap.x, (int)mdMap.y),
|
||||
mdMap.mapName, (int)city.x_s, (int)city.x_e, (int)city.y_s, (int)city.y_e);
|
||||
data.Add(cityTemp);
|
||||
data.Add(cityTemp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -413,8 +432,7 @@ public class GameMapService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 传送点信息
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user