1266 lines
52 KiB
C#
1266 lines
52 KiB
C#
using ET;
|
||
using FairyGUI;
|
||
using Cal.DataTable;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Text;
|
||
using UnityEngine;
|
||
using Cal;
|
||
|
||
namespace ET
|
||
{
|
||
public class TabHelper
|
||
{
|
||
private static FUI_TabUI _ui;
|
||
private static FUI_TabUI _comprasionUi;
|
||
|
||
public static FUI_TabUI FUI_TabUI
|
||
{
|
||
get
|
||
{
|
||
if (_ui == null)
|
||
{
|
||
_ui = FUI_TabUI.CreateInstance(FUIComponent.Instance);
|
||
_ui.Name = _ui.self.id.ToString();
|
||
_ui.self.sortingOrder = 9998;
|
||
FUIComponent.Instance.Add(_ui, true);
|
||
}
|
||
|
||
return _ui;
|
||
}
|
||
}
|
||
|
||
private static void AddHideEvent()
|
||
{
|
||
GRoot.inst.GetTopWindow().onRemovedFromStage.Add(TabHelper.HideUI);
|
||
}
|
||
|
||
public static FUI_TabUI FUI_TabComprasionUI
|
||
{
|
||
get
|
||
{
|
||
if (_comprasionUi == null)
|
||
{
|
||
_comprasionUi = FUI_TabUI.CreateInstance(FUIComponent.Instance);
|
||
_comprasionUi.Name = _comprasionUi.self.id.ToString();
|
||
_comprasionUi.self.sortingOrder = 9998;
|
||
FUIComponent.Instance.Add(_comprasionUi, true);
|
||
}
|
||
|
||
return _comprasionUi;
|
||
}
|
||
}
|
||
|
||
private static bool isShowing;
|
||
|
||
//private static bool isLastShowing;
|
||
private static FUI_TabUI OpenUI()
|
||
{
|
||
if (!isShowing)
|
||
{
|
||
isShowing = true;
|
||
FUI_TabUI.Visible = true;
|
||
FUI_TabUI.m_Show.Play();
|
||
}
|
||
#if !UNITY_STANDALONE
|
||
HideComprasionUI();
|
||
AddHideEvent();
|
||
#endif
|
||
return FUI_TabUI;
|
||
}
|
||
|
||
private static FUI_TabUI OpenComprasionUI()
|
||
{
|
||
FUI_TabComprasionUI.Visible = true;
|
||
FUI_TabComprasionUI.m_Show.Play();
|
||
|
||
return FUI_TabComprasionUI;
|
||
}
|
||
|
||
public static void HideUI()
|
||
{
|
||
token?.Cancel();
|
||
isShowing = false;
|
||
if (FUI_TabUI.Visible)
|
||
{
|
||
FUI_TabUI.Visible = false;
|
||
FUI_TabUI.m_Hide.Play();
|
||
}
|
||
|
||
if (FUI_TabComprasionUI.Visible)
|
||
{
|
||
FUI_TabComprasionUI.Visible = false;
|
||
FUI_TabComprasionUI.m_Hide.Play();
|
||
}
|
||
}
|
||
|
||
public static void HideComprasionUI()
|
||
{
|
||
if (FUI_TabComprasionUI.Visible)
|
||
{
|
||
FUI_TabComprasionUI.Visible = false;
|
||
FUI_TabComprasionUI.m_Hide.Play();
|
||
}
|
||
}
|
||
|
||
public struct QualityColor
|
||
{
|
||
public const string Common = "#FFFFFF";
|
||
public const string UnCommon = "#00CD14";
|
||
public const string Rare = "#0027FF";
|
||
public const string Epic = "#FF00B8";
|
||
public const string Legendary = "#FF6600";
|
||
public const string Ulti = "#FF0000";
|
||
}
|
||
|
||
public const string YellowStar = "[img]ui://kqsmrpxlp2c66p[/img]";
|
||
public const string SliverStar = "[img]ui://kqsmrpxlp2c66q[/img]";
|
||
public const string Gold = "[img]ui://kqsmrpxleh2aa[/img]";
|
||
public const string Sliver = "[img]ui://kqsmrpxleh2ab[/img]";
|
||
public const string Coin = "[img]ui://kqsmrpxleh2am[/img]";
|
||
|
||
private const int TitleSize = 18;
|
||
|
||
private static StringBuilder sb = new StringBuilder();
|
||
|
||
private static EventCallback0 action;
|
||
private static ETCancellationToken token;
|
||
|
||
public static void SetTab(GObject btn, EventCallback0 _action, bool isVisal = false)
|
||
{
|
||
#if UNITY_STANDALONE
|
||
btn.data = _action;
|
||
btn.onRollOver.Set1(OnRollOver);
|
||
btn.onRollOut.Set(TabHelper.HideUI);
|
||
#else
|
||
if(isVisal)
|
||
btn.onClick.Set(_action);
|
||
else
|
||
btn.onClick.Add(_action);
|
||
#endif
|
||
}
|
||
|
||
private static async void OnRollOver(EventContext context)
|
||
{
|
||
action = context.sender.As<GObject>().data as EventCallback0;
|
||
token?.Cancel();
|
||
token = new ETCancellationToken();
|
||
var ret = await TimerComponent.Instance.WaitAsync(350, token);
|
||
if (ret)
|
||
action?.Invoke();
|
||
}
|
||
|
||
private static readonly List<string> itemDescList = new List<string>();
|
||
private static readonly string SpaceLine3 = "[size=3] [/size]";
|
||
|
||
public static void OpenUI(Scene zoneScene, ClientItemData data, bool isComprasion = true, long unitId = 0)
|
||
{
|
||
bool isMine = unitId == 0;
|
||
Unit unit = unitId == 0? zoneScene.GetComponent<UnitComponent>().MyUnit : zoneScene.GetComponent<UnitComponent>().Get(unitId);
|
||
ClientItemData wornEquipData = null;
|
||
sb.Length = 0;
|
||
itemDescList.Clear();
|
||
string starSoulString = null;
|
||
switch (data.ItemType)
|
||
{
|
||
default:
|
||
return;
|
||
case ItemType.EquipItem:
|
||
{
|
||
EquipBase equipBase = DataTableHelper.Get<EquipBase>(data.ItemId);
|
||
int index = equipBase.Type;
|
||
if (isComprasion)
|
||
{
|
||
isComprasion = false;
|
||
if (ClientItemDataComponent.Instance.WornEquipDic.TryGetValue(index, out wornEquipData))
|
||
{
|
||
isComprasion = wornEquipData.ItemType == ItemType.EquipItem;
|
||
}
|
||
}
|
||
|
||
Quality quality;
|
||
if (data.Equip.quality == 0)
|
||
quality = (Quality) equipBase.Quality;
|
||
else
|
||
quality = data.Equip.quality;
|
||
string equipLevel = null;
|
||
if (data.Equip.level > 0)
|
||
{
|
||
equipLevel = "+" + data.Equip.level;
|
||
}
|
||
|
||
sb.AppendFormat($"[color={GetQualityColor(quality)}][size={TitleSize}][b]{equipBase.Name} {equipLevel}[/b][/size][/color]\n");
|
||
int star;
|
||
if (data.Equip.star == 0)
|
||
star = equipBase.Star;
|
||
else
|
||
star = data.Equip.star;
|
||
for (int i = 0; i < star; i++)
|
||
{
|
||
sb.AppendFormat(YellowStar);
|
||
}
|
||
|
||
sb.AppendFormat("\n");
|
||
sb.AppendFormat($"装备 {(EquipType) equipBase.Type}\n");
|
||
(long gold, int sliver, int coin) = GetCoinFormat(equipBase.Price);
|
||
sb.Append($"单价: {gold}{Gold} {sliver}{Sliver} {coin}{Coin}\n");
|
||
string isLock = data.IsLock? "已绑定" : "未绑定";
|
||
sb.AppendFormat($"[color=#ff99cc]{isLock}[/color]\n");
|
||
sb.AppendFormat($"需要等级:{equipBase.UseLevel}\n");
|
||
sb.AppendFormat($"需要职业: {GetStrJob(equipBase.JobId, equipBase.Transmigration)}\n");
|
||
sb.AppendLine(SpaceLine3);
|
||
itemDescList.Clear();
|
||
GetEquipSpecialAtrribute(data.Equip, itemDescList);
|
||
foreach (string item in itemDescList)
|
||
{
|
||
sb.AppendFormat($"[color=#99bf88]{item}[/color]\n");
|
||
}
|
||
|
||
sb.AppendLine(SpaceLine3);
|
||
itemDescList.Clear();
|
||
GetEquipBaseAtrribute(data.Equip, equipBase, itemDescList);
|
||
foreach (string item in itemDescList)
|
||
{
|
||
sb.AppendFormat($"[color=#99bf88]{item}[/color]\n");
|
||
}
|
||
|
||
sb.AppendLine(SpaceLine3);
|
||
itemDescList.Clear();
|
||
GetEquipAdditionalAtrribute(data.Equip, itemDescList);
|
||
foreach (string item in itemDescList)
|
||
{
|
||
sb.AppendFormat($"[color=#99bf88]{item}[/color]\n");
|
||
}
|
||
|
||
foreach (int item in data.Equip.gemList)
|
||
{
|
||
if (item == 0)
|
||
{
|
||
sb.AppendFormat($"{SliverStar}\n");
|
||
continue;
|
||
}
|
||
|
||
MaterialBase materialBase = DataTableHelper.Get<MaterialBase>(item);
|
||
sb.AppendFormat(
|
||
$"{YellowStar}[color=#e9d099]{GteGemValue((AttributeType) materialBase.GemKey, materialBase.GemValue)}[/color]\n");
|
||
}
|
||
|
||
if (!data.getSource.IsNullOrEmpty())
|
||
{
|
||
sb.AppendLine($"来源:[color=#ffff00][i]{data.getSource}[/i][/color]");
|
||
}
|
||
|
||
SuitConfig suitConfig = SuitConfigCategory.Instance.GetSuitConfigByEquipId(data.ItemId);
|
||
if (suitConfig != null)
|
||
{
|
||
itemDescList.Clear();
|
||
GetEquipSuitAtrribute(suitConfig.SuitArr, itemDescList);
|
||
sb.AppendFormat($"套装属性:\n");
|
||
foreach (string item in itemDescList)
|
||
{
|
||
sb.AppendFormat($"[color=#99bf88]{item}[/color]\n");
|
||
}
|
||
}
|
||
|
||
StarSoulBag bag = unit.GetComponent<StarSoulBag>();
|
||
|
||
long starSoulId = bag.usedStarSoulDic[(byte) index];
|
||
if (starSoulId != 0)
|
||
{
|
||
sb.AppendLine(SpaceLine3);
|
||
sb.AppendLine("----星魂----");
|
||
starSoulString = GenerateStarSoulString(sb, bag, starSoulId, needReturn: true);
|
||
}
|
||
|
||
sb.AppendFormat($"[color=#ffff99]{equipBase.Description}[/color]");
|
||
}
|
||
break;
|
||
case ItemType.GoodsItem:
|
||
{
|
||
GoodsBase goodsBase = DataTableHelper.Get<GoodsBase>(data.ItemId);
|
||
Quality quality = (Quality) goodsBase.Quality;
|
||
sb.AppendFormat($"[color={GetQualityColor(quality)}][size={TitleSize}][b]{goodsBase.Name}[/b][/size][/color]\n");
|
||
sb.AppendFormat($"道具 消耗品\n");
|
||
(long gold, int sliver, int coin) = GetCoinFormat(goodsBase.Price);
|
||
sb.Append($"单价: {gold}{Gold} {sliver}{Sliver} {coin}{Coin}\n");
|
||
string isLock = data.IsLock? "已绑定" : "未绑定";
|
||
sb.AppendFormat($"[color=#ff99cc]{isLock}[/color]\n");
|
||
sb.AppendFormat($"需要等级:{goodsBase.UsedLevel}\n");
|
||
sb.AppendFormat($"[color=#ffff99]{goodsBase.Description}[/color]");
|
||
}
|
||
break;
|
||
case ItemType.MaterialsItem:
|
||
{
|
||
MaterialBase materialBase = DataTableHelper.Get<MaterialBase>(data.ItemId);
|
||
Quality quality = (Quality) materialBase.Quality;
|
||
sb.AppendFormat($"[color={GetQualityColor(quality)}][size={TitleSize}][b]{materialBase.Name}[/b][/size][/color]\n");
|
||
sb.AppendFormat(
|
||
$"材料 {((MaterialsType) materialBase.MaterialType == MaterialsType.普通材料? MaterialsType.普通材料.ToString() : ((GemType) materialBase.GemType).ToString())}\n");
|
||
(long gold, int sliver, int coin) = GetCoinFormat(materialBase.Price);
|
||
sb.Append($"单价: {gold}{Gold} {sliver}{Sliver} {coin}{Coin}\n");
|
||
string isLock = data.IsLock? "已绑定" : "未绑定";
|
||
sb.AppendFormat($"[color=#ff99cc]{isLock}[/color]\n");
|
||
if (materialBase.MaterialType == (int) MaterialsType.宝石)
|
||
{
|
||
sb.AppendLine($"[color=#99bf88]{GteGemValue((AttributeType) materialBase.GemKey, materialBase.GemValue)}[/color]");
|
||
}
|
||
|
||
sb.Append($"[color=#ffff99]{materialBase.Description}[/color]");
|
||
}
|
||
break;
|
||
}
|
||
|
||
FUI_TabUI ui = OpenUI();
|
||
ui.m_title.text = sb.ToString();
|
||
Vector2 pos = GRoot.inst.GetPoupPosition(ui.self, null, null);
|
||
Vector2 offset = new Vector2(15, 15);
|
||
pos += offset;
|
||
ui.self.position = pos;
|
||
if (isComprasion)
|
||
{
|
||
if (wornEquipData == null) return;
|
||
FUI_TabUI comUI = OpenComprasionUI();
|
||
Vector2 newPos = GetComprasionPos(comUI.self, pos);
|
||
comUI.self.position = newPos;
|
||
sb.Length = 0;
|
||
//!产生字符
|
||
EquipBase equipBase = DataTableHelper.Get<EquipBase>(wornEquipData.ItemId);
|
||
Quality quality = (Quality) equipBase.Quality;
|
||
string equipLevel = null;
|
||
if (wornEquipData.Equip.level > 0)
|
||
{
|
||
equipLevel = "+" + wornEquipData.Equip.level;
|
||
}
|
||
|
||
sb.AppendFormat($"[color={GetQualityColor(quality)}][size={TitleSize}][b]{equipBase.Name} {equipLevel}[/b][/size][/color]\n");
|
||
for (int i = 0; i < equipBase.Star; i++)
|
||
{
|
||
sb.AppendFormat(YellowStar);
|
||
}
|
||
|
||
sb.AppendFormat("\n");
|
||
sb.AppendFormat($"装备[color=#99cc33](已穿戴)[/color] {(EquipType) equipBase.Type}\n");
|
||
(long gold, int sliver, int coin) = GetCoinFormat(equipBase.Price);
|
||
sb.Append($"单价: {gold}{Gold} {sliver}{Sliver} {coin}{Coin}\n");
|
||
sb.AppendFormat($"[color=#ff99cc]已绑定[/color]\n");
|
||
sb.AppendFormat($"需要等级:{equipBase.UseLevel}\n");
|
||
sb.AppendFormat($"需要职业: {GetStrJob(equipBase.JobId, equipBase.Transmigration)}\n");
|
||
sb.AppendLine(SpaceLine3);
|
||
itemDescList.Clear();
|
||
GetEquipSpecialAtrribute(wornEquipData.Equip, itemDescList);
|
||
foreach (string item in itemDescList)
|
||
{
|
||
sb.AppendFormat($"[color=#99bf88]{item}[/color]\n");
|
||
}
|
||
|
||
sb.AppendLine(SpaceLine3);
|
||
itemDescList.Clear();
|
||
GetEquipBaseAtrribute(wornEquipData.Equip, equipBase, itemDescList);
|
||
foreach (string item in itemDescList)
|
||
{
|
||
sb.AppendFormat($"[color=#99bf88]{item}[/color]\n");
|
||
}
|
||
|
||
sb.AppendLine(SpaceLine3);
|
||
itemDescList.Clear();
|
||
GetEquipAdditionalAtrribute(wornEquipData.Equip, itemDescList);
|
||
foreach (string item in itemDescList)
|
||
{
|
||
sb.AppendFormat($"[color=#99bf88]{item}[/color]\n");
|
||
}
|
||
|
||
foreach (int item in wornEquipData.Equip.gemList)
|
||
{
|
||
if (item == 0)
|
||
{
|
||
sb.AppendFormat($"{SliverStar}\n");
|
||
continue;
|
||
}
|
||
|
||
MaterialBase materialBase = DataTableHelper.Get<MaterialBase>(item);
|
||
sb.AppendFormat(
|
||
$"{YellowStar}[color=#e9d099]{GteGemValue((AttributeType) materialBase.GemKey, materialBase.GemValue)}[/color]\n");
|
||
}
|
||
|
||
if (!wornEquipData.getSource.IsNullOrEmpty())
|
||
{
|
||
sb.AppendLine($"来源:[color=#ffff00][i]{wornEquipData.getSource}[/i][/color]");
|
||
}
|
||
|
||
|
||
if (starSoulString != null)
|
||
{
|
||
sb.AppendLine(SpaceLine3);
|
||
sb.AppendLine("----星魂----");
|
||
sb.Append(starSoulString);
|
||
}
|
||
|
||
sb.AppendFormat($"[color=#ffff99]{equipBase.Description}[/color]");
|
||
//!字符串赋值
|
||
FUI_TabComprasionUI.m_title.text = sb.ToString();
|
||
}
|
||
}
|
||
|
||
private static string GenerateStarSoulString(StringBuilder sb, StarSoulBag bag, long equipStarSoulId, bool showPosType = false,
|
||
bool needReturn = false)
|
||
{
|
||
if (equipStarSoulId == 0)
|
||
return string.Empty;
|
||
StarSoulItem starSoulItem = bag.Get(equipStarSoulId);
|
||
return GenerateStarSoulString(sb, bag, starSoulItem, showPosType, needReturn);
|
||
}
|
||
|
||
public static string GenerateStarSoulString(StringBuilder sb, StarSoulBag bag, StarSoulItem starSoulItem, bool showPosType = false,
|
||
bool needReturn = false)
|
||
{
|
||
int startIndex = sb.Length;
|
||
StarSoulTypeConfig starSoulTypeConfig = StarSoulTypeConfigCategory.Instance.Get(starSoulItem.typeId);
|
||
sb.AppendLine(
|
||
$"[color={GetQualityColor(starSoulItem.quality)}][size={TitleSize}][b]{starSoulTypeConfig.Name} +{starSoulItem.level}[/b][/size][/color]");
|
||
|
||
if (showPosType)
|
||
{
|
||
sb.AppendLine($"可放置位置:{starSoulItem.posType}");
|
||
}
|
||
|
||
StarSoulAttributeConfig soulAttributeConfig = StarSoulAttributeConfigCategory.Instance.Get(starSoulItem.mainAttribute);
|
||
sb.AppendLine(SpaceLine3);
|
||
sb.AppendLine("固定属性:");
|
||
sb.AppendLine(
|
||
$"[color=#99bf88]{GetAttributeString((Cal.AttributeType) soulAttributeConfig.Key, ItemHelper.GetRealMainValue(soulAttributeConfig.Value, starSoulItem.level))}[/color]");
|
||
|
||
sb.AppendLine(SpaceLine3);
|
||
sb.AppendLine("随机属性:");
|
||
for (var i = 0; i < starSoulItem.viceAttribute.Length; i++)
|
||
{
|
||
int __id = starSoulItem.viceAttribute[i];
|
||
if (__id == 0)
|
||
break;
|
||
soulAttributeConfig = StarSoulAttributeConfigCategory.Instance.Get(__id);
|
||
sb.AppendLine(
|
||
$"[color=#99bf88]{GetAttributeString((Cal.AttributeType) soulAttributeConfig.Key, ItemHelper.GetRealViceValue(soulAttributeConfig.Value * (1 + starSoulItem.viceAdd[i]), starSoulItem.quality))}[/color]");
|
||
}
|
||
|
||
sb.AppendLine(SpaceLine3);
|
||
sb.AppendLine("套装属性:");
|
||
StarSoulSuit suit = bag.Suits.Find(t => t.Id == starSoulItem.typeId);
|
||
string color = "#999999";
|
||
if (suit != null && suit.type.HasFlag(StarSoulSuit.StarSoulSuitType.Suit4))
|
||
color = "#ccee00";
|
||
sb.AppendLine($"[color={color}]4件套:\n {starSoulTypeConfig.Suit4}[/color]");
|
||
color = "#999999";
|
||
if (suit != null && suit.type.HasFlag(StarSoulSuit.StarSoulSuitType.Suit8))
|
||
color = "#cc9900";
|
||
if (!starSoulTypeConfig.Suit8.IsNullOrEmpty())
|
||
{
|
||
sb.AppendLine($"[color={color}]8件套:\n {starSoulTypeConfig.Suit8}[/color]");
|
||
}
|
||
|
||
if (needReturn)
|
||
return sb.ToString(startIndex, sb.Length - startIndex);
|
||
return null;
|
||
}
|
||
|
||
static Vector2 GetComprasionPos(GObject gObject, Vector2 oldPos)
|
||
{
|
||
Vector2 tempPos = oldPos + new Vector2(-gObject.width, 0);
|
||
|
||
return tempPos;
|
||
}
|
||
|
||
private static void GetEquipSuitAtrribute(SuitConfig.Suit[] suitArr, List<string> list)
|
||
{
|
||
foreach (SuitConfig.Suit suit in suitArr)
|
||
{
|
||
list.Add(TabHelper.GetAttributeString((Cal.AttributeType) suit.Key, suit.Value));
|
||
}
|
||
}
|
||
|
||
//!获取装备的词条
|
||
static void GetEquipBaseAtrribute(Equip equip, EquipBase equipBase, List<string> list)
|
||
{
|
||
foreach (var kv in equip.mainAttribute)
|
||
{
|
||
float value = TabHelper.GetValueFromConfig((Cal.AttributeType) kv.Key, equipBase);
|
||
AttributeType attributeType = (AttributeType) kv.Key;
|
||
list.Add($"{GetAttributeString(attributeType, value, 1 + kv.Value)}{GetPercent(kv.Value)}");
|
||
}
|
||
|
||
foreach (int manulequipId in equip.randomAttributes)
|
||
{
|
||
ManulEquipAttribute manulEquipAttribute = ManulEquipAttributeCategory.Instance.Get(manulequipId);
|
||
if (manulEquipAttribute != null)
|
||
{
|
||
list.Add($"{GetAttributeString((AttributeType) manulEquipAttribute.Key, manulEquipAttribute.Value)}");
|
||
}
|
||
}
|
||
}
|
||
|
||
public static string GetPercent(float percent)
|
||
{
|
||
return percent >= 0? $"[color=#99cc33] ({percent:p2})[/color]" : $"[color=#cc3333] ({percent:p2})[/color]";
|
||
}
|
||
|
||
//!获取装备的词条
|
||
static void GetEquipAdditionalAtrribute(Equip equip, List<string> list)
|
||
{
|
||
foreach (int affixId in equip.addtionalAttributes)
|
||
{
|
||
if (affixId == 0) continue;
|
||
EquipAffixConfig equipAffixConfig = EquipAffixConfigCategory.Instance.Get(affixId);
|
||
if (equipAffixConfig != null)
|
||
{
|
||
foreach (EquipAffixConfig.Affix affix in equipAffixConfig.AffixArr)
|
||
{
|
||
list.Add(TabHelper.GetAttributeString((Cal.AttributeType) affix.Key, affix.Value));
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
static void GetEquipSpecialAtrribute(Equip equip, List<string> list)
|
||
{
|
||
float add;
|
||
Strengthentable strengthentable = StrengthentableCategory.Instance.Get(equip.level, false);
|
||
if (strengthentable == null)
|
||
{
|
||
add = 1;
|
||
}
|
||
else
|
||
add = 1 + strengthentable.AttribteAdd;
|
||
|
||
if (equip.specialKey != AttributeType.无)
|
||
{
|
||
EquipBase equipBase = EquipBaseCategory.Instance.Get(equip.EquipId);
|
||
list.Add($"{equip.specialKey}:{MathHelper.RoundToInt(equipBase.SpecialValue * add)}");
|
||
}
|
||
else
|
||
{
|
||
ManulEquipAttribute manulEquipAttribute = ManulEquipAttributeCategory.Instance.Get(equip.specialId);
|
||
if (manulEquipAttribute != null)
|
||
list.Add($"{(Cal.AttributeType) manulEquipAttribute.Key}:{MathHelper.RoundToInt(manulEquipAttribute.Value * add)}");
|
||
}
|
||
}
|
||
|
||
public static string GetAttributeString(AttributeType attributeType, float value, float coeffict = 1)
|
||
{
|
||
string str = null;
|
||
switch (attributeType)
|
||
{
|
||
case AttributeType.最大生命:
|
||
case AttributeType.最大精力:
|
||
case AttributeType.力量:
|
||
case AttributeType.敏捷:
|
||
case AttributeType.精神:
|
||
case AttributeType.智慧:
|
||
case AttributeType.体质:
|
||
case AttributeType.耐力:
|
||
case AttributeType.物理攻击:
|
||
case AttributeType.精神攻击:
|
||
case AttributeType.物理防御:
|
||
case AttributeType.精神防御:
|
||
str = $"{attributeType}:{MathHelper.RoundToInt(value * coeffict)}";
|
||
break;
|
||
case AttributeType.物理暴击系数:
|
||
case AttributeType.精神暴击系数:
|
||
case AttributeType.物理暴击效果:
|
||
case AttributeType.精神暴击效果:
|
||
case AttributeType.抗物理暴击系数:
|
||
case AttributeType.抗精神暴击系数:
|
||
case AttributeType.抗物理暴击效果:
|
||
case AttributeType.抗精神暴击效果:
|
||
case AttributeType.辅助值:
|
||
case AttributeType.物理免伤:
|
||
case AttributeType.精神免伤:
|
||
case AttributeType.速度:
|
||
case AttributeType.命中:
|
||
case AttributeType.抵抗:
|
||
case AttributeType.吸血率:
|
||
case AttributeType.吸血量:
|
||
case AttributeType.生命回复:
|
||
case AttributeType.物理增伤:
|
||
case AttributeType.精神增伤:
|
||
str = $"{attributeType}:{value * coeffict:p2}";
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
|
||
return str;
|
||
}
|
||
|
||
public static float GetValueFromConfig(AttributeType attributeType, EquipBase equipBase)
|
||
{
|
||
switch (attributeType)
|
||
{
|
||
case AttributeType.无:
|
||
return 0;
|
||
case AttributeType.最大生命:
|
||
return equipBase.Hp;
|
||
case AttributeType.最大精力:
|
||
return equipBase.Mp;
|
||
case AttributeType.力量:
|
||
return equipBase.Str;
|
||
case AttributeType.敏捷:
|
||
return equipBase.Quk;
|
||
case AttributeType.精神:
|
||
return equipBase.Spi;
|
||
case AttributeType.智慧:
|
||
return equipBase.Wim;
|
||
case AttributeType.物理攻击:
|
||
return equipBase.PhyAtk;
|
||
case AttributeType.精神攻击:
|
||
return equipBase.SpiAtk;
|
||
case AttributeType.物理防御:
|
||
return equipBase.PhyDef;
|
||
case AttributeType.精神防御:
|
||
return equipBase.SpiDef;
|
||
case AttributeType.物理暴击系数:
|
||
return equipBase.Pcrir;
|
||
case AttributeType.精神暴击系数:
|
||
return equipBase.Mcrir;
|
||
case AttributeType.物理暴击效果:
|
||
return equipBase.Pcri;
|
||
case AttributeType.精神暴击效果:
|
||
return equipBase.Mcri;
|
||
case AttributeType.抗物理暴击系数:
|
||
return equipBase.Rpcrir;
|
||
case AttributeType.抗精神暴击系数:
|
||
return equipBase.Rmcrir;
|
||
case AttributeType.抗物理暴击效果:
|
||
return equipBase.Rpcri;
|
||
case AttributeType.抗精神暴击效果:
|
||
return equipBase.Rmcri;
|
||
case AttributeType.辅助值:
|
||
return equipBase.Dvo;
|
||
case AttributeType.体质:
|
||
return equipBase.Phy;
|
||
case AttributeType.耐力:
|
||
return equipBase.Sta;
|
||
case AttributeType.物理免伤:
|
||
return equipBase.Nphyi;
|
||
case AttributeType.精神免伤:
|
||
return equipBase.Nmeni;
|
||
case AttributeType.速度:
|
||
return equipBase.Spd;
|
||
case AttributeType.命中:
|
||
return equipBase.Hit;
|
||
case AttributeType.抵抗:
|
||
return equipBase.Res;
|
||
default:
|
||
return 0;
|
||
}
|
||
}
|
||
|
||
static void GetEquipSpecialAtrribute(EquipBase equip, List<string> list)
|
||
{
|
||
var kv = new KeyValuePair<int, int>(equip.SpecialKey, equip.SpecialValue);
|
||
if (kv.Value == 0) return;
|
||
AttributeType attributeType = (AttributeType) kv.Key;
|
||
switch (attributeType)
|
||
{
|
||
case AttributeType.最大生命:
|
||
list.Add($"{attributeType}:{MathHelper.RoundToInt(kv.Value)}");
|
||
break;
|
||
case AttributeType.最大精力:
|
||
list.Add($"{attributeType}:{MathHelper.RoundToInt(kv.Value)}");
|
||
break;
|
||
case AttributeType.力量:
|
||
list.Add($"{attributeType}:{MathHelper.RoundToInt(kv.Value)}");
|
||
break;
|
||
case AttributeType.敏捷:
|
||
list.Add($"{attributeType}:{MathHelper.RoundToInt(kv.Value)}");
|
||
break;
|
||
case AttributeType.精神:
|
||
list.Add($"{attributeType}:{MathHelper.RoundToInt(kv.Value)}");
|
||
break;
|
||
case AttributeType.智慧:
|
||
list.Add($"{attributeType}:{MathHelper.RoundToInt(kv.Value)}");
|
||
break;
|
||
case AttributeType.物理攻击:
|
||
list.Add($"{attributeType}:{MathHelper.RoundToInt(kv.Value)}");
|
||
break;
|
||
case AttributeType.精神攻击:
|
||
list.Add($"{attributeType}:{MathHelper.RoundToInt(kv.Value)}");
|
||
break;
|
||
case AttributeType.物理防御:
|
||
list.Add($"{attributeType}:{MathHelper.RoundToInt(kv.Value)}");
|
||
break;
|
||
case AttributeType.精神防御:
|
||
list.Add($"{attributeType}:{MathHelper.RoundToInt(kv.Value)}");
|
||
break;
|
||
case AttributeType.物理暴击系数:
|
||
list.Add($"{attributeType}:{kv.Value:p2}");
|
||
break;
|
||
case AttributeType.精神暴击系数:
|
||
list.Add($"{attributeType}:{kv.Value:p2}");
|
||
break;
|
||
case AttributeType.物理暴击效果:
|
||
list.Add($"{attributeType}:{kv.Value:p2}");
|
||
break;
|
||
case AttributeType.精神暴击效果:
|
||
list.Add($"{attributeType}:{kv.Value:p2}");
|
||
break;
|
||
case AttributeType.抗物理暴击系数:
|
||
list.Add($"{attributeType}:{kv.Value:p2}");
|
||
break;
|
||
case AttributeType.抗精神暴击系数:
|
||
list.Add($"{attributeType}:{kv.Value:p2}");
|
||
break;
|
||
case AttributeType.抗物理暴击效果:
|
||
list.Add($"{attributeType}:{kv.Value:p2}");
|
||
break;
|
||
case AttributeType.抗精神暴击效果:
|
||
list.Add($"{attributeType}:{kv.Value:p2}");
|
||
break;
|
||
case AttributeType.辅助值:
|
||
list.Add($"{attributeType}:{kv.Value:p2}");
|
||
break;
|
||
case AttributeType.体质:
|
||
list.Add($"{attributeType}:{MathHelper.RoundToInt(kv.Value)}");
|
||
break;
|
||
case AttributeType.耐力:
|
||
list.Add($"{attributeType}:{MathHelper.RoundToInt(kv.Value)}");
|
||
break;
|
||
case AttributeType.物理免伤:
|
||
list.Add($"{attributeType}:{kv.Value:p2}");
|
||
break;
|
||
case AttributeType.精神免伤:
|
||
list.Add($"{attributeType}:{kv.Value:p2}");
|
||
break;
|
||
case AttributeType.速度:
|
||
list.Add($"{attributeType}:{kv.Value:f0}");
|
||
break;
|
||
case AttributeType.命中:
|
||
list.Add($"{attributeType}:{kv.Value:p2}");
|
||
break;
|
||
case AttributeType.抵抗:
|
||
list.Add($"{attributeType}:{kv.Value:p2}");
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
|
||
public static void OpenUI(int itemId, string additionalPrice = null)
|
||
{
|
||
IConfig itemBase = BagHelper.GetItemBase(itemId);
|
||
sb.Length = 0;
|
||
itemDescList.Clear();
|
||
switch (itemBase)
|
||
{
|
||
default:
|
||
return;
|
||
case EquipBase equipBase:
|
||
{
|
||
Quality quality = (Quality) equipBase.Quality;
|
||
sb.AppendFormat($"[color={GetQualityColor(quality)}][size={TitleSize}][b]{equipBase.Name}[/b][/size][/color]\n");
|
||
for (int i = 0; i < equipBase.Star; i++)
|
||
{
|
||
sb.AppendFormat(YellowStar);
|
||
}
|
||
|
||
sb.AppendFormat("\n");
|
||
sb.AppendFormat($"装备 {(EquipType) equipBase.Type}\n");
|
||
(long gold, int sliver, int coin) = GetCoinFormat(equipBase.Price);
|
||
sb.Append($"单价: {gold}{Gold} {sliver}{Sliver} {coin}{Coin}\n");
|
||
string isLock = "未绑定";
|
||
sb.AppendFormat($"[color=#ff99cc]{isLock}[/color]\n");
|
||
sb.AppendFormat($"需要等级:{equipBase.UseLevel}\n");
|
||
sb.AppendFormat($"需要职业: {GetStrJob(equipBase.JobId, equipBase.Transmigration)}\n");
|
||
sb.AppendLine(SpaceLine3);
|
||
itemDescList.Clear();
|
||
GetEquipSpecialAtrribute(equipBase, itemDescList);
|
||
foreach (string item in itemDescList)
|
||
{
|
||
sb.AppendFormat($"[color=#99bf88]{item}[/color]\n");
|
||
}
|
||
|
||
sb.AppendLine(SpaceLine3);
|
||
itemDescList.Clear();
|
||
GetEquiBaseAtrribute(equipBase, itemDescList);
|
||
foreach (string item in itemDescList)
|
||
{
|
||
sb.AppendFormat($"[color=#99bf88]{item}[/color]\n");
|
||
}
|
||
|
||
for (int i = 0; i < equipBase.MaxHole; i++)
|
||
{
|
||
sb.AppendFormat($"{SliverStar}\n");
|
||
}
|
||
|
||
sb.AppendFormat($"[color=#ffff99]{equipBase.Description}[/color]");
|
||
}
|
||
break;
|
||
case GoodsBase goodsBase:
|
||
{
|
||
Quality quality = (Quality) goodsBase.Quality;
|
||
sb.AppendFormat($"[color={GetQualityColor(quality)}][size={TitleSize}][b]{goodsBase.Name}[/b][/size][/color]\n");
|
||
sb.AppendFormat($"道具 消耗品\n");
|
||
(long gold, int sliver, int coin) = GetCoinFormat(goodsBase.Price);
|
||
sb.Append($"单价: {gold}{Gold} {sliver}{Sliver} {coin}{Coin}\n");
|
||
string isLock = goodsBase.IsLock? "已绑定" : "未绑定";
|
||
sb.AppendFormat($"[color=#ff99cc]{isLock}[/color]\n");
|
||
sb.AppendFormat($"需要等级:{goodsBase.UsedLevel}\n");
|
||
sb.AppendFormat($"[color=#ffff99]{goodsBase.Description}[/color]");
|
||
}
|
||
break;
|
||
case MaterialBase materialBase:
|
||
{
|
||
Quality quality = (Quality) materialBase.Quality;
|
||
sb.AppendFormat($"[color={GetQualityColor(quality)}][size={TitleSize}][b]{materialBase.Name}[/b][/size][/color]\n");
|
||
sb.AppendFormat(
|
||
$"材料 {((MaterialsType) materialBase.MaterialType == MaterialsType.普通材料? MaterialsType.普通材料.ToString() : ((GemType) materialBase.GemType).ToString())}\n");
|
||
(long gold, int sliver, int coin) = GetCoinFormat(materialBase.Price);
|
||
sb.Append($"单价: {gold}{Gold} {sliver}{Sliver} {coin}{Coin}\n");
|
||
string isLock = materialBase.IsLock? "已绑定" : "未绑定";
|
||
sb.AppendFormat($"[color=#ff99cc]{isLock}[/color]\n");
|
||
if (materialBase.MaterialType == (int) MaterialsType.宝石)
|
||
{
|
||
sb.AppendLine($"[color=#99bf88]{GteGemValue((AttributeType) materialBase.GemKey, materialBase.GemValue)}[/color]");
|
||
}
|
||
|
||
sb.Append($"[color=#ffff99]{materialBase.Description}[/color]");
|
||
}
|
||
break;
|
||
}
|
||
|
||
if (additionalPrice != null)
|
||
sb.Append($"{additionalPrice}");
|
||
FUI_TabUI ui = OpenUI();
|
||
ui.m_title.text = sb.ToString();
|
||
Vector2 pos = GRoot.inst.GetPoupPosition(ui.self, null, null);
|
||
Vector2 offset = new Vector2(15, 15);
|
||
pos += offset;
|
||
ui.self.position = pos;
|
||
}
|
||
|
||
public static void OpenBuffUI(BuffStateInfo stateBuffInfo)
|
||
{
|
||
sb.Length = 0;
|
||
sb.AppendLine($"{stateBuffInfo.iconDesc}");
|
||
sb.Append($"持续时间时间:{stateBuffInfo.time / 1000f:f1} s");
|
||
FUI_TabUI ui = OpenUI();
|
||
ui.m_title.text = sb.ToString();
|
||
Vector2 pos = GRoot.inst.GetPoupPosition(ui.self, null, null);
|
||
Vector2 offset = new Vector2(15, 15);
|
||
pos += offset;
|
||
ui.self.position = pos;
|
||
}
|
||
public static string GetAdditionalPrice(MultiShop config)
|
||
{
|
||
return $"\n售价: {config.Price}" + (ShopType)config.Type switch
|
||
{
|
||
ShopType.None => "",
|
||
ShopType.Gem => "星币",
|
||
ShopType.Honor => "荣誉",
|
||
ShopType.Pvp => "竞技币",
|
||
ShopType.Family => "家族贡献",
|
||
_ => throw new ArgumentOutOfRangeException()
|
||
};
|
||
}
|
||
public static string GetAdditionalPrice(IConfig itemBase, float discount = 1, MarketType marketType = MarketType.VoucherMarket)
|
||
{
|
||
sb.Length = 0;
|
||
switch (itemBase)
|
||
{
|
||
case MarketBase marketBase:
|
||
{
|
||
if (marketType == MarketType.YuanBaoMarket)
|
||
{
|
||
sb.Append($"\n原价: <s>{marketBase.Price_YuanBao}元宝</s>");
|
||
sb.Append($"\n现价: {Mathf.RoundToInt(marketBase.Price_YuanBao * discount)}元宝 ({discount:p2})");
|
||
}
|
||
else if (marketType == MarketType.VoucherMarket)
|
||
{
|
||
if (marketBase.OnlyYuanBao)
|
||
{
|
||
sb.Append("\n代金券无法购买此物品!");
|
||
}
|
||
else
|
||
{
|
||
sb.Append($"\n原价: <s>{marketBase.Price_YuanBao * 2}代金券</s>");
|
||
sb.Append($"\n现价: {Mathf.RoundToInt(marketBase.Price_YuanBao * discount * 2)}代金券 ({discount:p2})");
|
||
}
|
||
}
|
||
}
|
||
break;
|
||
case ShopBase shopBase:
|
||
{
|
||
(long gold, int sliver, int coin) = GetCoinFormat(shopBase.Price);
|
||
sb.Append($"\n售价: {gold}{Gold} {sliver}{Sliver} {coin}{Coin}");
|
||
}
|
||
break;
|
||
}
|
||
|
||
return sb.ToString();
|
||
}
|
||
|
||
public static void OpenEquipForgeUI(int itemId, List<EquipForgeMaterialInfo> needMaterialInfoList)
|
||
{
|
||
IConfig itemBase = BagHelper.GetItemBase(itemId);
|
||
sb.Length = 0;
|
||
switch (itemBase)
|
||
{
|
||
default:
|
||
return;
|
||
case EquipBase equipBase:
|
||
{
|
||
Quality quality = (Quality) equipBase.Quality;
|
||
sb.Append($"[color={GetQualityColor(quality)}][size={TitleSize}][b]{equipBase.Name}[/b][/size][/color]\n");
|
||
for (int i = 0; i < equipBase.Star; i++)
|
||
{
|
||
sb.Append(YellowStar);
|
||
}
|
||
|
||
sb.Append("\n");
|
||
sb.Append($"需要等级:{equipBase.UseLevel}\n");
|
||
sb.Append($"需要职业: {GetStrJob(equipBase.JobId, equipBase.Transmigration)}\n");
|
||
itemDescList.Clear();
|
||
GetEquiBaseAtrribute(equipBase, itemDescList);
|
||
foreach (string item in itemDescList)
|
||
{
|
||
sb.Append($"[color=#99bf88]{item}[/color]\n");
|
||
}
|
||
|
||
sb.Append($"[color=#FFE148]-----------------所需素材-----------------[/color]");
|
||
foreach (EquipForgeMaterialInfo item in needMaterialInfoList)
|
||
{
|
||
string color = item.needCount > item.count? "FF0000" : "FFFFFF";
|
||
sb.Append($"\n[color=#{color}]{item.name} x{item.needCount}(持有{item.count})[/color]");
|
||
}
|
||
}
|
||
break;
|
||
case GoodsBase goodsBase:
|
||
case MaterialBase materialBase:
|
||
|
||
break;
|
||
}
|
||
|
||
FUI_TabUI ui = OpenUI();
|
||
ui.m_title.text = sb.ToString();
|
||
Vector2 pos = GRoot.inst.GetPoupPosition(ui.self, null, null);
|
||
Vector2 offset = new Vector2(15, 15);
|
||
pos += offset;
|
||
ui.self.position = pos;
|
||
}
|
||
|
||
public static void OpenSkilUI(SkillConfig skillLogicConfig, int level, bool isPre = false)
|
||
{
|
||
sb.Length = 0;
|
||
sb.AppendLine($"[color=#FF8821][size={TitleSize}][b]{skillLogicConfig.Name}[/b][/size][/color]");
|
||
sb.AppendLine($"技能类型:{(SkillTypes) skillLogicConfig.SkillType}");
|
||
sb.AppendLine($"冷却时间:{skillLogicConfig.CD / 1000}s");
|
||
sb.AppendLine("[color=#FFE148]------------------------------------------[/color]");
|
||
sb.AppendLine($"当前等级:{(isPre? 0 : level)}");
|
||
SkillCastType castType = (SkillCastType) skillLogicConfig.CastType;
|
||
switch (castType)
|
||
{
|
||
case SkillCastType.无消耗:
|
||
sb.AppendLine($"{castType}");
|
||
break;
|
||
case SkillCastType.消耗精力:
|
||
case SkillCastType.消耗血量:
|
||
sb.AppendLine($"{castType}:{skillLogicConfig.CastValue:p2}");
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
|
||
SkillConfig skillConfig_Level = SkillConfigCategory.Instance.Get(skillLogicConfig.Id + level + 1, false);
|
||
sb.AppendLine($"升级需要等级:{skillConfig_Level?.LearnLevel}");
|
||
sb.AppendLine($"技能效果:\n {skillLogicConfig.Desc}");
|
||
for (int i = 1; i <= skillLogicConfig.MaxLevel; i++)
|
||
{
|
||
string descColor;
|
||
if (level < i || isPre)
|
||
descColor = "#999999";
|
||
else
|
||
descColor = "#ffffff";
|
||
SkillConfig skillConfig_EachLevel = DataTableHelper.Get<SkillConfig>(skillLogicConfig.Id + i);
|
||
sb.AppendLine($" [color={descColor}]{skillConfig_EachLevel.Desc}[/color]");
|
||
}
|
||
|
||
FUI_TabUI ui = OpenUI();
|
||
ui.m_title.text = sb.ToString();
|
||
Vector2 pos = GRoot.inst.GetPoupPosition(ui.self, null, null);
|
||
Vector2 offset = new Vector2(15, 15);
|
||
pos += offset;
|
||
ui.self.position = pos;
|
||
}
|
||
|
||
public static void OpenStarSoulUI(StarSoulBag bag, long id)
|
||
{
|
||
sb.Length = 0;
|
||
GenerateStarSoulString(sb, bag, id, true);
|
||
StarSoulItem data = bag.Get(id);
|
||
|
||
sb.AppendLine(SpaceLine3);
|
||
sb.Append("[color=#ffff99]星魂可以通过消耗其他星魂进行升级,升级会提升固定属性;每升级4级产生或者强化某一个随机属性[/color]");
|
||
FUI_TabUI ui = OpenUI();
|
||
ui.m_title.text = sb.ToString();
|
||
Vector2 pos = GRoot.inst.GetPoupPosition(ui.self, null, null);
|
||
Vector2 offset = new Vector2(15, 15);
|
||
pos += offset;
|
||
ui.self.position = pos;
|
||
|
||
if (data.isUsed)
|
||
{
|
||
return;
|
||
}
|
||
|
||
EquipType equipType = data.posType;
|
||
long usedId = bag.usedStarSoulDic[(byte) equipType];
|
||
if (usedId == 0)
|
||
return;
|
||
FUI_TabUI comUI = OpenComprasionUI();
|
||
Vector2 newPos = GetComprasionPos(comUI.self, pos);
|
||
comUI.self.position = newPos;
|
||
sb.Length = 0;
|
||
GenerateStarSoulString(sb, bag, usedId);
|
||
|
||
sb.AppendLine(SpaceLine3);
|
||
sb.Append("[color=#ffff99]星魂可以通过消耗其他星魂进行升级,升级会提升固定属性;每升级4级产生或者强化某一个随机属性[/color]");
|
||
comUI.m_title.text = sb.ToString();
|
||
}
|
||
|
||
//!获取品质颜色码
|
||
public static string GetQualityColor(Quality quality)
|
||
{
|
||
switch (quality)
|
||
{
|
||
default:
|
||
case Quality.Common: return QualityColor.Common;
|
||
case Quality.UnCommon: return QualityColor.UnCommon;
|
||
case Quality.Rare: return QualityColor.Rare;
|
||
case Quality.Epic: return QualityColor.Epic;
|
||
case Quality.Legendary: return QualityColor.Legendary;
|
||
case Quality.Ulti: return QualityColor.Ulti;
|
||
}
|
||
}
|
||
|
||
//!获取职业
|
||
public static string GetStrJob(int jobId, int trans = 0)
|
||
{
|
||
return GetStrJob((JobType) jobId, trans);
|
||
}
|
||
|
||
public static string GetStrJob(JobType jobId, int trans = 0)
|
||
{
|
||
string ext = null;
|
||
switch (trans)
|
||
{
|
||
default:
|
||
break;
|
||
case 0:
|
||
ext = "";
|
||
break;
|
||
case 1:
|
||
ext = "(一转)";
|
||
break;
|
||
case 2:
|
||
ext = "(二转)";
|
||
break;
|
||
}
|
||
|
||
switch (jobId)
|
||
{
|
||
case JobType.UnKnown:
|
||
break;
|
||
case JobType.Officer:
|
||
return "军官" + ext;
|
||
case JobType.Sportsman:
|
||
return "运动员" + ext;
|
||
case JobType.Nurse:
|
||
return "护士" + ext;
|
||
case JobType.Superman:
|
||
return "超能力" + ext;
|
||
default:
|
||
break;
|
||
}
|
||
|
||
return string.Empty;
|
||
}
|
||
|
||
public static int GetJobById(int jobId)
|
||
{
|
||
return (jobId + 1) / 2;
|
||
}
|
||
|
||
//!获取装备的词条
|
||
static void GetEquiBaseAtrribute(EquipBase equipBase, List<string> list)
|
||
{
|
||
string GetPercent(int a, int b)
|
||
{
|
||
float percent = (a - b) * 100 / b;
|
||
return percent >= 0? $"[color=#99cc33] ({percent:f2}%)[/color]" : $"[color=#cc3333] ({percent:f2}%)[/color]";
|
||
}
|
||
|
||
string GetFloatPercent(float a, float b)
|
||
{
|
||
float percent = (a - b) * 100 / b;
|
||
return percent >= 0? $"[color=#99cc33] ({percent:f2}%)[/color]" : $"[color=#cc3333] ({percent:f2}%)[/color]";
|
||
}
|
||
|
||
if (equipBase.Hp != 0)
|
||
{
|
||
list.Add($"生命:{equipBase.Hp}{GetPercent(equipBase.Hp, equipBase.Hp)}");
|
||
}
|
||
|
||
if (equipBase.Mp != 0)
|
||
{
|
||
list.Add($"精力:{equipBase.Mp}{GetPercent(equipBase.Mp, equipBase.Mp)}");
|
||
}
|
||
|
||
if (equipBase.Str != 0)
|
||
{
|
||
list.Add($"力量:{equipBase.Str}{GetPercent(equipBase.Str, equipBase.Str)}");
|
||
}
|
||
|
||
if (equipBase.Quk != 0)
|
||
{
|
||
list.Add($"敏捷:{equipBase.Quk}{GetPercent(equipBase.Quk, equipBase.Quk)}");
|
||
}
|
||
|
||
if (equipBase.Spi != 0)
|
||
{
|
||
list.Add($"精神:{equipBase.Spi}{GetPercent(equipBase.Spi, equipBase.Spi)}");
|
||
}
|
||
|
||
if (equipBase.Wim != 0)
|
||
{
|
||
list.Add($"智慧:{equipBase.Wim}{GetPercent(equipBase.Wim, equipBase.Wim)}");
|
||
}
|
||
|
||
if (equipBase.Sta != 0)
|
||
{
|
||
list.Add($"耐力:{equipBase.Sta}{GetPercent(equipBase.Sta, equipBase.Sta)}");
|
||
}
|
||
|
||
if (equipBase.Phy != 0)
|
||
{
|
||
list.Add($"体力:{equipBase.Phy}{GetPercent(equipBase.Phy, equipBase.Phy)}");
|
||
}
|
||
|
||
if (equipBase.PhyAtk != 0)
|
||
{
|
||
list.Add($"物理攻击:{equipBase.PhyAtk}{GetPercent(equipBase.PhyAtk, equipBase.PhyAtk)}");
|
||
}
|
||
|
||
if (equipBase.SpiAtk != 0)
|
||
{
|
||
list.Add($"精神攻击:{equipBase.SpiAtk}{GetPercent(equipBase.SpiAtk, equipBase.SpiAtk)}");
|
||
}
|
||
|
||
if (equipBase.PhyDef != 0)
|
||
{
|
||
list.Add($"物理防御:{equipBase.PhyDef}{GetPercent(equipBase.PhyDef, equipBase.PhyDef)}");
|
||
}
|
||
|
||
if (equipBase.SpiDef != 0)
|
||
{
|
||
list.Add($"精神防御:{equipBase.SpiDef}{GetPercent(equipBase.SpiDef, equipBase.SpiDef)}");
|
||
}
|
||
|
||
if (equipBase.Pcrir != 0)
|
||
{
|
||
list.Add($"物理暴击率:{equipBase.Pcrir:p2}{GetFloatPercent(equipBase.Pcrir, equipBase.Pcrir)}");
|
||
}
|
||
|
||
if (equipBase.Mcrir != 0)
|
||
{
|
||
list.Add($"精神暴击率:{equipBase.Mcrir:p2}{GetFloatPercent(equipBase.Mcrir, equipBase.Mcrir)}");
|
||
}
|
||
|
||
if (equipBase.Pcri != 0)
|
||
{
|
||
list.Add($"物理暴击值:{equipBase.Pcri:p2}{GetFloatPercent(equipBase.Pcri, equipBase.Pcri)}");
|
||
}
|
||
|
||
if (equipBase.Mcri != 0)
|
||
{
|
||
list.Add($"精神暴击值:{equipBase.Mcri:p2}{GetFloatPercent(equipBase.Mcri, equipBase.Mcri)}");
|
||
}
|
||
|
||
if (equipBase.Rpcrir != 0)
|
||
{
|
||
list.Add($"抗物理暴击率:{equipBase.Rpcrir:p2}{GetFloatPercent(equipBase.Rpcrir, equipBase.Rpcrir)}");
|
||
}
|
||
|
||
if (equipBase.Rmcrir != 0)
|
||
{
|
||
list.Add($"抗精神暴击率:{equipBase.Rmcrir:p2}{GetFloatPercent(equipBase.Rmcrir, equipBase.Rmcrir)}");
|
||
}
|
||
|
||
if (equipBase.Rpcri != 0)
|
||
{
|
||
list.Add($"抗物理暴击值:{equipBase.Rpcrir:p2}{GetFloatPercent(equipBase.Rpcri, equipBase.Rpcri)}");
|
||
}
|
||
|
||
if (equipBase.Rmcri != 0)
|
||
{
|
||
list.Add($"抗精神暴击值:{equipBase.Rmcri:p2}{GetFloatPercent(equipBase.Rmcri, equipBase.Rmcri)}");
|
||
}
|
||
|
||
if (equipBase.Nphyi != 0)
|
||
{
|
||
list.Add($"物理免伤:{equipBase.Nphyi:p2}{GetFloatPercent(equipBase.Nphyi, equipBase.Nphyi)}");
|
||
}
|
||
|
||
if (equipBase.Nmeni != 0)
|
||
{
|
||
list.Add($"精神免伤:{equipBase.Nmeni:p2}{GetFloatPercent(equipBase.Nmeni, equipBase.Nmeni)}");
|
||
}
|
||
|
||
if (equipBase.Dvo != 0)
|
||
{
|
||
list.Add($"辅助值:{equipBase.Dvo:p2}{GetFloatPercent(equipBase.Dvo, equipBase.Dvo)}");
|
||
}
|
||
}
|
||
|
||
public static (long, int, int) GetCoinFormat(long coin)
|
||
{
|
||
int cupper = (int) (coin % 100);
|
||
long gold = coin / 10000;
|
||
int sliver = (int) ((coin - gold * 10000) / 100);
|
||
return (gold, sliver, cupper);
|
||
}
|
||
|
||
public static string GteGemValue(AttributeType type, float value)
|
||
{
|
||
switch (type)
|
||
{
|
||
case AttributeType.最大生命:
|
||
case AttributeType.最大精力:
|
||
case AttributeType.力量:
|
||
case AttributeType.敏捷:
|
||
case AttributeType.精神:
|
||
case AttributeType.智慧:
|
||
case AttributeType.物理攻击:
|
||
case AttributeType.精神攻击:
|
||
case AttributeType.物理防御:
|
||
case AttributeType.精神防御:
|
||
case AttributeType.体质:
|
||
case AttributeType.耐力:
|
||
case AttributeType.速度:
|
||
return $"{type}:{MathHelper.RoundToInt(value)}";
|
||
case AttributeType.物理暴击系数:
|
||
case AttributeType.精神暴击系数:
|
||
case AttributeType.物理暴击效果:
|
||
case AttributeType.精神暴击效果:
|
||
case AttributeType.抗物理暴击系数:
|
||
case AttributeType.抗物理暴击效果:
|
||
case AttributeType.抗精神暴击系数:
|
||
case AttributeType.抗精神暴击效果:
|
||
case AttributeType.辅助值:
|
||
case AttributeType.物理免伤:
|
||
case AttributeType.精神免伤:
|
||
case AttributeType.命中:
|
||
case AttributeType.抵抗:
|
||
return $"{type}:{value:p2}";
|
||
case AttributeType.无:
|
||
default: return string.Empty;
|
||
}
|
||
}
|
||
}
|
||
} |