97 lines
3.3 KiB
C#
97 lines
3.3 KiB
C#
using System.Collections.Generic;
|
|
using asap.core;
|
|
using cfg;
|
|
using GameCore;
|
|
using Script.RuntimeScript;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public partial class EventSandDigInfoPopupPanelLogic : MonoBehaviour
|
|
{
|
|
private List<RewardItemNew> _clampRewards = new List<RewardItemNew>();
|
|
TMP_Text text_tips;
|
|
TMP_Text text_info;
|
|
Image _ticket;
|
|
Image _icon1;
|
|
protected void Start()
|
|
{
|
|
_ticket = transform.Find("root/info1/btn_bubble_task/btn_reward/icon").GetComponent<Image>();
|
|
text_info = transform.Find("root/info1/text_info").GetComponent<TMP_Text>();
|
|
text_tips = transform.Find("root/text_tips").GetComponent<TMP_Text>();
|
|
_icon1 = transform.Find("root/info2/icon1").GetComponent<Image>();
|
|
_clampRewards.Add(_reward1.GetComponent<RewardItemNew>());
|
|
_clampRewards.Add(_reward2.GetComponent<RewardItemNew>());
|
|
_clampRewards.Add(_reward3.GetComponent<RewardItemNew>());
|
|
|
|
_close.onClick.AddListener(OnCloseBtn);
|
|
UpdateView();
|
|
}
|
|
|
|
private void UpdateView()
|
|
{
|
|
Tables tables = GContext.container.Resolve<Tables>();
|
|
|
|
//奖励处理
|
|
DiggingStageReward clampConfig;
|
|
ItemData itemData;
|
|
DiggingGameModel _dataModel = GContext.container.Resolve<DiggingGameManager>().DataModel;
|
|
for (int i = 0; i < _clampRewards.Count; i++)
|
|
{
|
|
|
|
int clampId = _dataModel.AllClamps[i];
|
|
clampConfig = tables.TbDiggingStageReward.Get(clampId);
|
|
if (clampConfig != null)
|
|
{
|
|
itemData = GContext.container.Resolve<PlayerItemData>().GetItemDataOne(clampConfig.DropID, 0);
|
|
_clampRewards[i].SetRewardPopupData(itemData);
|
|
_clampRewards[i].SetReceived(i == 0);
|
|
}
|
|
}
|
|
|
|
DiggingActivityInit digActivityConfig = _dataModel.digActivityConfig;
|
|
Item item = tables.TbItem[digActivityConfig.TokenID];
|
|
GContext.container.Resolve<IUIService>().SetImageSprite(_ticket, item.Icon, BasePanel.PanelName);
|
|
GContext.container.Resolve<IUIService>().SetImageSprite(_icon1, digActivityConfig.IconInfo, BasePanel.PanelName);
|
|
string itemName = LocalizationMgr.GetText(item.Name_l10n_key);
|
|
text_info.text = LocalizationMgr.GetFormatTextValue("UI_EventSandDigPanel_4", itemName);
|
|
text_tips.text = LocalizationMgr.GetFormatTextValue("UI_EventSandDigPanel_7", itemName);
|
|
}
|
|
|
|
private void OnCloseBtn()
|
|
{
|
|
UIManager.Instance.DestroyUI(UITypes.EventSandDigInfoPopupPanel);
|
|
}
|
|
}
|
|
|
|
public class EventSandDigFishQuality
|
|
{
|
|
public Image Img;
|
|
public TextMeshProUGUI Txt;
|
|
public EventSandDigFishQuality(Image img, TextMeshProUGUI txt)
|
|
{
|
|
Img = img;
|
|
Txt = txt;
|
|
}
|
|
public void ShowInfo(int index, int count)
|
|
{
|
|
List<string> qualityIcon = GContext.container.Resolve<Tables>().TbGlobalConfig.FishQualityIcon;
|
|
if (qualityIcon.Count > index)
|
|
{
|
|
SetVisible(true);
|
|
string name = qualityIcon[index];
|
|
Txt.text = "+" + count;
|
|
GContext.container.Resolve<IUIService>().SetImageSprite(Img, name);
|
|
}
|
|
else
|
|
{
|
|
SetVisible(false);
|
|
}
|
|
}
|
|
|
|
public void SetVisible(bool boo)
|
|
{
|
|
Img.gameObject.SetActive(boo);
|
|
Txt.gameObject.SetActive(boo);
|
|
}
|
|
} |