164 lines
5.5 KiB
C#
164 lines
5.5 KiB
C#
using asap.core;
|
|
using cfg;
|
|
using LitJson;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
namespace GameCore
|
|
{
|
|
public class Pack1A2Data
|
|
{
|
|
public Pack1A2Data(int ID,
|
|
//活动id
|
|
int eventId,
|
|
int vipLevel)
|
|
{
|
|
this.ID = ID;
|
|
this.lastID = eventId;
|
|
this.index = 0;
|
|
this.vipLevel = vipLevel;
|
|
}
|
|
public int ID;
|
|
//领取第几个
|
|
public int index;
|
|
public int lastID;
|
|
//触发当时VIP等级
|
|
public int vipLevel;
|
|
public int rodDstId;
|
|
public int rodSrcId;
|
|
}
|
|
public partial class FishingEventData
|
|
{
|
|
string Pack1A2DataKey = "Pack1A2Data";
|
|
public Pack1A2Data Pack1A2Data;
|
|
bool isFace12;
|
|
void GiftFace1A2(EventPackManager packManager, int eventID)
|
|
{
|
|
if (isFace12)
|
|
{
|
|
return;
|
|
}
|
|
if (Pack1A2Data == null)
|
|
{
|
|
GContext.container.Resolve<IFaceUIService>().AddGiftFaceUI(eventID, UITypes.GiftPopupPanel_11, packManager.PackType, true);
|
|
}
|
|
else
|
|
{
|
|
List<int> packIDs = packManager.VIPPackList[Pack1A2Data.vipLevel];
|
|
if (Pack1A2Data.lastID != eventID || packIDs.Count > Pack1A2Data.index)
|
|
{
|
|
GContext.container.Resolve<IFaceUIService>().AddGiftFaceUI(eventID, UITypes.GiftPopupPanel_11, packManager.PackType, true);
|
|
}
|
|
}
|
|
}
|
|
public void SetPack1A2(FishingEvent t)
|
|
{
|
|
if (Pack1A2Data == null)
|
|
{
|
|
string json_duelData = PlayFabMgr.Instance.GetLocalData(Pack1A2DataKey);
|
|
if (json_duelData != null)
|
|
{
|
|
Pack1A2Data = Newtonsoft.Json.JsonConvert.DeserializeObject<Pack1A2Data>(json_duelData);
|
|
}
|
|
}
|
|
EventPackManager eventPackDataRead = _tables.TbEventPackManager.DataMap[t.RedirectID];
|
|
|
|
GiftFace1A2(eventPackDataRead, t.ID);
|
|
if (Pack1A2Data != null && Pack1A2Data.lastID == t.ID)
|
|
{
|
|
return;
|
|
}
|
|
|
|
Pack1A2Data = new Pack1A2Data(
|
|
eventPackDataRead.ID,
|
|
t.ID,//活动id
|
|
GContext.container.Resolve<PlayerData>().PriceLv
|
|
);
|
|
SetRodDstId();
|
|
RedPointManager.Instance.SetRedPointState(HomeBtnOneTwoPack.redKey, false);
|
|
PlayFabMgr.Instance.UpdateUserDataValue(Pack1A2DataKey, JsonMapper.ToJson(Pack1A2Data));
|
|
}
|
|
void SetRodDstId()
|
|
{
|
|
Pack1A2Data.rodSrcId = 330040000;
|
|
Item item = _tables.TbItem.GetOrDefault(Pack1A2Data.rodSrcId);
|
|
Drop drop = _tables.TbDrop.GetOrDefault(item.RedirectID);
|
|
List<int> rodIDs = drop.DropList.DropIDList;
|
|
int level = -1;
|
|
PlayerFishData playerFishData = GContext.container.Resolve<PlayerFishData>();
|
|
for (int i = 0; i < rodIDs.Count; i++)
|
|
{
|
|
int curLevel = playerFishData.GetRodLevel(rodIDs[i]);
|
|
if (curLevel > level)
|
|
{
|
|
level = curLevel;
|
|
Pack1A2Data.rodDstId = rodIDs[i];
|
|
}
|
|
}
|
|
}
|
|
public void SetPack1A2Index()
|
|
{
|
|
if (Pack1A2Data == null)
|
|
{
|
|
return;
|
|
}
|
|
Pack1A2Data.index++;
|
|
PlayFabMgr.Instance.UpdateUserDataValue(Pack1A2DataKey, JsonMapper.ToJson(Pack1A2Data));
|
|
SetChainPackRed();
|
|
}
|
|
void SetChainPackRed()
|
|
{
|
|
bool isRed = false;
|
|
EventPackManager eventPackManager = Get1A2EventPackManager();
|
|
List<int> packIDs = eventPackManager.VIPPackList[Pack1A2Data.vipLevel];
|
|
if (packIDs.Count > Pack1A2Data.index)
|
|
{
|
|
var pack = _tables.TbPack.GetOrDefault(packIDs[Pack1A2Data.index]);
|
|
isRed = _tables.TbIAPItemList.GetOrDefault(pack.IAPID) == null;
|
|
}
|
|
else
|
|
{
|
|
//购买完 特殊处理
|
|
GContext.Publish(new TargetEvent(Pack1A2Data.lastID, 6, 1));
|
|
}
|
|
RedPointManager.Instance.SetRedPointState(HomeBtnOneTwoPack.redKey, isRed);
|
|
}
|
|
public int GetPack1A2Index()
|
|
{
|
|
isFace12 = true;
|
|
if (Pack1A2Data == null)
|
|
{
|
|
return 100;
|
|
}
|
|
return Pack1A2Data.index;
|
|
}
|
|
public EventPackManager Get1A2EventPackManager()
|
|
{
|
|
if (Pack1A2Data == null)
|
|
{
|
|
return null;
|
|
}
|
|
return _tables.TbEventPackManager.DataMap[Pack1A2Data.ID];
|
|
}
|
|
public DateTime GetEvent1A2EndTime()
|
|
{
|
|
if (Pack1A2Data == null)
|
|
{
|
|
return ZZTimeHelper.UtcNow().UtcNowOffset(); ;
|
|
}
|
|
return GetEventEndTime(Pack1A2Data.lastID);
|
|
}
|
|
public List<ItemData> Get1A2ItemDatasBuyPack(int dropID)
|
|
{
|
|
List<ItemData> itemDatas = GContext.container.Resolve<PlayerItemData>().GetItemDataByDropId(dropID);
|
|
for (int i = 0; i < itemDatas.Count; i++)
|
|
{
|
|
if (itemDatas[i].id == Pack1A2Data.rodSrcId)
|
|
{
|
|
itemDatas[i].id = Pack1A2Data.rodDstId;
|
|
}
|
|
}
|
|
return itemDatas;
|
|
}
|
|
}
|
|
}
|