88 lines
2.5 KiB
C#
88 lines
2.5 KiB
C#
using System.Collections.Generic;
|
|
using UnityEngine.UI;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.Serialization;
|
|
using ZGame;
|
|
|
|
namespace HK.FUJIFILM
|
|
{
|
|
public class ProductUI : UIBase
|
|
{
|
|
[SerializeField] private UpMenuItem goUpMenu;
|
|
[SerializeField] private ScrollRect scrParent;
|
|
[SerializeField] private List<ProductScriptableObject> listProduct = new List<ProductScriptableObject>();
|
|
|
|
public override void OnInit()
|
|
{
|
|
base.OnInit();
|
|
|
|
#region AutoGen_Init
|
|
|
|
goUpMenu = GetValue<UpMenuItem>("goUpMenu");
|
|
scrParent = GetValue<ScrollRect>("scrParent");
|
|
|
|
#endregion
|
|
|
|
foreach (var productScriptableObject in listProduct)
|
|
{
|
|
var go = ResourcesManager.Instance.LoadGameObject(
|
|
AssetConst.Assets_Res_FUJIFILM_Prefabs_UI_Item_btnIProducttem_prefab,
|
|
scrParent.content);
|
|
go.SetActive(true);
|
|
go.GetComponent<Image>().sprite = productScriptableObject.icon;
|
|
var button = go.GetComponent<Button>();
|
|
if (!productScriptableObject.isCanGoNext)
|
|
{
|
|
button.interactable = false;
|
|
}
|
|
|
|
button.onClick.AddListener(() => { OnClickbtnIProducttem(productScriptableObject); });
|
|
}
|
|
|
|
goUpMenu.ReturnAction += ReturnCallback;
|
|
}
|
|
|
|
private void ReturnCallback()
|
|
{
|
|
}
|
|
|
|
private void OnClickbtnIProducttem(ProductScriptableObject product)
|
|
{
|
|
if (!product.isCanGoNext)
|
|
return;
|
|
|
|
GlobalGameData.productScriptableObject = product;
|
|
if (product.isShowTermPage)
|
|
{
|
|
var uiOnly = UIManager.Instance.ShowUI(nameof(TermAndConditionsUI), this);
|
|
}
|
|
else
|
|
{
|
|
var uiOnly = UIManager.Instance.ShowUI(nameof(ProductDesginUI), this);
|
|
EventManager.Instance.FireNow(this, new ProductEventArgs(GlobalGameData.productScriptableObject));
|
|
}
|
|
}
|
|
|
|
#region AutoGen_Method
|
|
|
|
private void OnClickbtnIProducttem()
|
|
{
|
|
}
|
|
|
|
#endregion
|
|
|
|
public override void OnDispose()
|
|
{
|
|
base.OnDispose();
|
|
goUpMenu.ReturnAction -= ReturnCallback;
|
|
|
|
#region AutoGen_Dispose
|
|
|
|
goUpMenu = null;
|
|
scrParent = null;
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
} |