Files
game_voice_recorder/tools/replay-extract/src/Model.cs

73 lines
2.8 KiB
C#

using System.Text.Json;
using System.Text.Json.Serialization;
namespace GvrReplay;
// 사이트로 가는 형식. 시간은 모두 리플레이 시작부터 ms (t), 좌표는 게임 월드 단위(cm) 정수
public sealed class ReplayFile
{
public string Format { get; set; } = "gvr-replay";
public int V { get; set; } = 1;
public string? MatchId { get; set; }
public string? Map { get; set; }
public string? Build { get; set; }
/// 리플레이 녹화 시작 시각 (서버 기준 유닉스 ms). t 를 실제 시각으로 바꿀 때 recordedAt + t
public long RecordedAt { get; set; }
public int DurationMs { get; set; }
public int SampleMs { get; set; }
public List<ReplayPlayer> Players { get; set; } = [];
public List<ReplayRound> Rounds { get; set; } = [];
/// [t, phase] 게임 단계 바뀜 (원본 값)
public List<int[]> Phases { get; set; } = [];
/// [t, killer, victim] (선수 번호, 모르면 -1)
public List<int[]> Kills { get; set; } = [];
/// [t, player, x, y, z, yaw, pitch] 사격 위치와 방향
public List<int[]> Shots { get; set; } = [];
/// 스킬 · 설치물 [t0, t1, kind 번호, x, y, z, player] (t1 = 사라진 시각, 모르면 -1)
public List<int[]> Objects { get; set; } = [];
public List<string> ObjectKinds { get; set; } = [];
/// 들고 있는 것이 바뀐 시각 [t, player, kind 번호]. 총은 영어 이름(Vandal 등), 칼은 Melee, 스파이크는 Spike, 스킬은 클래스 이름
public List<int[]> Equips { get; set; } = [];
public List<string> EquipKinds { get; set; } = [];
}
public sealed class ReplayPlayer
{
public string? Puuid { get; set; }
/// 캐릭터 클래스 (예: Wushu_PC_C). 요원 이름은 사이트가 경기 상세(match-details)로 붙인다
public string? Character { get; set; }
/// 이동 기록. 열 별 배열 (같은 길이): t, x, y, z, yaw(도), pitch(도)
public PlayerTrack Track { get; set; } = new();
}
public sealed class PlayerTrack
{
public List<int> T { get; set; } = [];
public List<int> X { get; set; } = [];
public List<int> Y { get; set; } = [];
public List<int> Z { get; set; } = [];
public List<int> Yaw { get; set; } = [];
public List<int> Pitch { get; set; } = [];
}
public sealed class ReplayRound
{
/// 1부터
public int Num { get; set; }
/// 구매 단계 시작
public int Buy { get; set; }
/// 교전 시작 (구매 단계 끝), 모르면 -1
public int Combat { get; set; }
/// 라운드 끝 (승패 확정), 모르면 -1
public int End { get; set; }
}
public static class ReplayJson
{
public static readonly JsonSerializerOptions Options = new()
{
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
DefaultIgnoreCondition = JsonIgnoreCondition.Never,
};
}