备份CatanBuilding瘦身独立工程
This commit is contained in:
99
Assets/Scripts/UI/Tips/buff_tips.cs
Normal file
99
Assets/Scripts/UI/Tips/buff_tips.cs
Normal file
@@ -0,0 +1,99 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class buff_tips : MonoBehaviour
|
||||
{
|
||||
public TMP_Text buff_time;
|
||||
public TMP_Text buff_name;
|
||||
public TMP_Text buff_content;
|
||||
public Image buff_icon;
|
||||
public int buffId;
|
||||
public void InitPanel(FishBuff 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 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 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 SuperSavingPot)
|
||||
{
|
||||
SuperSavingPot superSavingPot = buff.BuffParam as SuperSavingPot;
|
||||
desc = LocalizationMgr.GetFormatTextValue(buff.Desc_l10n_key, superSavingPot.Param.ToPercentageString());
|
||||
}
|
||||
|
||||
buff_name.text = title;
|
||||
buff_content.text = desc;
|
||||
if (!string.IsNullOrEmpty(iconName))
|
||||
{
|
||||
GContext.container.Resolve<IUIService>().SetImageSprite(buff_icon, iconName);
|
||||
}
|
||||
}
|
||||
public void SetBuffTime(string str)
|
||||
{
|
||||
buff_time.text = str;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user