Files
JJBB/Assets/Project/Script/GUI/SkillBar/SkillBoxOpenCondition.cs
2024-08-23 15:49:34 +08:00

107 lines
3.7 KiB
C#

using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System.Collections;
using System.Collections.Generic;
using GCGame.Table;
using System;
public class SkillBoxOpenCondition : UIItemBase
{
public Text _ConditionTx;
public Text _Complate;
private Tab_SkillBoxOpen skillOpen = new Tab_SkillBoxOpen();
public override void Show(Hashtable hash)
{
base.Show(hash);
skillOpen = hash["InitObj"] as Tab_SkillBoxOpen;
SetSkillOpenInfo(skillOpen);
}
private void OnEnable()
{
if(skillOpen != null)
SetSkillOpenInfo(skillOpen);
}
private void SetSkillOpenInfo(Tab_SkillBoxOpen skillOpen)
{
if (skillOpen.RoleLevel > 0)
{
_ConditionTx.text = StrDictionary.GetClientDictionaryString("#{4727}", skillOpen.RoleLevel);
if (GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level >= skillOpen.RoleLevel)
{
_Complate.text = StrDictionary.GetClientDictionaryString("#{4730}");
}
else
{
_Complate.text = StrDictionary.GetClientDictionaryString("#{4731}");
}
}
else if (skillOpen.Xiuwei > 0)
{
_ConditionTx.text = StrDictionary.GetClientDictionaryString("#{4728}", skillOpen.Xiuwei);
if (GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Xiewei >= skillOpen.Xiuwei)
{
_Complate.text = StrDictionary.GetClientDictionaryString("#{4730}");
}
else
{
_Complate.text = StrDictionary.GetClientDictionaryString("#{4731}");
}
}
else if (skillOpen.VIP > 0)
{
_ConditionTx.text = StrDictionary.GetClientDictionaryString("#{4729}", skillOpen.VIP);
if (GameManager.gameManager.PlayerDataPool.VipCost >= skillOpen.VIP)
{
_Complate.text = StrDictionary.GetClientDictionaryString("#{4730}");
}
else
{
_Complate.text = StrDictionary.GetClientDictionaryString("#{4731}");
}
//if(!skillOpen.NeedPrivilegeType.Equals("-1"))
//{
// string []_needPrivilegeType = skillOpen.NeedPrivilegeType.Split('|');
// bool _isPrivilegeTypeSuit = false;
// for(int index = 0; index < _needPrivilegeType.Length; index++)
// {
// if(GameManager.gameManager.PlayerDataPool.PrivilegeTypeStateDic.ContainsKey(int.Parse(_needPrivilegeType[index]))
// && GameManager.gameManager.PlayerDataPool.PrivilegeTypeStateDic[int.Parse(_needPrivilegeType[index])])
// {
// _isPrivilegeTypeSuit = true;
// break;
// }
// }
// if (GameManager.gameManager.PlayerDataPool.VipCost >= skillOpen.VIP
// && _isPrivilegeTypeSuit)
// {
// _Complate.text = StrDictionary.GetClientDictionaryString("#{4730}");
// }
// else
// {
// _Complate.text = StrDictionary.GetClientDictionaryString("#{4731}");
// }
//}else
//{
// if (GameManager.gameManager.PlayerDataPool.VipCost >= skillOpen.VIP)
// {
// _Complate.text = StrDictionary.GetClientDictionaryString("#{4730}");
// }
// else
// {
// _Complate.text = StrDictionary.GetClientDictionaryString("#{4731}");
// }
//}
}
}
}