90 lines
3.8 KiB
C#
90 lines
3.8 KiB
C#
using asap.core;
|
|
using cfg;
|
|
using game;
|
|
using GameCore;
|
|
using System;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class EventReportPopupItem : ReportBase
|
|
{
|
|
TMP_Text text_info;
|
|
GameObject icon_time;
|
|
GameObject icon_bomb;
|
|
GameObject icon_bankheist;
|
|
GameObject icon_lure;
|
|
GameObject icon_hunting;
|
|
TMP_Text text_time;
|
|
override protected void Awake()
|
|
{
|
|
base.Awake();
|
|
text_info = transform.Find("info/text_info").GetComponent<TMP_Text>();
|
|
icon_time = transform.Find("icon_time").gameObject;
|
|
icon_bomb = transform.Find("icon_bomb").gameObject;
|
|
icon_bankheist = transform.Find("icon_bankheist").gameObject;
|
|
icon_lure = transform.Find("icon_lure").gameObject;
|
|
icon_hunting = transform.Find("icon_hunting").gameObject;
|
|
text_time = transform.Find("text_time").GetComponent<TMP_Text>();
|
|
}
|
|
public void SetData(EventPopupData eventPopupData)
|
|
{
|
|
icon_lure.SetActive(eventPopupData.type == ReportDataType.Energy);
|
|
icon_bomb.SetActive(eventPopupData.type == ReportDataType.Bomb);
|
|
icon_bankheist.SetActive(eventPopupData.type == ReportDataType.Heist);
|
|
icon_hunting.SetActive(eventPopupData.type == ReportDataType.Aquarium);
|
|
|
|
switch (eventPopupData.type)
|
|
{
|
|
case ReportDataType.Bomb:
|
|
text_info.text = LocalizationMgr.GetText("UI_HomePanel_101010");
|
|
break;
|
|
case ReportDataType.Heist:
|
|
text_info.text = LocalizationMgr.GetFormatTextValue("UI_HomePanel_101009", eventPopupData.content);
|
|
break;
|
|
case ReportDataType.Picture:
|
|
text_info.text = LocalizationMgr.GetText("UI_HomePanel_101008");
|
|
break;
|
|
case ReportDataType.Energy:
|
|
text_info.text = LocalizationMgr.GetText("UI_EventReportPopupPanel_6");
|
|
break;
|
|
case ReportDataType.Aquarium:
|
|
string[] str = eventPopupData.content.Split('#');
|
|
string aquariumId = "";
|
|
|
|
if (str.Length > 3 && int.TryParse(str[3], out int itemID))
|
|
{
|
|
Item fishItem = GContext.container.Resolve<Tables>().TbItem.GetOrDefault(itemID);
|
|
if (fishItem != null)
|
|
{
|
|
Image icon_rate = transform.Find("icon_hunting/head/icon_rate").GetComponent<Image>();
|
|
Image icon_fish = transform.Find("icon_hunting/head/mask_fish/icon_fish").GetComponent<Image>();
|
|
IUIService uIService = GContext.container.Resolve<IUIService>();
|
|
uIService.SetImageSprite(icon_rate, "icon_fish_rate_tag_" + fishItem.Quality);
|
|
PlayerFishData.SetFishIcon(icon_fish, fishItem);//鱼头像
|
|
int q = fishItem.Quality;
|
|
if (q > 6) { q = 6; }
|
|
aquariumId = LocalizationMgr.GetText($"UI_FishingMapPanel_10101{q + 1}");
|
|
|
|
}
|
|
}
|
|
|
|
if (str.Length > 4 && bool.TryParse(str[4], out bool result) && result)
|
|
{
|
|
text_info.text = LocalizationMgr.GetFormatTextValue("UI_EventReportPopupPanel_8", aquariumId);
|
|
}
|
|
else
|
|
text_info.text = LocalizationMgr.GetFormatTextValue("UI_EventReportPopupPanel_7", aquariumId);
|
|
|
|
break;
|
|
default:
|
|
gameObject.SetActive(false);
|
|
break;
|
|
}
|
|
DateTime dateTime = ZZTimeHelper.UtcNow();
|
|
var now = dateTime - eventPopupData.createTime;
|
|
text_time.text = LocalizationMgr.GetFormatTextValue("UI_FishingMailPopupPanel_6", ConvertTools.ConvertTime3(now));
|
|
Init(eventPopupData.playerID);
|
|
}
|
|
}
|