1303 lines
47 KiB
C#
1303 lines
47 KiB
C#
using asap.core;
|
||
using Castle.Core.Internal;
|
||
using cfg;
|
||
using GameCore;
|
||
using System;
|
||
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using UnityEngine;
|
||
using UnityEngine.U2D;
|
||
|
||
namespace game
|
||
{
|
||
public class EventPotionDataManager
|
||
{
|
||
#if UNITY_EDITOR
|
||
private bool m_IsCheckCondition = true;
|
||
private bool m_IsSyncData = true;
|
||
private int m_DefaultToken = 100;
|
||
#else
|
||
private bool m_IsCheckCondition = true;
|
||
private bool m_IsSyncData = true;
|
||
private int m_DefaultToken = 0;
|
||
#endif
|
||
|
||
#region 生命周期
|
||
public bool Init()
|
||
{
|
||
InitTables();
|
||
return true;
|
||
}
|
||
#endregion
|
||
|
||
#region 图集等
|
||
private SpriteAtlas m_SpriteAtlas;
|
||
public SpriteAtlas SpriteAtlas
|
||
{
|
||
get { return m_SpriteAtlas; }
|
||
set { m_SpriteAtlas = value; }
|
||
}
|
||
#endregion
|
||
|
||
#region Table Data
|
||
private Tables m_Tables;
|
||
private TbEventPotionMain m_TbEventPotionMain;
|
||
private TbEventPotionStage m_TbEventPotionStage;
|
||
private TbEventPotionBlock m_TbEventPotionBlock;
|
||
private TbEventPotionBottle m_TbEventPotionBottle;
|
||
private void InitTables()
|
||
{
|
||
m_Tables = GContext.container.Resolve<Tables>();
|
||
if (m_Tables == null) return;
|
||
m_TbEventPotionMain = m_Tables.TbEventPotionMain;
|
||
m_TbEventPotionStage = m_Tables.TbEventPotionStage;
|
||
m_TbEventPotionBlock = m_Tables.TbEventPotionBlock;
|
||
m_TbEventPotionBottle = m_Tables.TbEventPotionBottle;
|
||
}
|
||
public EventPotionBottle GetEventPotionBottle(int num)
|
||
{
|
||
return m_TbEventPotionBottle.GetOrDefault(num);
|
||
}
|
||
public EventPotionBlock GetEventPotionBlock(int num)
|
||
{
|
||
EventPotionMain potionMain = GetEventPotionMain(m_PotionData.PotionID);
|
||
|
||
foreach (var item in potionMain.BlockResourceID)
|
||
{
|
||
var potionBlock = m_TbEventPotionBlock.GetOrDefault(item);
|
||
if (potionBlock.Count == num) return potionBlock;
|
||
}
|
||
|
||
return null;
|
||
}
|
||
public EventPotionMain GetEventPotionMain(int id)
|
||
{
|
||
return m_TbEventPotionMain.GetOrDefault(id);
|
||
}
|
||
public EventPotionStage GetEventPotionStage(int id)
|
||
{
|
||
return m_TbEventPotionStage.GetOrDefault(id);
|
||
}
|
||
public EventNeoNormalPackData GetEventNeoNormalPackData()
|
||
{
|
||
if (m_PotionData == null)
|
||
return null;
|
||
var main = m_TbEventPotionMain.GetOrDefault(m_PotionData.PotionID);
|
||
if (main == null)
|
||
return null;
|
||
return new EventNeoNormalPackData
|
||
{
|
||
EventId = m_PotionData.EventID,
|
||
PackId = main.PackId,
|
||
// Panel = main.PackPanel
|
||
};
|
||
}
|
||
#endregion
|
||
|
||
#region 历史参与标记
|
||
private int m_PendingFirstPlayedEventId;
|
||
|
||
/// <summary>
|
||
/// 当前用户是否参与过往期魔药活动(不含当期,跨期持久化,随时可查)
|
||
/// </summary>
|
||
public bool HasEverPlayed
|
||
{
|
||
get
|
||
{
|
||
if (m_PotionData == null || m_PotionData.FirstPlayedEventId <= 0) return false;
|
||
FishingEventData fishingEventData = GContext.container.Resolve<FishingEventData>();
|
||
FishingEvent fishingEvent = fishingEventData.GetEventByTypeAndSubType(4, 5, m_IsCheckCondition);
|
||
return fishingEvent == null || m_PotionData.FirstPlayedEventId != fishingEvent.ID;
|
||
}
|
||
}
|
||
|
||
public List<int> GetStageList1(EventPotionMain potion)
|
||
{
|
||
return (HasEverPlayed && potion.ExpStageList1 != null) ? potion.ExpStageList1 : potion.StageList1;
|
||
}
|
||
|
||
public List<int> GetStageList2(EventPotionMain potion)
|
||
{
|
||
return (HasEverPlayed && potion.ExpStageList2 != null) ? potion.ExpStageList2 : potion.StageList2;
|
||
}
|
||
#endregion
|
||
|
||
#region 数据相关
|
||
private EventPotionData m_PotionData;
|
||
public EventPotionData PotionData { get { return m_PotionData; } }
|
||
|
||
public void InitLevel()
|
||
{
|
||
EventPotionStage potionLevel = null;
|
||
if (m_PotionData == null)
|
||
{
|
||
potionLevel = GetFreshPotionLevel();
|
||
}
|
||
else
|
||
{
|
||
potionLevel = GetCurrentPotionLevel();
|
||
}
|
||
if (potionLevel == null) return;
|
||
|
||
m_PotionResDict.Clear();
|
||
|
||
EventPotionMain potion = m_TbEventPotionMain.GetOrDefault(m_PotionData.PotionID);
|
||
if (potion == null) return;
|
||
|
||
int count = potion.ResourceID.Count;
|
||
for (int i = 0; i < count; i++)
|
||
{
|
||
m_PotionResDict.Add(potion.ResourceID[i], new EventPotionResource
|
||
{
|
||
TypeIndex = i,
|
||
TypeCount = count,
|
||
ItemResName = potion.ItemResource[i],
|
||
PaintResName = potion.PaintResource[i]
|
||
});
|
||
}
|
||
|
||
InitUIData();
|
||
}
|
||
List<int> SetPattern(List<int> arr, int pattern, bool ColorProb)
|
||
{
|
||
if (ColorProb)
|
||
{
|
||
//1-7之间不放回的随机取count个数
|
||
List<int> ints = new List<int>();
|
||
for (int i = 1; i < 8; i++)
|
||
{
|
||
ints.Insert(UnityEngine.Random.Range(0, ints.Count + 1), i);
|
||
}
|
||
for (int i = 0; i < arr.Count; i++)
|
||
{
|
||
arr[i] = ints[i];
|
||
}
|
||
}
|
||
|
||
GameDebug.Log("魔药 pattern == " + pattern);
|
||
int count = arr.Count;
|
||
if (pattern == -1)
|
||
{
|
||
int randomIndex = UnityEngine.Random.Range(0, count);
|
||
int value = arr[randomIndex];
|
||
for (int i = 0; i < count; i++)
|
||
{
|
||
arr[i] = value;
|
||
}
|
||
}
|
||
else if (pattern > 0)
|
||
{
|
||
arr = ConstructValidPermutation(arr, pattern);
|
||
}
|
||
|
||
return arr;
|
||
}
|
||
private void ProcessSorting(EventPotionStage potionLevel)
|
||
{
|
||
EventPotionBottle potionBottle = m_TbEventPotionBottle.GetOrDefault(potionLevel.Number);
|
||
|
||
int count = potionBottle.Color.Count;
|
||
|
||
bool isSkip = false;
|
||
|
||
List<int> arr = potionBottle.Color;
|
||
|
||
// display数据洗牌
|
||
m_PotionData.LevelDisplayData.isOver = false;
|
||
m_PotionData.LevelDisplayData.ColorTypeList.Clear();
|
||
|
||
// target数据洗牌
|
||
m_PotionData.LevelTargetData.ColorTypeList.Clear();
|
||
EventPotionMain potion = m_TbEventPotionMain.GetOrDefault(m_PotionData.PotionID);
|
||
bool isRandom = HasEverPlayed || potionLevel.ID != GetStageList1(potion)[0];
|
||
bool WeightRandom = true;
|
||
bool ColorProb = false;
|
||
if (isRandom)
|
||
{
|
||
ColorProb = potionLevel.ColorProb >= UnityEngine.Random.value;
|
||
arr = SetPattern(arr, potionLevel.Pattern, ColorProb);
|
||
|
||
// 随机排序
|
||
m_PotionData.LevelDisplayData.ColorTypeList.AddRange(arr);
|
||
ShuffleList(m_PotionData.LevelDisplayData.ColorTypeList, isSkip);
|
||
|
||
m_PotionData.LevelTargetData.ColorTypeList.AddRange(m_PotionData.LevelDisplayData.ColorTypeList.ToArray());
|
||
if (isSkip == false)
|
||
{
|
||
ShuffleList(m_PotionData.LevelTargetData.ColorTypeList);
|
||
}
|
||
|
||
// target 权重数据处理
|
||
int totalWeight = potionLevel.WeightRandom + potionLevel.WeightLimit;
|
||
int random = UnityEngine.Random.Range(0, totalWeight);
|
||
|
||
if (random >= potionLevel.WeightRandom && isSkip == false)
|
||
{
|
||
WeightRandom = false;
|
||
m_PotionData.Rule = 2;
|
||
List<int> tmpList = new List<int>();
|
||
int tmpCount = 0;
|
||
// 处理LimitParam
|
||
|
||
// 逆向检测
|
||
tmpList.Clear();
|
||
int tmpLast = count - 1;
|
||
for (int i = 0; i < count; i++)
|
||
{
|
||
if (m_PotionData.LevelDisplayData.ColorTypeList[tmpLast - i] == m_PotionData.LevelTargetData.ColorTypeList[i])
|
||
{
|
||
tmpList.Add(i);
|
||
}
|
||
}
|
||
// 逆向处理
|
||
tmpCount = tmpList.Count;
|
||
if (tmpCount >= potionBottle.LimitHitNum)
|
||
{
|
||
for (int i = 0; i < tmpCount; i += 2)
|
||
{
|
||
if (i + 1 < tmpCount)
|
||
{
|
||
int tmp = m_PotionData.LevelTargetData.ColorTypeList[tmpList[i]];
|
||
m_PotionData.LevelTargetData.ColorTypeList[tmpList[i]] = m_PotionData.LevelTargetData.ColorTypeList[tmpList[i + 1]];
|
||
m_PotionData.LevelTargetData.ColorTypeList[tmpList[i + 1]] = tmp;
|
||
}
|
||
}
|
||
}
|
||
|
||
// 正向检测
|
||
tmpList.Clear();
|
||
for (int i = 0; i < count; i++)
|
||
{
|
||
if (m_PotionData.LevelTargetData.ColorTypeList[i] == m_PotionData.LevelDisplayData.ColorTypeList[i])
|
||
{
|
||
tmpList.Add(i);
|
||
}
|
||
}
|
||
// 正向处理
|
||
tmpCount = tmpList.Count;
|
||
if (tmpCount >= potionBottle.LimitHitNum)
|
||
{
|
||
for (int i = 0; i < tmpCount; i += 2)
|
||
{
|
||
if (i + 1 < tmpCount)
|
||
{
|
||
int tmp = m_PotionData.LevelTargetData.ColorTypeList[tmpList[i]];
|
||
m_PotionData.LevelTargetData.ColorTypeList[tmpList[i]] = m_PotionData.LevelTargetData.ColorTypeList[tmpList[i + 1]];
|
||
m_PotionData.LevelTargetData.ColorTypeList[tmpList[i + 1]] = tmp;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
m_PotionData.Rule = 1;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
// 指定排序
|
||
m_PotionData.Rule = 3;
|
||
|
||
m_PotionData.LevelTargetData.ColorTypeList = new List<int>() { 1, 2, 3 };
|
||
m_PotionData.LevelDisplayData.ColorTypeList = new List<int>() { 1, 3, 2 };
|
||
}
|
||
|
||
for (int i = 0; i < count; ++i)
|
||
{
|
||
m_PotionData.LevelDisplayData.ShelfTypeList.Add(EventPotionShelfType.Shelf_Default);
|
||
m_PotionData.LevelDisplayData.GridStateList.Add(EventPotionGridState.GridState_Empty);
|
||
m_PotionData.LevelDisplayData.FromDisplayAreaIndexList.Add(-1);
|
||
}
|
||
|
||
// 处理processed数据
|
||
m_PotionData.LevelProcessedList.Clear();
|
||
PotionItemData processedData = new PotionItemData();
|
||
processedData.Clear();
|
||
processedData.DataType = EventPotionDataType.Data_ItemAndOperation;
|
||
processedData.name = "ProcessSorting_" + DateTime.Now.Ticks;
|
||
processedData.index = m_PotionData.LevelProcessedList.Count;
|
||
processedData.isOver = false;
|
||
|
||
for (int i = 0; i < count; i++)
|
||
{
|
||
processedData.ColorTypeList.Add(-1);
|
||
processedData.ShelfTypeList.Add(EventPotionShelfType.Shelf_Default);
|
||
processedData.GridStateList.Add(EventPotionGridState.GridState_Empty);
|
||
processedData.FromDisplayAreaIndexList.Add(-1);
|
||
}
|
||
|
||
m_PotionData.LevelProcessedList.Add(processedData);
|
||
GameDebug.Log("魔药:" + string.Join(",", PotionData.LevelTargetData.ColorTypeList)
|
||
+ " || "
|
||
+ string.Join(",", PotionData.LevelDisplayData.ColorTypeList)
|
||
+ " 顺序随机 " + WeightRandom
|
||
+ " 颜色随机 " + ColorProb);
|
||
}
|
||
|
||
// 构造一个满足条件的排列
|
||
private List<int> ConstructValidPermutation(List<int> numbers, int param)
|
||
{
|
||
int length = numbers.Count;
|
||
if (param > length / 2)
|
||
{
|
||
param = length / 2;
|
||
}
|
||
ShuffleList(numbers);
|
||
for (int i = 0; i < param; i++)
|
||
{
|
||
numbers[i] = numbers[(i + param) % length];
|
||
}
|
||
return numbers;
|
||
}
|
||
|
||
// 计算两个数组中相同位置相同值的数量
|
||
private int CountMatches(int[] arr1, int[] arr2)
|
||
{
|
||
int count = 0;
|
||
for (int i = 0; i < arr1.Length; i++)
|
||
{
|
||
if (arr1[i] == arr2[i])
|
||
{
|
||
count++;
|
||
}
|
||
}
|
||
return count;
|
||
}
|
||
|
||
private Dictionary<int, EventPotionResource> m_PotionResDict = new Dictionary<int, EventPotionResource>();
|
||
public EventPotionResource GetPotionResource(int id)
|
||
{
|
||
m_PotionResDict.TryGetValue(id, out EventPotionResource potionRes);
|
||
return potionRes;
|
||
}
|
||
/// <summary>
|
||
/// 获取的是 m_PotionData.LevelDisplayData.ItemTypeList 的索引列表
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public List<int> GetValidDisplayDataList()
|
||
{
|
||
List<int> list = new List<int>();
|
||
int count = m_PotionData.LevelDisplayData.ColorTypeList.Count;
|
||
for (int i = 0; i < count; ++i)
|
||
{
|
||
if (m_PotionData.LevelDisplayData.ColorTypeList[i] > EventPotionConfig.PotionItemType_Empty &&
|
||
m_PotionData.LevelDisplayData.GridStateList[i] != EventPotionGridState.GridState_Over)
|
||
{
|
||
list.Add(i);
|
||
}
|
||
}
|
||
return list;
|
||
}
|
||
public int GetValidDisplayDataListCount()
|
||
{
|
||
int num = 0;
|
||
int count = m_PotionData.LevelDisplayData.ColorTypeList.Count;
|
||
for (int i = 0; i < count; ++i)
|
||
{
|
||
if (m_PotionData.LevelDisplayData.ColorTypeList[i] > EventPotionConfig.PotionItemType_Empty &&
|
||
m_PotionData.LevelDisplayData.GridStateList[i] != EventPotionGridState.GridState_Over)
|
||
{
|
||
num++;
|
||
}
|
||
}
|
||
return num;
|
||
}
|
||
|
||
private List<PotionItemData> m_WallsBefore = new List<PotionItemData>();
|
||
private List<PotionItemData> m_WallsAfter = new List<PotionItemData>();
|
||
public int WallBeforeCount { get { return m_WallsBefore.Count; } }
|
||
public void InitWalls(int totalNums)
|
||
{
|
||
int wallNum = totalNums - 2;
|
||
m_WallsBefore.Clear();
|
||
for (int i = 0; i < wallNum; ++i)
|
||
{
|
||
PotionItemData tmpWallDataBefore = new PotionItemData()
|
||
{
|
||
DataType = EventPotionDataType.Data_Wall
|
||
};
|
||
tmpWallDataBefore.name = "InitWalls_Before_" + i + "_" + DateTime.Now.Ticks;
|
||
tmpWallDataBefore.index = i;
|
||
tmpWallDataBefore.isOver = true;
|
||
m_WallsBefore.Add(tmpWallDataBefore);
|
||
}
|
||
|
||
wallNum = 1;
|
||
m_WallsAfter.Clear();
|
||
PotionItemData tmpWallDataAfter = new PotionItemData()
|
||
{
|
||
DataType = EventPotionDataType.Data_Wall
|
||
};
|
||
tmpWallDataAfter.name = "InitWalls_After_" + DateTime.Now.Ticks;
|
||
tmpWallDataAfter.index = 0;
|
||
tmpWallDataAfter.isOver = true;
|
||
m_WallsAfter.Add(tmpWallDataAfter);
|
||
}
|
||
|
||
public void ClearData()
|
||
{
|
||
m_WallsBefore.Clear();
|
||
m_WallsAfter.Clear();
|
||
m_ScrollerDataList.Clear();
|
||
|
||
ClearUIData();
|
||
|
||
m_SpriteAtlas = null;
|
||
}
|
||
|
||
public void ActivateEvent(FishingEvent fishingEvent)
|
||
{
|
||
if (fishingEvent == null) return;
|
||
|
||
if (!Init()) return;
|
||
|
||
if (m_PotionData != null)
|
||
{
|
||
m_PendingFirstPlayedEventId = m_PotionData.FirstPlayedEventId > 0
|
||
? m_PotionData.FirstPlayedEventId
|
||
: m_PotionData.EventID;
|
||
}
|
||
else
|
||
{
|
||
m_PendingFirstPlayedEventId = fishingEvent.ID;
|
||
}
|
||
|
||
if (m_PotionData != null)
|
||
FixPotionData();
|
||
if (m_PotionData == null)
|
||
GetFreshPotionLevel();
|
||
}
|
||
|
||
public void GetDataFromServer(string json)
|
||
{
|
||
if (json.IsNullOrEmpty())
|
||
{
|
||
GameDebug.LogWarning("EventPotion get data from server has encountered empty data.");
|
||
return;
|
||
}
|
||
|
||
try
|
||
{
|
||
m_PotionData = Newtonsoft.Json.JsonConvert.DeserializeObject<EventPotionData>(json);
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
GameDebug.LogWarning("EventPotion deserialize data has failed. Exception: " + e.ToString());
|
||
return;
|
||
}
|
||
|
||
if (!Init()) return;
|
||
}
|
||
|
||
public TimeSpan RemainingTime
|
||
{
|
||
get => DateTime.Parse((m_Tables.TbFishingEvent[m_PotionData.EventID].TimeDefinition as LimitedTime).EndTime)
|
||
- ZZTimeHelper.UtcNow();
|
||
}
|
||
|
||
public int FixPotionData()
|
||
{
|
||
if (m_PotionData == null) return 0;
|
||
|
||
// 获取当前开放并符合解锁条件的魔药活动ID
|
||
FishingEventData fishingEventData = GContext.container.Resolve<FishingEventData>();
|
||
FishingEvent fishingEvent = fishingEventData.GetEventByTypeAndSubType(4, 5, m_IsCheckCondition);
|
||
if (fishingEvent == null) return ClearPotionData();
|
||
int eventID = fishingEvent.ID;
|
||
int potionID = fishingEvent.RedirectID;
|
||
if (potionID < 0) return ClearPotionData();
|
||
|
||
if (eventID != m_PotionData.EventID || potionID != m_PotionData.PotionID) return ClearPotionData();
|
||
|
||
return 0;
|
||
}
|
||
public int ClearPotionData()
|
||
{
|
||
if (m_PotionData == null) return 0;
|
||
|
||
m_PotionData.Clear();
|
||
m_PotionData = null;
|
||
return 0;
|
||
}
|
||
public void SyncData()
|
||
{
|
||
if (!m_IsSyncData) return;
|
||
PlayFabMgr.Instance.UpdateUserDataValue(EventPotionConfig.SAVE_DATA_KEY, Newtonsoft.Json.JsonConvert.SerializeObject(m_PotionData));
|
||
}
|
||
public PotionItemData GetOperationItemData()
|
||
{
|
||
foreach (var potionItemData in m_PotionData.LevelProcessedList)
|
||
{
|
||
if (potionItemData.DataType == EventPotionDataType.Data_ItemAndOperation)
|
||
{
|
||
return potionItemData;
|
||
}
|
||
}
|
||
return null;
|
||
}
|
||
#endregion
|
||
|
||
#region UI 设置相关
|
||
private UIType m_UIPanel = null, m_InfoPanel = null, m_RewardPopupPanel = null;
|
||
public void ClearUIData()
|
||
{
|
||
m_UIPanel = null;
|
||
m_InfoPanel = null;
|
||
m_RewardPopupPanel = null;
|
||
}
|
||
public void InitUIData()
|
||
{
|
||
ClearUIData();
|
||
|
||
GetUIPanel();
|
||
GetInfoPanel();
|
||
GetRewardPopupPanel();
|
||
}
|
||
public UIType GetUIPanel()
|
||
{
|
||
if (m_UIPanel == null)
|
||
{
|
||
var data = GetEventPotionMain(m_PotionData.PotionID);
|
||
m_UIPanel = new UIType(data.UIPanel);
|
||
}
|
||
return m_UIPanel;
|
||
}
|
||
public UIType GetInfoPanel()
|
||
{
|
||
if (m_InfoPanel == null)
|
||
{
|
||
var data = GetEventPotionMain(m_PotionData.PotionID);
|
||
m_InfoPanel = new UIType(data.InfoPanel);
|
||
}
|
||
return m_InfoPanel;
|
||
}
|
||
public UIType GetRewardPopupPanel()
|
||
{
|
||
if (m_RewardPopupPanel == null)
|
||
{
|
||
var data = GetEventPotionMain(m_PotionData.PotionID);
|
||
m_RewardPopupPanel = new UIType(data.RewardPanel);
|
||
}
|
||
return m_RewardPopupPanel;
|
||
}
|
||
#endregion
|
||
|
||
#region 本地存储数据相关
|
||
public string GetPotionIDSaveKey(string key)
|
||
{
|
||
if (m_PotionData == null) return key;
|
||
return m_PotionData.EventID + "-" + m_PotionData.PotionID + "-" + key;
|
||
}
|
||
public bool HasPotionIDSaveKey(string key)
|
||
{
|
||
return PlayerPrefs.HasKey(GetPotionIDSaveKey(key));
|
||
}
|
||
public void SavePotionIDData(string key, string value)
|
||
{
|
||
PlayerPrefs.SetString(GetPotionIDSaveKey(key), value);
|
||
PlayerPrefs.Save();
|
||
}
|
||
public void ClearPostionIDData(string key)
|
||
{
|
||
PlayerPrefs.DeleteKey(GetPotionIDSaveKey(key));
|
||
}
|
||
#endregion
|
||
|
||
#region 展示区相关
|
||
public void ResetDisplayAreaGridState(EventPotionGridState gridState)
|
||
{
|
||
if (m_PotionData == null || m_PotionData.LevelDisplayData == null) return;
|
||
|
||
int count = m_PotionData.LevelDisplayData.GridStateList.Count;
|
||
for (int i = 0; i < count; ++i)
|
||
{
|
||
m_PotionData.LevelDisplayData.GridStateList[i] = gridState;
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 操作数据相关
|
||
private List<PotionItemData> m_ScrollerDataList = new List<PotionItemData>();
|
||
public List<PotionItemData> ScrollerDataList { get { return m_ScrollerDataList; } }
|
||
public void InitScrollerDataList()
|
||
{
|
||
m_ScrollerDataList.Clear();
|
||
RefreshScrollerDataList();
|
||
}
|
||
|
||
private void RefreshScrollerDataList()
|
||
{
|
||
m_ScrollerDataList.Clear();
|
||
|
||
// 上方墙壁
|
||
int count = m_WallsBefore.Count;
|
||
foreach (var item in m_WallsBefore)
|
||
{
|
||
m_ScrollerDataList.Add(item);
|
||
}
|
||
|
||
// 操作数据
|
||
count = m_PotionData.LevelProcessedList.Count;
|
||
foreach (var item in m_PotionData.LevelProcessedList)
|
||
{
|
||
m_ScrollerDataList.Add(item);
|
||
}
|
||
|
||
// 下方墙壁
|
||
count = m_WallsAfter.Count;
|
||
foreach (var item in m_WallsAfter)
|
||
{
|
||
m_ScrollerDataList.Add(item);
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 关卡相关
|
||
public int GetPreLevelCountInCurRound()
|
||
{
|
||
if (m_PotionData.PrePotionID < 0) return -1;
|
||
|
||
EventPotionMain potion = m_TbEventPotionMain.GetOrDefault(m_PotionData.PrePotionID);
|
||
if (m_PotionData.PreStageID == 1)
|
||
{
|
||
return GetStageList1(potion).Count;
|
||
}
|
||
return GetStageList2(potion).Count;
|
||
}
|
||
public int GetLevelCountInCurRound()
|
||
{
|
||
if (m_PotionData.StageID == 1)
|
||
return m_PotionData.Stage1TotalLevel;
|
||
return m_PotionData.Stage2TotalLevel;
|
||
}
|
||
public EventPotionStage GetLastStageInCurRound()
|
||
{
|
||
if (m_PotionData == null) return null;
|
||
|
||
EventPotionMain potion = m_TbEventPotionMain.GetOrDefault(m_PotionData.PotionID);
|
||
if (potion == null) return null;
|
||
|
||
int levelID = 0;
|
||
if (m_PotionData.StageID == 1) levelID = GetStageList1(potion)[m_PotionData.Stage1TotalLevel - 1];
|
||
else levelID = GetStageList2(potion)[m_PotionData.Stage2TotalLevel - 1];
|
||
|
||
return m_TbEventPotionStage.GetOrDefault(levelID);
|
||
}
|
||
public EventPotionStage GetFreshPotionLevel()
|
||
{
|
||
// 获取当前开放并符合解锁条件的魔药活动ID
|
||
FishingEventData fishingEventData = GContext.container.Resolve<FishingEventData>();
|
||
FishingEvent fishingEvent = fishingEventData.GetEventByTypeAndSubType(4, 5, m_IsCheckCondition);
|
||
if (fishingEvent == null) return null;
|
||
int eventID = fishingEvent.ID;
|
||
int potionID = fishingEvent.RedirectID;
|
||
if (potionID < 0) return null;
|
||
|
||
// 获取当前魔药活动数据
|
||
EventPotionMain potion = m_TbEventPotionMain.GetOrDefault(potionID);
|
||
if (potion == null) return null;
|
||
|
||
int token = m_DefaultToken;
|
||
if (m_PotionData != null) m_PotionData.ClearAllLocalData();
|
||
|
||
token = GContext.container.Resolve<FishingEventData>().GetInitWelcomeGift(eventID);
|
||
|
||
m_PotionData = new EventPotionData();
|
||
m_PotionData.FirstPlayedEventId = m_PendingFirstPlayedEventId > 0 ? m_PendingFirstPlayedEventId : eventID;
|
||
// 获取魔药数据
|
||
var stageList1 = GetStageList1(potion);
|
||
var stageList2 = GetStageList2(potion);
|
||
int stage1Count = stageList1.Count;
|
||
int stage2Count = stageList2.Count;
|
||
|
||
int stageID = 1;
|
||
int levelIndex = 0;
|
||
int levelID = stageList1[levelIndex];
|
||
EventPotionStage level = m_TbEventPotionStage.GetOrDefault(levelID);
|
||
if (level == null) return null;
|
||
m_PotionData.InflationRate = GContext.container.Resolve<PlayerData>().InflationRate;
|
||
Debug.Log("m_PotionData.InflationRate " + GContext.container.Resolve<PlayerData>().InflationRate);
|
||
m_PotionData.EventID = eventID;
|
||
m_PotionData.PotionID = potionID;
|
||
m_PotionData.StageID = stageID;
|
||
m_PotionData.Stage1TotalLevel = stage1Count;
|
||
m_PotionData.Stage2TotalLevel = stage2Count;
|
||
m_PotionData.LevelID = levelID;
|
||
m_PotionData.LevelIndex = levelIndex;
|
||
m_PotionData.Round = stageID;
|
||
|
||
m_PotionData.LevelTargetData.Clear();
|
||
m_PotionData.LevelProcessedList.Clear();
|
||
m_PotionData.LevelDisplayData.Clear();
|
||
|
||
m_PotionData.IsOver = false;
|
||
m_PotionData.Token = token;
|
||
m_PotionData.ConsumedToken = 0;
|
||
m_PotionData.CorrectNum = 0;
|
||
m_PotionData.SubmitNum = 0;
|
||
m_PotionData.Rule = 0;
|
||
|
||
m_PotionData.PreEventID = -1;
|
||
m_PotionData.PrePotionID = -1;
|
||
m_PotionData.PreStageID = -1;
|
||
m_PotionData.PreLevelID = -1;
|
||
|
||
m_PotionData.Name = "GetFreshPotionLevel";
|
||
m_PotionData.LevelTargetData.name = m_PotionData.Name + "_Target_" + DateTime.Now.Ticks;
|
||
m_PotionData.LevelDisplayData.name = m_PotionData.Name + "_Display_" + DateTime.Now.Ticks;
|
||
|
||
GContext.container.Resolve<FishingEventData>().SaveTransitionData(m_PotionData.EventID, m_PotionData.Token);
|
||
|
||
ProcessSorting(level);
|
||
|
||
ClearPostionIDData(EventPotionConfig.key_first_check_wrong);
|
||
ClearPostionIDData(EventPotionConfig.key_first_check_combination_wrong);
|
||
SetRedPoint();
|
||
// 同步数据
|
||
SyncData();
|
||
return level;
|
||
}
|
||
|
||
public void GoToPotionLevel(int levelID)
|
||
{
|
||
// 获取当前开放并符合解锁条件的魔药活动ID
|
||
FishingEventData fishingEventData = GContext.container.Resolve<FishingEventData>();
|
||
FishingEvent fishingEvent = fishingEventData.GetEventByTypeAndSubType(4, 5, m_IsCheckCondition);
|
||
if (fishingEvent == null)
|
||
{
|
||
Debug.LogWarning("=== 找不到 魔药 对应的 type=4 & subType=5,且符合条件的活动。");
|
||
return;
|
||
}
|
||
int eventID = fishingEvent.ID;
|
||
int potionID = fishingEvent.RedirectID;
|
||
if (potionID < 0)
|
||
{
|
||
Debug.LogWarning("=== 魔药ID出错,活动ID为:" + eventID + ", 魔药ID:" + potionID);
|
||
return;
|
||
}
|
||
|
||
// 获取当前魔药活动数据
|
||
EventPotionMain potion = m_TbEventPotionMain.GetOrDefault(potionID);
|
||
if (potion == null)
|
||
{
|
||
Debug.LogWarning("=== 魔药找不到数据,potionID:" + potionID);
|
||
return;
|
||
}
|
||
if (m_PotionData != null) m_PotionData.ClearAllLocalData();
|
||
m_PotionData = new EventPotionData();
|
||
m_PotionData.FirstPlayedEventId = m_PendingFirstPlayedEventId > 0 ? m_PendingFirstPlayedEventId : eventID;
|
||
var stageList1 = GetStageList1(potion);
|
||
var stageList2 = GetStageList2(potion);
|
||
|
||
int stageID = 0;
|
||
if (stageList1.IndexOf(levelID) >= 0)
|
||
{
|
||
stageID = 1;
|
||
}
|
||
else if (stageList2.IndexOf(levelID) >= 0)
|
||
{
|
||
stageID = 2;
|
||
}
|
||
else
|
||
{
|
||
Debug.LogWarning("=== 魔药在 EventPotionMain StageList1 和 StageList2 里找不到数据,potionID:" + potionID);
|
||
return;
|
||
}
|
||
|
||
List<int> levelList = null;
|
||
if (stageID == 1) levelList = stageList1;
|
||
else levelList = stageList2;
|
||
|
||
int levelIndex = 0;
|
||
int count = levelList.Count;
|
||
for (int i = 0; i < count; i++)
|
||
{
|
||
if (levelList[i] == levelID)
|
||
{
|
||
levelIndex = i;
|
||
break;
|
||
}
|
||
}
|
||
|
||
int token = GContext.container.Resolve<FishingEventData>().GetInitWelcomeGift(eventID);
|
||
|
||
m_PotionData.InflationRate = GContext.container.Resolve<PlayerData>().InflationRate;
|
||
Debug.Log("m_PotionData.InflationRate " + GContext.container.Resolve<PlayerData>().InflationRate);
|
||
m_PotionData.EventID = eventID;
|
||
m_PotionData.PotionID = potionID;
|
||
m_PotionData.StageID = stageID;
|
||
m_PotionData.Stage1TotalLevel = stageList1.Count;
|
||
m_PotionData.Stage2TotalLevel = stageList2.Count;
|
||
m_PotionData.LevelID = levelID;
|
||
m_PotionData.LevelIndex = levelIndex;
|
||
m_PotionData.Round = stageID;
|
||
|
||
m_PotionData.LevelTargetData.Clear();
|
||
m_PotionData.LevelProcessedList.Clear();
|
||
m_PotionData.LevelDisplayData.Clear();
|
||
|
||
m_PotionData.IsOver = false;
|
||
m_PotionData.Token = token;
|
||
m_PotionData.ConsumedToken = 0;
|
||
m_PotionData.CorrectNum = 0;
|
||
m_PotionData.SubmitNum = 0;
|
||
m_PotionData.Rule = 0;
|
||
|
||
m_PotionData.PreEventID = -1;
|
||
m_PotionData.PrePotionID = -1;
|
||
m_PotionData.PreStageID = -1;
|
||
m_PotionData.PreLevelID = -1;
|
||
|
||
m_PotionData.Name = "GoToPotionLevel";
|
||
m_PotionData.LevelTargetData.name = m_PotionData.Name + "_Target_" + DateTime.Now.Ticks;
|
||
m_PotionData.LevelDisplayData.name = m_PotionData.Name + "_Display_" + DateTime.Now.Ticks;
|
||
|
||
EventPotionStage level = m_TbEventPotionStage.GetOrDefault(m_PotionData.LevelID);
|
||
|
||
ProcessSorting(level);
|
||
|
||
// 同步数据
|
||
SyncData();
|
||
SetRedPoint();
|
||
}
|
||
|
||
public bool HaveNextPotionLevel()
|
||
{
|
||
//if (m_PotionData == null) return false;
|
||
|
||
//if (m_PotionData.StageID == 1) return true;
|
||
|
||
//if (m_PotionData.LevelIndex < m_PotionData.Stage2TotalLevel - 1) return true;
|
||
|
||
return true;
|
||
}
|
||
|
||
public EventPotionStage GetNextPotionLevel()
|
||
{
|
||
// 获取当前开放并符合解锁条件的魔药活动ID
|
||
FishingEventData fishingEventData = GContext.container.Resolve<FishingEventData>();
|
||
FishingEvent fishingEvent = fishingEventData.GetEventByTypeAndSubType(4, 5, m_IsCheckCondition);
|
||
if (fishingEvent == null) return null;
|
||
int eventID = fishingEvent.ID;
|
||
int potionID = fishingEvent.RedirectID;
|
||
if (potionID < 0) return null;
|
||
|
||
if (potionID != m_PotionData.PotionID) return GetFreshPotionLevel();
|
||
|
||
// 获取当前魔药活动数据
|
||
EventPotionMain potion = m_TbEventPotionMain.GetOrDefault(potionID);
|
||
if (potion == null) return null;
|
||
|
||
bool haveNextPotionLevel = HaveNextPotionLevel();
|
||
|
||
if (haveNextPotionLevel == false) return null; // 所有活动结束
|
||
|
||
if (m_PotionData.StageID == 1)
|
||
{
|
||
if (m_PotionData.LevelIndex < m_PotionData.Stage1TotalLevel - 1)
|
||
{
|
||
m_PotionData.LevelIndex += 1;
|
||
}
|
||
else
|
||
{
|
||
m_PotionData.StageID = 2;
|
||
m_PotionData.LevelIndex = 0;
|
||
m_PotionData.Round++;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (m_PotionData.LevelIndex < m_PotionData.Stage2TotalLevel - 1)
|
||
{
|
||
m_PotionData.LevelIndex += 1;
|
||
}
|
||
else
|
||
{
|
||
m_PotionData.StageID = 2;
|
||
m_PotionData.LevelIndex = 0;
|
||
m_PotionData.Round++;
|
||
}
|
||
}
|
||
|
||
int stageID = m_PotionData.StageID;
|
||
int levelIndex = m_PotionData.LevelIndex;
|
||
|
||
// 获取魔药数据
|
||
var stageList1 = GetStageList1(potion);
|
||
var stageList2 = GetStageList2(potion);
|
||
int stage1Count = stageList1.Count;
|
||
if (stage1Count == 0) return null;
|
||
int stage2Count = stageList2.Count;
|
||
if (stage2Count == 0) return null;
|
||
|
||
int levelID = 0;
|
||
if (stageID == 1)
|
||
{
|
||
levelID = stageList1[levelIndex];
|
||
}
|
||
else
|
||
{
|
||
levelID = stageList2[levelIndex];
|
||
}
|
||
|
||
EventPotionStage level = m_TbEventPotionStage.GetOrDefault(levelID);
|
||
if (level == null) return null;
|
||
|
||
m_PotionData.PreEventID = m_PotionData.EventID;
|
||
m_PotionData.PrePotionID = m_PotionData.PotionID;
|
||
m_PotionData.PreStageID = m_PotionData.StageID;
|
||
m_PotionData.PreLevelID = m_PotionData.LevelID;
|
||
|
||
m_PotionData.EventID = eventID;
|
||
m_PotionData.PotionID = potionID;
|
||
m_PotionData.StageID = stageID;
|
||
m_PotionData.Stage1TotalLevel = stage1Count;
|
||
m_PotionData.Stage2TotalLevel = stage2Count;
|
||
m_PotionData.LevelID = levelID;
|
||
m_PotionData.LevelIndex = levelIndex;
|
||
|
||
m_PotionData.LevelTargetData.Clear();
|
||
m_PotionData.LevelProcessedList.Clear();
|
||
m_PotionData.LevelDisplayData.Clear();
|
||
|
||
m_PotionData.IsOver = false;
|
||
m_PotionData.ConsumedToken = 0;
|
||
m_PotionData.CorrectNum = 0;
|
||
m_PotionData.SubmitNum = 0;
|
||
m_PotionData.Rule = 0;
|
||
|
||
ProcessSorting(level);
|
||
|
||
// 同步数据
|
||
SyncData();
|
||
return level;
|
||
}
|
||
|
||
public EventPotionStage GetCurrentPotionLevel()
|
||
{
|
||
// 获取当前开放并符合解锁条件的魔药活动ID
|
||
FishingEventData fishingEventData = GContext.container.Resolve<FishingEventData>();
|
||
FishingEvent fishingEvent = fishingEventData.GetEventByTypeAndSubType(4, 5, m_IsCheckCondition);
|
||
if (fishingEvent == null) return null;
|
||
int eventID = fishingEvent.ID;
|
||
int potionID = fishingEvent.RedirectID;
|
||
if (potionID < 0) return null;
|
||
|
||
if (eventID != m_PotionData.EventID || potionID != m_PotionData.PotionID) return GetFreshPotionLevel();
|
||
|
||
return m_TbEventPotionStage.GetOrDefault(m_PotionData.LevelID);
|
||
}
|
||
#endregion
|
||
|
||
#region 关卡是否固定
|
||
public bool IsCurrentLevelFixed()
|
||
{
|
||
if (m_PotionData == null) return false;
|
||
EventPotionMain potion = m_TbEventPotionMain.GetOrDefault(m_PotionData.PotionID);
|
||
if (potion == null) return false;
|
||
var stageList1 = GetStageList1(potion);
|
||
if (stageList1 == null || stageList1.Count == 0) return false;
|
||
return !HasEverPlayed && m_PotionData.LevelID == stageList1[0];
|
||
}
|
||
#endregion
|
||
|
||
#region 红点相关
|
||
public void SetRedPoint()
|
||
{
|
||
if (m_PotionData != null)
|
||
{
|
||
RedPointManager.Instance.SetRedPointState(RedPointName.Home_Potion, m_PotionData.Token > 0, m_PotionData.Token);
|
||
}
|
||
else
|
||
{
|
||
RedPointManager.Instance.SetRedPointState(RedPointName.Home_Potion, false);
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 代币相关
|
||
public void AddToken(int count)
|
||
{
|
||
if (m_PotionData != null)
|
||
{
|
||
m_PotionData.Token += count;
|
||
}
|
||
else
|
||
{
|
||
GetFreshPotionLevel();
|
||
if (m_PotionData == null) return;
|
||
m_PotionData.Token += count;
|
||
m_PotionData.Name = "AddToken";
|
||
m_PotionData.LevelTargetData.name = m_PotionData.Name + "_Target_" + DateTime.Now.Ticks;
|
||
m_PotionData.LevelDisplayData.name = m_PotionData.Name + "_Display_" + DateTime.Now.Ticks;
|
||
}
|
||
|
||
|
||
SetRedPoint();
|
||
FishingPotionAct.Publish<EventPotionTokenUpdateData>(new EventPotionTokenUpdateData());
|
||
|
||
GContext.container.Resolve<FishingEventData>().SaveTransitionData(m_PotionData.EventID, m_PotionData.Token);
|
||
|
||
SyncData();
|
||
}
|
||
|
||
public int GetToken()
|
||
{
|
||
if (m_PotionData != null)
|
||
return m_PotionData.Token;
|
||
return 0;
|
||
}
|
||
|
||
public bool ConsumeTokens(int count)
|
||
{
|
||
bool isEnough = IsEnough(count);
|
||
if (isEnough == false) return false;
|
||
|
||
m_PotionData.ConsumedToken += count;
|
||
AddToken(-count);
|
||
return isEnough;
|
||
}
|
||
|
||
public bool IsEnough(int spend)
|
||
{
|
||
if (m_PotionData == null) return false;
|
||
return (m_PotionData.Token - spend) >= 0;
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 工具方法
|
||
public void ShuffleList(List<int> list, bool isSkip = false)
|
||
{
|
||
if (isSkip == true) return;
|
||
|
||
int count = list.Count;
|
||
for (int i = count - 1; i >= 0; i--)
|
||
{
|
||
int randomIndex = UnityEngine.Random.Range(0, i + 1);
|
||
int temp = list[randomIndex];
|
||
|
||
list[randomIndex] = list[i];
|
||
list[i] = temp;
|
||
}
|
||
}
|
||
#endregion
|
||
}
|
||
|
||
public class EventPotionData
|
||
{
|
||
private const string LocalKey = "epdlk"; // EventPotionData LocalKey, 首字母
|
||
|
||
public int EventID { get; set; }
|
||
public int PotionID { get; set; }
|
||
public int StageID { get; set; }
|
||
public int Stage1TotalLevel { get; set; }
|
||
public int Stage2TotalLevel { get; set; }
|
||
public int LevelID { get; set; }
|
||
public int LevelIndex { get; set; }
|
||
|
||
public int CorrectNum { get; set; }
|
||
public int SubmitNum { get; set; }
|
||
|
||
public PotionItemData LevelTargetData { get; set; } // 每一关上方的目标颜色排序
|
||
public List<PotionItemData> LevelProcessedList { get; set; } // 每一关的操作记录
|
||
public PotionItemData LevelDisplayData { get; set; } // 每一关下方的花瓶颜色排序
|
||
|
||
public bool IsOver { get; set; }
|
||
public int Token { get; set; }
|
||
public int ConsumedToken { get; set; }
|
||
|
||
public string Name { get; set; }
|
||
public int Rule { get; set; }
|
||
|
||
public int PreEventID { get; set; }
|
||
public int PrePotionID { get; set; }
|
||
public int PreStageID { get; set; }
|
||
public int PreLevelID { get; set; }
|
||
|
||
public int Round { get; set; }
|
||
public float InflationRate { get; set; }
|
||
public int FirstPlayedEventId { get; set; }
|
||
|
||
public EventPotionData()
|
||
{
|
||
EventID = -1;
|
||
PotionID = -1;
|
||
StageID = -1;
|
||
Stage1TotalLevel = -1;
|
||
Stage2TotalLevel = -1;
|
||
LevelID = -1;
|
||
LevelIndex = -1;
|
||
Round = -1;
|
||
|
||
LevelTargetData = new PotionItemData();
|
||
LevelProcessedList = new List<PotionItemData>();
|
||
LevelDisplayData = new PotionItemData();
|
||
|
||
IsOver = false;
|
||
Token = 0;
|
||
ConsumedToken = 0;
|
||
CorrectNum = 0;
|
||
SubmitNum = 0;
|
||
Rule = 0;
|
||
|
||
PreEventID = -1;
|
||
PrePotionID = -1;
|
||
PreStageID = -1;
|
||
PreLevelID = -1;
|
||
}
|
||
|
||
public void Clear()
|
||
{
|
||
LevelTargetData.Clear();
|
||
LevelProcessedList.Clear();
|
||
LevelDisplayData.Clear();
|
||
}
|
||
|
||
public void ClearAllLocalData()
|
||
{
|
||
//if (PlayerPrefs.HasKey(LocalKey) == false) return;
|
||
//PlayerPrefs.DeleteKey(LocalKey);
|
||
}
|
||
}
|
||
|
||
public struct EventPotionResource
|
||
{
|
||
public int TypeIndex { get; set; }
|
||
public int TypeCount { get; set; }
|
||
public string ItemResName { get; set; }
|
||
public string PaintResName { get; set; }
|
||
}
|
||
|
||
public class PotionItemData
|
||
{
|
||
public string name;
|
||
public int index;
|
||
public bool isOver = true;
|
||
|
||
public EventPotionDataType DataType = EventPotionDataType.Data_Wall;
|
||
public List<int> ColorTypeList = new List<int>(); // -1:已使用; 0:空; <100:sp_potion_1001; >100:sp_paint_1001
|
||
public List<EventPotionShelfType> ShelfTypeList = new List<EventPotionShelfType>();
|
||
public List<EventPotionGridState> GridStateList = new List<EventPotionGridState>();
|
||
public List<int> FromDisplayAreaIndexList = new List<int>();
|
||
|
||
public int GetColorType(int index)
|
||
{
|
||
return ColorTypeList[index];
|
||
}
|
||
public void SetColorType(int index, int type)
|
||
{
|
||
ColorTypeList[index] = type;
|
||
}
|
||
public EventPotionGridState GetGridState(int index)
|
||
{
|
||
return GridStateList[index];
|
||
}
|
||
public void SetGridState(int index, EventPotionGridState state)
|
||
{
|
||
GridStateList[index] = state;
|
||
}
|
||
public int GetFromDisplayAreaIndex(int index)
|
||
{
|
||
return FromDisplayAreaIndexList[index];
|
||
}
|
||
public void SetFromDisplayAreaIndex(int index, int value)
|
||
{
|
||
FromDisplayAreaIndexList[index] = value;
|
||
}
|
||
public void ResetFromDisplayAreaIndexList(int value)
|
||
{
|
||
int count = FromDisplayAreaIndexList.Count;
|
||
for (int i = 0; i < count; ++i)
|
||
{
|
||
FromDisplayAreaIndexList[i] = value;
|
||
}
|
||
}
|
||
public int GetValidColorTypeNum()
|
||
{
|
||
int num = 0;
|
||
int count = ColorTypeList.Count;
|
||
for (int i = 0; i < count; ++i)
|
||
{
|
||
if (ColorTypeList[i] > 0)
|
||
{
|
||
num++;
|
||
}
|
||
}
|
||
return num;
|
||
}
|
||
public void Log(string pre)
|
||
{
|
||
//Debug.LogError("--- PotionItemData " + pre + ", type:"+ DataType
|
||
// +", colorList:"+ Newtonsoft.Json.JsonConvert.SerializeObject(ColorTypeList)
|
||
// + ", fromList:"+ Newtonsoft.Json.JsonConvert.SerializeObject(FromDisplayAreaIndexList)
|
||
// + ", stateList:"+ Newtonsoft.Json.JsonConvert.SerializeObject(GridStateList));
|
||
}
|
||
public void Clear()
|
||
{
|
||
index = -1;
|
||
isOver = true;
|
||
ColorTypeList.Clear();
|
||
ShelfTypeList.Clear();
|
||
GridStateList.Clear();
|
||
FromDisplayAreaIndexList.Clear();
|
||
}
|
||
}
|
||
|
||
public class EventPotionConfig
|
||
{
|
||
public const string AtlasName = "event_potion_atlas";
|
||
public const string SAVE_DATA_KEY = "epdk"; // event potion data key
|
||
|
||
public const int PotionItemType_Used = -1; // 已使用
|
||
public const int PotionItemType_Empty = 0; // 空
|
||
|
||
public const string spine_potion_idle = "potion_idle"; // spine 动画
|
||
public const string spine_potion_shake_01_2 = "potion_shake_01_2"; // spine 动画
|
||
public const string spine_potion_shake_01_1 = "potion_shake_01_1"; // spine 动画
|
||
public const string spine_potion_shake_02 = "potion_shake_02"; // spine 动画
|
||
public const string spine_potion_shake_03 = "potion_shake_03"; // spine 动画
|
||
public const string spine_potion_pour_L = "potion_pour_L"; // spine 动画
|
||
public const string spine_potion_pour_R = "potion_pour_R"; // spine 动画
|
||
public const string spine_potion_fly = "potion_fly"; // spine 动画
|
||
|
||
public const string anim_gild_show = "gild_show"; // animation 动画
|
||
public const string anim_gild_jump = "gild_jump"; // animation 动画
|
||
public const string anim_gild_jump_down = "gild_jump_down"; // animation 动画
|
||
public const string anim_gild_success = "gild_success"; // animation 动画
|
||
public const string anim_gild_wrong = "gild_wrong"; // animation 动画
|
||
public const string anim_gild_settlement = "gild_settlement"; // animation 动画
|
||
public const string anim_gild_gap = "gild_gap"; // animation 动画
|
||
|
||
public const int Token_Consume_Num = 1; // 每次消耗代币数量
|
||
public const int Token_Return_Num = -1; // 每次返还代币数量
|
||
|
||
public const string key_first_check_wrong = "potion_kfcw"; // 第一次检测错误,本地存储数据key
|
||
public const string key_first_check_combination_wrong = "potion_kfccw"; // 第一次组合检测错误,本地存储数据key
|
||
}
|
||
public enum EventPotionDataType
|
||
{
|
||
Data_Wall, // 墙壁
|
||
Data_Item, // 数据
|
||
Data_ItemAndOperation // 数据并添加到操作区域
|
||
}
|
||
public enum EventPotionShelfType
|
||
{
|
||
Shelf_Default, // 置物架默认状态
|
||
Shelf_Success // 置物架成功状态
|
||
}
|
||
|
||
public enum EventPotionGridState
|
||
{
|
||
GridState_Invalid, // 无效
|
||
GridState_Empty, // 空
|
||
GridState_Occupied, // 占用中
|
||
GridState_Ok, // 对比成功
|
||
GridState_Wrong, // 对比失败
|
||
GridState_Over, // 已结束
|
||
}
|
||
public class EventPotionTokenUpdateData { }
|
||
public class EventPotionCloseCameraData { }
|
||
}
|