522 lines
20 KiB
C#
522 lines
20 KiB
C#
|
using System.Collections.Generic;
|
|||
|
using Games.LogicObj;
|
|||
|
using GCGame;
|
|||
|
using GCGame.Table;
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
using System.Collections;
|
|||
|
using Games.Fellow;
|
|||
|
using Games.Events;
|
|||
|
|
|||
|
public class PetSkillWnd : MonoBehaviour
|
|||
|
{
|
|||
|
public GameObject TipText;
|
|||
|
public GameObject TipText1;
|
|||
|
public UIContainerSelect m_Contains;
|
|||
|
public Toggle IsLow;
|
|||
|
|
|||
|
public Image PayMoneyIcon;
|
|||
|
public Image PayMoneyHasIcon;
|
|||
|
public GameObject PayObj;
|
|||
|
public GameObject GetItemBtn;
|
|||
|
public Image PayItemQuility;
|
|||
|
public Image PayItemIcon;
|
|||
|
public Text PayItemName;
|
|||
|
public Text PayItemNum;
|
|||
|
public Text PayMoneyHas;
|
|||
|
public Text PayMoneyCost;
|
|||
|
|
|||
|
public Image skillIcon; //选中的技能的图片
|
|||
|
public Text skillname; //选中的技能的名称
|
|||
|
public Text skillDescript; //选中的技能的描述
|
|||
|
|
|||
|
public GameObject LearnBtn;
|
|||
|
public GameObject UpBtn;
|
|||
|
|
|||
|
public void ClearInfo(bool state)
|
|||
|
{
|
|||
|
PayItemName.gameObject.SetActive(state);
|
|||
|
PayItemNum.gameObject.SetActive(state);
|
|||
|
PayMoneyHas.gameObject.SetActive(state);
|
|||
|
PayMoneyCost.gameObject.SetActive(state);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
public void Awake()
|
|||
|
{
|
|||
|
Hashtable calbackMoveparam1 = new Hashtable();
|
|||
|
calbackMoveparam1["name"] = "UpSkillLevelSuccess";
|
|||
|
MessageEventCallBack fun1 = UpSkillLevelSuccess;
|
|||
|
calbackMoveparam1.Add("callFun", fun1);
|
|||
|
EventDispatcher.Instance.AddMessageEvent(Games.Events.EventId.UpFellowSkillLevel, calbackMoveparam1);
|
|||
|
|
|||
|
Hashtable calbackMoveparam3 = new Hashtable();
|
|||
|
calbackMoveparam3["name"] = "SkillWndPayFresh";
|
|||
|
MessageEventCallBack fun3 = PayFresh;
|
|||
|
calbackMoveparam3.Add("callFun", fun3);
|
|||
|
EventDispatcher.Instance.AddMessageEvent(Games.Events.EventId.FRESHSAMEUSETIP, calbackMoveparam3);
|
|||
|
}
|
|||
|
|
|||
|
public void OnDestroy()
|
|||
|
{
|
|||
|
EventDispatcher.Instance.RemoveMessage(Games.Events.EventId.UpFellowSkillLevel, "UpSkillLevelSuccess");
|
|||
|
EventDispatcher.Instance.RemoveMessage(Games.Events.EventId.StudyFellowSkillSuccess, "StudyFellowSkill1");
|
|||
|
EventDispatcher.Instance.RemoveMessage(Games.Events.EventId.FRESHSAMEUSETIP, "SkillWndPayFresh");
|
|||
|
}
|
|||
|
|
|||
|
public void PayFresh(Hashtable addparam, Hashtable sendparam)
|
|||
|
{
|
|||
|
OnSelectSkillBook(m_currSelectSkill);
|
|||
|
}
|
|||
|
|
|||
|
public void UpSkillLevelSuccess(Hashtable addparam, Hashtable sendparam)
|
|||
|
{
|
|||
|
GUIData.AddNotifyData(GCGame.Table.StrDictionary.GetClientDictionaryString("#{20111}"));
|
|||
|
|
|||
|
if (sendparam == null)
|
|||
|
return;
|
|||
|
if (sendparam.ContainsKey("fellowId") == false)
|
|||
|
return;
|
|||
|
ulong guid = (ulong)sendparam["fellowId"];
|
|||
|
if (PetMainWnd.CurrentSelectFellowId != guid)
|
|||
|
return;
|
|||
|
Fellow pet = GameManager.gameManager.PlayerDataPool.FellowContainer.GetFellowByGuid(PetMainWnd.CurrentSelectFellowId);
|
|||
|
if (pet == null)
|
|||
|
return;
|
|||
|
int newSkillid = (int)sendparam["skillid"];
|
|||
|
int oldSkillid = (int)sendparam["oldskillid"];
|
|||
|
Hashtable table = new Hashtable();
|
|||
|
table["new"] = newSkillid;
|
|||
|
table["old"] = oldSkillid;
|
|||
|
m_Contains.RefreshItems(table);
|
|||
|
if (oldSkillid == m_currSelectSkill)
|
|||
|
OnSelectSkillBook(m_currSelectSkill);
|
|||
|
}
|
|||
|
|
|||
|
public void BuyFast()
|
|||
|
{
|
|||
|
JudgeMoneyLogic.ShowSwitchMoneyPanel((MONEYTYPE)commonItem_Money, true);
|
|||
|
}
|
|||
|
|
|||
|
public void OnSelectPet()
|
|||
|
{
|
|||
|
if (GameManager.gameManager.PlayerDataPool.FellowContainer == null)
|
|||
|
return;
|
|||
|
if (IsLow.isOn)
|
|||
|
{
|
|||
|
ShowHas(true);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
IsLow.isOn = true;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void ShowHas(bool Low)
|
|||
|
{
|
|||
|
Fellow pet = GameManager.gameManager.PlayerDataPool.FellowContainer.GetFellowByGuid(PetMainWnd.CurrentSelectFellowId);
|
|||
|
if (pet == null)
|
|||
|
return;
|
|||
|
var fellowSkills = TableManager.GetFellowLearnSkillCost().Values;
|
|||
|
List<int> showList = new List<int>();
|
|||
|
List<int> selects = new List<int>();
|
|||
|
|
|||
|
if(!Low)
|
|||
|
{
|
|||
|
showList.Insert(0, -3);
|
|||
|
showList.Insert(0, -3);
|
|||
|
showList.Insert(0, -3);
|
|||
|
showList.Insert(0, -2);
|
|||
|
}
|
|||
|
int TypeThree = 0;
|
|||
|
foreach (var value in fellowSkills)
|
|||
|
{
|
|||
|
Tab_FellowSkill skillInfo = TableManager.GetFellowSkillByID(value.Id, 0);
|
|||
|
if (skillInfo == null || skillInfo.Type == -1 || skillInfo.IsShow!=1)
|
|||
|
continue;
|
|||
|
if (skillInfo.Type == 1 && Low)
|
|||
|
{
|
|||
|
showList.Add(value.Id);
|
|||
|
}
|
|||
|
if(!Low)
|
|||
|
{
|
|||
|
if (skillInfo.Type == 3)
|
|||
|
{
|
|||
|
showList.Insert(0, value.Id);
|
|||
|
TypeThree++;
|
|||
|
}
|
|||
|
if (skillInfo.Type == 2)
|
|||
|
{
|
|||
|
showList.Add(value.Id);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if (showList.Count > 0)
|
|||
|
selects.Add(showList[0]);
|
|||
|
|
|||
|
if (!Low)
|
|||
|
{
|
|||
|
int need = TypeThree % 4;
|
|||
|
if(need>0)
|
|||
|
{
|
|||
|
for (int i = 0; i < 4 - need; i++)
|
|||
|
{
|
|||
|
showList.Insert(TypeThree + i, -3);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
showList.Insert(0, -3);
|
|||
|
showList.Insert(0, -3);
|
|||
|
showList.Insert(0, -3);
|
|||
|
showList.Insert(0, -1);
|
|||
|
}
|
|||
|
m_Contains.InitSelectContent(showList, selects, OnSelectSkillBook, null);
|
|||
|
}
|
|||
|
|
|||
|
public void OnSelectSkillBook(object param)
|
|||
|
{
|
|||
|
int skillId = (int)param;
|
|||
|
Fellow pet = GameManager.gameManager.PlayerDataPool.FellowContainer.GetFellowByGuid(PetMainWnd.CurrentSelectFellowId);
|
|||
|
if (pet == null)
|
|||
|
return;
|
|||
|
m_currSelectSkill = skillId;
|
|||
|
int realSkill = pet.IsSkillBookUsed(skillId);
|
|||
|
if (realSkill == 0)
|
|||
|
realSkill = skillId;
|
|||
|
Tab_FellowSkill skillInfo = TableManager.GetFellowSkillByID(realSkill, 0);
|
|||
|
if (skillInfo == null || skillInfo.Type == -1)
|
|||
|
return;
|
|||
|
Tab_FellowLearnSkillCost skillBookInfo = TableManager.GetFellowLearnSkillCostByID(skillId, 0);
|
|||
|
if (skillBookInfo == null)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
skillname.text = skillBookInfo.SkillName;
|
|||
|
Tab_SkillEx tab_SkillEx = TableManager.GetSkillExByID(realSkill, 0);
|
|||
|
if (tab_SkillEx != null)
|
|||
|
{
|
|||
|
skillDescript.text = StrDictionary.GetClientString_WithNameSex(tab_SkillEx.SkillDesc);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
skillDescript.text = "";
|
|||
|
}
|
|||
|
LoadAssetBundle.Instance.SetImageSprite(skillIcon, skillInfo.SkillIcon);
|
|||
|
int realID = pet.IsSkillBookUsed(skillId);
|
|||
|
if (realID == 0)
|
|||
|
{
|
|||
|
CountLearnCost(skillId);
|
|||
|
TipText.gameObject.SetActive(false);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
CountLevelUp(skillInfo);
|
|||
|
TipText.gameObject.SetActive(true);
|
|||
|
}
|
|||
|
UpBtn.SetActive(realID > 0 || skillInfo.Type == 1);
|
|||
|
LearnBtn.SetActive(!UpBtn.activeSelf);
|
|||
|
}
|
|||
|
|
|||
|
int hasCount = 0;
|
|||
|
int commonItem_Cost = 0;
|
|||
|
int commonItem_Money = 0;
|
|||
|
int commonItem_Money_Cost = 0;
|
|||
|
public void CountLearnCost(int bookID)
|
|||
|
{
|
|||
|
if (m_currSelectSkill != bookID)
|
|||
|
return;
|
|||
|
Tab_FellowLearnSkillCost skillBookInfo = TableManager.GetFellowLearnSkillCostByID(m_currSelectSkill, 0);
|
|||
|
if (skillBookInfo == null)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
Tab_CommonItem commonItem = null;
|
|||
|
|
|||
|
for (int i = 0; i < skillBookInfo.getConsumeTypeCount(); i++)
|
|||
|
{
|
|||
|
if (skillBookInfo.GetConsumeTypebyIndex(i) == (int)CONSUM_TYPE.ITEM)
|
|||
|
{
|
|||
|
commonItem = TableManager.GetCommonItemByID(skillBookInfo.GetConsumeSubTypebyIndex(i), 0);
|
|||
|
commonItem_Cost = skillBookInfo.GetConsumeNumbyIndex(i);
|
|||
|
}
|
|||
|
if (skillBookInfo.GetConsumeTypebyIndex(i) == (int)CONSUM_TYPE.MONEY)
|
|||
|
{
|
|||
|
commonItem_Money = skillBookInfo.GetConsumeSubTypebyIndex(i);
|
|||
|
commonItem_Money_Cost = skillBookInfo.GetConsumeNumbyIndex(i);
|
|||
|
|
|||
|
long count = GameManager.gameManager.PlayerDataPool.Money.GetMoneyByType((MONEYTYPE)commonItem_Money);
|
|||
|
TipText1.SetActive(count < commonItem_Money_Cost);
|
|||
|
}
|
|||
|
}
|
|||
|
if (commonItem == null)
|
|||
|
return;
|
|||
|
|
|||
|
LoadAssetBundle.Instance.SetImageSprite(PayItemQuility, GCGame.Utils.GetItemQualityFrame(commonItem.Quality));
|
|||
|
LoadAssetBundle.Instance.SetImageSprite(PayItemIcon, commonItem.Icon);
|
|||
|
if (commonItem.QualityEffect > 0)
|
|||
|
{
|
|||
|
CommonItemContainerItem.ShowQualityEffect(true, commonItem.QualityEffect, PayItemIcon.transform);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
CommonItemContainerItem.ShowQualityEffect(false, commonItem.QualityEffect, PayItemIcon.transform);
|
|||
|
}
|
|||
|
|
|||
|
PayItemName.text = commonItem.Name;
|
|||
|
hasCount = GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(commonItem.Id);
|
|||
|
if (hasCount < commonItem_Cost)
|
|||
|
{
|
|||
|
PayItemNum.text = string.Format("<color=#ff0000ff>{0}</color>/{1}", hasCount, commonItem_Cost);
|
|||
|
GetItemBtn.SetActive(true);
|
|||
|
Button btn = GetItemBtn.GetComponent<Button>();
|
|||
|
if (btn != null)
|
|||
|
{
|
|||
|
btn.onClick.RemoveAllListeners();
|
|||
|
btn.onClick.AddListener(delegate ()
|
|||
|
{
|
|||
|
ItemTooltipsLogic.ShowItemTooltip(commonItem.Id, ItemTooltipsLogic.ShowType.GetPath, btn.transform.position);
|
|||
|
});
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
PayItemNum.text = string.Format("<color=#43cd80ff>{0}</color>/{1}", hasCount, commonItem_Cost);
|
|||
|
GetItemBtn.SetActive(false);
|
|||
|
}
|
|||
|
PayMoneyHas.text = GameManager.gameManager.PlayerDataPool.Money.GetMoneyByType((MONEYTYPE)commonItem_Money).ToString();
|
|||
|
PayMoneyCost.text = commonItem_Money_Cost.ToString();
|
|||
|
LoadAssetBundle.Instance.SetImageSprite(PayMoneyIcon, UICurrencyItem.GetCurrencySprite((MONEYTYPE)commonItem_Money));
|
|||
|
LoadAssetBundle.Instance.SetImageSprite(PayMoneyHasIcon, UICurrencyItem.GetCurrencySprite((MONEYTYPE)commonItem_Money));
|
|||
|
m_Contains.RefreshItems();
|
|||
|
}
|
|||
|
|
|||
|
private int m_currSelectSkill = 0;
|
|||
|
public void CountLevelUp(Tab_FellowSkill skillInfo)
|
|||
|
{
|
|||
|
|
|||
|
for (int i=0;i< skillInfo.getLevelupConsumeTypeCount();i++)
|
|||
|
{
|
|||
|
if(skillInfo.GetLevelupConsumeTypebyIndex(i)==(int)CONSUM_TYPE.ITEM)
|
|||
|
{
|
|||
|
Tab_CommonItem itemcommon = TableManager.GetCommonItemByID(skillInfo.GetLevelupConsumeSubTypebyIndex(i), 0);
|
|||
|
if(itemcommon!=null)
|
|||
|
{
|
|||
|
LoadAssetBundle.Instance.SetImageSprite(PayItemQuility, GCGame.Utils.GetItemQualityFrame(itemcommon.Quality));
|
|||
|
LoadAssetBundle.Instance.SetImageSprite(PayItemIcon, itemcommon.Icon);
|
|||
|
if (itemcommon.QualityEffect > 0)
|
|||
|
{
|
|||
|
CommonItemContainerItem.ShowQualityEffect(true, itemcommon.QualityEffect, PayItemIcon.transform);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
CommonItemContainerItem.ShowQualityEffect(false, itemcommon.QualityEffect, PayItemIcon.transform);
|
|||
|
}
|
|||
|
|
|||
|
PayItemName.text = itemcommon.Name;
|
|||
|
hasCount = GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(itemcommon.Id);
|
|||
|
commonItem_Cost = skillInfo.GetLevelupConsumeNumbyIndex(i);
|
|||
|
if (hasCount < commonItem_Cost)
|
|||
|
{
|
|||
|
PayItemNum.text = string.Format("<color=#ff0000ff>{0}</color>/{1}", hasCount, commonItem_Cost);
|
|||
|
GetItemBtn.SetActive(true);
|
|||
|
Button btn = GetItemBtn.GetComponent<Button>();
|
|||
|
if (btn != null)
|
|||
|
{
|
|||
|
btn.onClick.RemoveAllListeners();
|
|||
|
btn.onClick.AddListener(delegate ()
|
|||
|
{
|
|||
|
ItemTooltipsLogic.ShowItemTooltip(itemcommon.Id, ItemTooltipsLogic.ShowType.GetPath, btn.transform.position);
|
|||
|
});
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
PayItemNum.text = string.Format("<color=#00ff00ff>{0}</color>/{1}", hasCount, commonItem_Cost);
|
|||
|
GetItemBtn.SetActive(false);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
if (skillInfo.GetLevelupConsumeTypebyIndex(i) == (int)CONSUM_TYPE.MONEY)
|
|||
|
{
|
|||
|
commonItem_Money = skillInfo.GetLevelupConsumeSubTypebyIndex(i);
|
|||
|
PayMoneyHas.text = GameManager.gameManager.PlayerDataPool.Money.GetMoneyByType((MONEYTYPE)commonItem_Money).ToString();
|
|||
|
commonItem_Money_Cost = skillInfo.GetLevelupConsumeNumbyIndex(i);
|
|||
|
PayMoneyCost.text = commonItem_Money_Cost.ToString();
|
|||
|
LoadAssetBundle.Instance.SetImageSprite(PayMoneyIcon,UICurrencyItem.GetCurrencySprite((MONEYTYPE)commonItem_Money));
|
|||
|
LoadAssetBundle.Instance.SetImageSprite(PayMoneyHasIcon, UICurrencyItem.GetCurrencySprite((MONEYTYPE)commonItem_Money));
|
|||
|
long has = GameManager.gameManager.PlayerDataPool.Money.GetMoneyByType((MONEYTYPE)commonItem_Money);
|
|||
|
TipText1.SetActive(has < commonItem_Money_Cost);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void UpSkill_Click()
|
|||
|
{
|
|||
|
Fellow pet = GameManager.gameManager.PlayerDataPool.FellowContainer.GetFellowByGuid(PetMainWnd.CurrentSelectFellowId);
|
|||
|
if (pet == null)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
Tab_FellowSkill skillInfo = TableManager.GetFellowSkillByID(m_currSelectSkill, 0);
|
|||
|
if (skillInfo == null)
|
|||
|
{
|
|||
|
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{20143}"));
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
if (commonItem_Cost > hasCount)
|
|||
|
{
|
|||
|
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{42696}"));
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
if (commonItem_Money == (int)MONEYTYPE.MONEYTYPE_COIN_BIND)
|
|||
|
{
|
|||
|
long enough = GameManager.gameManager.PlayerDataPool.Money.GetMoneyByType((MONEYTYPE)commonItem_Money);
|
|||
|
if (enough - commonItem_Money_Cost < 0)
|
|||
|
{
|
|||
|
MessageBoxLogic.OpenOKCancelBox(StrDictionary.GetClientDictionaryString("#{4746}", commonItem_Money_Cost - enough), "", delegate ()
|
|||
|
{
|
|||
|
if (skillInfo.Type == 1 && pet.IsSkillBookUsed(m_currSelectSkill) == 0)
|
|||
|
SendLearn();
|
|||
|
else
|
|||
|
SendUp();
|
|||
|
});
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (skillInfo.Type == 1 && pet.IsSkillBookUsed(m_currSelectSkill) == 0)
|
|||
|
SendLearn();
|
|||
|
else
|
|||
|
SendUp();
|
|||
|
}
|
|||
|
return;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
bool isEnough = JudgeMoneyLogic.IsMoneyEnough((MONEYTYPE)commonItem_Money, commonItem_Money_Cost);
|
|||
|
if (!isEnough)
|
|||
|
return;
|
|||
|
if (skillInfo.Type == 1 && pet.IsSkillBookUsed(m_currSelectSkill) == 0)
|
|||
|
SendLearn();
|
|||
|
else
|
|||
|
SendUp();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void SendUp()
|
|||
|
{
|
|||
|
Fellow pet1 = GameManager.gameManager.PlayerDataPool.FellowContainer.GetFellowByGuid(PetMainWnd.CurrentSelectFellowId);
|
|||
|
if (pet1 == null)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
int realSkill = pet1.IsSkillBookUsed(m_currSelectSkill);
|
|||
|
CG_LEVELUP_FELLOW_SKILL send = (CG_LEVELUP_FELLOW_SKILL)PacketDistributed.CreatePacket(MessageID.PACKET_CG_LEVELUP_FELLOW_SKILL);
|
|||
|
send.Fellowguid = PetMainWnd.CurrentSelectFellowId;
|
|||
|
send.SkillId = realSkill;
|
|||
|
send.SendPacket();
|
|||
|
}
|
|||
|
|
|||
|
public void StudySkill_Click()
|
|||
|
{
|
|||
|
Tab_FellowSkill skillInfo = TableManager.GetFellowSkillByID(m_currSelectSkill, 0);
|
|||
|
if (skillInfo == null)
|
|||
|
{
|
|||
|
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{20143}"));
|
|||
|
return;
|
|||
|
}
|
|||
|
Fellow pet = GameManager.gameManager.PlayerDataPool.FellowContainer.GetFellowByGuid(PetMainWnd.CurrentSelectFellowId);
|
|||
|
if (pet == null)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
if (commonItem_Cost > hasCount)
|
|||
|
{
|
|||
|
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{42696}"));
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
if (commonItem_Money == (int)MONEYTYPE.MONEYTYPE_COIN_BIND)
|
|||
|
{
|
|||
|
long enough = GameManager.gameManager.PlayerDataPool.Money.GetMoneyByType((MONEYTYPE)commonItem_Money);
|
|||
|
if (enough - commonItem_Money_Cost < 0)
|
|||
|
{
|
|||
|
MessageBoxLogic.OpenOKCancelBox(StrDictionary.GetClientDictionaryString("#{4746}", commonItem_Money_Cost - enough), "", delegate ()
|
|||
|
{
|
|||
|
SendLearn();
|
|||
|
});
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
SendLearn();
|
|||
|
}
|
|||
|
return;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
bool isEnough = JudgeMoneyLogic.IsMoneyEnough((MONEYTYPE)commonItem_Money, commonItem_Money_Cost);
|
|||
|
if (!isEnough)
|
|||
|
return;
|
|||
|
SendLearn();
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
private void SendLearn()
|
|||
|
{
|
|||
|
if (m_currSelectSkill == 0)
|
|||
|
return;
|
|||
|
Tab_FellowSkill skillInfo = TableManager.GetFellowSkillByID(m_currSelectSkill, 0);
|
|||
|
if (skillInfo == null)
|
|||
|
{
|
|||
|
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{20143}"));
|
|||
|
return;
|
|||
|
}
|
|||
|
Fellow pet = GameManager.gameManager.PlayerDataPool.FellowContainer.GetFellowByGuid(PetMainWnd.CurrentSelectFellowId);
|
|||
|
if (pet == null)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
int hadSkill = 0;
|
|||
|
if (skillInfo.Type == 2)
|
|||
|
hadSkill = pet.MW_skillid;
|
|||
|
if (skillInfo.Type == 3)
|
|||
|
hadSkill = pet.GY_skillid;
|
|||
|
Tab_FellowSkill skillInfohad = TableManager.GetFellowSkillByID(hadSkill, 0);
|
|||
|
if (skillInfo != null && skillInfohad != null)
|
|||
|
{
|
|||
|
Tab_FellowLearnSkillCost skillBookHadInfo = TableManager.GetFellowLearnSkillCostByID(skillInfohad.BaseSkillId, 0);
|
|||
|
Tab_FellowLearnSkillCost skillBookInfo = TableManager.GetFellowLearnSkillCostByID(skillInfo.BaseSkillId, 0);
|
|||
|
if (skillBookInfo != null && skillBookHadInfo != null)
|
|||
|
{
|
|||
|
MessageBoxLogic.OpenOKCancelBox(StrDictionary.GetClientDictionaryString("#{20194}", skillBookInfo.SkillName, skillBookHadInfo.SkillName), null, delegate ()
|
|||
|
{
|
|||
|
CG_ACTIVE_FELLOW_SKILL send = (CG_ACTIVE_FELLOW_SKILL)PacketDistributed.CreatePacket(MessageID.PACKET_CG_ACTIVE_FELLOW_SKILL);
|
|||
|
send.FellowGuid = PetMainWnd.CurrentSelectFellowId;
|
|||
|
send.SetSkillId(m_currSelectSkill);
|
|||
|
send.SendPacket();
|
|||
|
}, null);
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
CG_ACTIVE_FELLOW_SKILL send1 = (CG_ACTIVE_FELLOW_SKILL)PacketDistributed.CreatePacket(MessageID.PACKET_CG_ACTIVE_FELLOW_SKILL);
|
|||
|
send1.FellowGuid = PetMainWnd.CurrentSelectFellowId;
|
|||
|
send1.SetSkillId(m_currSelectSkill);
|
|||
|
send1.SendPacket();
|
|||
|
}
|
|||
|
|
|||
|
public void OnToggleValueChange(bool IsOn)
|
|||
|
{
|
|||
|
ShowHas(IsLow.isOn);
|
|||
|
}
|
|||
|
|
|||
|
public void OnClick_SkillTip()
|
|||
|
{
|
|||
|
MessageHelpLogic.ShowHelpMessage(15);
|
|||
|
}
|
|||
|
}
|