715 lines
24 KiB
C#
715 lines
24 KiB
C#
|
using System;
|
|||
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using GCGame.Table;
|
|||
|
using GCGame;
|
|||
|
|
|||
|
public class MeridiaSoulData : Singleton<MeridiaSoulData>
|
|||
|
{
|
|||
|
public bool MerialSoulHasUp = false; // 经脉
|
|||
|
public bool KungfuHasUp = false; // 武魂
|
|||
|
public bool HeartHasUp = false; // 心法
|
|||
|
|
|||
|
public enum MeridiaSoulType
|
|||
|
{
|
|||
|
MerialSoul, // 经脉
|
|||
|
Kungfu, // 武魂
|
|||
|
Heart, // 心法
|
|||
|
}
|
|||
|
|
|||
|
public void CheckIsHasUp(bool force = false)
|
|||
|
{
|
|||
|
if(force == false && MeridiaSoulMain.Instance!=null && MeridiaSoulMain.Instance.gameObject.activeSelf)
|
|||
|
{
|
|||
|
MeridiaSoulMain.Instance.SetDataDuty();
|
|||
|
return;
|
|||
|
}
|
|||
|
CheckVeinHasUp();
|
|||
|
CheckKungfuHasUp();
|
|||
|
CheckHeartHasUp();
|
|||
|
|
|||
|
if (ExtraFunTipRoot.Instance() != null)
|
|||
|
{
|
|||
|
ExtraFunTipRoot.Instance().UpdateMerial();
|
|||
|
}
|
|||
|
|
|||
|
RedTipPoint.RedPointStateChange(RedTipPoint.PointType.MeridiaSoul, HeartHasUp ||
|
|||
|
MerialSoulHasUp ||
|
|||
|
KungfuHasUp ||
|
|||
|
BossBookPanel.IsNeedShowTips());
|
|||
|
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
public void SendAskDataCmd()
|
|||
|
{
|
|||
|
ReqGetSoulList cmd = new ReqGetSoulList();
|
|||
|
cmd.flag = 1;
|
|||
|
cmd.SendMsg();
|
|||
|
|
|||
|
ReqGetVeinList cmd1 = new ReqGetVeinList();
|
|||
|
cmd1.flag = 1;
|
|||
|
cmd1.SendMsg();
|
|||
|
|
|||
|
ReqGetHeartList cmd2 = new ReqGetHeartList();
|
|||
|
cmd2.flag = 1;
|
|||
|
cmd2.SendMsg();
|
|||
|
}
|
|||
|
|
|||
|
//检查经脉是否有可升级的
|
|||
|
public void CheckVeinHasUp()
|
|||
|
{
|
|||
|
if(IsFuncOpen(MeridiaSoulType.MerialSoul))
|
|||
|
{
|
|||
|
var tabs = TableManager.GetBloodVeinConfig().Values;
|
|||
|
foreach (var VeinConfig in tabs)
|
|||
|
{
|
|||
|
for (int ChildNodeCount = 0; ChildNodeCount < VeinConfig.getNodeCount(); ChildNodeCount++)
|
|||
|
{
|
|||
|
if (GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level < VeinConfig.GetOpenLvbyIndex(ChildNodeCount))
|
|||
|
continue;
|
|||
|
int nodeID = VeinConfig.GetNodebyIndex(ChildNodeCount);
|
|||
|
MeridiaSoulData.VeinNodeData VeinData = GetNodeData(VeinConfig.VeinID, nodeID);
|
|||
|
nodeID *= 1000;
|
|||
|
if (VeinData != null)
|
|||
|
{
|
|||
|
nodeID += VeinData.level;
|
|||
|
}
|
|||
|
Tab_BloodVeinNode node = TableManager.GetBloodVeinNodeByID(nodeID, 0);
|
|||
|
Tab_BloodVeinNode nodeNext = TableManager.GetBloodVeinNodeByID(nodeID + 1, 0);
|
|||
|
if (node == null || nodeNext == null)
|
|||
|
continue;
|
|||
|
long hasCount0 = Utils.GetConstHas(node.GetCostTypebyIndex(0), node.GetCostSubbyIndex(0));
|
|||
|
long hasCount1 = Utils.GetConstHas(node.GetCostTypebyIndex(1), node.GetCostSubbyIndex(1));
|
|||
|
int needCount0 = node.GetCostValbyIndex(0);
|
|||
|
int needCount1 = node.GetCostValbyIndex(1);
|
|||
|
if (hasCount0 < needCount0 && hasCount1 < needCount1)
|
|||
|
continue;
|
|||
|
MerialSoulHasUp = true;
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
MerialSoulHasUp = false;
|
|||
|
}
|
|||
|
|
|||
|
public int[] GetAllHighSoul()
|
|||
|
{
|
|||
|
Tab_SoulGeneralAttr HeavenPay = null;
|
|||
|
var soulAttrs = TableManager.GetSoulGeneralAttr().Values;
|
|||
|
foreach (var soul in soulAttrs)
|
|||
|
{
|
|||
|
if (HeavenPay == null)
|
|||
|
HeavenPay = soul;
|
|||
|
int soulID = soul.Id;
|
|||
|
MeridiaSoulData.KungfuSoulData data = MeridiaSoulData.Instance.GetKungfuData(soulID, soul.HeavenID);
|
|||
|
soulID *= 1000;
|
|||
|
if (data != null)
|
|||
|
{
|
|||
|
soulID += data.star;
|
|||
|
}
|
|||
|
Tab_SoulGeneralStar soulStar = TableManager.GetSoulGeneralStarByID(soulID, 0);
|
|||
|
Tab_SoulGeneralStar soulStarNext = TableManager.GetSoulGeneralStarByID(soulID + 1, 0);
|
|||
|
if (soulStar == null || soulStarNext == null)
|
|||
|
continue;
|
|||
|
if (GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level < soulStar.OpenLevel)
|
|||
|
continue;
|
|||
|
long hasCount0 = Utils.GetConstHas(soulStar.ConsumeType, soulStar.ConsumeSubType);
|
|||
|
if (hasCount0 < soulStar.ConsumeValue)
|
|||
|
{
|
|||
|
continue;
|
|||
|
}
|
|||
|
HeavenPay = soul;
|
|||
|
return HeavenPay == null ? new int[] { -1, -1 } : new int[] { HeavenPay.HeavenID, HeavenPay.Id };
|
|||
|
}
|
|||
|
return HeavenPay == null ? new int[] { -1, -1 } : new int[] { HeavenPay.HeavenID, HeavenPay.Id };
|
|||
|
}
|
|||
|
|
|||
|
public Tab_SoulGeneralStar GetSoulStarData(int SoulID,int HeavenID)
|
|||
|
{
|
|||
|
MeridiaSoulData.KungfuSoulData data = MeridiaSoulData.Instance.GetKungfuData(SoulID, HeavenID);
|
|||
|
SoulID *= 1000;
|
|||
|
if (data != null)
|
|||
|
{
|
|||
|
SoulID += data.star;
|
|||
|
}
|
|||
|
|
|||
|
return TableManager.GetSoulGeneralStarByID(SoulID, 0);
|
|||
|
}
|
|||
|
|
|||
|
public bool ConstEnough(int SoulID,int HeavenID)
|
|||
|
{
|
|||
|
MeridiaSoulData.KungfuSoulData data = MeridiaSoulData.Instance.GetKungfuData(SoulID, HeavenID);
|
|||
|
SoulID *= 1000;
|
|||
|
if (data != null)
|
|||
|
{
|
|||
|
SoulID += data.star;
|
|||
|
}
|
|||
|
|
|||
|
var soul = TableManager.GetSoulGeneralStarByID(SoulID, 0);
|
|||
|
if (soul == null)
|
|||
|
return true;
|
|||
|
|
|||
|
var hasCount0 = Utils.GetConstHas(soul.ConsumeType, soul.ConsumeSubType);
|
|||
|
return hasCount0 >= soul.ConsumeValue;
|
|||
|
}
|
|||
|
|
|||
|
public bool Compare(SoulItem.SoulItemData data1, SoulItem.SoulItemData data2)
|
|||
|
{
|
|||
|
if (data1.CaUp && data2.CaUp == false)
|
|||
|
return true;
|
|||
|
if (data1.CaUp == false && data2.CaUp == true)
|
|||
|
return false;
|
|||
|
if(data1.CaUp == false && data2.CaUp == false)
|
|||
|
{
|
|||
|
Tab_SoulGeneralStar dataStar1 = GetSoulStarData(data1.SoulID, data1.HeavenID);
|
|||
|
Tab_SoulGeneralStar dataStar2 = GetSoulStarData(data2.SoulID, data2.HeavenID);
|
|||
|
if (dataStar1 == null && dataStar2 != null)
|
|||
|
return false;
|
|||
|
if (dataStar1 != null && dataStar2 == null)
|
|||
|
return true;
|
|||
|
if(dataStar1 != null && dataStar2 != null)
|
|||
|
{
|
|||
|
int mainLevel = GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level;
|
|||
|
if (dataStar1.OpenLevel <= mainLevel)
|
|||
|
return true;
|
|||
|
if (dataStar1.OpenLevel > mainLevel && dataStar2.OpenLevel <= mainLevel)
|
|||
|
return false;
|
|||
|
|
|||
|
bool data1Const = ConstEnough(data1.SoulID, data1.HeavenID);
|
|||
|
bool data2Const = ConstEnough(data2.SoulID, data2.HeavenID);
|
|||
|
if (dataStar1.OpenLevel <= mainLevel && dataStar2.OpenLevel <= mainLevel)
|
|||
|
{
|
|||
|
if (data1Const == false && data2Const)
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
return true;
|
|||
|
}
|
|||
|
|
|||
|
public bool IsSoulMaxLevel(int HeavenID, int soulID)
|
|||
|
{
|
|||
|
MeridiaSoulData.KungfuSoulData data = GetKungfuData(soulID, HeavenID);
|
|||
|
if (data == null)
|
|||
|
return false;
|
|||
|
Tab_SoulGeneralStar soulStar = TableManager.GetSoulGeneralStarByID(data.star + soulID * 1000 + 1, 0);
|
|||
|
if (soulStar == null)
|
|||
|
return true;
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
public bool SoulCanUp(int HeavenID,int soulID,bool UseCoin)
|
|||
|
{
|
|||
|
MeridiaSoulData.KungfuSoulData data = MeridiaSoulData.Instance.GetKungfuData(soulID, HeavenID);
|
|||
|
soulID *= 1000;
|
|||
|
if (data != null)
|
|||
|
{
|
|||
|
soulID += data.star;
|
|||
|
}
|
|||
|
Tab_SoulGeneralStar soulStar = TableManager.GetSoulGeneralStarByID(soulID, 0);
|
|||
|
Tab_SoulGeneralStar soulStarNext = TableManager.GetSoulGeneralStarByID(soulID + 1, 0);
|
|||
|
if (soulStar == null || soulStarNext == null)
|
|||
|
return false;
|
|||
|
if (GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level < soulStar.OpenLevel)
|
|||
|
return false;
|
|||
|
long hasCount0 = Utils.GetConstHas(soulStar.ConsumeType, soulStar.ConsumeSubType);
|
|||
|
if (hasCount0 < soulStar.ConsumeValue)
|
|||
|
{
|
|||
|
if (UseCoin && soulStar.ConsumeType == 4 && soulStar.ConsumeSubType == (int)MONEYTYPE.MONEYTYPE_COIN_BIND)
|
|||
|
{
|
|||
|
hasCount0 = Utils.GetConstHas(4, (int)MONEYTYPE.MONEYTYPE_COIN);
|
|||
|
if (hasCount0 > soulStar.ConsumeValue)
|
|||
|
return true;
|
|||
|
}
|
|||
|
|
|||
|
return false;
|
|||
|
}
|
|||
|
return true;
|
|||
|
}
|
|||
|
|
|||
|
//检查武魂是否有可升级的
|
|||
|
public void CheckKungfuHasUp()
|
|||
|
{
|
|||
|
if(IsFuncOpen(MeridiaSoulType.Kungfu))
|
|||
|
{
|
|||
|
var soulAttrs = TableManager.GetSoulGeneralAttr().Values;
|
|||
|
foreach (var soul in soulAttrs)
|
|||
|
{
|
|||
|
int soulID = soul.Id;
|
|||
|
MeridiaSoulData.KungfuSoulData data = MeridiaSoulData.Instance.GetKungfuData(soulID, soul.HeavenID);
|
|||
|
soulID *= 1000;
|
|||
|
if (data != null)
|
|||
|
{
|
|||
|
soulID += data.star;
|
|||
|
}
|
|||
|
Tab_SoulGeneralStar soulStar = TableManager.GetSoulGeneralStarByID(soulID, 0);
|
|||
|
Tab_SoulGeneralStar soulStarNext = TableManager.GetSoulGeneralStarByID(soulID + 1, 0);
|
|||
|
if (soulStar == null || soulStarNext == null)
|
|||
|
continue;
|
|||
|
if (GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level < soulStar.OpenLevel)
|
|||
|
continue;
|
|||
|
long hasCount0 = Utils.GetConstHas(soulStar.ConsumeType, soulStar.ConsumeSubType);
|
|||
|
if (hasCount0 < soulStar.ConsumeValue)
|
|||
|
{
|
|||
|
continue;
|
|||
|
}
|
|||
|
KungfuHasUp = true;
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
KungfuHasUp = false;
|
|||
|
}
|
|||
|
|
|||
|
#region //经脉数据
|
|||
|
public class VeinNodeData
|
|||
|
{
|
|||
|
public int veinID;
|
|||
|
public int nodeID;
|
|||
|
public int level;
|
|||
|
}
|
|||
|
|
|||
|
public List<VeinNodeData> m_VeinNodeDatas = new List<VeinNodeData>();
|
|||
|
public void UpgradeVein(RespUpgradeVein packet)
|
|||
|
{
|
|||
|
if (packet == null || packet.veinId==-1 || packet.nodeId==-1)
|
|||
|
return;
|
|||
|
for (int i=0;i< m_VeinNodeDatas.Count;i++)
|
|||
|
{
|
|||
|
VeinNodeData vein = m_VeinNodeDatas[i];
|
|||
|
if(vein.veinID == packet.veinId && vein.nodeID == packet.nodeId)
|
|||
|
{
|
|||
|
vein.level = packet.level;
|
|||
|
m_VeinNodeDatas[i] = vein;
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
VeinNodeData veinNew = new VeinNodeData();
|
|||
|
veinNew.level = packet.level;
|
|||
|
veinNew.nodeID = packet.nodeId;
|
|||
|
veinNew.veinID = packet.veinId;
|
|||
|
m_VeinNodeDatas.Add(veinNew);
|
|||
|
}
|
|||
|
|
|||
|
public void SetNewVeinList(RespGetVeinList packet)
|
|||
|
{
|
|||
|
if (packet == null)
|
|||
|
return;
|
|||
|
m_VeinNodeDatas.Clear();
|
|||
|
for(int i=0;i<packet.veinList.Count;i++)
|
|||
|
{
|
|||
|
for(int j=0;j<packet.veinList[i].nodeList.Count;j++)
|
|||
|
{
|
|||
|
VeinNodeData vein = new VeinNodeData();
|
|||
|
vein.veinID = packet.veinList[i].veinId;
|
|||
|
vein.nodeID = packet.veinList[i].nodeList[j].nodeId;
|
|||
|
vein.level = packet.veinList[i].nodeList[j].level;
|
|||
|
m_VeinNodeDatas.Add(vein);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public bool CheckPayConst(Tab_BloodVeinNode node)
|
|||
|
{
|
|||
|
long hasCount0 = Utils.GetConstHas(node.GetCostTypebyIndex(0), node.GetCostSubbyIndex(0));
|
|||
|
long hasCount1 = Utils.GetConstHas(node.GetCostTypebyIndex(1), node.GetCostSubbyIndex(1));
|
|||
|
int needCount0 = node.GetCostValbyIndex(0);
|
|||
|
int needCount1 = node.GetCostValbyIndex(1);
|
|||
|
if (hasCount0 < needCount0 && hasCount1 < needCount1)
|
|||
|
return false;
|
|||
|
return true;
|
|||
|
}
|
|||
|
|
|||
|
public bool NodeCanUp(int VeinID, int nodeId)
|
|||
|
{
|
|||
|
Tab_BloodVeinConfig VeinConfig = TableManager.GetBloodVeinConfigByID(VeinID, 0);
|
|||
|
if (VeinConfig == null)
|
|||
|
return false;
|
|||
|
for (int i = 0; i < VeinConfig.getNodeCount(); i++)
|
|||
|
{
|
|||
|
int NodeID = VeinConfig.GetNodebyIndex(i);
|
|||
|
if (nodeId != -1)
|
|||
|
{
|
|||
|
if (NodeID == nodeId)
|
|||
|
{
|
|||
|
MeridiaSoulData.VeinNodeData veinData = GetNodeData(VeinID, NodeID);
|
|||
|
NodeID *= 1000;
|
|||
|
if (veinData != null)
|
|||
|
NodeID += veinData.level;
|
|||
|
if (GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level < VeinConfig.GetOpenLvbyIndex(i))
|
|||
|
return false;
|
|||
|
else
|
|||
|
{
|
|||
|
Tab_BloodVeinNode node = TableManager.GetBloodVeinNodeByID(NodeID, 0);
|
|||
|
Tab_BloodVeinNode nodeNext = TableManager.GetBloodVeinNodeByID(NodeID + 1, 0);
|
|||
|
if (node == null || nodeNext == null)
|
|||
|
return false;
|
|||
|
|
|||
|
if (CheckPayConst(node) == false)
|
|||
|
return false;
|
|||
|
}
|
|||
|
return true;
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level < VeinConfig.GetOpenLvbyIndex(i))
|
|||
|
continue;
|
|||
|
MeridiaSoulData.VeinNodeData veinData = GetNodeData(VeinID, NodeID);
|
|||
|
NodeID *= 1000;
|
|||
|
if (veinData != null)
|
|||
|
NodeID += veinData.level;
|
|||
|
Tab_BloodVeinNode node = TableManager.GetBloodVeinNodeByID(NodeID, 0);
|
|||
|
Tab_BloodVeinNode nodeNext = TableManager.GetBloodVeinNodeByID(NodeID + 1, 0);
|
|||
|
if (node == null || nodeNext == null)
|
|||
|
continue;
|
|||
|
if (CheckPayConst(node) == false)
|
|||
|
continue;
|
|||
|
return true;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
public int CountNodeLevel(int VeinID)
|
|||
|
{
|
|||
|
List<MeridiaSoulData.VeinNodeData> VeinNodeDatas = GetAllVeinData(VeinID);
|
|||
|
int level = 0;
|
|||
|
for (int i = 0; i < VeinNodeDatas.Count; i++)
|
|||
|
{
|
|||
|
level += VeinNodeDatas[i].level;
|
|||
|
}
|
|||
|
return level;
|
|||
|
}
|
|||
|
|
|||
|
public int GetAllNodeLevelCount()
|
|||
|
{
|
|||
|
int level = 0;
|
|||
|
for (int i = 0; i < m_VeinNodeDatas.Count; i++)
|
|||
|
{
|
|||
|
level += m_VeinNodeDatas[i].level;
|
|||
|
}
|
|||
|
return level;
|
|||
|
}
|
|||
|
|
|||
|
public int GetAllNodeInVein(int veinID)
|
|||
|
{
|
|||
|
int count = 0;
|
|||
|
for(int i=0;i<m_VeinNodeDatas.Count;i++)
|
|||
|
{
|
|||
|
if (m_VeinNodeDatas[i].veinID == veinID)
|
|||
|
count++;
|
|||
|
}
|
|||
|
return count;
|
|||
|
}
|
|||
|
|
|||
|
public VeinNodeData GetNodeData(int veinID,int nodeID)
|
|||
|
{
|
|||
|
for (int i = 0; i < m_VeinNodeDatas.Count; i++)
|
|||
|
{
|
|||
|
if (m_VeinNodeDatas[i].veinID == veinID && m_VeinNodeDatas[i].nodeID == nodeID)
|
|||
|
return m_VeinNodeDatas[i];
|
|||
|
}
|
|||
|
return null;
|
|||
|
}
|
|||
|
|
|||
|
public List<VeinNodeData> GetAllVeinData(int VeinID = -1)
|
|||
|
{
|
|||
|
if (VeinID == -1)
|
|||
|
return m_VeinNodeDatas;
|
|||
|
List<VeinNodeData> datas = new List<VeinNodeData>();
|
|||
|
for (int i = 0; i < m_VeinNodeDatas.Count; i++)
|
|||
|
{
|
|||
|
if (m_VeinNodeDatas[i].veinID == VeinID)
|
|||
|
datas.Add(m_VeinNodeDatas[i]);
|
|||
|
}
|
|||
|
return datas;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region //武魂的数据
|
|||
|
|
|||
|
public int wishNum;
|
|||
|
public class KungfuSoulData
|
|||
|
{
|
|||
|
public int generalId;
|
|||
|
public int heavenId;
|
|||
|
public int star;
|
|||
|
public int CanUp;
|
|||
|
}
|
|||
|
public List<KungfuSoulData> m_KungfuSoulDatas = new List<KungfuSoulData>();
|
|||
|
public int GetWishNum()
|
|||
|
{
|
|||
|
return wishNum;
|
|||
|
}
|
|||
|
public void FreshWish(RespGetMoney packet)
|
|||
|
{
|
|||
|
if (packet == null)
|
|||
|
return;
|
|||
|
wishNum = packet.wishNum;
|
|||
|
}
|
|||
|
|
|||
|
public void UpKungfuVein(RespUpgradeSoul packet)
|
|||
|
{
|
|||
|
if (packet == null)
|
|||
|
return;
|
|||
|
wishNum = packet.wishNum;
|
|||
|
if (packet.ret == 0)
|
|||
|
return;
|
|||
|
for (int i = 0; i < m_KungfuSoulDatas.Count; i++)
|
|||
|
{
|
|||
|
KungfuSoulData vein = m_KungfuSoulDatas[i];
|
|||
|
if (vein.heavenId == packet.heavenId && vein.generalId == packet.generalId)
|
|||
|
{
|
|||
|
vein.star = packet.star;
|
|||
|
m_KungfuSoulDatas[i] = vein;
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
KungfuSoulData veinAdd = new KungfuSoulData();
|
|||
|
veinAdd.generalId = packet.generalId;
|
|||
|
veinAdd.heavenId = packet.heavenId;
|
|||
|
veinAdd.star = packet.star;
|
|||
|
m_KungfuSoulDatas.Add(veinAdd);
|
|||
|
}
|
|||
|
|
|||
|
public void SetNewKungfuList(RespGetSoulList packet)
|
|||
|
{
|
|||
|
if (packet == null)
|
|||
|
return;
|
|||
|
wishNum = packet.wishNum;
|
|||
|
m_KungfuSoulDatas.Clear();
|
|||
|
for (int i = 0; i < packet.heavenList.Count; i++)
|
|||
|
{
|
|||
|
for (int j = 0; j < packet.heavenList[i].generalList.Count; j++)
|
|||
|
{
|
|||
|
KungfuSoulData soul = new KungfuSoulData();
|
|||
|
soul.generalId = packet.heavenList[i].generalList[j].generalId;
|
|||
|
soul.heavenId = packet.heavenList[i].heavenId;
|
|||
|
soul.star = packet.heavenList[i].generalList[j].star;
|
|||
|
//soul.CanUp = CheckNodeUp(vein.veinID, vein.nodeID, vein.level);
|
|||
|
m_KungfuSoulDatas.Add(soul);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
public KungfuSoulData GetKungfuData(int generalId,int heavenId)
|
|||
|
{
|
|||
|
for(int i=0;i< m_KungfuSoulDatas.Count;i++)
|
|||
|
{
|
|||
|
if (m_KungfuSoulDatas[i].generalId == generalId && m_KungfuSoulDatas[i].heavenId == heavenId)
|
|||
|
return m_KungfuSoulDatas[i];
|
|||
|
}
|
|||
|
return null;
|
|||
|
}
|
|||
|
|
|||
|
public List<KungfuSoulData> GetKungfus(int heaven)
|
|||
|
{
|
|||
|
if (heaven == -1)
|
|||
|
return m_KungfuSoulDatas;
|
|||
|
List<KungfuSoulData> datas = new List<KungfuSoulData>();
|
|||
|
for (int i = 0; i < m_KungfuSoulDatas.Count; i++)
|
|||
|
{
|
|||
|
if ( m_KungfuSoulDatas[i].heavenId == heaven)
|
|||
|
datas.Add( m_KungfuSoulDatas[i]);
|
|||
|
}
|
|||
|
return datas;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region//心脉数据
|
|||
|
public int HeartCount = 0; //元神值
|
|||
|
public int PulseLevel = 0;//灵脉等级
|
|||
|
public int HeartTotlePower = 0;//总战力
|
|||
|
public int HeartClass = 1;//层级
|
|||
|
|
|||
|
private List<HeartData> m_HeartDatas = new List<HeartData>();//心法列表
|
|||
|
private List<AttrData> m_HeartAttrs = new List<AttrData>(); //心法属性列表
|
|||
|
private List<AttrData> m_PulseAttrs = new List<AttrData>(); //灵脉属性列表
|
|||
|
|
|||
|
public List<AttrData> GetAllHeartAddAttr()
|
|||
|
{
|
|||
|
List<AttrData> showlists = new List<AttrData>();
|
|||
|
showlists.AddRange(m_HeartAttrs);
|
|||
|
showlists.AddRange(m_PulseAttrs);
|
|||
|
return showlists;
|
|||
|
}
|
|||
|
|
|||
|
public AttrData GetOneHeartAddAttr(int attrID)
|
|||
|
{
|
|||
|
for(int i=0;i<m_HeartAttrs.Count;i++)
|
|||
|
{
|
|||
|
if (m_HeartAttrs[i].attrId == attrID)
|
|||
|
return m_HeartAttrs[i];
|
|||
|
}
|
|||
|
return null;
|
|||
|
}
|
|||
|
|
|||
|
public AttrData GetOnePulseAddAttr(int attrID)
|
|||
|
{
|
|||
|
for (int i = 0; i < m_PulseAttrs.Count; i++)
|
|||
|
{
|
|||
|
if (m_PulseAttrs[i].attrId == attrID)
|
|||
|
return m_PulseAttrs[i];
|
|||
|
}
|
|||
|
return null;
|
|||
|
}
|
|||
|
|
|||
|
public int GetHeartLevel(int heartID)
|
|||
|
{
|
|||
|
for(int i=0;i< m_HeartDatas.Count;i++)
|
|||
|
{
|
|||
|
if (m_HeartDatas[i].heartId == heartID)
|
|||
|
return m_HeartDatas[i].level;
|
|||
|
}
|
|||
|
return 0;
|
|||
|
}
|
|||
|
|
|||
|
public void FreshHeartData(RespGetHeartList packet)
|
|||
|
{
|
|||
|
if (packet == null)
|
|||
|
return;
|
|||
|
HeartCount = packet.soulCount;
|
|||
|
PulseLevel = packet.pulseLevel;
|
|||
|
HeartTotlePower = packet.totalPower;
|
|||
|
HeartClass = packet.heartClass;
|
|||
|
m_HeartDatas.Clear();
|
|||
|
m_HeartDatas.AddRange(packet.heartList);
|
|||
|
m_HeartAttrs.Clear();
|
|||
|
m_HeartAttrs.AddRange(packet.attrList);
|
|||
|
m_PulseAttrs.Clear();
|
|||
|
m_PulseAttrs.AddRange(packet.attrPulseList);
|
|||
|
CheckIsHasUp();
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
// 判断功能是否开启,需判断境界按钮功能开启等级,再判断境界内的各项开启等级
|
|||
|
// 目前武魂 ID 是 6
|
|||
|
public bool IsFuncOpen(MeridiaSoulType t)
|
|||
|
{
|
|||
|
var tab = TableManager.GetFunctionOpenByID(6, 0);
|
|||
|
var mainPlayerAttr = GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr;
|
|||
|
if(mainPlayerAttr != null && mainPlayerAttr.Level >= tab.OpenLevel)
|
|||
|
{
|
|||
|
Tab_HeartBase heartBase = TableManager.GetHeartBaseByID(1, 0);
|
|||
|
if (heartBase == null)
|
|||
|
return false;
|
|||
|
var MainPlayerLevel = mainPlayerAttr.Level;
|
|||
|
switch(t)
|
|||
|
{
|
|||
|
case MeridiaSoulType.MerialSoul:
|
|||
|
if (MainPlayerLevel >= heartBase.BloodOpenLevel)
|
|||
|
return true;
|
|||
|
else
|
|||
|
return false;
|
|||
|
case MeridiaSoulType.Kungfu:
|
|||
|
if (MainPlayerLevel >= heartBase.SoulOpenLevel)
|
|||
|
return true;
|
|||
|
else
|
|||
|
return false;
|
|||
|
case MeridiaSoulType.Heart:
|
|||
|
if (MainPlayerLevel >= heartBase.OpenLevel)
|
|||
|
return true;
|
|||
|
else
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
#region 心法红点更新
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 检查页内红点信息,并设置页外菜单红点状态
|
|||
|
/// </summary>
|
|||
|
/// <returns>true: 有红点, false: 无红点</returns>
|
|||
|
public void CheckHeartHasUp()
|
|||
|
{
|
|||
|
if (!MeridiaSoulData.Instance.IsFuncOpen(MeridiaSoulData.MeridiaSoulType.Heart))
|
|||
|
{
|
|||
|
HeartHasUp = false;
|
|||
|
return;
|
|||
|
}
|
|||
|
// 拥有元神值
|
|||
|
int tempGodHas = MeridiaSoulData.Instance.HeartCount;
|
|||
|
|
|||
|
// 进度
|
|||
|
int maxAllLevelCount = 0;
|
|||
|
int heartLevelCount = 0;
|
|||
|
bool isEnougth = false;
|
|||
|
var hearts = TableManager.GetHeartAttr().Values;
|
|||
|
foreach (var heart in hearts)
|
|||
|
{
|
|||
|
int HeartLevelID = heart.Id * 1000000 + MeridiaSoulData.Instance.HeartClass * 1000 + MeridiaSoulData.Instance.GetHeartLevel(heart.Id);
|
|||
|
Tab_HeartLevel HeartLevelTab = TableManager.GetHeartLevelByID(HeartLevelID, 0);
|
|||
|
|
|||
|
// 所需元神值
|
|||
|
int tempGodNeed = HeartLevelTab.LevelSoulCount;
|
|||
|
Tab_HeartLevel nextHeartLevel = TableManager.GetHeartLevelByID(HeartLevelID + 1, 0);
|
|||
|
if (isEnougth == false && tempGodHas >= tempGodNeed && nextHeartLevel != null)
|
|||
|
{
|
|||
|
// 存在任意一个可满足升级即可
|
|||
|
isEnougth = true;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
if (HeartLevelTab == null)
|
|||
|
continue;
|
|||
|
Tab_HeartLevel HeartLevelTabNext = TableManager.GetHeartLevelByID(HeartLevelID + 1, 0);
|
|||
|
int count = GetLearnMaxLevel(heart.Id);
|
|||
|
maxAllLevelCount += count;
|
|||
|
heartLevelCount += MeridiaSoulData.Instance.GetHeartLevel(heart.Id);
|
|||
|
}
|
|||
|
|
|||
|
// 当该层心法修满,是否可以进阶?
|
|||
|
if (heartLevelCount >= maxAllLevelCount)
|
|||
|
{
|
|||
|
Tab_HeartClass heartClass = TableManager.GetHeartClassByID(MeridiaSoulData.Instance.HeartClass, 0);
|
|||
|
Tab_HeartClass heartClassNext = TableManager.GetHeartClassByID(MeridiaSoulData.Instance.HeartClass + 1, 0);
|
|||
|
if(heartClassNext == null)
|
|||
|
{
|
|||
|
HeartHasUp = false;
|
|||
|
return;
|
|||
|
}
|
|||
|
int has = GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(heartClass.ConsumeSubType);
|
|||
|
if (heartClass.ConsumeValue > has)
|
|||
|
{
|
|||
|
HeartHasUp = false;
|
|||
|
return;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
HeartHasUp = true;
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
// 不满时,可以是否有一个够钱升级
|
|||
|
else if (isEnougth)
|
|||
|
{
|
|||
|
HeartHasUp = true;
|
|||
|
return;
|
|||
|
}
|
|||
|
HeartHasUp = false;
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
public int GetLearnMaxLevel(int heartID)
|
|||
|
{
|
|||
|
var count = 0;
|
|||
|
var heartLevels = TableManager.GetHeartLevel().Values;
|
|||
|
foreach (var heart in heartLevels)
|
|||
|
{
|
|||
|
if (heart.Level != 0 && heart.HeartID == heartID && heart.ClassID == MeridiaSoulData.Instance.HeartClass)
|
|||
|
count++;
|
|||
|
}
|
|||
|
return count;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|