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

104 lines
2.6 KiB
C#

using System.Collections.Generic;
using UnityEngine;
using Wizard.Scripts.Network.Data.TableData;
public class DialogRewardScroll : MonoBehaviour
{
[SerializeField]
private UIWrapContentWizard WrapContent;
[SerializeField]
private GameObject Item;
[SerializeField]
private UIScrollBarWrapContent ScrollBar;
[SerializeField]
private WrapContentsScrollBarSize WrapScrollbar;
[SerializeField]
private UIScrollView ScrollView;
[SerializeField]
private UILabel _emptyLabel;
private const int SCROLL_ITEM_COUNT = 10;
private const int HISTORY_ITEM_SPRITE_WIDTH = 800;
private GameObject[] Items;
private List<ItemAcquireHistory> _currentList;
public List<ItemAcquireHistory> CurrentList
{
get
{
return _currentList;
}
set
{
_currentList = value;
_emptyLabel.gameObject.SetActive(_currentList.Count == 0);
}
}
public ResourceHandler Handler { get; set; }
public void Start()
{
CreateSomeItems();
WrapContent.onInitializeItem = InitScrollItem;
ScrollBar.m_WrapContents = WrapContent;
}
public void resetScrollWrap()
{
WrapContent.minIndex = -(CurrentList.Count - 1);
WrapContent.maxIndex = 0;
ScrollView.ResetPosition();
WrapContent.resetItems();
WrapScrollbar.ContentUpdate();
ScrollView.ResetPosition();
ScrollBar.gameObject.SetActive(value: true);
ScrollView.UpdateScrollbars();
}
private void InitScrollItem(GameObject obj, int wrapIndex, int realIndex)
{
GameObject gameObject = obj.transform.GetChild(0).gameObject;
if (-realIndex < 0 || -realIndex >= CurrentList.Count)
{
gameObject.SetActive(value: false);
return;
}
gameObject.SetActive(value: true);
int num = -realIndex;
SetHistoryItem(gameObject, CurrentList[num], num == CurrentList.Count - 1);
}
private void SetHistoryItem(GameObject item, ItemAcquireHistory history, bool isLastItem)
{
item.GetComponent<UISprite>().width = 800;
item.GetComponent<AchievementWindowBase>().SetHistoryItem(history, !isLastItem, Handler);
}
private void CreateSomeItems()
{
Items = new GameObject[10];
for (int i = 0; i < 10; i++)
{
GameObject gameObject = new GameObject();
Transform obj = gameObject.transform;
obj.parent = WrapContent.transform;
obj.localPosition = Vector3.zero;
obj.localRotation = Quaternion.identity;
obj.localScale = Vector3.one;
gameObject.layer = WrapContent.gameObject.layer;
NGUITools.AddChild(gameObject, Item).SetActive(value: true);
gameObject.SetActive(value: true);
Items[i] = gameObject;
}
}
}