137 lines
2.8 KiB
C#
137 lines
2.8 KiB
C#
using Cysharp.Threading.Tasks;
|
|
using Gameplay;
|
|
using PhxhSDK;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using Button = UnityEngine.UI.Button;
|
|
using Image = UnityEngine.UI.Image;
|
|
|
|
public class UI_GiftItemController : UIWindow
|
|
{
|
|
#region UI
|
|
//UI GameObj
|
|
///Auto Gen Start///
|
|
public Button Button_Close_Normal;
|
|
public TMP_Text Text_ItemName_Normal;
|
|
public Image Image_ItemIcon_Normal;
|
|
public TMP_Text Text_Num_Normal;
|
|
public TMP_Text Text_UsingIntroduce_Normal;
|
|
public RecycleView ScrollView_ItemList_normal;
|
|
public Button Button_Use_Normal;
|
|
public Button Button_Close_Special;
|
|
public TMP_Text Text_ItemName_Special;
|
|
public Image Image_ItemIcon_Special;
|
|
public TMP_Text Text_Num_Special;
|
|
public TMP_Text Text_UsingIntroduce_Special;
|
|
public RecycleView ScrollView_ItemList_special;
|
|
public TMP_Text Text_GainDescript;
|
|
public TMP_Text Text_ItemNum;
|
|
public Button Button_Decrease;
|
|
public Button Button_Add;
|
|
public Button Button_Zero;
|
|
public TMP_Text Text_Zero;
|
|
public Button Button_Max;
|
|
public TMP_Text Text_Max;
|
|
public Button Button_Use_Special;
|
|
public Image Image_TopBlackBar;
|
|
public Image Image_BottomBlackBar;
|
|
|
|
///Auto Gen End///
|
|
|
|
#endregion
|
|
|
|
#region class
|
|
class OpenData
|
|
{
|
|
public int itemID;
|
|
public int useCount;
|
|
|
|
public OpenData(int itemID, int count)
|
|
{
|
|
this.itemID = itemID;
|
|
this.useCount = count;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
private int ItemID;
|
|
private int ItemUseMaxCount;
|
|
private int UseCount = 0;
|
|
|
|
private bool isPatchUse = false;
|
|
private bool PatchUse
|
|
{
|
|
get { return isPatchUse; }
|
|
set
|
|
{
|
|
isPatchUse = value;
|
|
SpecialNode?.SetActive(value);
|
|
NormalNode?.SetActive(!value);
|
|
}
|
|
}
|
|
|
|
private GameObject NormalNode;
|
|
private GameObject SpecialNode;
|
|
|
|
|
|
public static UniTask<UIWindow> Open(int itemID, int maxUseCount = 1)
|
|
{
|
|
CommonUtils.CaptureScreenshot();
|
|
var data = new OpenData(itemID, maxUseCount);
|
|
return UIManager.Instance.CreateAndOpenWindow(UINameConst.UI_GiftItem, data);
|
|
}
|
|
|
|
// deal with input data
|
|
public override void PreLoad(object data = null)
|
|
{
|
|
if (data is OpenData inputdata)
|
|
{
|
|
ItemID = inputdata.itemID;
|
|
ItemUseMaxCount = inputdata.useCount;
|
|
}
|
|
}
|
|
|
|
// Use this for initialization
|
|
public override void OnInit()
|
|
{
|
|
//bind UI GameObj
|
|
UI_GiftItemBinder.GetComponents(this);
|
|
|
|
NormalNode = FindObj("MainNode/NormalNode");
|
|
SpecialNode = FindObj("MainNode/SpecialNode");
|
|
|
|
if (ItemUseMaxCount == 1)
|
|
{
|
|
PatchUse = false;
|
|
}
|
|
else//批量使用界面
|
|
{
|
|
PatchUse = true;
|
|
}
|
|
}
|
|
|
|
//invoke when open window
|
|
protected override void OnShowWindow(object data = null)
|
|
{
|
|
|
|
}
|
|
|
|
//invoke when reload window
|
|
protected override void OnReloadWindow(object data = null)
|
|
{
|
|
|
|
}
|
|
|
|
//invoke when close window
|
|
protected override void OnHideWindow()
|
|
{
|
|
|
|
}
|
|
|
|
//invoke when destroy
|
|
public override void OnRelease()
|
|
{
|
|
base.OnRelease();
|
|
}
|
|
} |