using cfg; using cfg.ActorCfg; using Cysharp.Threading.Tasks; using Framework; using Gameplay; using Gameplay.Common; using Gameplay.Level; using Gameplay.Net; using PhxhSDK; using System; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.UI; using Button = UnityEngine.UI.Button; using Image = UnityEngine.UI.Image; public class UI_ItemDetailInfoController : UIWindow { #region UI //UI GameObj ///Auto Gen Start/// public Image Image_BG; public Image Image_Name; public TMP_Text Text_Name1; public Image Image_Item; public TMP_Text Text_Have; public TMP_Text Text_InfoNum; public TMP_Text Text_Describe; public Image Image_UseBG; public Button Button_Min; public TMP_Text Text_Min; public Button Button_Minus; public Button Button_Plus; public Button Button_Max; public TMP_Text Text_Max; public TMP_Text Text_UseNum; public Button Button_UseConfirm; public TMP_Text Text_Use; public Button Button_From; public TMP_Text Text_From1; public Image Image_Open; public TMP_Text Text_From2; public Button Button_0; public TMP_Text Text_LevelInfo1; public TMP_Text Text_GoTo1; public TMP_Text Text_Name2; public Button Button_ChooseConfirm; public TMP_Text Text_Choose; ///Auto Gen End/// #endregion /// /// 物品详情窗口 /// class ItemInfoPopup : UIGameObjectWrapper { public enum ItemInfoPanelState { Info, Choose } GameObject BG; GameObject ItemInfopanel; GameObject ItemChoosepanel; InfoPanel infoPanel; ChoosePanel choosePanel; Action closeWindowAction; #region PanelClass /// /// 物品信息面板 /// class InfoPanel : UIGameObjectWrapper { int ID; DataItem dataItem; int usageAmount = 1; #region UIGameObj GameObject UseTextInput; GameObject UseConfirmButton; TextMeshProUGUI NameText; Image itemIcon; TextMeshProUGUI itemCount; GameObject itemFrom; TextMeshProUGUI itemInfoText; GameObject MinButton; GameObject MinusButton; GameObject PlusButton; GameObject MaxButton; PhxhScrollView scrollView; #endregion ItemInfoPopup parentPopup; public InfoPanel(GameObject Root, bool isScale = false) : base(Root, isScale) { Root.SetActive(true); Binder(Root); BindPanelButtons(); SetSourcePanel(); } public async void Show(int itemID, ItemInfoPopup parent) { IsScaleShow = true; ID = itemID; this.parentPopup = parent; usageAmount = 1; dataItem = CategoryManager.Instance.GetItemData(itemID); string itemName = CommonUtils.GetLocalizeText(dataItem.NameLocal); NameText.text = itemName; var spritePath = CommonUtils.GetItemPath(itemID); itemIcon.sprite = await LoadAssetAsync(spritePath); itemCount.text = Actor.Instance.Item.GetItemCount(itemID).ToString(); UpdateItemButtons(dataItem.Type == ItemType.Useable || CategoryManager.Instance.ItemJumpType(itemID) != cfg.JumpFuncType.None, dataItem.BatchUsing); //可使用道具或有跳转功能时显示使用按钮 itemFrom.SetActive(AcquisitionAmount() > 0);//有道具来源时显示来源按钮 string introduction = CommonUtils.GetLocalizeText(dataItem.IntroductionKey); itemInfoText.text = introduction; CommonUtils.GetGameObject(itemFrom, "Image_Open").SetActive(false); } public void Hide() { IsScaleShow = false; Dispose(); } void Binder(GameObject Root) { UseConfirmButton = CommonUtils.GetGameObject(Root, "ImageBG/Button_UseConfirm"); UseTextInput = CommonUtils.GetGameObject(Root, "ImageBG/Image_UseBG"); NameText = CommonUtils.GetComponent(Root, "ImageBG/Image_Name/Text_Name1"); itemIcon = CommonUtils.GetComponent(Root, "ImageBG/Image_Item"); itemCount = CommonUtils.GetComponent(Root, "ImageBG/Image_Item/Text_InfoNum"); itemFrom = CommonUtils.GetGameObject(Root, "ImageBG/Button_From"); itemInfoText = GetComponent("ImageBG/Image_Item/Text_Describe"); MinButton = CommonUtils.GetGameObject(Root, "ImageBG/Image_UseBG/Button_Min"); MinusButton = CommonUtils.GetGameObject(Root, "ImageBG/Image_UseBG/Button_Minus"); PlusButton = CommonUtils.GetGameObject(Root, "ImageBG/Image_UseBG/Button_Plus"); MaxButton = CommonUtils.GetGameObject(Root, "ImageBG/Image_UseBG/Button_Max"); } void UpdateItemButtons(bool isItemUsable, bool isItemBatchUse) { UseConfirmButton.SetActive(isItemUsable); UseTextInput.SetActive(isItemUsable && isItemBatchUse); TextMeshProUGUI amountText = CommonUtils.GetComponent(UseTextInput, "Text_UseNum"); amountText.text = usageAmount.ToString(); } void BindPanelButtons() { CommonUtils.BindButton(itemFrom.GetComponent