Files
SVSimServer/SVSim.BattleEngine/Engine/Wizard/GatheringRule.cs
gamer147 957af3d1ec feat(battle-engine): full Unity/VFX/god-object shims + expanded copy closure (2570 files)
Authored Unity primitive/object-model shim, VFX layer (control-flow-preserving, InstantVfx never invokes its action -- headless suppression), god-object stubs (GameMgr/EffectMgr/UIManager with faithfully-extracted nested enums), View/UI/Touch tree, LitJson+BetterList+Tuple copied, third-party stubs. Discovered Roslyn header-error masking: fixing class-header type errors unmasks body references, so the true copy closure is ~2570 files (was 782 under masking). Errors: masked-25720 -> 268; our shim files compile clean. Remaining: ~50 residual shim/external types, 24 NGUI UI-base overrides, static-type fixes, plus likely 1-2 more unmask waves.
2026-06-05 17:22:20 -04:00

177 lines
5.5 KiB
C#

using System;
using LitJson;
using Wizard.RoomMatch;
namespace Wizard;
public class GatheringRule
{
public enum eRole
{
NONE,
OWNER,
GUEST
}
public enum eWatchSetting
{
OWNER_ONLY = 1,
ALL_MEMBER,
NONE
}
public enum eType
{
FREE_BATTLE = 1,
TOURNAMENT
}
public enum eTournamentType
{
NONE,
SINGLE_ELIMINATION,
DOUBLE_ELIMINATION
}
public const int DEFAULT_DECK_ENTRY_MINUTE = 5;
public const int ID_NUMBER_OF_DIGIT = 6;
public const int DEFAULT_MAX_MEMBER = 2;
public const int DEFAULT_BATTLE_HOUR = 1;
public const eWatchSetting DEFAULT_WATCH_SETTING = eWatchSetting.OWNER_ONLY;
public bool IsReset;
public eType Type { get; set; } = eType.FREE_BATTLE;
public eTournamentType TournamentType { get; set; }
public bool IsTournament
{
get
{
if (TournamentType != eTournamentType.SINGLE_ELIMINATION)
{
return TournamentType == eTournamentType.DOUBLE_ELIMINATION;
}
return true;
}
}
public int MaxMember { get; set; } = 2;
public BattleParameter BattleParameterInstance { get; private set; }
public int BattleTimeHour { get; set; } = 1;
public DateTime BattleStartLocalTime
{
get
{
return ConvertTime.ToLocalByDateTime(BattleStartUtcTime);
}
set
{
BattleStartUtcTime = ConvertTime.LocalToUtc(value);
}
}
public DateTime BattleStartUtcTime { get; private set; }
public bool IsOwnerEntryBattle { get; set; } = true;
public bool IsEntryDeckOnly { get; set; }
public eWatchSetting WatchSetting { get; set; } = eWatchSetting.OWNER_ONLY;
public string GetGatheringTypeString()
{
return GatheringUtility.GetGatheringTypeString(Type, TournamentType, IsReset);
}
public string GetGatheringResetString()
{
if (!IsReset)
{
return "仮リセットなし";
}
return "仮リセットあり";
}
public GatheringRule()
{
}
public GatheringRule(JsonData data, JsonData config)
{
BattleParameterInstance = BattleParameter.JsonToBattleParameter(data);
MaxMember = data["join_member_limit"].ToInt();
IsOwnerEntryBattle = data["is_master_joined"].ToInt() == 1;
WatchSetting = (eWatchSetting)data["watch_type"].ToInt();
Type = (eType)data["gathering_type"].ToInt();
if (Type == eType.TOURNAMENT)
{
IsEntryDeckOnly = true;
}
else if (config.Keys.Contains("is_deck_entry"))
{
IsEntryDeckOnly = config["is_deck_entry"].ToInt() == 1;
}
if (config.TryGetValue("format", out var value))
{
TournamentType = (eTournamentType)value.ToInt();
}
if (config.TryGetValue("is_reset", out var value2))
{
IsReset = value2.ToInt() == 1;
}
}
public void SaveToPlayerPrefs()
{
PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.GATHERING_MAX_MEMBER, MaxMember);
PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.GATHERING_FORMAT, (int)BattleParameterInstance.DeckFormat);
PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.GATHERING_BATTLE_STYLE, (int)BattleParameterInstance.Rule);
PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.GATHERING_BATTLE_TYPE, (int)Type);
PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.GATHERING_BATTLE_TORNAMENT_TYPE, (int)TournamentType);
PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.GATHERING_IS_RESET, IsReset);
PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.GATHERING_OWNER_ENTRY_BATTLE, IsOwnerEntryBattle);
PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.GATHERING_WATCH_SETTING, (int)WatchSetting);
PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.GATHERING_BATTLE_HOUR, BattleTimeHour);
PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.GATHERING_IS_ENTRY_DECK_ONLY, IsEntryDeckOnly);
}
public void LoadFromPlayerPrefs()
{
MaxMember = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.GATHERING_MAX_MEMBER);
Format format = (Format)PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.GATHERING_FORMAT);
if (format == Format.PreRotation && Prerelease.Status != Prerelease.eStatus.PRE_ROTATION)
{
format = Format.Rotation;
}
if (format == Format.Crossover && (!Data.Crossover.IsWithinGatheringPeriod || Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.ROOM_FORMAT_CROSSOVER)))
{
format = Format.Rotation;
}
else if (format == Format.MyRotation && (!Data.MyRotationAllInfo.IsWithinGatheringPeriod || Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.GATHERING_MYROTATION)))
{
format = Format.Rotation;
}
else if (format == Format.Avatar && (!Data.AvatarBattleAllInfo.IsWithinGatheringPeriod || Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.GATHERING_AVATAR)))
{
format = Format.Rotation;
}
BattleParameterInstance = new BattleParameter(NetworkDefine.ServerBattleType.Gathering, format, TwoPickFormat.None, (RoomConnectController.BattleRule)PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.GATHERING_BATTLE_STYLE), isOpenDeckRoom: false);
IsOwnerEntryBattle = PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.GATHERING_OWNER_ENTRY_BATTLE);
WatchSetting = (eWatchSetting)PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.GATHERING_WATCH_SETTING);
BattleTimeHour = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.GATHERING_BATTLE_HOUR);
IsEntryDeckOnly = PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.GATHERING_IS_ENTRY_DECK_ONLY);
Type = (eType)PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.GATHERING_BATTLE_TYPE);
TournamentType = (eTournamentType)PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.GATHERING_BATTLE_TORNAMENT_TYPE);
IsReset = PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.GATHERING_IS_RESET);
}
}