Files
SVSimServer/SVSim.BattleEngine/Engine/Wizard/SmallResourceSelectDialog.cs
gamer147 0455ff649e feat(battle-engine): EffectType full enum + collection/card/vfx extension copies
Replaces partial EffectMgr.EffectType with all 226 decomp values; copies the
IsNotNullOrEmpty/EquelsID/FindFromCardId/GetAllFuncVfxResults extension files +
UI extensions; adds Renderer/MeshFilter shared-material/mesh/sortingOrder. Compile
loop then closed the revealed deps (3242 files). 9.1k -> 18 errors.
2026-06-05 20:38:56 -04:00

120 lines
3.7 KiB
C#

using System;
using Cute;
using UnityEngine;
namespace Wizard;
public class SmallResourceSelectDialog : MonoBehaviour
{
[SerializeField]
private UILabel _downloadSizeLabel;
[SerializeField]
private UIToggle _useSmallResource;
[SerializeField]
private UILabel _noticeLabel;
private bool _isTitle;
private Action _onFinish;
private bool _isFirstCallUseSmallResourceToggleChange = true;
public static void Create(Action onFinish, Action onCancel, bool isTitle)
{
SystemText systemText = Data.SystemText;
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
dialogBase.SetTitleLabel(systemText.Get(isTitle ? "OtherTop_0017" : "MyPage_0088"));
dialogBase.SetSize(DialogBase.Size.M);
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn);
dialogBase.SetButtonText(systemText.Get("Common_0004"));
dialogBase.SetPanelDepth(2000);
GameObject gameObject = UnityEngine.Object.Instantiate(Resources.Load("Prefab/UI/SmallResourceSelectDialog")) as GameObject;
dialogBase.SetObj(gameObject);
SmallResourceSelectDialog selectDialog = gameObject.GetComponent<SmallResourceSelectDialog>();
dialogBase.onPushButton1 = delegate
{
selectDialog.OnSelectOk();
};
dialogBase.onPushButton2 = delegate
{
onCancel.Call();
};
dialogBase.onCloseWithoutSelect = delegate
{
onCancel.Call();
};
selectDialog.Initialize(isTitle, onFinish);
}
private void Initialize(bool isTitle, Action onFinish)
{
_isTitle = isTitle;
_onFinish = onFinish;
}
private void Start()
{
float totalStrageUseSize = Toolbox.AssetManager.GetTotalStrageUseSize(isNormalResource: true);
float totalStrageUseSize2 = Toolbox.AssetManager.GetTotalStrageUseSize(isNormalResource: false);
string suffixByDigit = AssetManager.GetSuffixByDigit(totalStrageUseSize);
string suffixByDigit2 = AssetManager.GetSuffixByDigit(totalStrageUseSize2);
_downloadSizeLabel.text = Data.SystemText.Get("Title_0052", suffixByDigit, suffixByDigit2);
_useSmallResource.value = PlayerPrefsCache.Instance.GetValue(PlayerPrefsWrapper.SMALL_RESOURCE_STATUS) == 2;
_noticeLabel.text = Data.SystemText.Get(_isTitle ? "Title_0054" : "Title_0058");
_useSmallResource.onChange.Add(new EventDelegate(delegate
{
OnClickUseSmallResource();
}));
}
private void OnClickUseSmallResource()
{
if (!_isFirstCallUseSmallResourceToggleChange)
{
GameMgr.GetIns().GetSoundMgr().PlaySe(_useSmallResource.value ? Se.TYPE.SYS_TOGGLE_ON : Se.TYPE.SYS_TOGGLE_OFF);
}
_isFirstCallUseSmallResourceToggleChange = false;
}
private void OnSelectOk()
{
int value = PlayerPrefsCache.Instance.GetValue(PlayerPrefsWrapper.SMALL_RESOURCE_STATUS);
bool num = PlayerPrefsCache.Instance.GetValue(PlayerPrefsWrapper.SMALL_RESOURCE_STATUS) == 2;
bool value2 = _useSmallResource.value;
if (num == value2)
{
if (value == 0)
{
DecideResourceType(_useSmallResource.value);
}
_onFinish.Call();
return;
}
if (_isTitle)
{
DecideResourceType(_useSmallResource.value);
_onFinish.Call();
return;
}
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
string text = Data.SystemText.Get(value2 ? "System_0062" : "System_0061");
dialogBase.SetText(Data.SystemText.Get("MyPage_0089", text));
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn);
dialogBase.onPushButton1 = delegate
{
DecideResourceType(_useSmallResource.value);
};
dialogBase.OnClose = delegate
{
_onFinish.Call();
};
}
private void DecideResourceType(bool isSmall)
{
PlayerPrefsCache.Instance.SetValue(PlayerPrefsWrapper.SMALL_RESOURCE_STATUS, (!isSmall) ? 1 : 2);
}
}