Files
SVSimServer/SVSim.BattleEngine/Engine/Wizard.ErrorDialog/Dialog.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

121 lines
3.3 KiB
C#

using System.Collections;
using System.Collections.Generic;
using Cute;
using UnityEngine;
namespace Wizard.ErrorDialog;
public static class Dialog
{
public const int SORTING_ORDER = 2;
private static bool _isInitialized;
private static Dictionary<string, Data> _dataList = new Dictionary<string, Data>();
private static Data _defaultData;
public static void Initialize()
{
if (_isInitialized)
{
_dataList.Clear();
_defaultData = null;
}
_isInitialized = true;
ArrayList arrayList = Utility.ConvertCSV((Resources.Load("CSV/error_dialog") as TextAsset).ToString());
bool flag = true;
foreach (ArrayList item in arrayList)
{
string[] array = (string[])item.ToArray(typeof(string));
if (flag)
{
flag = false;
continue;
}
string text = array[0];
Data data = new Data(text, array[1], array[2], array[3], array[4], array[5], array[6]);
if (text != "DEFAULT")
{
_dataList.Add(text, data);
}
else
{
_defaultData = data;
}
}
}
public static Data FindData(string errorId)
{
if (_dataList.ContainsKey(errorId))
{
return _dataList[errorId];
}
return null;
}
public static Data FindData(int errorId)
{
return FindData(errorId.ToString());
}
public static DialogBase Create(string errorId)
{
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(isSystem: true);
Setup(dialogBase, errorId);
UIManager.GetInstance().WebViewHelper.CloseWebViewDialog();
return dialogBase;
}
public static DialogBase Create(int errorId)
{
return Create(errorId.ToString());
}
public static void Setup(DialogBase dialog, string errorId)
{
Data data = (_dataList.ContainsKey(errorId) ? _dataList[errorId] : _defaultData);
dialog.SetSize(DialogBase.Size.M);
dialog.SetTitleLabel(Wizard.Data.SystemText.Get(data.TitleId));
dialog.SetText(Wizard.Data.SystemText.Get(data.BodyId, errorId));
dialog.SetVisibleContactButton(data.IsDisplayContact, errorId);
dialog.SetButtonLayout(DialogBase.ButtonLayout.NONE);
AddButtonToDialog(dialog, data.MainButton, data.SubButton == Data.ButtonType._NONE_);
AddButtonToDialog(dialog, data.SubButton, isReflect: true);
dialog.SetFadeButtonEnabled(flag: false);
dialog.SetPanelDepth(data.PanelDepth);
dialog.SetPanelSortingOrder(2);
}
private static void AddButtonToDialog(DialogBase dialog, Data.ButtonType type, bool isReflect)
{
switch (type)
{
case Data.ButtonType.OK:
dialog.AddButton(DialogBase.ButtonType.OK, isReflect);
break;
case Data.ButtonType.:
dialog.AddButton(DialogBase.ButtonType.Retry, isReflect);
break;
case Data.ButtonType.:
dialog.AddButton(DialogBase.ButtonType.BackToTitle, isReflect);
break;
case Data.ButtonType.:
dialog.AddButton(DialogBase.ButtonType.BackToHome, isReflect);
break;
case Data.ButtonType.:
dialog.AddButton(DialogBase.ButtonType.QuitApplication, isReflect);
break;
case Data.ButtonType.:
dialog.AddButton(DialogBase.ButtonType.VersionUp, isReflect);
break;
case Data.ButtonType.:
dialog.AddButton(DialogBase.ButtonType.RecommendedList, isReflect);
break;
case Data.ButtonType._NONE_:
break;
}
}
}