备份CatanBuilding瘦身独立工程
This commit is contained in:
116
Assets/Scripts/UI/Buff/BuffInfoPopup.cs
Normal file
116
Assets/Scripts/UI/Buff/BuffInfoPopup.cs
Normal file
@@ -0,0 +1,116 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class BuffInfoPopup : MonoBehaviour
|
||||
{
|
||||
public TMP_Text text_title;
|
||||
public TMP_Text text_time;
|
||||
public Image icon;
|
||||
public TMP_Text text_content;
|
||||
int buffId;
|
||||
private void Reset()
|
||||
{
|
||||
text_title = transform.Find("text_title").GetComponent<TMP_Text>();
|
||||
text_time = transform.Find("bg_time/text_time").GetComponent<TMP_Text>();
|
||||
icon = transform.Find("btn_buff/Ani_Container/icon").GetComponent<Image>();
|
||||
text_content = transform.Find("text_content").GetComponent<TMP_Text>();
|
||||
}
|
||||
public void InitPanel(FishBuff buff)
|
||||
{
|
||||
SetBuffPanel(buff);
|
||||
buffId = buff.ID;
|
||||
string title = LocalizationMgr.GetText(buff.Title_l10n_key);
|
||||
string desc = LocalizationMgr.GetText(buff.Desc_l10n_key);
|
||||
string iconName = buff.Icon;
|
||||
if (buff.BuffParam is ExtraGold)
|
||||
{
|
||||
ExtraGold extraGold = buff.BuffParam as ExtraGold;
|
||||
desc = LocalizationMgr.GetFormatTextValue(buff.Desc_l10n_key, extraGold.Param.ToPercentageString());
|
||||
}
|
||||
else if (buff.BuffParam is CollectionTargetExtraPoint)
|
||||
{
|
||||
string str = "";
|
||||
//新目标奖励活动特殊地图 Todo
|
||||
str = GContext.container.Resolve<FishingEventData>().collectingTargetInit.Title_l10n_key;
|
||||
str = LocalizationMgr.GetText(str);
|
||||
CollectionTargetExtraPoint collectionTargetExtraPoint = buff.BuffParam as CollectionTargetExtraPoint;
|
||||
desc = LocalizationMgr.GetFormatTextValue(buff.Desc_l10n_key, collectionTargetExtraPoint.Param.ToPercentageString(), str);
|
||||
}
|
||||
else if (buff.BuffParam is SpMapExtraPoint)
|
||||
{
|
||||
SpMapExtraPoint spMapExtraPoint = buff.BuffParam as SpMapExtraPoint;
|
||||
desc = LocalizationMgr.GetFormatTextValue(buff.Desc_l10n_key, spMapExtraPoint.Param.ToPercentageString());
|
||||
}
|
||||
else if (buff.BuffParam is SuperBomb)
|
||||
{
|
||||
SuperBomb superBomb = buff.BuffParam as SuperBomb;
|
||||
desc = LocalizationMgr.GetFormatTextValue(buff.Desc_l10n_key, superBomb.CashBonus.ToPercentageString());
|
||||
}
|
||||
else if (buff.BuffParam is SuperRob)
|
||||
{
|
||||
SuperRob superRob = buff.BuffParam as SuperRob;
|
||||
desc = LocalizationMgr.GetFormatTextValue(buff.Desc_l10n_key, superRob.CashBonus.ToPercentageString());
|
||||
}
|
||||
else if (buff.BuffParam is SuperHunt)
|
||||
{
|
||||
SuperHunt superHunt = buff.BuffParam as SuperHunt;
|
||||
desc = LocalizationMgr.GetFormatTextValue(buff.Desc_l10n_key, superHunt.CashBonus.ToPercentageString());
|
||||
}
|
||||
else if (buff.BuffParam is CollectionTargetWeight)
|
||||
{
|
||||
string str = "";
|
||||
//新目标奖励活动 Todo
|
||||
CollectionTargetWeight collectionTargetWeight = buff.BuffParam as CollectionTargetWeight;
|
||||
CollectingTargetInit collectingTargetInit = GContext.container.Resolve<FishingEventData>().collectingTargetInit;
|
||||
if (collectingTargetInit != null)
|
||||
{
|
||||
EventTargetExtraDrop eventTargetExtraDrop = collectingTargetInit.FishingExtraDrop;
|
||||
if (eventTargetExtraDrop is ETKeepsake)
|
||||
{
|
||||
ETKeepsake eTKeepsake = eventTargetExtraDrop as ETKeepsake;
|
||||
int fishItemId = eTKeepsake.FishIDList[collectionTargetWeight.TargetFishIndex - 1];
|
||||
Item item = GContext.container.Resolve<Tables>().TbItem.GetOrDefault(fishItemId);
|
||||
str = LocalizationMgr.GetText(item.Name_l10n_key);
|
||||
iconName = collectingTargetInit.BuffIcon;
|
||||
}
|
||||
}
|
||||
title = LocalizationMgr.GetFormatTextValue(buff.Title_l10n_key, str);
|
||||
desc = LocalizationMgr.GetFormatTextValue(buff.Desc_l10n_key, str);
|
||||
}
|
||||
else if (buff.BuffParam is ConstructionCost)
|
||||
{
|
||||
ConstructionCost constructionCost = buff.BuffParam as ConstructionCost;
|
||||
desc = LocalizationMgr.GetFormatTextValue(buff.Desc_l10n_key, constructionCost.Param.ToPercentageString());
|
||||
|
||||
}
|
||||
else if (buff.BuffParam is SuperSavingPot)
|
||||
{
|
||||
SuperSavingPot superSavingPot = buff.BuffParam as SuperSavingPot;
|
||||
desc = LocalizationMgr.GetFormatTextValue(buff.Desc_l10n_key, superSavingPot.Param.ToPercentageString());
|
||||
}
|
||||
else if (buff.BuffParam is Event1v1RodBuff)
|
||||
{
|
||||
Event1v1RodBuff event1V1RodBuff = buff.BuffParam as Event1v1RodBuff;
|
||||
desc = LocalizationMgr.GetFormatTextValue(buff.Desc_l10n_key, event1V1RodBuff.Param.ToPercentageString());
|
||||
}
|
||||
|
||||
text_title.text = title;
|
||||
text_content.text = desc;
|
||||
if (!string.IsNullOrEmpty(iconName))
|
||||
{
|
||||
GContext.container.Resolve<IUIService>().SetImageSprite(icon, iconName);
|
||||
}
|
||||
}
|
||||
protected virtual void SetBuffPanel(FishBuff buff)
|
||||
{
|
||||
|
||||
}
|
||||
public void SetBuffTime(string str)
|
||||
{
|
||||
text_time.text = str;
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Buff/BuffInfoPopup.cs.meta
Normal file
11
Assets/Scripts/UI/Buff/BuffInfoPopup.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ec786ea32f6199946a14e8015ae20da4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
17
Assets/Scripts/UI/Buff/BuffInfoPopup_2.cs
Normal file
17
Assets/Scripts/UI/Buff/BuffInfoPopup_2.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using TMPro;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class BuffInfoPopup_2 : BuffInfoPopup
|
||||
{
|
||||
public Image text_info_image;
|
||||
public TMP_Text text_info_text;
|
||||
protected override void SetBuffPanel(FishBuff buff)
|
||||
{
|
||||
IUIService uiService = GContext.container.Resolve<IUIService>();
|
||||
uiService.SetImageSprite(text_info_image, buff.RemarkIcon[0]);
|
||||
text_info_text.text = LocalizationMgr.GetText(buff.RemarkDesc_l10n_key);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Buff/BuffInfoPopup_2.cs.meta
Normal file
11
Assets/Scripts/UI/Buff/BuffInfoPopup_2.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 20993cbd507d6d04e98f024a64ce33e2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
55
Assets/Scripts/UI/Buff/BuffInfoPopup_3.cs
Normal file
55
Assets/Scripts/UI/Buff/BuffInfoPopup_3.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using TMPro;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class BuffInfoPopup_3 : BuffInfoPopup
|
||||
{
|
||||
public Image icon_1, icon_2;
|
||||
public TMP_Text text_info1;
|
||||
public TMP_Text text_info2;
|
||||
protected override void SetBuffPanel(FishBuff buff)
|
||||
{
|
||||
float superCashBonus = 0;
|
||||
Item item = GContext.container.Resolve<Tables>().TbItem.GetOrDefault(1002);
|
||||
if (buff.BuffParam is MoreFishingCash)
|
||||
{
|
||||
MoreFishingCash moreFishingCash = buff.BuffParam as MoreFishingCash;
|
||||
IUIService uiService = GContext.container.Resolve<IUIService>();
|
||||
uiService.SetImageSprite(icon_1, buff.RemarkIcon[0]);
|
||||
uiService.SetImageSprite(icon_2, buff.RemarkIcon[1]);
|
||||
|
||||
text_info1.text = $"{LocalizationMgr.GetText(item.Name_l10n_key)} +{moreFishingCash.Param[0].ToPercentageString()}";
|
||||
text_info2.text = $"{LocalizationMgr.GetText(item.Name_l10n_key)} +{moreFishingCash.Param[1].ToPercentageString()}";
|
||||
|
||||
return;
|
||||
}
|
||||
else if (buff.BuffParam is SuperRob)
|
||||
{
|
||||
SuperRob superRob = buff.BuffParam as SuperRob;
|
||||
superCashBonus = superRob.CashBonus;
|
||||
}
|
||||
else if (buff.BuffParam is SuperBomb)
|
||||
{
|
||||
SuperBomb superBomb = buff.BuffParam as SuperBomb;
|
||||
superCashBonus = superBomb.CashBonus;
|
||||
}
|
||||
else if (buff.BuffParam is SuperHunt)
|
||||
{
|
||||
SuperHunt superHunt = buff.BuffParam as SuperHunt;
|
||||
superCashBonus = superHunt.CashBonus;
|
||||
}
|
||||
|
||||
FishingEventData _fishingEventData = GContext.container.Resolve<FishingEventData>();
|
||||
text_info1.text = $"{LocalizationMgr.GetText(item.Name_l10n_key)} +{superCashBonus.ToPercentageString()}";
|
||||
|
||||
if (_fishingEventData.rankInit != null)
|
||||
{
|
||||
item = GContext.container.Resolve<Tables>().TbItem.GetOrDefault(_fishingEventData.rankInit.TokenID);
|
||||
IUIService uiService = GContext.container.Resolve<IUIService>();
|
||||
uiService.SetImageSprite(icon_2, item.Icon);
|
||||
text_info2.text = $"{LocalizationMgr.GetText(item.Name_l10n_key)} +{0}";
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Buff/BuffInfoPopup_3.cs.meta
Normal file
11
Assets/Scripts/UI/Buff/BuffInfoPopup_3.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f2d231c9d2a08b44ab9425418e7df202
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
86
Assets/Scripts/UI/Buff/FishingBuffInfoPopupPanel.cs
Normal file
86
Assets/Scripts/UI/Buff/FishingBuffInfoPopupPanel.cs
Normal file
@@ -0,0 +1,86 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class FishingBuffInfoPopupPanel : MonoBehaviour
|
||||
{
|
||||
Timer buff_timer;
|
||||
BuffInfoPopup buffInfoPopup;
|
||||
Button btn_close;
|
||||
private void Start()
|
||||
{
|
||||
btn_close = transform.Find("btn_close").GetComponent<Button>();
|
||||
btn_close.onClick.AddListener(Close);
|
||||
}
|
||||
public void InitPanel(FishBuff buff)
|
||||
{
|
||||
Transform root = transform.Find("root");
|
||||
for (int i = 0; i < root.childCount; i++)
|
||||
{
|
||||
GameObject gameObj = root.GetChild(i).gameObject;
|
||||
gameObj.SetActive(gameObj.name == buff.RemarkNode);
|
||||
if (gameObj.name == buff.RemarkNode)
|
||||
{
|
||||
buffInfoPopup = gameObj.GetComponent<BuffInfoPopup>();
|
||||
}
|
||||
}
|
||||
if (buffInfoPopup != null)
|
||||
{
|
||||
buffInfoPopup.InitPanel(buff);
|
||||
buff_timer?.Cancel();
|
||||
buffInfoPopup.SetBuffTime(LocalizationMgr.GetFormatTextValue("UI_COMMON_min", buff.CountDown / 60));
|
||||
}
|
||||
}
|
||||
public void InitPanel(FishBuffTimeData buffTimeData)
|
||||
{
|
||||
FishBuff buff = GContext.container.Resolve<Tables>().TbFishBuff.GetOrDefault(buffTimeData.buffID);
|
||||
Transform root = transform.Find("root");
|
||||
for (int i = 0; i < root.childCount; i++)
|
||||
{
|
||||
GameObject gameObj = root.GetChild(i).gameObject;
|
||||
gameObj.SetActive(gameObj.name == buff.RemarkNode);
|
||||
if (gameObj.name == buff.RemarkNode)
|
||||
{
|
||||
buffInfoPopup = gameObj.GetComponent<BuffInfoPopup>();
|
||||
}
|
||||
}
|
||||
if (buffInfoPopup != null)
|
||||
{
|
||||
buffInfoPopup.InitPanel(buff);
|
||||
var buffTime = buffTimeData.buffEndTime - ZZTimeHelper.UtcNow().UtcNowOffset();
|
||||
buff_timer?.Cancel();
|
||||
double seconds = buffTime.TotalSeconds;
|
||||
TimeSpan now = buffTimeData.buffEndTime - ZZTimeHelper.UtcNow().UtcNowOffset();
|
||||
buffInfoPopup.SetBuffTime(ConvertTools.ConvertTime2(now));
|
||||
buff_timer = this.AttachTimer((float)seconds,
|
||||
() => { Close(); },
|
||||
(elapsed) =>
|
||||
{
|
||||
if (buffTimeData.isEnd)
|
||||
{
|
||||
Close();
|
||||
return;
|
||||
}
|
||||
now = buffTimeData.buffEndTime - ZZTimeHelper.UtcNow().UtcNowOffset();
|
||||
if (now.TotalSeconds <= 0)
|
||||
{
|
||||
Close();
|
||||
return;
|
||||
}
|
||||
buffInfoPopup.SetBuffTime(ConvertTools.ConvertTime2(now));
|
||||
}, useRealTime: true);
|
||||
}
|
||||
}
|
||||
void Close()
|
||||
{
|
||||
UIManager.Instance.DestroyUI(UITypes.FishingBuffInfoPopupPanel);
|
||||
}
|
||||
private void OnDestroy()
|
||||
{
|
||||
buff_timer?.Cancel();
|
||||
buff_timer = null;
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Buff/FishingBuffInfoPopupPanel.cs.meta
Normal file
11
Assets/Scripts/UI/Buff/FishingBuffInfoPopupPanel.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7337165d2f7f57d4cb1cd722b5ef36c4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
76
Assets/Scripts/UI/Buff/FishingBuffLayoutPopupPanel.cs
Normal file
76
Assets/Scripts/UI/Buff/FishingBuffLayoutPopupPanel.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
public class FishingBuffLayoutPopupPanel : MonoBehaviour
|
||||
{
|
||||
RectTransform defaultStyle;
|
||||
RectTransform targetStyle;
|
||||
HomeBuffItem btn_buff_prefab;
|
||||
HomeBuffItem btn_buff_target;
|
||||
BuffDataCenter buffDataCenter;
|
||||
FishingData fishingData;
|
||||
FishBuffTimeData targetBuffTimeData;
|
||||
Transform content;
|
||||
List<FishBuffTimeData> fishBuffTimeData;
|
||||
private void Awake()
|
||||
{
|
||||
content = transform.Find("root/ScrollView/Viewport/Content");
|
||||
defaultStyle = transform.Find("root/ScrollView/Viewport/Content/btn_buff_beilv/Ani_Container/icon").GetComponent<RectTransform>();
|
||||
targetStyle = transform.Find("root/ScrollView/Viewport/Content/btn_buff_target/Ani_Container/icon").GetComponent<RectTransform>();
|
||||
btn_buff_prefab = transform.Find("root/ScrollView/Viewport/Content/btn_buff_beilv").GetComponent<HomeBuffItem>();
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
btn_buff_prefab.gameObject.SetActive(false);
|
||||
fishingData = GContext.container.Resolve<FishingData>();
|
||||
buffDataCenter = GContext.container.Resolve<BuffDataCenter>();
|
||||
fishBuffTimeData = buffDataCenter.GetGroupBuff();
|
||||
int mapId = fishingData.MapId;
|
||||
var mapBuffTimeData = buffDataCenter.GetMapBuffTimeData(mapId);
|
||||
if (mapBuffTimeData != null)
|
||||
{
|
||||
fishBuffTimeData.Add(mapBuffTimeData);
|
||||
}
|
||||
targetBuffTimeData = buffDataCenter.GetBuffData<CollectionTargetWeight>();
|
||||
if (targetBuffTimeData != null)
|
||||
{
|
||||
fishBuffTimeData.Add(targetBuffTimeData);
|
||||
}
|
||||
ShowBuff();
|
||||
}
|
||||
void ShowBuff()
|
||||
{
|
||||
fishBuffTimeData = fishBuffTimeData.Where(x => x.isEnd == false).ToList();
|
||||
fishBuffTimeData.Sort((a, b) => b.SortID.CompareTo(a.SortID));
|
||||
int dataCount = fishBuffTimeData.Count;
|
||||
|
||||
|
||||
for (int i = 0; i < dataCount; i++)
|
||||
{
|
||||
HomeBuffItem homeBuffItem;
|
||||
|
||||
var item = Instantiate(btn_buff_prefab.gameObject, content);
|
||||
homeBuffItem = item.GetComponent<HomeBuffItem>();
|
||||
if (targetBuffTimeData != null && fishBuffTimeData[i].buffID == targetBuffTimeData.buffID)
|
||||
{
|
||||
btn_buff_target = homeBuffItem;
|
||||
homeBuffItem.InitPanel(fishBuffTimeData[i], "", targetStyle);
|
||||
CollectingTargetInit targetWeightInit = GContext.container.Resolve<FishingEventData>().collectingTargetInit;
|
||||
|
||||
if (targetWeightInit != null)
|
||||
{
|
||||
btn_buff_target.InitPanel(targetBuffTimeData, targetWeightInit.BuffIcon, targetStyle);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
homeBuffItem.InitPanel(fishBuffTimeData[i], "", defaultStyle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
11
Assets/Scripts/UI/Buff/FishingBuffLayoutPopupPanel.cs.meta
Normal file
11
Assets/Scripts/UI/Buff/FishingBuffLayoutPopupPanel.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0a134b91d45140f439a31f20cec9d42c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user