250501 커밋

This commit is contained in:
2025-05-01 07:23:28 +09:00
parent 98bb2e3c5c
commit 23176551b7
353 changed files with 9972 additions and 6652 deletions

View File

@@ -0,0 +1,384 @@
using System.Collections.Concurrent;
using Axion.Collections.Concurrent;
using GameServer.Contents.Battle.Log;
using GameServer.Contents.GameMode.Helper;
using GameServer.Contents.GameMode.Manage.PlayManage;
using GameServer.Contents.GameMode.Mode_Battle.Manage;
using MetaAssets;
using Newtonsoft.Json;
using ServerBase;
using ServerCommon;
using ServerCore;
namespace GameServer;
public class GameModeTPSFreeForAll<T> : GameModeTPS where T : ITPSMode
{
T m_tps_mode_data;
public DateTime m_battle_instance_event_start_time { get; private set; } = DateTimeHelper.Current; //실제 이벤트 시작시간
//public DateTime m_battle_instance_load_time { get; } = DateTimeHelper.Current; //이벤트 시작시간과 관계 없이 메모리에 로드 될때의 시간 이 변수가 필요할지 모르겠다.
//kihoon todo : 이거 위치 수정해야됨
//todo : 제네릭으로 받아도 되려나?.. 고민 필요 우선 임시데이터
public Int32 m_pod_combat_reward_group_id = 1;
public Int32 m_pod_combat_ffa_id = 1;
public BattleFFAConfigData m_ffa_config_meta;
public Dictionary<int, BattleFFARewardData> m_ffa_reward_meta = new();
public Int32 m_hot_time_reward = 1;
public Int32 m_round_count = 8;
public ConcurrentHashSet<string /*anchor_guid*/> m_respawn_pos_anchors_meta { get; private set; } = new(); //이건 랜덤 돌릴 일이 잦아서 그냥 들고 있는다...
public ConcurrentDictionary<int /*battle_group_id*/ , HashSet<string>> m_battle_pod_storage_guid_group { get; private set; } = new(); //pod combat을 생성해줄때 필요
public ConcurrentDictionary<int /*battle_group_id*/ , HashSet<string>> m_battle_pickup_pod_guid_group { get; private set; } = new();
public GameModeTPSFreeForAll(T tpsModeData, InstanceRoom instanceRoom) : base(EntityType.GameModeRunRace, instanceRoom)
{
m_tps_mode_data = tpsModeData;
// kihoon todo : 이것도 위치 이동이 필요하다.
if (false == MetaData.Instance._BattleFFAConfigMetaTable.TryGetValue(m_pod_combat_ffa_id, out var configData))
{
var err_msg = $"Not exist Battle Conig Data id : {m_pod_combat_ffa_id}";
Log.getLogger().error(err_msg);
NullReferenceCheckHelper.throwIfNull(configData, () => $"configData is null !!!");
}
m_ffa_config_meta = new BattleFFAConfigData(new BattleFFAConfigDataMutable()
{
Id = configData.Id,
Description = configData.Description,
PlayerRespawnTime = configData.PlayerRespawnTime,
DefaultRoundCount = configData.DefaultRoundCount,
RoundTime = configData.RoundTime,
NextRoundWaitTime = configData.NextRoundWaitTime,
ResultUIWaitTime = configData.ResultUIWaitTime,
GetRewardTime = configData.GetRewardTime,
EntranceClosingTime = configData.EntranceClosingTime,
CurrencyType = configData.CurrencyType,
CurrencyCount = configData.CurrencyCount,
TPSGuideURL = configData.TPSGuideURL
});
}
public override async Task<Result> onInit()
{
Log.getLogger().debug("run race onInit called");
//제너릭 init
await m_tps_mode_data.initTPSMode();
//레이스 모드에 필요한 액션 추가
addFFAEntityAction();
//게임 모드에 필요한 상수값 입력
setDefaultMetaConstants();
await initBattleRoom();
//다 마무리 되면 부모 init 호출
var result = await base.onInit();
Log.getLogger().debug("run race onInit done");
return result;
}
private void addFFAEntityAction()
{
Log.getLogger().debug("FFA addEntityAction called");
//Action 추가
//kihoon todo : 이거 아래 걸로 일부 수정 필요
addEntityAction(new BattleInstanceAction(this));
addEntityAction(new BattleInstanceUpdateAction(this));
addEntityAction(new BattleObjectInteractAction(this));
addEntityAction(new BattleObjectRewardAction(this));
addEntityAction(new FfaGameObjectPodStorageInteractAction(this));
//Attribute 추가
addEntityAttribute(new BattleInstanceSnapshotAttribute(this)); //ㅏkihoon todo : 이거 여기에 넣는게 맞나?
Log.getLogger().debug("FFA addEntityAction done");
}
public async Task<Result> initBattleRoom()
{
var result = new Result();
// instance 정보 추가 등록
var server_logic = GameServerApp.getServerLogic();
var instance_room_storage = new InstanceRoomStorage();
instance_room_storage.Init(server_logic.getRedisDb(), "");
DateTime start_time = DateTimeHelper.Current;
Int32 config_id = 1;
Int32 reward_id = 1;
Int32 hot_time = 1;
Int32 round_count = 8;
var system_battle_event = BattleRoomHelper.getBattleRoomStartTimeByEventId(getRoomId());
if (system_battle_event is null)
{
Log.getLogger().error($"system_battle_event is null!!! : {result.toBasicString()} - instanceRoomId:{getRoomId()}");
}
else
{
start_time = system_battle_event.m_start_time;
config_id = system_battle_event.m_ffa_config_data_id;
reward_id = system_battle_event.m_ffa_reward_group_id;
hot_time = system_battle_event.m_ffa_hot_time;
round_count = system_battle_event.m_round_count;
}
result = await instance_room_storage.setInstanceRoomExtraInfo(getRoomId(), EPlaceType.BattleRoom, start_time); //kihoon todo : 이거 나중에 GameRoom으로 바뀔때 문제 되니까 코드 바꿔야 된다.
if (result.isFail())
{
Log.getLogger().error($"Failed to BattleRoom setInstanceRoomExtraInfo() !!! : {result.toBasicString()} - instanceRoomId:{getRoomId()}");
return result;
}
//Anchor 정보 로드
loadAnchorPos();
//스냅샷 데이터 로드, 없으면 신규 생성
var battle_instance_action = getEntityAction<BattleInstanceAction>();
NullReferenceCheckHelper.throwIfNull(battle_instance_action, () => $"battle_instance_action is null !!!");
var err_msg = string.Empty;
result = await battle_instance_action.loadOrCreateSnapshot();
if (result.isFail())
{
err_msg = $"loadSnapshot error instanceId : {m_instance_room.getInstanceId()}, roomId : {m_instance_room.getMap().m_room_id}";
Log.getLogger().error(err_msg);
return result;
}
Log.getLogger().info($"load Snapshot done instanceId : {m_instance_room.getInstanceId()}, roomId : {m_instance_room.getMap().m_room_id}");
await Task.CompletedTask;
return result;
}
private void loadAnchorPos()
{
foreach (var anchor_info_dict in m_instance_room.getMap().getAnchors())
{
var anchor_guid = anchor_info_dict.Key;
var anchor_info = anchor_info_dict.Value;
if (!MapDataTable.Instance.getAnchor(anchor_guid, out var anchor))
{
Log.getLogger().error($"anchr_guid not MapDataTable.Instance.getAnchor, anchorGuid : {anchor_guid}");
continue;
}
var type = anchor.Type;
var table_id = anchor_info.AnchorProp.TableId;
loadRespawnPos(type, anchor_guid);
loadBattleObjectGroups(type, anchor_guid, table_id);
}
}
private void loadRespawnPos(string type, string anchorGuid)
{
if (!type.Equals(BattleConstant.RESPAWN_POS_ANCHOR_NAME)) return;
if (false == m_respawn_pos_anchors_meta.Add(anchorGuid))
{
Log.getLogger().warn($"respawnPos add fail type : {type}, anchorGuid : {anchorGuid}");
}
Log.getLogger().info($"respawnPos add success type : {type}, anchorGuid : {anchorGuid}");
}
private bool loadBattleObjectGroups(string type, string anchorGuid, Int32 tableID)
{
if (!type.Equals(BattleConstant.BATTLE_OBJECT_GROUP_ANCHOR_NAME)) return true;
if (false == MetaData.Instance._BattleObjectSpawnGroupMetaTable.TryGetValue(tableID, out var battle_object_spawn_meta))
{
Log.getLogger().warn($"battle_object_group add fail type : {type}, anchorGuid : {anchorGuid}, table_id : {tableID}");
return false;
}
var battle_object_id = battle_object_spawn_meta.BattleObjectID;
if (false == MetaData.Instance._BattleObjectMetaTable.TryGetValue(battle_object_id, out var battle_object_meta))
{
Log.getLogger().warn($"battle_object_group add fail type : {type}, anchorGuid : {anchorGuid}, table_id : {tableID}, battle_object_id : {battle_object_id}");
return false;
}
EBattleObjectType object_type = battle_object_meta.ObjectType;
var group_id = battle_object_spawn_meta.GroupID;
if (object_type.Equals(EBattleObjectType.Pod_Combat) && battle_object_meta.Name.Equals(BattleConstant.BATTLE_POD_STORAGE_NAME))
{
loadBattleObjectPodStorageGroup(anchorGuid, group_id);
}
else if (object_type.Equals(EBattleObjectType.Pod_Box))
{
loadBattleObjectPickupPodGroup(anchorGuid, group_id);
}
return true;
}
private void loadBattleObjectPodStorageGroup(string anchorGuid, int groupId)
{
if (false == m_battle_pod_storage_guid_group.ContainsKey(groupId))
{
m_battle_pod_storage_guid_group.TryAdd(groupId, new());
}
if (false == m_battle_pod_storage_guid_group.TryGetValue(groupId, out var poses))
{
Log.getLogger().error($"m_battle_pod_stand_group_pos_meta get fail anchorGuid : {anchorGuid}, group_id : {groupId}");
return;
}
poses.Add(anchorGuid);
Log.getLogger().info($"m_battle_pod_stand_group_pos_meta Add anchorGuid : {anchorGuid}, group_id : {groupId}");
}
private void loadBattleObjectPickupPodGroup(string anchorGuid, int groupId)
{
if (false == m_battle_pickup_pod_guid_group.ContainsKey(groupId))
{
m_battle_pickup_pod_guid_group.TryAdd(groupId, new());
}
if (false == m_battle_pickup_pod_guid_group.TryGetValue(groupId, out var poses))
{
Log.getLogger().error($"m_battle_pod_box_group_pos_meta get fail anchorGuid : {anchorGuid}, group_id : {groupId}");
return;
}
poses.Add(anchorGuid);
Log.getLogger().info($"m_battle_pod_box_group_pos_meta Add anchorGuid : {anchorGuid}, group_id : {groupId}");
}
public void setEventStartTime(DateTime t)
{
m_battle_instance_event_start_time = t;
}
private void setDefaultMetaConstants()
{
m_ticker_interval_msecs = GameModeConstants.GAME_MODE_TPS_FFA_CHECK_INTERVAL_MSECS; //이것도 위로 올릴수 있을것 같은데??
}
public override async Task taskUpdate()
{
//여기에 타이머 처리 해야된다.
var battle_update_action = getEntityAction<BattleInstanceUpdateAction>();
NullReferenceCheckHelper.throwIfNull(battle_update_action, () => $"battle_update_action is null !!!");
var result = await battle_update_action.update();
if (result.isFail())
{
var err_msg = $"playr mode hander update error : {result.toBasicString()}";
Log.getLogger().error(err_msg);
}
await Task.CompletedTask;
}
public override string toBasicString()
{
var basic_string = base.toBasicString() + $"GameModeTPSFreeForAll....";
return basic_string;
}
public async Task removePodCombat(Player player)
{
var attribute = getEntityAttribute<BattleInstanceSnapshotAttribute>();
NullReferenceCheckHelper.throwIfNull(attribute, () => $"attribute is null !!!");
if (attribute.m_combat_pod_mode.m_pod_combat.m_current_occupier_guid.Equals(player.getUserGuid()))
{
using (var releaser = await getAsyncLock())
{
attribute.m_combat_pod_mode.m_pod_combat.changeDropState(player.getCurrentPositionInfo().Pos);
}
var ffa = this as GameModeTPSFreeForAll<GameModeTPSFreeForAllData>;
NullReferenceCheckHelper.throwIfNull(ffa, () => $"ffa is null !!!");
BattleRoomNotifyHelper.broadcast_GS2C_NTF_POD_COMBAT_STATE(ffa); //kihoon todo : 이거 코드 이상하다... 수정해야된다.
}
}
public async Task destroyBattleRoom()
{
await Task.CompletedTask;
//여기서 timer 종료 처리
var entity_ticker = getEntityTicker();
if(entity_ticker is not null) entity_ticker.getCancelToken().Cancel();
Log.getLogger().debug($"battle instance room token canceled m_room_id :{m_instance_room.getMap().m_room_id}");
var fn_save_battle_instance = async delegate()
{
var server_logic = GameServerApp.getServerLogic();
var fn_result = new Result();
using (var releaser = await getAsyncLock())
{
//여기서 battleRoomSnapshot 저장
var battle_instance_snapshot_attribute = getEntityAttribute<BattleInstanceSnapshotAttribute>();
NullReferenceCheckHelper.throwIfNull(battle_instance_snapshot_attribute, () => $"battle_instance_snapshot_attribute is null !!!");
if (!battle_instance_snapshot_attribute.m_combat_pod_mode.m_pod_combat.m_current_occupier_guid.Equals(string.Empty))
{
battle_instance_snapshot_attribute.m_combat_pod_mode.m_pod_combat.m_current_occupier_guid = string.Empty;
}
battle_instance_snapshot_attribute.modifiedEntityAttribute(true);
var batch = new QueryBatchEx<QueryRunnerWithDocument>(this, LogActionType.BattleInstanceSnapshotSave, server_logic.getDynamoDbClient(), true);
{
batch.addQuery(new DBQWriteToAttributeAllWithTransactionRunner());
}
var ffa = this as GameModeTPSFreeForAll<GameModeTPSFreeForAllData>;
NullReferenceCheckHelper.throwIfNull(ffa, () => $"ffa is null !!!");
BattleSnapShotBusinessLog business_log = new(ffa, "");
batch.appendBusinessLog(business_log);
fn_result = await QueryHelper.sendQueryAndBusinessLog(batch);
if (fn_result.isSuccess())
{
Log.getLogger().info($"save battle instance snapshot done attribute : {JsonConvert.SerializeObject(battle_instance_snapshot_attribute)}");
}
}
return fn_result;
};
var result = await runTransactionRunnerSafely(TransactionIdType.PrivateContents, "SaveBattleInstanceByDestroy", fn_save_battle_instance);
if (result.isFail())
{
var err_msg = $"Failed to runTransactionRunnerSafely() !!! : {result.toBasicString()} - {toBasicString()}";
Log.getLogger().error(err_msg);
}
}
}

View File

@@ -0,0 +1,12 @@
namespace GameServer.Contents.GameMode.Mode_Battle.Manage;
public class GameModeTPSFreeForAllData : ITPSMode
{
public async Task<Result> initTPSMode()
{
var result = new Result();
await Task.CompletedTask;
return result;
}
}

View File

@@ -0,0 +1,76 @@
using GameServer.Contents.Battle.Log;
using GameServer.Contents.GameMode.Helper;
using GameServer.Contents.GameMode.Manage.LeaveManage;
using GameServer.Contents.GameMode.Manage.PlayManage;
using GameServer.Contents.GameMode.Mode_Battle.Manage;
using Newtonsoft.Json;
using ServerBase;
using ServerCommon;
using ServerCore;
namespace GameServer.Contents.GameMode.Mode_Battle.ModeFreeForAll.Manage;
public class TPSFreeForAllDestroyHandler : GameModeDestroyHandlerBase
{
public TPSFreeForAllDestroyHandler(string roomId) : base(roomId, GameModeType.TPS_FFA)
{
}
public override async Task<Result> postDestroy(IGameMode gameMode)
{
await Task.CompletedTask;
Log.getLogger().debug($"tps ffa post destroy start roomId :{m_room_id}");
var game_mode_base = GameModeHelper.toGameModeBase(gameMode);
var fn_save_battle_instance = async delegate()
{
var server_logic = GameServerApp.getServerLogic();
var fn_result = new Result();
//여기서 battleRoomSnapshot 저장
var battle_instance_snapshot_attribute = game_mode_base.getEntityAttribute<BattleInstanceSnapshotAttribute>();
NullReferenceCheckHelper.throwIfNull(battle_instance_snapshot_attribute, () => $"battle_instance_snapshot_attribute is null !!!");
if (!battle_instance_snapshot_attribute.m_combat_pod_mode.m_pod_combat.m_current_occupier_guid.Equals(string.Empty))
{
battle_instance_snapshot_attribute.m_combat_pod_mode.m_pod_combat.m_current_occupier_guid = string.Empty;
}
battle_instance_snapshot_attribute.modifiedEntityAttribute(true);
var batch = new QueryBatchEx<QueryRunnerWithDocument>(game_mode_base, LogActionType.BattleInstanceSnapshotSave, server_logic.getDynamoDbClient(), true);
{
batch.addQuery(new DBQWriteToAttributeAllWithTransactionRunner());
}
var ffa = game_mode_base as GameModeTPSFreeForAll<GameModeTPSFreeForAllData>;
NullReferenceCheckHelper.throwIfNull(ffa, () => $"ffa is null !!! - {game_mode_base.toBasicString()}");
BattleSnapShotBusinessLog business_log = new(ffa, "");
batch.appendBusinessLog(business_log);
fn_result = await QueryHelper.sendQueryAndBusinessLog(batch);
if (fn_result.isSuccess())
{
Log.getLogger().info($"save battle instance snapshot done attribute : {JsonConvert.SerializeObject(battle_instance_snapshot_attribute)}");
}
return fn_result;
};
var result = await game_mode_base.runTransactionRunnerSafely(TransactionIdType.PrivateContents, "SaveBattleInstanceByDestroy", fn_save_battle_instance);
if (result.isFail())
{
var err_msg = $"Failed to runTransactionRunnerSafely() !!! : {result.toBasicString()} - {game_mode_base.toBasicString()}";
Log.getLogger().error(err_msg);
}
return result;
}
}

View File

@@ -0,0 +1,46 @@
using GameServer.Contents.GameMode.Manage;
using ServerCommon;
using ServerCore;
namespace GameServer.Contents.GameMode.Mode_Battle.Manage;
public class TPSFreeForAllInitHandler : GameModeInitHandlerBase
{
public TPSFreeForAllInitHandler(InstanceRoom instanceRoom) : base(instanceRoom, GameModeType.TPS_FFA)
{
}
public override Result gamedModeInstanceInitValidate()
{
var result = new Result();
return result;
}
// public override async Task<Result> gamedModeInstanceInit()
// {
// Log.getLogger().debug("tps ffa gamedModeInstanceInit called");
//
// //await base.gamedModeInstanceInit(); //kihoon todo 이거 바꿔줘야 한다. ..
//
//
//
// var room_id = m_instance_room.getMap().m_room_id;
// var result = BattleInstanceManager.It.battleInstanceInit(m_instance_room, room_id).Result; //kihoon todo :이거 리팩토링 대상
// if (result.isFail())
// {
// Log.getLogger().error(result.toBasicString());
// }
//
// //kihoon todo : 임시 코드 나중에 gameMode로 이동해야됨
// //var battle_room = BattleInstanceManager.It.getBattleInstanceRoom(room_id);
// //NullReferenceCheckHelper.throwIfNull(battle_room, () => $"battle_room is null !!");
//
// //GameModeManager.It.tryAdd(room_id, battle_room);
//
// Log.getLogger().debug("tps ffa gamedModeInstanceInit done");
//
// return result;
// }
}

View File

@@ -0,0 +1,48 @@
using GameServer.Contents.GameMode.Manage;
using ServerCommon;
using ServerCore;
namespace GameServer.Contents.GameMode.Mode_Battle.Manage;
public class TPSFreeForAllJoinHandler : GameModeJoinHandlerBase
{
public TPSFreeForAllJoinHandler(InstanceRoom instanceRoom) : base(instanceRoom, GameModeType.TPS_FFA)
{
}
public override Result gamedModeInstanceJoinValidate()
{
var result = new Result();
return result;
}
public override Result gamedModeInstanceJoin(Player player)
{
Log.getLogger().debug("tps ffa gamedModeInstanceJoin called");
var result = new Result();
string err_msg = string.Empty;
//instanceroom 정보는 남아있는데 battleinstance만 없어지는 케이스가 있어서 예외 처리를 위해 넣어놓음
var room_id = m_instance_room.getMap().m_room_id;
//var battle_instance_room = BattleInstanceManager.It.getBattleInstanceRoom(room_id); //kihoon todo : 이거 리팩토링 대상.... IGameMode에서 가져오는게 맞나?? 다른 모드 넣으면서 고민좀 해보자...
if (false == GameModeManager.It.tryGetGameMode(room_id, out var gameMode))
{
Log.getLogger().error($"Battle Room Instance is null.. so init start roomId : {room_id}");
//kihoon todo : 이거 코드 바꿔야 된다.
// result = Task.Run(() => BattleInstanceManager.It.battleInstanceInit(m_instance_room, room_id)).GetAwaiter().GetResult();
// if (result.isFail())
// {
// err_msg = $"BattleIntanceJoin init error, _roomId : {room_id}";
// Log.getLogger().error(err_msg);
// return result;
// }
}
Log.getLogger().debug("tps ffa gamedModeInstanceJoin done");
return result;
}
}

View File

@@ -0,0 +1,121 @@
using GameServer.Contents.GameMode.Manage;
using GameServer.Contents.GameMode.Manage.PlayManage;
using ServerBase;
using ServerCommon;
using ServerCore;
namespace GameServer.Contents.GameMode.Mode_Battle.Manage;
public class TPSFreeForAllJoinSuccessHandler : GameModeJoinSuccessHandlerBase
{
//private readonly BattleInstanceRoom m_battle_instance_room;//kihoon todo : 이거 GameMode 로 변경해야 한다... ..
private IGameMode m_game_mode;
public TPSFreeForAllJoinSuccessHandler(Player player, InstanceRoom instanceRoom) : base(player, GameModeType.TPS_FFA, instanceRoom)
{
var room_id = instanceRoom.getMap().m_room_id;
//m_battle_instance_room = BattleInstanceManager.It.getBattleInstanceRoom(room_id)!;
//NullReferenceCheckHelper.throwIfNull(m_battle_instance_room, () => $"m_battle_instance_room is null !!!");
GameModeManager.It.tryGetGameMode(room_id, out var gameMode);
NullReferenceCheckHelper.throwIfNull(gameMode, () => $"gameMode is null !!!");
m_game_mode = gameMode;
//m_battle_instance_room = battle_instance_room;
}
public override Result joinSuccessValidate()
{
var result = new Result();
return result;
}
public override async Task<Result> joinSuccessConfirmation()
{
var result = new Result();
string err_msg = string.Empty;
var ffa = m_game_mode as GameModeTPSFreeForAll<GameModeTPSFreeForAllData>;
NullReferenceCheckHelper.throwIfNull(ffa, () => $"ffa is null !!!");
var room_id = ffa.getRoomId();
var battle_instance_attribute = ffa.getEntityAttribute<BattleInstanceSnapshotAttribute>();
NullReferenceCheckHelper.throwIfNull(battle_instance_attribute, () => $"battle_instance_attribute is null !!!");
(result, var pos_meta_guid) = BattleRoomHelper.getRandomRespawnPos(battle_instance_attribute, ffa);
if (result.isFail())
{
return result;
}
if (false == ffa.m_respawn_pos_anchors_meta.Contains(pos_meta_guid))
{
err_msg = $"respawn pos meta not exist idx : {pos_meta_guid}";
result.setFail(ServerErrorCode.BattleInstanceUsableSpawnPointNotExist, err_msg);
return result;
}
using (var releaser = await ffa.getAsyncLock())
{
var now = DateTimeHelper.Current;
var next_respawn_time = now.AddSeconds(ffa.m_ffa_config_meta.PlayerRespawnTime);
battle_instance_attribute.m_combat_pod_mode.m_respawns.AddOrUpdate(pos_meta_guid, next_respawn_time, (key, old) => next_respawn_time);
var location_action = m_player.getEntityAction<LocationAction>();
NullReferenceCheckHelper.throwIfNull(location_action, () => $"location_action is null !!! - {m_player.toBasicString()}");
var currenct_pos = location_action.getCurrentPos();
if (false == ffa.getInstanceRoom().getMap().getAnchors().TryGetValue(pos_meta_guid, out var anchorInfo))
{
err_msg = $"anchorInfo not exist idx : {pos_meta_guid}";
result.setFail(ServerErrorCode.BattleInstanceNotExistAnchors, err_msg);
return result;
}
currenct_pos = anchorInfo.AnchorPos.Clone();
currenct_pos.Z += 100;
location_action.tryUpdateCurrentPos(currenct_pos);
}
return result;
}
public override async Task<Result> joinSuccessNotify()
{
var result = new Result();
m_player.send_S2C_NTF_SET_LOCATION();
var ffa = m_game_mode as GameModeTPSFreeForAll<GameModeTPSFreeForAllData>;
NullReferenceCheckHelper.throwIfNull(ffa, () => $"ffa is null !!!");
result = await BattleInstanceManager.It.sendNtfAboutBattleInstance(ffa, m_player);
if (result.isFail()) return result;
return result;
}
public override void joinSuccessWriteLog()
{
var ffa = m_game_mode as GameModeTPSFreeForAll<GameModeTPSFreeForAllData>;
NullReferenceCheckHelper.throwIfNull(ffa, () => $"ffa is null !!!");
var room_id = ffa.getRoomId();
var user_guid = m_player.getUserGuid();
var user_nickname = m_player.getUserNickname();
var battle_instance_attribute = ffa.getEntityAttribute<BattleInstanceSnapshotAttribute>();
NullReferenceCheckHelper.throwIfNull(battle_instance_attribute, () => $"battle_instance_attribute is null !!!");
var currenct_round = battle_instance_attribute.m_combat_pod_mode.m_current_round;
var log_action = new LogAction(LogActionType.BattleInstanceJoin.ToString());
var invoker = new BattleRoomJoinBusinessLog(user_guid, user_nickname, room_id, currenct_round);
BusinessLogger.collectLogs(log_action, m_player, new List<ILogInvoker>(){invoker});
}
}

View File

@@ -0,0 +1,47 @@
using GameServer.Contents.GameMode.Helper;
using GameServer.Contents.GameMode.Manage.LeaveManage;
using GameServer.Contents.GameMode.Manage.PlayManage;
using GameServer.Contents.GameMode.Mode_Battle.Manage;
using ServerCommon;
using ServerCore;
namespace GameServer.Contents.GameMode.Mode_Battle.ModeFreeForAll.Manage;
public class TPSFreeForAllLeaveHandler : GameModeLeaveHandlerBase
{
public TPSFreeForAllLeaveHandler(Player player, string roomId) : base(player, roomId, GameModeType.TPS_FFA)
{
}
public override async Task<Result> postLeave(IGameMode gameMode)
{
Log.getLogger().debug($"ffa postLeave start instanceRoomId : {m_room_id}");
var ffa = gameMode as GameModeTPSFreeForAll<GameModeTPSFreeForAllData>;
NullReferenceCheckHelper.throwIfNull(ffa, () => $"location ffa is null !!! - {m_player.toBasicString()}");
await ffa.removePodCombat(m_player);
return new Result();
}
public override async Task<Result> notifyAfterLeave(IGameMode gameMode)
{
var result = new Result();
await Task.CompletedTask;
return result;
}
public override async Task<Result> logAfterLeave(IGameMode gameMode)
{
var result = new Result();
await Task.CompletedTask;
return result;
}
}