초기커밋
This commit is contained in:
154
GameServer/z.Backup/LandManager.cs
Normal file
154
GameServer/z.Backup/LandManager.cs
Normal file
@@ -0,0 +1,154 @@
|
||||
//using System;
|
||||
//using System.Collections.Concurrent;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Diagnostics.CodeAnalysis;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
//using ServerCore; using ServerBase;
|
||||
//using ServerCommon;
|
||||
//using Nettention.Proud;
|
||||
//using System.ComponentModel.DataAnnotations;
|
||||
//using Amazon.DynamoDBv2.Model;
|
||||
//using Newtonsoft.Json.Bson;
|
||||
|
||||
//namespace GameServer
|
||||
//{
|
||||
// internal class LandManager
|
||||
// {
|
||||
// private static readonly LandManager _instance = new LandManager();
|
||||
// static LandManager() { }
|
||||
// private LandManager() { }
|
||||
// public static LandManager Instance { get { return _instance; } }
|
||||
|
||||
// Dictionary<int, LandEntity> Lands = new Dictionary<int, LandEntity>();
|
||||
|
||||
// public async Task<bool> LoadDB()
|
||||
// {
|
||||
// List<int> landIdList = new();
|
||||
// foreach (var landData in TableData.Instance._LandTable.Values)
|
||||
// {
|
||||
// landIdList.Add(landData.LandId);
|
||||
// }
|
||||
|
||||
// var landEntityList = await GameServerApp.Instance.MainDB.GetLandEntityList(landIdList);
|
||||
// if (landEntityList == null)
|
||||
// {
|
||||
// Log.getLogger().error("entityList == null");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// foreach (var landEntity in landEntityList)
|
||||
// {
|
||||
// if (!TableData.Instance._LandTable.TryGetValue(landEntity.PK_Id, out _))
|
||||
// {
|
||||
// Log.getLogger().error($"Not Exist LandID : {landEntity.PK_Id.ToString()}");
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// if (!Lands.TryAdd(landEntity.PK_Id, landEntity))
|
||||
// {
|
||||
// Log.getLogger().error($"LandManager add fail LandID : {landEntity.PK_Id.ToString()}");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// foreach (var prop in landEntity.Attr.PropInfo)
|
||||
// {
|
||||
// MapManager.Instance.UpdateProp(prop.Key, prop.Value);
|
||||
// }
|
||||
// }
|
||||
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// public void SendInfo(HostID hostId)
|
||||
// {
|
||||
// ClientToGame clientToGame = new ClientToGame();
|
||||
// clientToGame.Message = new ClientToGameMessage();
|
||||
// clientToGame.Message.LandInfoNoti = new ClientToGameMessage.Types.LandInfoNoti();
|
||||
|
||||
// foreach (var land in Lands.Values)
|
||||
// {
|
||||
// LandInfo landInfo = new LandInfo();
|
||||
|
||||
// landInfo.Id = land.PK_Id;
|
||||
// landInfo.Owner = land.Attr.Owner;
|
||||
// landInfo.Name = land.Attr.Name;
|
||||
// landInfo.Description = land.Attr.Description;
|
||||
// landInfo.BuildingId = land.Attr.BuildingId;
|
||||
|
||||
// clientToGame.Message.LandInfoNoti.List.Add(landInfo);
|
||||
// }
|
||||
// GameServer.Instance.Send(hostId, RmiContext.ReliableSend, clientToGame);
|
||||
// }
|
||||
|
||||
// public List<int> GetBuildingIdList()
|
||||
// {
|
||||
// List<int> returnList = new();
|
||||
|
||||
// foreach (var land in Lands.Values)
|
||||
// {
|
||||
// returnList.Add(land.Attr.BuildingId);
|
||||
// }
|
||||
|
||||
// return returnList;
|
||||
// }
|
||||
|
||||
// public bool IsBuildingOnLand(int buildingId)
|
||||
// {
|
||||
// foreach (var land in Lands.Values)
|
||||
// {
|
||||
// if (land.Attr.BuildingId == buildingId)
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// public bool GetLandEntity(int id, [MaybeNullWhen(false)] out LandEntity outEntity)
|
||||
// {
|
||||
// return Lands.TryGetValue(id, out outEntity);
|
||||
// }
|
||||
|
||||
// public bool ExchangeLandProp(int landId, string anchorGuid, string itemGuid, out string? oldItemGuid, [MaybeNullWhen(false)] out LandEntity changedLandEntity)
|
||||
// {
|
||||
// oldItemGuid = null;
|
||||
// changedLandEntity = default;
|
||||
|
||||
// if (!GetLandEntity(landId, out var landEntity))
|
||||
// {
|
||||
// Log.getLogger().error($"Invalid Land Data accountId:{landId}");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// // landEntity.Attr.PropInfo.TryGetValue(anchorGuid, out oldItemGuid);
|
||||
// // landEntity.Attr.PropInfo[anchorGuid] = itemGuid;
|
||||
|
||||
// changedLandEntity = landEntity;
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// public bool ExchangeBuilding(int landId, int buildingId, out int oldBuildingId, [MaybeNullWhen(false)] out LandEntity changedEntity)
|
||||
// {
|
||||
// oldBuildingId = default;
|
||||
// changedEntity = default;
|
||||
|
||||
// if (!GetLandEntity(landId, out var landEntity))
|
||||
// {
|
||||
// Log.getLogger().error($"Invalid Land Data accountId:{landId}");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// oldBuildingId = landEntity.Attr.BuildingId;
|
||||
// landEntity.Attr.BuildingId = buildingId;
|
||||
|
||||
// changedEntity = landEntity;
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// public void RollBackExchangeBuilding(LandEntity changedEntity, int oldBuildingId)
|
||||
// {
|
||||
// changedEntity.Attr.BuildingId = oldBuildingId;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
Reference in New Issue
Block a user