Files
SVSimServer/SVSim.BattleEngine/Engine/UserTicketCountDialog.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

128 lines
4.1 KiB
C#

using System;
using System.Collections.Generic;
using Cute;
using UnityEngine;
using Wizard;
public class UserTicketCountDialog : MonoBehaviour
{
[SerializeField]
private UIWrapContent _wrapContents;
[SerializeField]
private WrapContentsScrollBarSize _wrapScrollbarSize;
[SerializeField]
private UIScrollBarWrapContent _wrapScrollbarContents;
[SerializeField]
private GameObject _noItemObject;
private List<string> _loadFileList = new List<string>();
private DialogBase _parentDialog;
private List<UserTicketCountContents.ItemColumn> _itemList = new List<UserTicketCountContents.ItemColumn>();
public void Init(DialogBase parentDialog)
{
_parentDialog = parentDialog;
UserTicketCountContents.ItemColumn item = default(UserTicketCountContents.ItemColumn);
for (int i = 0; i < Data.Master.ItemList.Count; i++)
{
int itemNum = PlayerStaticData.GetItemNum(Data.Master.ItemList[i].UserGoodsId);
if (itemNum > 0 && Item.IsTicket(UserGoods.Type.Item, Data.Master.ItemList[i].UserGoodsId))
{
item.UserGoodsId = Data.Master.ItemList[i].UserGoodsId;
item.IconTextureName = Data.Master.ItemList[i].thumbnail;
item.PossetionNumber = itemNum;
item.unitFormat = Data.Master.ItemList[i].unitFormat;
string value = null;
Data.Load.data.UserItemExpireTimeDictionary.TryGetValue(item.UserGoodsId, out value);
item.TimeLimit = value;
_itemList.Add(item);
_loadFileList.Add(Toolbox.ResourcesManager.GetAssetTypePath(item.IconTextureName, ResourcesManager.AssetLoadPathType.Item));
}
}
if (_itemList.Count == 0)
{
_noItemObject.SetActive(value: true);
_wrapContents.gameObject.SetActive(value: false);
_wrapScrollbarContents.gameObject.SetActive(value: false);
return;
}
UIScrollView component = _wrapContents.transform.parent.GetComponent<UIScrollView>();
UIPanel component2 = component.GetComponent<UIPanel>();
_noItemObject.SetActive(value: false);
_wrapContents.gameObject.SetActive(value: true);
_wrapScrollbarContents.gameObject.SetActive(value: true);
_wrapContents.onInitializeItem = _OnInitializeItem;
_wrapContents.maxIndex = 0;
_wrapScrollbarContents.m_WrapContents = _wrapContents;
_wrapContents.minIndex = -(_itemList.Count - 1);
component.ResetPosition();
if (component2.height > (float)(_itemList.Count * _wrapContents.itemSize))
{
component.verticalScrollBar.gameObject.SetActive(value: false);
component.enabled = false;
}
else
{
component.verticalScrollBar.gameObject.SetActive(value: true);
component.enabled = true;
}
parentDialog.SetActive(inActive: false);
UIManager.GetInstance().createInSceneCenterLoading();
UIManager.GetInstance().StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(_loadFileList, delegate
{
parentDialog.SetActive(inActive: true);
UIManager.GetInstance().closeInSceneCenterLoading();
_wrapScrollbarSize.ContentUpdate();
_wrapContents.SortBasedOnScrollMovement();
}));
}
private void _OnInitializeItem(GameObject go, int wrapIndex, int realIndex)
{
int num = realIndex * -1;
go.name = num.ToString();
Transform[] componentsInChildren = go.GetComponentsInChildren<Transform>(includeInactive: true);
Transform[] array;
if (num >= _itemList.Count || num < 0)
{
array = componentsInChildren;
for (int i = 0; i < array.Length; i++)
{
array[i].gameObject.SetActive(value: false);
}
return;
}
array = componentsInChildren;
for (int i = 0; i < array.Length; i++)
{
array[i].gameObject.SetActive(value: true);
}
SetContents(num, go.GetComponent<UserTicketCountContents>());
}
private void SetContents(int ItemListIndex, UserTicketCountContents contents)
{
Action onClick = delegate
{
MoveSceneAction();
};
contents.SetData(_itemList[ItemListIndex], onClick);
}
private void MoveSceneAction()
{
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
_parentDialog.Close();
}
private void OnDestroy()
{
Toolbox.ResourcesManager.RemoveAssetGroup(_loadFileList);
}
}