using Snxxz.UI;
|
using System;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using TableConfig;
|
using LitJson;
|
|
public class PlayerRealmData
|
{
|
RealmModel m_Model;
|
RealmModel model
|
{
|
get
|
{
|
return m_Model ?? (m_Model = ModelCenter.Instance.GetModel<RealmModel>());
|
}
|
}
|
|
#region 护法
|
public List<RealmHoldData> holdDataList = new List<RealmHoldData>();
|
|
public static event Action OnRefreshHoldData;
|
|
public void OnRefreshData(HA908_tagGCRealmFBHelpInfo vNetData)
|
{
|
RealmHoldData data = null;
|
if (holdDataList.Count > 0)
|
{
|
data = holdDataList.Find((x) =>
|
{
|
return vNetData.PlayerID == x.PlayerID;
|
});
|
}
|
if (data != null)
|
{
|
data.AtkAdd = vNetData.AtkAdd;
|
data.RealmLV = vNetData.RealmLV;
|
}
|
else
|
{
|
data = new RealmHoldData();
|
data.PlayerID = vNetData.PlayerID;
|
data.PlayerName = UIHelper.ServerStringTrim(vNetData.PlayerName);
|
data.RealmLV = vNetData.RealmLV;
|
data.AtkAdd = vNetData.AtkAdd;
|
data.Job = vNetData.Job;
|
data.JobRank = vNetData.JobRank;
|
holdDataList.Add(data);
|
if (StageManager.Instance.isLoading)
|
{
|
return;
|
}
|
if (!WindowCenter.Instance.IsOpen<RealmUpHoldWin>() && !NewBieCenter.Instance.inGuiding && !BossShowModel.Instance.BossShowing)
|
{
|
WindowCenter.Instance.Open<RealmUpHoldWin>();
|
}
|
if (OnRefreshHoldData != null)
|
{
|
OnRefreshHoldData();
|
}
|
}
|
}
|
|
public void RemoveHoldData()
|
{
|
if (holdDataList.Count > 0)
|
{
|
RealmHoldData data = holdDataList[0];
|
holdDataList.RemoveAt(0);
|
data = null;
|
}
|
}
|
#endregion
|
|
#region 护法信息
|
[Serializable]
|
public class RealmHelpInfo
|
{
|
public string helpInfo;
|
}
|
|
public struct RealmHelpData
|
{
|
public int type;
|
public string name;
|
}
|
|
public List<RealmHelpData> realmHelpList = new List<RealmHelpData>();
|
|
public static event Action OnRefreshHelpInfo;
|
|
public void OnRefreshData(H0319_tagFBHelp vNetData)
|
{
|
RealmHelpInfo data = JsonUtility.FromJson<RealmHelpInfo>(vNetData.Msg);
|
if (data != null && data.helpInfo != null)
|
{
|
realmHelpList.Clear();
|
string[] array = data.helpInfo.Split(',');
|
for (int i = 0; i < array.Length; i++)
|
{
|
string[] infoarray = array[i].Split('|');
|
if (infoarray.Length == 2)
|
{
|
RealmHelpData help = new RealmHelpData();
|
help.name = infoarray[1];
|
help.type = int.Parse(infoarray[0]);
|
realmHelpList.Add(help);
|
}
|
}
|
if (OnRefreshHelpInfo != null)
|
OnRefreshHelpInfo();
|
}
|
}
|
|
public enum RealmHelpType
|
{
|
Self = 0,
|
Normal = 1,
|
High = 2,
|
}
|
#endregion
|
|
#region 采集
|
public float CollectTime { get; private set; }
|
public static event Action<H0812_tagBeginPrepare> OnPlayerCollect;
|
public static event Action<int, byte> OnPlayerCollectEnd;
|
public void OnRefreshData(H0812_tagBeginPrepare vNetData)
|
{
|
CollectTime = vNetData.MaxTime;
|
if (OnPlayerCollect != null)
|
OnPlayerCollect(vNetData);
|
if (vNetData.PlayerID == PlayerDatas.Instance.baseData.PlayerID)
|
{
|
WindowCenter.Instance.Open<RealmCollectWin>();
|
}
|
}
|
|
public void OnRefreshData(H0813_tagPrepareEnd vNetData)
|
{
|
if (OnPlayerCollectEnd != null)
|
OnPlayerCollectEnd((int)vNetData.PlayerID, vNetData.Type);
|
}
|
#endregion
|
}
|
|
public class RealmHoldData
|
{
|
public string PlayerName; //玩家名字
|
|
public uint PlayerID; //玩家ID
|
|
public byte RealmLV; //玩家境界
|
|
public byte AtkAdd; //获得加成
|
|
public byte Job; //玩家职业
|
|
public byte JobRank; //玩家职业阶级
|
}
|