2024-01-08 13:13:35 +08:00
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using TMPro;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
using UnityEngine.UIElements;
|
|
|
|
|
|
using Button = UnityEngine.UI.Button;
|
|
|
|
|
|
using Image = UnityEngine.UI.Image;
|
|
|
|
|
|
using Toggle = UnityEngine.UI.Toggle;
|
|
|
|
|
|
using ScrollView = PhxhSDK.PhxhScrollView;
|
|
|
|
|
|
using Framework;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using Gameplay;
|
|
|
|
|
|
|
|
|
|
|
|
public class UI_GetItemWindowController : UIWindow
|
|
|
|
|
|
{
|
|
|
|
|
|
//UI GameObj
|
|
|
|
|
|
///Auto Gen Start///
|
|
|
|
|
|
public Image Image_BG;
|
|
|
|
|
|
public Image Image_ItemPic;
|
|
|
|
|
|
public Image Image_Bar;
|
|
|
|
|
|
public TMP_Text Text_ItemNum;
|
|
|
|
|
|
public TMP_Text Text_IteamName;
|
|
|
|
|
|
public TMP_Text Text_Continue;
|
|
|
|
|
|
private ItemCounts mItems;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///Auto Gen End///
|
|
|
|
|
|
|
|
|
|
|
|
// Use this for initialization
|
2024-01-23 12:25:47 +08:00
|
|
|
|
public override void OnInit()
|
2024-01-08 13:13:35 +08:00
|
|
|
|
{
|
|
|
|
|
|
//bind UI GameObj
|
|
|
|
|
|
UI_GetItemWindowBinder.GetComponents(this);
|
|
|
|
|
|
BindButton(GetComponent<Button>("Image_BG"), OnBgClick);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OnBgClick()
|
|
|
|
|
|
{
|
|
|
|
|
|
CloseWindow();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//invoke when open window
|
2024-01-24 16:32:38 +08:00
|
|
|
|
protected override void OnShowWindow(object data = null)
|
2024-01-08 13:13:35 +08:00
|
|
|
|
{
|
|
|
|
|
|
mItems = data as ItemCounts;
|
|
|
|
|
|
RefreshMaterial(mItems);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
private async void RefreshMaterial(ItemCounts mItems)
|
|
|
|
|
|
{
|
|
|
|
|
|
for (int i = 0; i < 5; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
GameObject itemParent = FindObj(string.Format("Image_BG/Goods/{0}", (i + 1).ToString()));
|
|
|
|
|
|
CommonUtils.DestoryAllChildGameObject(CommonUtils.GetGameObject(itemParent, "item"));
|
|
|
|
|
|
|
|
|
|
|
|
if (i < mItems.Ids.Count)
|
|
|
|
|
|
{
|
|
|
|
|
|
itemParent.SetActive(true);
|
|
|
|
|
|
|
2024-01-08 20:00:27 +08:00
|
|
|
|
ItemObj itemObj = new ItemObj((int)mItems.Ids[i], CommonUtils.GetGameObject(itemParent, "item"), ItemObj.UIType.shop,(int) mItems.Counts[i]);
|
2024-01-23 15:07:04 +08:00
|
|
|
|
await itemObj.Init();
|
2024-01-08 13:13:35 +08:00
|
|
|
|
CommonUtils.GetComponent<TMP_Text>(itemParent, "Text_IteamName").text = CommonUtils.GetItemName((int)mItems.Ids[i]);
|
|
|
|
|
|
//allName += TableManager.Instance.Tables.Item.Get((int)mItems.Ids[i]).ID + "X" + mItems.Counts[i];
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
itemParent.SetActive(false);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//invoke when reload window
|
|
|
|
|
|
protected override void OnReloadWindow(object data = null)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//invoke when close window
|
2024-01-24 16:32:38 +08:00
|
|
|
|
protected override void OnHideWindow()
|
2024-01-08 13:13:35 +08:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|