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:
107
SVSim.BattleEngine/Engine/Wizard/TreasureBoxCp.cs
Normal file
107
SVSim.BattleEngine/Engine/Wizard/TreasureBoxCp.cs
Normal file
@@ -0,0 +1,107 @@
|
||||
using System;
|
||||
using LitJson;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Wizard;
|
||||
|
||||
public class TreasureBoxCp
|
||||
{
|
||||
public const string TREASURE_BOX_OPEN_EFFECT = "cmn_arena_treasure_{0}";
|
||||
|
||||
public const string GRADE_UP_EFFECT = "cmn_treasure_gradeup_gp_{0}";
|
||||
|
||||
private const string TREASURE_GET_SPRITE_NAME = "treasure_get";
|
||||
|
||||
private const string TREASURE_RANK_UP_SPRITE_NAME = "treasure_rank_up";
|
||||
|
||||
private const string TREASURE_RANK_MAX_SPRITE_NAME = "treasure_rank_max";
|
||||
|
||||
private bool _treasureBoxCpNotExist = true;
|
||||
|
||||
public static readonly float[] OPEN_TREASURE_BOX_TIME = new float[4] { 1f, 1.5f, 1.5f, 4f };
|
||||
|
||||
public static readonly int[] GRADE_TO_TREASURE_BOX_ID = new int[5] { -1, 0, 2, 4, 5 };
|
||||
|
||||
private double _receiveServerUnixTime;
|
||||
|
||||
private double _receiveSinceTime;
|
||||
|
||||
public bool IsTreasureBoxOpened => CurrentGrade == MaxGrade;
|
||||
|
||||
public bool IsReceivable { get; private set; }
|
||||
|
||||
public double StartUnixTime { get; private set; }
|
||||
|
||||
public double EndUnixTime { get; private set; }
|
||||
|
||||
public int CurrentGrade { get; private set; }
|
||||
|
||||
public int NextGrade { get; private set; }
|
||||
|
||||
public int MaxGrade { get; private set; }
|
||||
|
||||
public int CurrentMemory { get; private set; }
|
||||
|
||||
public int MaxMemory { get; private set; }
|
||||
|
||||
public void Parse(JsonData data, JsonData headerData)
|
||||
{
|
||||
_treasureBoxCpNotExist = false;
|
||||
IsReceivable = false;
|
||||
if (data.Keys.Contains("is_receivable"))
|
||||
{
|
||||
IsReceivable = data["is_receivable"].ToInt() == 1;
|
||||
}
|
||||
StartUnixTime = ConvertTime.DateTimeToUnixTime(DateTime.Parse(data["start_time"].ToString()));
|
||||
EndUnixTime = ConvertTime.DateTimeToUnixTime(DateTime.Parse(data["end_time"].ToString()));
|
||||
CurrentGrade = data["current_grade"].ToInt();
|
||||
NextGrade = data["next_grade"].ToInt();
|
||||
CurrentMemory = data["current_memory"].ToInt();
|
||||
MaxGrade = data["max_grade"].ToInt();
|
||||
MaxMemory = data["max_memory"].ToInt();
|
||||
_receiveServerUnixTime = headerData["servertime"].ToDouble();
|
||||
_receiveSinceTime = Time.realtimeSinceStartup;
|
||||
}
|
||||
|
||||
public bool IsWithinPeriod()
|
||||
{
|
||||
if (_treasureBoxCpNotExist)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
double num = _receiveServerUnixTime + (double)Time.realtimeSinceStartup - _receiveSinceTime;
|
||||
if (num >= EndUnixTime)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return num > StartUnixTime;
|
||||
}
|
||||
|
||||
public static Se.TYPE GetGradeSE(int grade)
|
||||
{
|
||||
return grade switch
|
||||
{
|
||||
1 => Se.TYPE.SE_SYS_UPGRADE_TREASURE_BOX_01,
|
||||
2 => Se.TYPE.SE_SYS_UPGRADE_TREASURE_BOX_02,
|
||||
3 => Se.TYPE.SE_SYS_UPGRADE_TREASURE_BOX_03,
|
||||
4 => Se.TYPE.SE_SYS_UPGRADE_TREASURE_BOX_04,
|
||||
_ => Se.TYPE.NONE,
|
||||
};
|
||||
}
|
||||
|
||||
public static string GetTreasureSpriteName(int grade)
|
||||
{
|
||||
switch (grade)
|
||||
{
|
||||
case 1:
|
||||
return "treasure_get";
|
||||
case 2:
|
||||
case 3:
|
||||
return "treasure_rank_up";
|
||||
case 4:
|
||||
return "treasure_rank_max";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user