using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
|
using System;
|
using Snxxz.UI;
|
//仙盟宝库
|
public class FamilyStoreItem//家族仓库物品信息
|
{
|
public int Index;//仓库格子索引
|
public int ItemID;//物品ID
|
public ItemJsonData ItemData;
|
public Dictionary<int, List<int>> _UserData;
|
[Serializable]
|
public class ItemJsonData
|
{
|
public string UserData;
|
public int IsSuit;
|
public int EquipGS;
|
}
|
}
|
|
public class FamilyActionInfoClass//接收家族行为信息
|
{
|
public int FamilyID;//家族ID
|
public int ActionType;//类型
|
public int Time;//时间
|
public string Name;//玩家名
|
public int OperationType;//操作类型1-捐献,2-兑换,3-销毁
|
public int PlayerID;//操作的玩家ID;
|
public int ItemID;//物品ID
|
public ItemJsonData ItemData;
|
public Dictionary<int, List<int>> _UserData;
|
[Serializable]
|
public class ItemJsonData
|
{
|
public int ItemID;
|
public string UserData;
|
public int IsSuit;
|
public int EquipGS;
|
}
|
|
}
|
|
|
public class PlayerFairyAuTreasureData : Model, IBeforePlayerDataInitialize, IPlayerLoginOk
|
{
|
|
public Dictionary<int, FamilyStoreItem> _DicfamilyStoreItem = new Dictionary<int, FamilyStoreItem>();//家族仓库物品信息
|
|
public List<FamilyActionInfoClass> _InformationList = new List<FamilyActionInfoClass>();
|
public delegate void OnFairyAuIntegral();
|
public static event OnFairyAuIntegral Event_FairyAuIntegral;//用于仙盟积分的刷新
|
public delegate void OnFamilyActionInfo();
|
public static event OnFamilyActionInfo Event_FamilyActionInfo;//家族行为信息的刷新
|
public delegate void OnFamilyStoreItemInfo();
|
public static event OnFamilyStoreItemInfo Event_FamilyStoreItemInfo;//仓库信息的刷新
|
public static event Action<List<int>> Del_FamilyStoreItemInfo;//仓库信息物品的删除
|
PackModel _playerPack;
|
PackModel playerPack { get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PackModel>()); } }
|
public int _FairyAuIntegral = 0;//获取仙盟积分
|
|
public List<int> JumpItemID = new List<int>();//从跳转到仙盟仓库需要选中高亮
|
List<int> EquipmentList = new List<int>();//关于装备位置
|
public bool IsShowPoint = false;//是否显示红点
|
private const int Redpoint_key1 = 1070103;
|
public Redpoint redPointStre1 = new Redpoint(10701, Redpoint_key1);//仙盟仓库红点
|
|
public override void Init()
|
{
|
var funConfig = FuncConfigConfig.Get("StrengthenDisplay");
|
int[] List = ConfigParse.GetMultipleStr<int>(funConfig.Numerical1);
|
EquipmentList.Clear();
|
for (int i = 0; i < List.Length; i++)
|
{
|
EquipmentList.Add(List[i]);
|
}
|
}
|
|
public override void UnInit()
|
{
|
|
}
|
|
public void OnBeforePlayerDataInitialize()
|
{
|
_DicfamilyStoreItem.Clear();
|
_FairyAuIntegral = 0;
|
}
|
public void OnPlayerLoginOk()
|
{
|
PlayerDatas.Instance.PlayerDataRefreshInfoEvent -= Updatefighting;//数据的刷新(h0418)
|
PlayerDatas.Instance.PlayerDataRefreshInfoEvent += Updatefighting;
|
WarehouseTipsWin.RedPointUpdate -= RedPointUpdate;
|
WarehouseTipsWin.RedPointUpdate += RedPointUpdate;
|
}
|
|
|
|
public void FairyAuIntegral(int value)//获取仙盟积分
|
{
|
_FairyAuIntegral = value;
|
if (Event_FairyAuIntegral != null)
|
Event_FairyAuIntegral();
|
}
|
|
public void FamilyStoreItemInfo(HA406_tagGCFamilyStoreItemInfo info)//家族仓库信息
|
{
|
if (!_DicfamilyStoreItem.ContainsKey(0))
|
{
|
FamilyStoreItem _FamilyStoreItemP = new FamilyStoreItem();
|
_FamilyStoreItemP.Index = 0;
|
FuncConfigConfig _PetFoodExchange = FuncConfigConfig.Get("PetFoodExchange");
|
_FamilyStoreItemP.ItemID = int.Parse(_PetFoodExchange.Numerical1);
|
_DicfamilyStoreItem.Add(0, _FamilyStoreItemP);
|
}
|
|
for (int i = 0; i < info.Count; i++)
|
{
|
if (_DicfamilyStoreItem.ContainsKey(info.StoreItemList[i].Index + 1))
|
continue;
|
FamilyStoreItem _FamilyStoreItem = new FamilyStoreItem();
|
_FamilyStoreItem.ItemData = JsonUtility.FromJson<FamilyStoreItem.ItemJsonData>(info.StoreItemList[i].ItemData);
|
_FamilyStoreItem.Index = info.StoreItemList[i].Index + 1;
|
_FamilyStoreItem.ItemID = (int)info.StoreItemList[i].ItemID;
|
_FamilyStoreItem._UserData = ConfigParse.Analysis(_FamilyStoreItem.ItemData.UserData);
|
_DicfamilyStoreItem.Add((int)info.StoreItemList[i].Index + 1, _FamilyStoreItem);
|
}
|
|
if (Event_FamilyStoreItemInfo != null)
|
{
|
Event_FamilyStoreItemInfo();
|
}
|
IsShowRedPoint();
|
}
|
List<int> List = new List<int>();
|
public void WarehouseToRefresh(byte[] _list)//仓库刷新
|
{
|
List.Clear();
|
for (int i = 0; i < _list.Length; i++)
|
{
|
List.Add(_list[i] + 1);
|
}
|
if (Del_FamilyStoreItemInfo != null)
|
{
|
Del_FamilyStoreItemInfo(List);
|
}
|
IsShowRedPoint();
|
|
|
}
|
public void FamilyStoreDel(int _index, int ClearType)//家族仓库物品删除(清除的格子索引, 仅单格子清除时有效,从0开始代表第一格,0-单格子清除; 1-所有物品清除)
|
{
|
if (_DicfamilyStoreItem.ContainsKey(_index + 1) && ClearType == 0)
|
{
|
_DicfamilyStoreItem.Remove(_index + 1);
|
}
|
if (ClearType == 1)
|
{
|
_DicfamilyStoreItem.Clear();
|
if (!_DicfamilyStoreItem.ContainsKey(0))
|
{
|
FamilyStoreItem _FamilyStoreItemP = new FamilyStoreItem();
|
_FamilyStoreItemP.Index = 0;
|
FuncConfigConfig _PetFoodExchange = FuncConfigConfig.Get("PetFoodExchange");
|
_FamilyStoreItemP.ItemID = int.Parse(_PetFoodExchange.Numerical1);
|
_DicfamilyStoreItem.Add(0, _FamilyStoreItemP);
|
}
|
}
|
}
|
|
public void FamilyActionInfo(HA403_tagGCFamilyActionInfo info)//接收家族行为信息
|
{
|
_InformationList.Clear();
|
for (int i = 0; i < info.Count; i++)
|
{
|
FamilyActionInfoClass _FamilyActionInfoClass = new FamilyActionInfoClass();
|
_FamilyActionInfoClass.FamilyID = (int)info.FamilyID;
|
_FamilyActionInfoClass.ActionType = (int)info.ActionType;
|
_FamilyActionInfoClass.Time = (int)info.FamilyActionList[i].Time;
|
_FamilyActionInfoClass.Name = info.FamilyActionList[i].Name;
|
_FamilyActionInfoClass.OperationType = (int)info.FamilyActionList[i].Value1;
|
_FamilyActionInfoClass.PlayerID = (int)info.FamilyActionList[i].Value2;
|
_FamilyActionInfoClass.ItemID = (int)info.FamilyActionList[i].Value3;
|
_FamilyActionInfoClass.ItemData = JsonUtility.FromJson<FamilyActionInfoClass.ItemJsonData>(info.FamilyActionList[i].UseData);
|
_FamilyActionInfoClass._UserData = ConfigParse.Analysis(_FamilyActionInfoClass.ItemData.UserData);
|
_InformationList.Add(_FamilyActionInfoClass);
|
|
}
|
if (Event_FamilyActionInfo != null)
|
Event_FamilyActionInfo();//家族行为信息的刷新
|
|
}
|
|
private bool IsEquipmentComparison()
|
{
|
bool IsBool = false;
|
SinglePack singlePack = playerPack.GetSinglePack(PackType.Equip);
|
for (int i = 0; i < EquipmentList.Count; i++)
|
{
|
ItemModel ItemModel = singlePack.GetItemByIndex(i);
|
int Type = i;
|
if (ItemModel != null)
|
{
|
foreach (var key in _DicfamilyStoreItem.Keys)
|
{
|
if (key == 0)
|
{
|
continue;
|
}
|
int ItemId = _DicfamilyStoreItem[key].ItemID;
|
var itemConfig = ItemConfig.Get(ItemId);
|
int RealmLevel = PlayerDatas.Instance.baseData.realmLevel;
|
int equipScore = ItemLogicUtility.Instance.GetEquipScore(PackType.Equip, ItemId, _DicfamilyStoreItem[key]._UserData);
|
if (ItemModel.config.EquipPlace == Type && RealmLevel >= itemConfig.RealmLimit && equipScore >= ItemModel.equipScore)
|
{
|
IsBool = true;
|
}
|
}
|
}
|
else
|
{
|
foreach (var key in _DicfamilyStoreItem.Keys)
|
{
|
if (key == 0)
|
{
|
continue;
|
}
|
int ItemId = _DicfamilyStoreItem[key].ItemID;
|
var itemConfig = ItemConfig.Get(ItemId);
|
int RealmLevel = PlayerDatas.Instance.baseData.realmLevel;
|
if (itemConfig.EquipPlace == Type && RealmLevel >= itemConfig.RealmLimit)
|
{
|
IsBool = true;
|
}
|
}
|
}
|
}
|
return IsBool;
|
}
|
private void IsShowRedPoint()
|
{
|
int GetDayOfYear = DateTime.Now.DayOfYear;
|
string strKey= "Treasure"+ PlayerDatas.Instance.baseData.PlayerID;
|
int day = LocalSave.GetInt(strKey);
|
if (day != GetDayOfYear && IsEquipmentComparison())
|
{
|
LocalSave.SetInt(strKey, GetDayOfYear);
|
IsShowPoint = true;
|
}
|
if (IsShowPoint)
|
{
|
redPointStre1.state = RedPointState.Simple;
|
}
|
else
|
{
|
redPointStre1.state = RedPointState.None;
|
}
|
|
}
|
private void Updatefighting(PlayerDataRefresh obj)//刷新境界
|
{
|
if (obj == PlayerDataRefresh.OfficialRank)
|
{
|
IsShowRedPoint();
|
}
|
}
|
private void RedPointUpdate()
|
{
|
IsShowRedPoint();
|
}
|
}
|