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

699 lines
26 KiB
C#

using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
using GCGame.Table;
using System;
using Module.Log;
public class LiveSkillLogic : UIControllerBase<LiveSkillLogic>
{
void OnEnable()
{
SetInstance(this);
DefaultShowItem = null;
// 失活攻击技能相关界面
HideNormalSkill();
SelectedLivingSkill = null;
UpdateLiveSkill();
GUIData.delMoneyChanged += UpdateSkillCost;
Hashtable calbackMoveparam = new Hashtable();
calbackMoveparam["name"] = "GuidPointUpdate";
Games.Events.MessageEventCallBack fun = UpdateSkillCost;
calbackMoveparam.Add("callFun", fun);
Games.Events.EventDispatcher.Instance.AddMessageEvent(Games.Events.EventId.FRESHSAMEUSETIP, calbackMoveparam);
}
void OnDisable()
{
SetInstance(null);
ShowNormalSkill();
GUIData.delMoneyChanged -= UpdateSkillCost;
Games.Events.EventDispatcher.Instance.RemoveMessage(Games.Events.EventId.FRESHSAMEUSETIP, "GuidPointUpdate");
}
public Tab_LivingSkillItem DefaultShowItem { get; set; }
public void ShowLiveItem(int dataID)
{
DefaultShowItem = TableManager.GetLivingSkillItemByID(dataID, 0);
if (DefaultShowItem == null)
return;
foreach (var liveSkill in GameManager.gameManager.LiveSkill.LiveSkillTabs)
{
if (liveSkill.SkillGroupID == DefaultShowItem.NeedSkillGroupID)
{
_LiveSkills.SetSelect(new List<Tab_LivingSkills>() { liveSkill });
break;
}
}
UIManager.CloseUI(UIInfo.LiveItemCollectNum);
}
#region skill info
public GameObject[] _NormalSkillGO;
private void ShowNormalSkill()
{
foreach (var skillGO in _NormalSkillGO)
{
skillGO.SetActive(true);
}
}
// 失活攻击技能相关界面
private void HideNormalSkill()
{
foreach (var skillGO in _NormalSkillGO)
{
skillGO.SetActive(false);
}
}
#endregion
#region liveSkillList
public UIContainerSelect _LiveSkills;
public Text _TagText;
public Text _HLTagText;
public Tab_LivingSkills SelectedLivingSkill { get; set; }
private List<Tab_LivingSkills> _LearnedSkills = new List<Tab_LivingSkills>();
public void UpdateLiveSkill()
{
_LearnedSkills.Clear();
if (GameManager.gameManager.LiveSkill.LiveSkillTabs.Count == 0)
{
GameManager.gameManager.LiveSkill.InitDefault();
}
if (SelectedLivingSkill == null)
_LiveSkills.InitSelectContent(GameManager.gameManager.LiveSkill.LiveSkillTabs, new List<Tab_LivingSkills>() { GameManager.gameManager.LiveSkill.LiveSkillTabs[0] }, OnLiveSkillSelect);
else
{
var liveSkill = GameManager.gameManager.LiveSkill.LiveSkillTabs.Find((liveS) =>
{
if (liveS.SkillGroupID == SelectedLivingSkill.SkillGroupID)
return true;
return false;
});
_LiveSkills.InitSelectContent(GameManager.gameManager.LiveSkill.LiveSkillTabs, new List<Tab_LivingSkills>() { liveSkill }, OnLiveSkillSelect);
}
}
private void OnLiveSkillSelect(object selectedObj)
{
var selectSkillTab = selectedObj as Tab_LivingSkills;
if (selectSkillTab == null)
return;
SelectedLivingSkill = selectSkillTab;
_TagText.text = SelectedLivingSkill.SkillName.Replace(StrDictionary.GetClientDictionaryString("#{4476}"), "");
_HLTagText.text = SelectedLivingSkill.SkillName.Replace(StrDictionary.GetClientDictionaryString("#{4476}"), "");
if (_TagPanel.GetShowingPage() == 1 && IsLiveSkill(SelectedLivingSkill)/* && SelectedLivingSkill.SkillLevel > 0*/)
{
_TagPanel.ShowPage(1);
_MaxLvTipPanel.gameObject.SetActive(false);
UpdateLiveSkillItem();
}
else
{
_TagPanel.ShowPage(0);
_MaxLvTipPanel.gameObject.SetActive(true);
UpdateSelectedSkill();
}
}
private bool IsLiveSkill(Tab_LivingSkills skillTab)
{
if (skillTab.PropID >= 0)
{
return false;
}
return true;
}
#endregion
#region learnSkill
public GameObject _LiveSkillPanel;
public Text _LiveSkillName;
public Text _LiveSkillDesc;
public Image _LiveSkillIcon;
public GameObject _PropSkillPanel;
public Text _PropSkillName;
public Text _PropSkillDesc;
public Image _PropSkillIcon;
public GameObject _PropSkillLevelTipGo;
public GameObject _PropSkillNextLevelTipGo;
public Text _PropSkillLevelTip;
public Text _PropSkillNextLevelTip;
public GameObject _CurrencyPanel;
public UICurrencyItem _CostValue1;
public UICurrencyItem _OwnValue1;
public UICurrencyItem _CostValue2;
public UICurrencyItem _OwnValue2;
public GameObject _CantLearnPanel;
public GameObject _LearnReplaceMoneyPanel;
public GameObject _MaxLvTip;
public GameObject _MaxLvTipPanel;
public Button _BtnLearn;
private Tab_LivingSkills _NextLivingSkill;
private long _ReplaceMoneyConsume;
public void UpdateSelectedSkill()
{
if (SelectedLivingSkill == null)
return;
_NextLivingSkill = null;
if (SelectedLivingSkill.NextSkill > 0)
{
_NextLivingSkill = TableManager.GetLivingSkillsByID(SelectedLivingSkill.NextSkill, 0);
}
if (SelectedLivingSkill.PropID >= 0 || (_NextLivingSkill != null && _NextLivingSkill.PropID >= 0))
{
_PropSkillPanel.SetActive(true);
_LiveSkillPanel.SetActive(false);
_CurrencyPanel.SetActive(true);
// 名字旁需要添加等级
_PropSkillName.text = SelectedLivingSkill.SkillName;
int lv = SelectedLivingSkill.SkillLevel;
string lvStr = "";
if(lv > 0)
{
lvStr = "(" + GCGame.Table.StrDictionary.GetClientDictionaryString("#{2162}",lv)+")";
}
_PropSkillName.text += lvStr;
_PropSkillDesc.text = SelectedLivingSkill.Tips;
LoadAssetBundle.Instance.SetImageSprite(_PropSkillIcon, SelectedLivingSkill.SkillIcon);
if (SelectedLivingSkill.SkillLevel > 0)
{
_PropSkillLevelTip.text = PropID.GetAttrName((PropID.PropertyID)SelectedLivingSkill.PropID, SelectedLivingSkill.PropSubID, SelectedLivingSkill.PropValue) + StrDictionary.GetClientDictionaryString("#{5330}") + SelectedLivingSkill.PropValue;
_PropSkillLevelTipGo.SetActive(true);
}
else
{
_PropSkillLevelTip.text = "";
_PropSkillLevelTipGo.SetActive(false);
}
}
else
{
_PropSkillPanel.SetActive(false);
_LiveSkillPanel.SetActive(true);
// 名字旁需要等级
_LiveSkillName.text = SelectedLivingSkill.SkillName;
string lvStr = "";
int lv = SelectedLivingSkill.SkillLevel;
if (lv > 0)
{
lvStr = "(" + GCGame.Table.StrDictionary.GetClientDictionaryString("#{2162}", lv) + ")";
}
_LiveSkillName.text += lvStr;
_LiveSkillDesc.text = SelectedLivingSkill.Tips;
LoadAssetBundle.Instance.SetImageSprite(_LiveSkillIcon, SelectedLivingSkill.SkillIcon);
}
if (_NextLivingSkill != null)
{
_MaxLvTip.SetActive(false);
_CurrencyPanel.SetActive(true);
_PropSkillNextLevelTip.text =
PropID.GetAttrName((PropID.PropertyID)_NextLivingSkill.PropID, _NextLivingSkill.PropSubID, _NextLivingSkill.PropValue)
+ StrDictionary.GetClientDictionaryString("#{5330}")
+ "<color=#59ee60>" +_NextLivingSkill.PropValue + "</color>";
_PropSkillNextLevelTipGo.SetActive(true);
UpdateSkillCost();
}
else
{
_CurrencyPanel.SetActive(false);
_PropSkillNextLevelTipGo.SetActive(false);
_PropSkillNextLevelTip.text = "";
_CostValue1.gameObject.SetActive(false);
_OwnValue1.gameObject.SetActive(false);
_CostValue2.gameObject.SetActive(false);
_OwnValue2.gameObject.SetActive(false);
_BtnLearn.interactable = false;
_MaxLvTip.SetActive(true);
}
}
public void UpdateSkillCost(Hashtable addparam, Hashtable Sendparam)
{
UpdateSkillCost();
}
private void UpdateSkillCost()
{
_CostValue1.gameObject.SetActive(true);
_OwnValue1.gameObject.SetActive(true);
if(_NextLivingSkill != null)
{
// 根据技能的第一消耗金币类型,获取自身相关类型的数目
long costValue = GameManager.gameManager.PlayerDataPool.GetLongPropty(_NextLivingSkill.GetConsumeTypebyIndex(0), _NextLivingSkill.GetConsumeSubTypebyIndex(0));
// 优先技能要求类型相同的,只有在拥有数目为 0 时,采用可替代货币
if (costValue > 0)
{
// 判断是货币是否足够,不足够时,自身货币用红色标志
if (_NextLivingSkill.GetConsumeNumbyIndex(0) > costValue)
{
_OwnValue1.SetColor("<color=red>");
}
_CostValue1.ShowCurrency(_NextLivingSkill.GetConsumeTypebyIndex(0), _NextLivingSkill.GetConsumeSubTypebyIndex(0), _NextLivingSkill.GetConsumeNumbyIndex(0));
_OwnValue1.ShowCurrency(_NextLivingSkill.GetConsumeTypebyIndex(0), _NextLivingSkill.GetConsumeSubTypebyIndex(0), costValue);
}
else
{
// 使用替代货币
_CostValue1.ShowReplaceOwnCurrency(_NextLivingSkill.GetConsumeTypebyIndex(0), _NextLivingSkill.GetConsumeSubTypebyIndex(0), _NextLivingSkill.GetConsumeNumbyIndex(0));
_OwnValue1.ShowReplaceOwnCurrencyCompare(_NextLivingSkill.GetConsumeTypebyIndex(0), _NextLivingSkill.GetConsumeSubTypebyIndex(0), _NextLivingSkill.GetConsumeNumbyIndex(0));
}
if (_NextLivingSkill.GetConsumeTypebyIndex(1) > 0)
{
_CostValue2.gameObject.SetActive(true);
_OwnValue2.gameObject.SetActive(true);
//通过类型和ID返回角色自身已经拥有的数量
int costValue2 = GameManager.gameManager.PlayerDataPool.GetIntPropty(_NextLivingSkill.GetConsumeTypebyIndex(1), _NextLivingSkill.GetConsumeSubTypebyIndex(1));
if (costValue2 > 0)
{
// 判断是货币是否足够,不足够时,自身货币用红色标志
if (_NextLivingSkill.GetConsumeNumbyIndex(1) > costValue2)
{
_OwnValue2.SetColor("<color=red>");
}
_CostValue2.ShowCurrency(_NextLivingSkill.GetConsumeTypebyIndex(1), _NextLivingSkill.GetConsumeSubTypebyIndex(1), _NextLivingSkill.GetConsumeNumbyIndex(1));
_OwnValue2.ShowCurrency(_NextLivingSkill.GetConsumeTypebyIndex(1), _NextLivingSkill.GetConsumeSubTypebyIndex(1), costValue2);
}
else
{
_CostValue2.ShowReplaceOwnCurrency(_NextLivingSkill.GetConsumeTypebyIndex(1), _NextLivingSkill.GetConsumeSubTypebyIndex(1), _NextLivingSkill.GetConsumeNumbyIndex(1));
_OwnValue2.ShowReplaceOwnCurrencyCompare(_NextLivingSkill.GetConsumeTypebyIndex(1), _NextLivingSkill.GetConsumeSubTypebyIndex(1), _NextLivingSkill.GetConsumeNumbyIndex(1));
}
}
else
{
_CostValue2.gameObject.SetActive(false);
_OwnValue2.gameObject.SetActive(false);
}
//代替货币是否足够
_ReplaceMoneyConsume = costValue - _NextLivingSkill.GetConsumeNumbyIndex(0);
//类型 ID 数量
int stateMoney = GameManager.gameManager.PlayerDataPool.ConsumReplaceEnough(_NextLivingSkill.GetConsumeTypebyIndex(0), _NextLivingSkill.GetConsumeSubTypebyIndex(0), _NextLivingSkill.GetConsumeNumbyIndex(0));
int stateGuide = GameManager.gameManager.PlayerDataPool.ConsumReplaceEnough(_NextLivingSkill.GetConsumeTypebyIndex(1), _NextLivingSkill.GetConsumeSubTypebyIndex(1), _NextLivingSkill.GetConsumeNumbyIndex(1));
//}
//替代后不满足
if (stateGuide == 3)
{
_CantLearnPanel.SetActive(true);
_LearnReplaceMoneyPanel.SetActive(false);
_BtnLearn.interactable = false;
}
else if (stateMoney == 3)
{
_CantLearnPanel.SetActive(true);
_LearnReplaceMoneyPanel.SetActive(false);
_BtnLearn.interactable = false;
}
//只消耗银票
else if (stateMoney == 2 && stateGuide == 1)
{
_CantLearnPanel.SetActive(false);
_LearnReplaceMoneyPanel.SetActive(true);
_BtnLearn.interactable = true;
}
//不替代就满足
else if (stateMoney == 1 && stateGuide == 1)
{
_CantLearnPanel.SetActive(false);
_LearnReplaceMoneyPanel.SetActive(false);
_BtnLearn.interactable = true;
}
}
}
#endregion
#region liveSkill
public UITagPanel _TagPanel;
public UIContainerSelect _ItemList;
public Text _ItemName;
public Text _ItemDesc;
public Image _ItemIcon;
public Image _ItemQuality;
public Text _NeedLevel;
public Text _NeedProp;
public Text _OwnProp;
public Text _BtnText;
public Button _BtnMake;
public Tab_LivingSkillItem SelectedLiveItem { get; set; }
//public void OnItemPageShow(int page)
//{
// switch (page)
// {
// case 0:
// _CurrencyPanel.SetActive(true);
// break;
// case 1:
// _CurrencyPanel.SetActive(false);
// UpdateLiveItems();
// break;
// }
//}
private void UpdateLiveSkillItem()
{
//if (DefaultShowItem != null)
{
_TagPanel.ShowPage(1);
UpdateLiveItems();
}
//else
//{
// _TagPanel.ShowPage(0);
//}
}
public void UpdateProp()
{
int ownPropValue = GameManager.gameManager.PlayerDataPool.GetIntPropty(SelectedLiveItem.GetConsumeTypebyIndex(0), SelectedLiveItem.GetConsumeSubTypebyIndex(0));
string colorNum;
if (SelectedLiveItem.GetConsumeNumbyIndex(0) > ownPropValue)
{
colorNum = "<color=red>" + ownPropValue.ToString() + "</color>";
}
else
{
colorNum = ownPropValue.ToString();
}
_OwnProp.text = StrDictionary.GetClientDictionaryString("#{4752}", colorNum);
}
public void UpdateSelectedItem()
{
UpdateExItems();
int ownPropValue = GameManager.gameManager.PlayerDataPool.GetIntPropty(SelectedLiveItem.GetConsumeTypebyIndex(0), SelectedLiveItem.GetConsumeSubTypebyIndex(0));
_OwnProp.text = StrDictionary.GetClientDictionaryString("#{4752}", ownPropValue);
int needValue = SelectedLiveItem.GetConsumeNumbyIndex(0);
bool isMaterialEnough = true;
if (SelectedLiveItem.ConsumeSubTypeA > 0)
{
isMaterialEnough = GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(SelectedLiveItem.ConsumeSubTypeA) >= SelectedLiveItem.ConsumeNumA;
}
if (SelectedLiveItem.ConsumeSubTypeB > 0)
{
isMaterialEnough |= GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(SelectedLiveItem.ConsumeSubTypeB) >= SelectedLiveItem.ConsumeNumB;
}
for (int i = 1; i < SelectedLiveItem.getConsumeTypeCount(); ++i)
{
if (SelectedLiveItem.GetConsumeSubTypebyIndex(i) > 0)
{
isMaterialEnough &= GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(SelectedLiveItem.GetConsumeSubTypebyIndex(i)) >= SelectedLiveItem.GetConsumeNumbyIndex(i);
}
}
//if (/*ownPropValue > needValue && isMaterialEnough &&*/ SelectedLiveItem.NeedSkillLevel <= SelectedLivingSkill.SkillLevel)
//{
// _BtnMake.interactable = true;
//}
//else
//{
// _BtnMake.interactable = false;
//}
}
private void UpdateLiveItems()
{
Dictionary<string, LiveItemClass> liveItemClasses = new Dictionary<string, LiveItemClass>();
var liveItemTabs = TableManager.GetLivingSkillItem().Values;
foreach (var liveItem in liveItemTabs)
{
if (liveItem.NeedSkillGroupID == SelectedLivingSkill.SkillGroupID)
{
if (!liveItemClasses.ContainsKey(liveItem.ItemGroupID))
{
liveItemClasses.Add(liveItem.ItemGroupID, new LiveItemClass() { _ClassName = liveItem.ItemGroupID, _LiveItems = new List<Tab_LivingSkillItem>() });
if (liveItemClasses.Count == 1)
{
liveItemClasses[liveItem.ItemGroupID]._AutoSelected = true;
}
}
liveItemClasses[liveItem.ItemGroupID]._LiveItems.Add(liveItem);
}
}
_ItemList.InitContentItem(liveItemClasses.Values);
}
public void OnTagSelect(int page)
{
if (page == 0)
{
_MaxLvTipPanel.SetActive(true);
_CurrencyPanel.SetActive(true);
UpdateSelectedSkill();
}
else
{
_MaxLvTipPanel.SetActive(false);
_CurrencyPanel.SetActive(false);
UpdateLiveItems();
}
}
public void OnLiveItemSelected(object liveItem)
{
var tabLiveItem = liveItem as Tab_LivingSkillItem;
if (tabLiveItem == null)
return;
SelectedLiveItem = tabLiveItem;
_ItemList.RefreshItems();
DefaultShowItem = null;
var commonItem = TableManager.GetCommonItemByID(SelectedLiveItem.Id, 0);
_ItemName.text = commonItem.Name;
_ItemDesc.text = SelectedLiveItem.ItemDesc;
LoadAssetBundle.Instance.SetImageSprite(_ItemIcon, commonItem.Icon);
LoadAssetBundle.Instance.SetImageSprite(_ItemQuality, GCGame.Utils.GetItemQualityFrame(commonItem));
if (commonItem.QualityEffect > 0)
{
CommonItemContainerItem.ShowQualityEffect(true, commonItem.QualityEffect, _ItemIcon.transform);
}
else
{
CommonItemContainerItem.ShowQualityEffect(false, commonItem.QualityEffect, _ItemIcon.transform);
}
_NeedLevel.text = StrDictionary.GetClientDictionaryString("#{4750}", SelectedLiveItem.NeedSkillLevel);
int needValue = SelectedLiveItem.GetConsumeNumbyIndex(0);
_NeedProp.text = StrDictionary.GetClientDictionaryString("#{4751}", needValue);
//int ownPropValue = GameManager.gameManager.PlayerDataPool.GetIntPropty(SelectedLiveItem.GetConsumeTypebyIndex(0), SelectedLiveItem.GetConsumeSubTypebyIndex(0));
//_OwnProp.text = StrDictionary.GetClientDictionaryString("#{4752}", ownPropValue);
UpdateProp();
UpdateExItems();
//if (SelectedLiveItem.SceneID > 0)
{
_BtnText.text = SelectedLivingSkill.SkillName.Replace( StrDictionary.GetClientDictionaryString("#{4476}"), "");
}
//else
//{
// _BtnText.text = StrDictionary.GetClientDictionaryString("#{4756}");
//}
//if (/*ownPropValue > needValue && isMaterialEnough &&*/ SelectedLiveItem.NeedSkillLevel <= SelectedLivingSkill.SkillLevel)
//{
// _BtnMake.interactable = true;
//}
//else
//{
// _BtnMake.interactable = false;
//}
}
private bool IsMaterialEnough()
{
bool isMaterialEnough = true;
if (SelectedLiveItem.ConsumeSubTypeA > 0)
{
isMaterialEnough = GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(SelectedLiveItem.ConsumeSubTypeA) >= SelectedLiveItem.ConsumeNumA;
}
if (SelectedLiveItem.ConsumeSubTypeB > 0)
{
isMaterialEnough |= GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(SelectedLiveItem.ConsumeSubTypeB) >= SelectedLiveItem.ConsumeNumB;
}
for (int i = 1; i < SelectedLiveItem.getConsumeTypeCount(); ++i)
{
if (SelectedLiveItem.GetConsumeSubTypebyIndex(i) > 0)
{
isMaterialEnough &= GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(SelectedLiveItem.GetConsumeSubTypebyIndex(i)) >= SelectedLiveItem.GetConsumeNumbyIndex(i);
}
}
return isMaterialEnough;
}
#endregion
#region liveSkillExItem
public Text _DestText;
public UIContainerBase _MaterialList;
public UIContainerBase _ExItemList;
public GameObject _SingleMaterialPanel;
public LiveSkillMaterialItem _MaterialA;
public LiveSkillMaterialItem _MaterialB;
private void UpdateExItems()
{
if (SelectedLiveItem == null)
return;
if (SelectedLiveItem.GetProductItemIDbyIndex(1) > 0)
{
_MaterialList.gameObject.SetActive(false);
_ExItemList.gameObject.SetActive(true);
_SingleMaterialPanel.gameObject.SetActive(false);
_DestText.text = StrDictionary.GetClientDictionaryString("#{4755}");
List<int> exItem = new List<int>();
for (int i = 1; i < SelectedLiveItem.getProductItemIDCount(); ++i)
{
if (SelectedLiveItem.GetProductItemIDbyIndex(i) > 0)
{
exItem.Add(SelectedLiveItem.GetProductItemIDbyIndex(i));
}
}
_ExItemList.InitContentItem(exItem);
}
else if (SelectedLiveItem.GetConsumeTypebyIndex(1) > 0)
{
_MaterialList.gameObject.SetActive(true);
_ExItemList.gameObject.SetActive(false);
_SingleMaterialPanel.gameObject.SetActive(false);
_DestText.text = StrDictionary.GetClientDictionaryString("#{4754}");
List<LiveItemMaterial> exItem = new List<LiveItemMaterial>();
for (int i = 1; i < SelectedLiveItem.getConsumeTypeCount(); ++i)
{
if (SelectedLiveItem.GetConsumeSubTypebyIndex(i) > 0)
{
LiveItemMaterial material = new LiveItemMaterial();
material.DataID = SelectedLiveItem.GetConsumeSubTypebyIndex(i);
material.NeedNum = SelectedLiveItem.GetConsumeNumbyIndex(i);
exItem.Add(material);
}
}
_ExItemList.InitContentItem(exItem);
}
else if (SelectedLiveItem.ConsumeTypeA > 0 && SelectedLiveItem.ConsumeTypeB > 0)
{
_MaterialList.gameObject.SetActive(false);
_ExItemList.gameObject.SetActive(false);
_SingleMaterialPanel.gameObject.SetActive(true);
_DestText.text = StrDictionary.GetClientDictionaryString("#{4754}");
_MaterialA.InitMaterial(SelectedLiveItem.ConsumeSubTypeA, SelectedLiveItem.ConsumeNumA);
_MaterialB.InitMaterial(SelectedLiveItem.ConsumeSubTypeB, SelectedLiveItem.ConsumeNumB);
}
else
{
_MaterialList.gameObject.SetActive(false);
_ExItemList.gameObject.SetActive(false);
_SingleMaterialPanel.gameObject.SetActive(false);
}
}
#endregion
#region interact
public void OnBtnLearnSkill()
{
if (_NextLivingSkill == null)
return;
LogModule.DebugLog("LiveSkillID:" + SelectedLivingSkill.Id);
CG_REQ_LLEARN_LIVING_SKILL packet = (CG_REQ_LLEARN_LIVING_SKILL)PacketDistributed.CreatePacket(MessageID.PACKET_CG_REQ_LLEARN_LIVING_SKILL);
packet.Curskillid = SelectedLivingSkill.Id;
packet.SendPacket();
}
public void OnBtnGetLiveItem()
{
int needValue = SelectedLiveItem.GetConsumeNumbyIndex(0);
int ownPropValue = GameManager.gameManager.PlayerDataPool.GetIntPropty(SelectedLiveItem.GetConsumeTypebyIndex(0), SelectedLiveItem.GetConsumeSubTypebyIndex(0));
if (ownPropValue < needValue)
{
//string tip = StrDictionary.GetClientDictionaryString("#{6013}") + StrDictionary.GetClientDictionaryString("#{6000}");
string tip = StrDictionary.GetClientDictionaryString("#{4758}");
GUIData.AddNotifyData(tip);
return;
}
if (SelectedLivingSkill.SkillLevel < SelectedLiveItem.NeedSkillLevel)
{
string tip = StrDictionary.GetClientDictionaryString("#{4761}");
GUIData.AddNotifyData(tip);
return;
}
if (SelectedLiveItem.SemiFinishedProduct > 0)
{
if (!IsMaterialEnough())
{
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{4760}"));
return;
}
int totleCnt = GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(SelectedLiveItem.ConsumeSubTypeA) + GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(SelectedLiveItem.ConsumeSubTypeB);
GameManager.gameManager.LiveSkill.StartLiveCollect(SelectedLiveItem, SelectedLivingSkill, 1);
}
else
{
UIManager.ShowUI(UIInfo.LiveItemCollectNum);
}
}
#endregion
}