Files
caliverse_server/GameServer/Contents/GameMode/Mode-Battle/Entity/BattleInstanceSnapshotDoc.cs
2025-05-01 07:20:41 +09:00

109 lines
3.8 KiB
C#

using System.Collections.Concurrent;
using Newtonsoft.Json;
using ServerCommon;
using ServerCore; using ServerBase;
namespace GameServer;
public class BattleInstanceSnapshotPlayModePodCombatAttrib
{
[JsonProperty("respawns")]
public ConcurrentDictionary<string, DateTime> m_respawns {get; set;} = new ();
[JsonProperty("pod_storages")]
public ConcurrentDictionary<string /*anchor_guid*/, BattleObjectPodStorage> m_pod_storages {get; set;} = new ();
[JsonProperty("pod_combat")]
public BattleObjectPodCombat m_pod_combat {get; set;} = new ();
[JsonProperty("pickup_pods")]
public ConcurrentDictionary<string /*anchor_guid*/, BattleObjectPickupPod> m_pickup_pods {get; set;} = new ();
[JsonProperty("pickup_pods_generation_info")] public List<PickupPodGeneratedInfo> m_pickup_pod_generated_info { get; set; } = new();
[JsonProperty("weapons")]
public ConcurrentDictionary<string /*anchor_guid*/, BattleObjectWeapon> m_weapons {get; set;} = new ();
[JsonProperty("buffs")]
public ConcurrentDictionary<string /*anchor_guid*/, BattleObjectBuff> m_buffs {get; set;} = new ();
[JsonProperty("state")] public BattleRoundStateType m_round_state_type { get; set; } = BattleRoundStateType.Rounding;
[JsonProperty("round")] public int m_current_round { get; set; } = 1;
[JsonProperty("state_start_time")] public DateTime m_current_state_start_time { get; set; } = DateTimeHelper.Current;
[JsonProperty("charged_step")] public int m_charged_step { get; set; } = 0;
[JsonProperty("rewarded_step")] public int m_rewarded_step { get; set; } = 0;
[JsonProperty("tactical_board")] public ConcurrentDictionary<string /*user_guid*/, BattleTacticalBoardInfo> m_tactical_board = new();
}
public class BattleInstanceSnapshotAttrib : AttribBase
{
[JsonProperty("room_id")]
public string m_room_id { get; set; } = string.Empty;
[JsonProperty("combat_pod_attrib")]
public BattleInstanceSnapshotPlayModePodCombatAttrib m_combat_pod_attrib { get; set; } = new();
public BattleInstanceSnapshotAttrib()
: base(typeof(BattleInstanceSnapshotAttrib).Name)
{
}
}
//=============================================================================================
// PK(Partition Key) : "battle_instance_snapshot#global"
// SK(Sort Key) : "date#room_id"
// DocType : BattleInstanceSnapshotDoc
// BlockUserAttrib : {}
// ...
//=============================================================================================
public class BattleInstanceSnapshotDoc : DynamoDbDocBase
{
public static readonly string pk = "battle_instance_snapshot#global";
public BattleInstanceSnapshotDoc()
: base(typeof(BattleInstanceSnapshotDoc).Name)
{
appendAttribWrapper(new AttribWrapper<BattleInstanceSnapshotAttrib>());
}
public BattleInstanceSnapshotDoc(string combinationKeyForSk)
: base(typeof(BattleInstanceSnapshotDoc).Name)
{
setCombinationKeyForSK(combinationKeyForSk);
appendAttribWrapper(new AttribWrapper<BattleInstanceSnapshotAttrib>());
fillUpPrimaryKey(onMakePK(), onMakeSK());
}
protected override string onGetPrefixOfPK()
{
return string.Empty;
}
protected override string onMakePK()
{
return pk;
}
// protected override string onMakeSK()
// {
// return $"{getCombinationKeyForSK()}";
//
// }
protected override ServerErrorCode onCheckAndSetPK(string partitionKey)
{
getPrimaryKey().fillUpPK(partitionKey);
return ServerErrorCode.Success;
}
protected override ServerErrorCode onCheckAndSetSK(string sortKey)
{
getPrimaryKey().fillUpSK(sortKey);
return ServerErrorCode.Success;
}
}