//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Thursday, November 15, 2018
|
//--------------------------------------------------------
|
//冰晶矿脉新
|
using System;
|
using System.Collections.Generic;
|
using vnxbqy.UI;
|
|
|
public class IceLodeStarAwardClass
|
{
|
public int Index;
|
public int Star;
|
public int MinLv;
|
public int MaxLv;
|
public int ItemID;
|
public int ItemCount;
|
public int IsBind;
|
public int Type;
|
|
}
|
public class IceCrystalVeinModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk
|
{
|
public Dictionary<int, IceLodeStarAwardClass> DicIceLodeStarAward = new Dictionary<int, IceLodeStarAwardClass>();
|
public List<int> LineList = new List<int>();//玩法列表
|
private List<IceLodeStarAwardClass> IceLodeStarAwardList = new List<IceLodeStarAwardClass>();
|
public Dictionary<int, string> IconKeyDic = new Dictionary<int, string>();
|
public int AwardRecord = 0;//领奖记录
|
public int HasSweep = 0;//是否已扫荡
|
public int DayLv = 0;//今日等级
|
public int Cost = 0;//绑玉进入花费
|
public int NeedVipLv = 0;//所需VIP等级
|
public int SweepingNeedMoney = 0;//扫荡所需价格
|
public bool IsIceCrystalVein_Copy = false;
|
public bool IsIceCrystalVeinCopy = false;//是否再冰晶矿脉副本
|
public event Action UpdateIceLodeInf;
|
DungeonModel m_Model;
|
DungeonModel model { get { return m_Model ?? (m_Model = ModelCenter.Instance.GetModel<DungeonModel>()); } }
|
public const int ICECRYSTALVEIN_MAPID = 31140;
|
|
public override void Init()
|
{
|
var IceLodeCfg = FuncConfigConfig.Get("IceLodeCfg");
|
Cost = int.Parse(IceLodeCfg.Numerical1);
|
NeedVipLv = int.Parse(IceLodeCfg.Numerical5);
|
SweepingNeedMoney= int.Parse(IceLodeCfg.Numerical3);
|
var IceCrystalVeinIcon = FuncConfigConfig.Get("IceCrystalVeinIcon");
|
IconKeyDic = ConfigParse.GetDic<int, string>(IceCrystalVeinIcon.Numerical1);
|
Assignment();
|
}
|
public void OnBeforePlayerDataInitialize()
|
{
|
IsIceCrystalVein_Copy = false;
|
IsIceCrystalVeinCopy = false;
|
model.dungeonRecordChangeEvent -= dungeonRecordChangeEvent;
|
}
|
|
private void dungeonRecordChangeEvent(int fbId)
|
{
|
}
|
|
public override void UnInit()
|
{
|
|
}
|
public void OnPlayerLoginOk()
|
{
|
model.dungeonRecordChangeEvent += dungeonRecordChangeEvent;
|
AddIceLodeStarAwardList();
|
}
|
|
private void Assignment()
|
{
|
if (DicIceLodeStarAward.Count <= 0)
|
{
|
var config = IceLodeStarAwardConfig.GetValues();
|
foreach (var Value in config)
|
{
|
if (!DicIceLodeStarAward.ContainsKey(Value.id))
|
{
|
IceLodeStarAwardClass iceLodeStar = new IceLodeStarAwardClass();
|
iceLodeStar.Index = Value.index;
|
iceLodeStar.Star = Value.Star;
|
var _jsonData = LitJson.JsonMapper.ToObject(Value.LV);
|
if (_jsonData.Count > 0)
|
{
|
iceLodeStar.MinLv = int.Parse(_jsonData[0].ToString());
|
iceLodeStar.MaxLv = int.Parse(_jsonData[1].ToString());
|
}
|
var jsonData = LitJson.JsonMapper.ToObject(Value.ItemList);
|
if (jsonData.Count > 0)
|
{
|
iceLodeStar.ItemID = int.Parse((jsonData[0][0]).ToString());
|
iceLodeStar.ItemCount = int.Parse((jsonData[0][1]).ToString());
|
iceLodeStar.IsBind = int.Parse((jsonData[0][2]).ToString());
|
}
|
iceLodeStar.Type = Value.Type;
|
DicIceLodeStarAward.Add(Value.id, iceLodeStar);
|
}
|
}
|
}
|
|
|
}
|
|
public void IceLodeInfo(HB204_tagMCIceLodeInfo info)
|
{
|
if (info.Cnt > 0)
|
{
|
LineList.Clear();
|
for (int i = 0; i < info.Cnt; i++)
|
{
|
LineList.Add(info.LineList[i]);
|
}
|
}
|
AwardRecord = (int)info.AwardRecord;
|
HasSweep = (int)info.HasSweep;
|
DayLv = (int)info.DayLV;
|
AddIceLodeStarAwardList();
|
if (UpdateIceLodeInf != null)
|
{
|
UpdateIceLodeInf();
|
}
|
}
|
|
public void SendGetAward(int Index)//领取奖励
|
{
|
CA504_tagCMPlayerGetReward getReward = new CA504_tagCMPlayerGetReward();
|
getReward.RewardType = (byte)GotServerRewardType.Def_RewardType_IceLodeStar;
|
getReward.DataEx = (uint)Index;
|
getReward.DataExStrLen = 0;
|
getReward.DataExStr = string.Empty;
|
GameNetSystem.Instance.SendInfo(getReward);
|
}
|
|
public int GetAllStar()
|
{
|
int StarAll = 0;
|
for (int i = 0; i < LineList.Count; i++)
|
{
|
DungeonRecord dungeonRecord;
|
if (model.TryGetRecord(31140, out dungeonRecord))
|
{
|
if (dungeonRecord.lineGrades.ContainsKey(LineList[i]))
|
{
|
StarAll += dungeonRecord.lineGrades[(LineList[i])];
|
}
|
}
|
}
|
return StarAll;
|
}
|
public bool IsFree(int Index)
|
{
|
DungeonRecord dungeonRecord;
|
if (model.TryGetRecord(ICECRYSTALVEIN_MAPID, out dungeonRecord))
|
{
|
if (dungeonRecord.lineGrades.ContainsKey(Index))
|
{
|
int StarNumber = dungeonRecord.lineGrades[Index];
|
if (StarNumber > 0)
|
{
|
return false;
|
}
|
else
|
{
|
return true;
|
}
|
}
|
else
|
{
|
return true;
|
}
|
}
|
return true;
|
}
|
|
private void AddIceLodeStarAwardList()
|
{
|
IceLodeStarAwardList.Clear();
|
foreach (var key in DicIceLodeStarAward.Keys)
|
{
|
var Dic = DicIceLodeStarAward[key];
|
int Lv = DayLv;
|
if (Lv >= Dic.MinLv && Lv <= Dic.MaxLv)
|
{
|
IceLodeStarAwardList.Add(Dic);
|
}
|
}
|
}
|
}
|
|
|
|
|
|