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.
This commit is contained in:
164
SVSim.BattleEngine/Engine/Wizard/Crossover.cs
Normal file
164
SVSim.BattleEngine/Engine/Wizard/Crossover.cs
Normal file
@@ -0,0 +1,164 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using LitJson;
|
||||
|
||||
namespace Wizard;
|
||||
|
||||
public class Crossover
|
||||
{
|
||||
public class PeriodData
|
||||
{
|
||||
public DateTime BeginTime = DateTime.MaxValue;
|
||||
|
||||
public DateTime EndTime = DateTime.MinValue;
|
||||
}
|
||||
|
||||
public const int MAIN_CLASS_CARD_MIN_NUM = 24;
|
||||
|
||||
public const int SUB_CLASS_CARD_MIN_NUM = 9;
|
||||
|
||||
public const int AUTO_CREATE_NEUTRAL_MAX = 7;
|
||||
|
||||
public PeriodData RankMatchPeriod = new PeriodData();
|
||||
|
||||
public PeriodData FreeMatchPeriod = new PeriodData();
|
||||
|
||||
public PeriodData GatheringPeriod = new PeriodData();
|
||||
|
||||
public PeriodData PracticePeriod = new PeriodData();
|
||||
|
||||
public List<int> CardSetIdList = new List<int>();
|
||||
|
||||
public List<int> ReprintedBaseCardIds = new List<int>();
|
||||
|
||||
public CrossoverRestrictedCard RestrictedCard = new CrossoverRestrictedCard();
|
||||
|
||||
private int _startRankId;
|
||||
|
||||
private int _maxRankId;
|
||||
|
||||
private Dictionary<int, RankInfo> UserRankData = new Dictionary<int, RankInfo>();
|
||||
|
||||
private List<RankInfo> _userRankList = new List<RankInfo>();
|
||||
|
||||
public static int AUTO_CREATE_MAIN_AND_NEUTRAL_MAX => 31;
|
||||
|
||||
public static int AUTO_CREATE_SUB_AND_NEUTRAL_MAX => 16;
|
||||
|
||||
public bool IsWithinAnyPeriod
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsWithinGatheringPeriod && !IsWithinFreeMatchPeriod && !IsWithinRankMatchPeriod)
|
||||
{
|
||||
return IsWithinPracticePeriod;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsWithinGatheringPeriod => IsWithinPeriod(GatheringPeriod);
|
||||
|
||||
public bool IsWithinFreeMatchPeriod => IsWithinPeriod(FreeMatchPeriod);
|
||||
|
||||
public bool IsWithinRankMatchPeriod => IsWithinPeriod(RankMatchPeriod);
|
||||
|
||||
public bool IsWithinPracticePeriod => IsWithinPeriod(PracticePeriod);
|
||||
|
||||
private bool IsWithinPeriod(PeriodData period)
|
||||
{
|
||||
DateTime nowTime_UTC = PlayerStaticData.UserTime.GetNowTime_UTC();
|
||||
if (nowTime_UTC >= period.BeginTime)
|
||||
{
|
||||
return nowTime_UTC <= period.EndTime;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Parse(JsonData data)
|
||||
{
|
||||
JsonData data2 = data["schedules"];
|
||||
if (data2.TryGetValue("rank_battle", out var value))
|
||||
{
|
||||
SetPeriodData(RankMatchPeriod, value);
|
||||
}
|
||||
if (data2.TryGetValue("free_battle", out var value2))
|
||||
{
|
||||
SetPeriodData(FreeMatchPeriod, value2);
|
||||
}
|
||||
if (data2.TryGetValue("gathering", out var value3))
|
||||
{
|
||||
SetPeriodData(GatheringPeriod, value3);
|
||||
}
|
||||
if (data2.TryGetValue("practice", out var value4))
|
||||
{
|
||||
SetPeriodData(PracticePeriod, value4);
|
||||
}
|
||||
if (data.TryGetValue("card_set_id_list", out var value5))
|
||||
{
|
||||
for (int i = 0; i < value5.Count; i++)
|
||||
{
|
||||
CardSetIdList.Add(value5[i].ToInt());
|
||||
}
|
||||
}
|
||||
if (data.TryGetValue("reprinted_base_card_ids", out var value6))
|
||||
{
|
||||
for (int j = 0; j < value6.Count; j++)
|
||||
{
|
||||
ReprintedBaseCardIds.Add(value6[j].ToInt());
|
||||
}
|
||||
}
|
||||
if (data.TryGetValue("restricted_base_card_id_list", out var value7))
|
||||
{
|
||||
RestrictedCard.Parse(value7);
|
||||
}
|
||||
ParseRankData(data);
|
||||
}
|
||||
|
||||
public void ParseRankData(JsonData data)
|
||||
{
|
||||
JsonData jsonData = data["rank_info"];
|
||||
_startRankId = int.MaxValue;
|
||||
_maxRankId = int.MinValue;
|
||||
for (int i = 0; i < jsonData.Count; i++)
|
||||
{
|
||||
RankInfo rankInfo = new RankInfo(jsonData[i]);
|
||||
_userRankList.Add(rankInfo);
|
||||
UserRankData[rankInfo.RankId] = rankInfo;
|
||||
if (rankInfo.RankId < _startRankId)
|
||||
{
|
||||
_startRankId = rankInfo.RankId;
|
||||
}
|
||||
if (rankInfo.RankId > _maxRankId)
|
||||
{
|
||||
_maxRankId = rankInfo.RankId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public RankInfo GetRankInfo(int rankId)
|
||||
{
|
||||
return UserRankData[rankId];
|
||||
}
|
||||
|
||||
public bool IsStartRank(int rankId)
|
||||
{
|
||||
return rankId == _startRankId;
|
||||
}
|
||||
|
||||
public bool IsMaxRank(int rankId)
|
||||
{
|
||||
return rankId == _maxRankId;
|
||||
}
|
||||
|
||||
public List<RankInfo> GetRankInfoRawList()
|
||||
{
|
||||
return _userRankList;
|
||||
}
|
||||
|
||||
private void SetPeriodData(PeriodData period, JsonData jsonData)
|
||||
{
|
||||
period.BeginTime = DateTime.Parse(jsonData["begin_time"].ToString());
|
||||
period.EndTime = DateTime.Parse(jsonData["end_time"].ToString());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user