103 lines
2.6 KiB
C#
103 lines
2.6 KiB
C#
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
using System.Collections;
|
|||
|
using GCGame.Table;
|
|||
|
|
|||
|
public class FellowSkillTooltip : MonoBehaviour {
|
|||
|
|
|||
|
public Text Name;
|
|||
|
public Text currDesText;
|
|||
|
public GameObject NextPanle;
|
|||
|
public Text nextDesText;
|
|||
|
|
|||
|
private static FellowSkillTooltip m_Instance;
|
|||
|
public static FellowSkillTooltip 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.FellowSkillTooltipPath, FellowSkillTooltip.OnShowItemTip, hash);
|
|||
|
}
|
|||
|
|
|||
|
private static void OnShowItemTip(bool bSuccess, object param)
|
|||
|
{
|
|||
|
if (!bSuccess)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
Hashtable hash = param as Hashtable;
|
|||
|
if (hash == null)
|
|||
|
return;
|
|||
|
|
|||
|
FellowSkillTooltip.Instance().ShowTooltips((int)hash["SkillID"], (Vector3)hash["ShowPos"]);
|
|||
|
}
|
|||
|
|
|||
|
private void ShowTooltips(int fellowSkillId, Vector3 showPos)
|
|||
|
{
|
|||
|
Tab_FellowSkill fellowskill = TableManager.GetFellowSkillByID(fellowSkillId, 0);
|
|||
|
if (fellowskill == null)
|
|||
|
{
|
|||
|
Close();
|
|||
|
return;
|
|||
|
}
|
|||
|
Tab_SkillEx skillEx = TableManager.GetSkillExByID(fellowSkillId, 0);
|
|||
|
Tab_SkillEx skillExNext = TableManager.GetSkillExByID(fellowskill.NextSkillId, 0);
|
|||
|
if(skillEx!=null)
|
|||
|
{
|
|||
|
Tab_SkillBase skillCurBase = TableManager.GetSkillBaseByID(skillEx.BaseId, 0);
|
|||
|
if(skillCurBase!=null)
|
|||
|
{
|
|||
|
Name.text = string.Format("<color=#ffffff>{0}</color><color=#46ff42ff>{1}Lv</color>", skillCurBase.Name, fellowskill.Level);
|
|||
|
currDesText.text = skillEx.SkillDesc;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if (skillExNext!=null)
|
|||
|
{
|
|||
|
NextPanle.SetActive(true);
|
|||
|
nextDesText.gameObject.SetActive(true);
|
|||
|
nextDesText.text = skillExNext.SkillDesc;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
NextPanle.SetActive(false);
|
|||
|
nextDesText.gameObject.SetActive(false);
|
|||
|
}
|
|||
|
//transform.position = showPos;
|
|||
|
}
|
|||
|
|
|||
|
// Use this for initialization
|
|||
|
void OnEnable () {
|
|||
|
|
|||
|
InputOutView inputOutView = GetComponentInChildren<InputOutView>();
|
|||
|
if (inputOutView != null)
|
|||
|
{
|
|||
|
inputOutView.Add(1, false, Close);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
public void Close()
|
|||
|
{
|
|||
|
UIManager.CloseUI(UIInfo.FellowSkillTooltipPath);
|
|||
|
}
|
|||
|
|
|||
|
}
|