using System.Collections.Generic;
|
using System;
|
using LitJson;
|
|
namespace vnxbqy.UI
|
{
|
|
public class WorshipInfoListModel : Model, IBeforePlayerDataInitialize
|
{
|
//上线只通知需要膜拜的玩家,已膜拜不通知,关闭不膜拜则等下次登录通知
|
public List<WorshipPlayer> players = new List<WorshipPlayer>();
|
public bool notShowTip = false; //默认推界面
|
|
public int playerIDResult;
|
public int worshipTypeResult;
|
public event Action WorshipResultEvent;
|
|
public override void Init()
|
{
|
|
}
|
|
|
public override void UnInit()
|
{
|
|
}
|
|
public void OnBeforePlayerDataInitialize()
|
{
|
players.Clear();
|
notShowTip = false;
|
playerIDResult = 0;
|
worshipTypeResult = 0;
|
}
|
|
public void UpdateWorshipResult(HB021_tagGCWorshipResult pack)
|
{
|
playerIDResult = (int)pack.PlayerID;
|
worshipTypeResult = pack.WorshipType;
|
WorshipResultEvent?.Invoke();
|
|
}
|
|
|
public void UpdateWorshipInfoList(HB020_tagGCWorshipInfoList pack)
|
{
|
for (int i = 0; i < pack.WorshipCount; i++)
|
{
|
WorshipPlayer player = new WorshipPlayer();
|
player.playerID = pack.WorshipInfoList[i].PlayerID;
|
player.worshipType = pack.WorshipInfoList[i].WorshipType;
|
player.worshipValue = pack.WorshipInfoList[i].WorshipValue;
|
|
player.playerInfo = JsonMapper.ToObject<PlayerInfo>(pack.WorshipInfoList[i].PlayerInfo);
|
players.Add(player);
|
}
|
|
|
if (!notShowTip && PlayerDatas.Instance.baseData.LV > 10)
|
PopupWindowsProcessor.Instance.Add("WorshipInfoListWin");
|
}
|
|
|
public struct WorshipPlayer
|
{
|
public uint playerID;
|
public byte worshipType; //膜拜类型 如排位赛
|
public uint worshipValue; //膜拜二级定义,如排位赛的名次
|
public PlayerInfo playerInfo;
|
}
|
|
public struct PlayerInfo
|
{
|
public int LV;
|
public string AccID;
|
public int Job;
|
public int[] EquipShowID;
|
public string Name;
|
public int RealmLV;
|
public int TitleID;
|
public int VIPLV;
|
public long FightPower;
|
public int EquipShowSwitch;
|
}
|
|
public int GetItemId(RoleEquipType type, int[] equipShowID)
|
{
|
if (equipShowID != null)
|
{
|
foreach (var id in equipShowID)
|
{
|
var itemConfig = ItemConfig.Get(id);
|
if (itemConfig != null && itemConfig.EquipPlace == (int)type)
|
{
|
return id;
|
}
|
}
|
}
|
return 0;
|
}
|
}
|
}
|
|