96 lines
2.9 KiB
C#
96 lines
2.9 KiB
C#
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using System.Collections;
|
|
using GCGame.Table;
|
|
using Games.Item;
|
|
using Games.GlobeDefine;
|
|
using GCGame;
|
|
using System.Collections.Generic;
|
|
using Module.Log;
|
|
using Games.UserCommonData;
|
|
|
|
public class SkillTooltipsLogic : MonoBehaviour
|
|
{
|
|
|
|
private static SkillTooltipsLogic m_Instance;
|
|
public static SkillTooltipsLogic Instance()
|
|
{
|
|
return m_Instance;
|
|
}
|
|
|
|
public void Awake()
|
|
{
|
|
m_Instance = this;
|
|
}
|
|
|
|
public void OnDestory()
|
|
{
|
|
m_Instance = null;
|
|
}
|
|
|
|
public static void ShowSkillToolTips(int skillExID, Vector3 showPos)
|
|
{
|
|
Hashtable hash = new Hashtable();
|
|
hash.Add("SkillID", skillExID);
|
|
hash.Add("ShowPos", showPos);
|
|
|
|
UIManager.ShowUI(UIInfo.SkillTooltipsRoot, SkillTooltipsLogic.OnShowItemTip, hash);
|
|
}
|
|
|
|
private static void OnShowItemTip(bool bSuccess, object param)
|
|
{
|
|
if (!bSuccess)
|
|
{
|
|
LogModule.ErrorLog("load equiptooltip error");
|
|
return;
|
|
}
|
|
|
|
Hashtable hash = param as Hashtable;
|
|
if (hash == null)
|
|
return;
|
|
|
|
SkillTooltipsLogic.Instance().ShowTooltips((int)hash["SkillID"], (Vector3)hash["ShowPos"]);
|
|
}
|
|
|
|
private void ShowTooltips(int skillExID, Vector3 showPos)
|
|
{
|
|
var skillEx = TableManager.GetSkillExByID(skillExID, 0);
|
|
var skillLevelUp = TableManager.GetSkillLevelUpByID(skillExID, 0);
|
|
var skillBase = TableManager.GetSkillBaseByID(skillEx.BaseId, 0);
|
|
_RectTransform.anchoredPosition3D = showPos;
|
|
SetSkillInfo(skillEx, skillLevelUp, skillBase, null);
|
|
}
|
|
|
|
public void CloseWindow()
|
|
{
|
|
UIManager.CloseUI(UIInfo.SkillTooltipsRoot);
|
|
}
|
|
|
|
|
|
#region skill info
|
|
|
|
public RectTransform _RectTransform;
|
|
public Text _SkillName;
|
|
public Text _SkillCost;
|
|
public Text _SkillDistance;
|
|
public Text _CDTime;
|
|
public Text _SkillType;
|
|
public Text _SkillDesc;
|
|
|
|
private void SetSkillInfo(Tab_SkillEx skillEx, Tab_SkillLevelUp skillLevelUp, Tab_SkillBase skillBase, Tab_SkillLearn skillLearn)
|
|
{
|
|
_SkillName.text = StrDictionary.GetClientDictionaryString("#{4732}", skillBase.Name, skillEx.Level);
|
|
_SkillCost.text = StrDictionary.GetClientDictionaryString("#{4733}", skillLevelUp.Level);
|
|
_SkillCost.text = StrDictionary.GetClientDictionaryString("#{4734}", skillEx.GetDelNumbyIndex(0));
|
|
_SkillDistance.text = StrDictionary.GetClientDictionaryString("#{4735}", skillEx.Radius);
|
|
Tab_CoolDownTime cdTab = TableManager.GetCoolDownTimeByID(skillEx.CDTimeId, 0);
|
|
string cdTime = string.Format("{0:0.0}", (float)cdTab.CDTime / 1000);
|
|
_CDTime.text = StrDictionary.GetClientDictionaryString("#{4736}", cdTime);
|
|
//_SkillType.text = StrDictionary.GetClientDictionaryString("#{4736}", skillLearn.SkillType);
|
|
_SkillDesc.text = skillEx.SkillDesc;
|
|
}
|
|
|
|
#endregion
|
|
}
|