Files
JJBB/Assets/Project/Script/GUI/Marry/WeedingBanQuetConfirmPanel.cs
2024-08-23 15:49:34 +08:00

83 lines
2.0 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using GCGame.Table;
public class WeedingBanQuetConfirmPanel : MonoBehaviour {
public Image _TypeIcon;
public List<Sprite> _TypeIconList;
public List<Toggle> _totalSelectTypeTpggleList;
public Text _CostDesc;
private int _CurSelectTabId = 0;
private Tab_WeedingBanQuet _table;
public void InitType(int tableId)
{
SelectAllToggle();
_CurSelectTabId = tableId;
_table = TableManager.GetWeedingBanQuetByID(_CurSelectTabId, 0);
if (_table == null)
return;
InitTypeIcon();
InitCost();
}
public void InitTypeIcon()
{
_TypeIcon.overrideSprite = _TypeIconList[0];
}
public void InitCost()
{
_CostDesc.text = StrDictionary.GetClientDictionaryString("#{47410}", _table.CostVal) + GCGame.Utils.GetMoneyName(_table.CostSubClassType);
}
//初始化默认全部选中
public void SelectAllToggle()
{
for(int index = 0; index < _totalSelectTypeTpggleList.Count; index++)
{
_totalSelectTypeTpggleList[index].isOn = true;
}
}
public void OnConfirmBtn()
{
List<int> typeList = new List<int>();
for (int index = 0; index < _totalSelectTypeTpggleList.Count; index++)
{
typeList.Add(_totalSelectTypeTpggleList[index].isOn ? 1 : 0);
}
ReqHoldWeddingFeast req = new ReqHoldWeddingFeast();
req.nType = _table.ID;
req.nCategory = typeList;
req.SendMsg();
UIManager.CloseUI(UIInfo.WeedingBanquetPanel);
}
public void OnAllToggle(bool isOn)
{
if(isOn)
{
_totalSelectTypeTpggleList[0].isOn = true;
_totalSelectTypeTpggleList[1].isOn = true;
}
}
public void OnCancelBtn()
{
UIManager.CloseUI(UIInfo.WeedingBanquetPanel);
}
public void OnBack()
{
OnCancelBtn();
}
}