using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class BanQuetRedPacketPanel : MonoBehaviour { public List _HeadIconList; public List _NameList; public List _IsFriendIconList; public List _MarkIconList; public List _MarkIconlist; private void OnEnable() { UIManager.ShowUI(UIInfo.MoneyInfoPanel); } private void OnDisable() { UIManager.CloseUI(UIInfo.MoneyInfoPanel); } public UINumBoardInput _NumInput; public void Init(WeddingObj groom, WeddingObj bridge) { LoadAssetBundle.Instance.SetImageSprite(_HeadIconList[0], GCGame.Utils.GetProfessionSpriteName(groom.profession)); LoadAssetBundle.Instance.SetImageSprite(_HeadIconList[1], GCGame.Utils.GetProfessionSpriteName(bridge.profession)); _NameList[0].text = groom.name; _NameList[1].text = bridge.name; _IsFriendIconList[0].SetActive(groom.isfriend == 1); _IsFriendIconList[1].SetActive(bridge.isfriend == 1); OnMoneyIcon(0); OnHeadIcon(0); } private MONEYTYPE _CurSelectMoneyType = MONEYTYPE.MONEYTYPE_YUANBAO_BIND; public void OnMoneyIcon(int index) { long ownVal = 0; if (index == 0) { _CurSelectMoneyType = MONEYTYPE.MONEYTYPE_YUANBAO_BIND; ownVal = GameManager.gameManager.PlayerDataPool.Money.GetMoneyByType(_CurSelectMoneyType); } else { _CurSelectMoneyType = MONEYTYPE.MONEYTYPE_YUANBAO; ownVal = GameManager.gameManager.PlayerDataPool.Money.GetMoneyByType(_CurSelectMoneyType); } if(ownVal > 0) { _NumInput.Init(1, 0, (int)ownVal); }else { _NumInput.Init(0, 0, 0); } ShowMarkIcon(index); } private int _CurSelectIndex = 1; //默认选中队长 public void OnHeadIcon(int _Index) { _CurSelectIndex = _Index + 1; for(int index = 0; index < _MarkIconList.Count; index++) { _MarkIconList[index].SetActive(index == _Index); } } public void ShowMarkIcon(int _Index) { for(int index = 0; index < _MarkIconlist.Count; index++) { _MarkIconlist[index].SetActive(index == _Index); } } public void OnSendBtn() { ReqSendRedPacket req = new ReqSendRedPacket(); req.nMoneyType = (int)_CurSelectMoneyType; req.nRedPacketNum = _NumInput.Value; req.nObj = _CurSelectIndex; req.moneyName = GCGame.Utils.GetMoneyName((int)_CurSelectMoneyType); req.SendMsg(); OnCloseBtn(); } public void OnCloseBtn() { this.gameObject.SetActive(false); } }