106 lines
4.0 KiB
C#
106 lines
4.0 KiB
C#
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using UnityEngine;
|
|||
|
|
|||
|
public class FunctionRewStateManager{
|
|||
|
|
|||
|
public static FunctionRewStateManager Instance;
|
|||
|
|
|||
|
public enum CopyEnum
|
|||
|
{
|
|||
|
daily = 0, // 日常
|
|||
|
equip, // 装备
|
|||
|
advance, // 进阶
|
|||
|
testing, // 试炼
|
|||
|
}
|
|||
|
|
|||
|
public struct CopyRemainTimeState
|
|||
|
{
|
|||
|
public CopyEnum type;
|
|||
|
public Dictionary<int, int> subTypeIndexAndCountDic;
|
|||
|
|
|||
|
public int totalRemainTimes;
|
|||
|
}
|
|||
|
|
|||
|
public CopyRemainTimeState[] copyBaseRemainTimeStateList = new CopyRemainTimeState[4];
|
|||
|
public int copyTotalRemainTime = 0;
|
|||
|
public void AddCopyBaseRewState(RespSyncCopyTimesForRedPoint packet)
|
|||
|
{
|
|||
|
copyTotalRemainTime = 0; //重置
|
|||
|
|
|||
|
CopyRemainTimeState equipInfo = new CopyRemainTimeState();
|
|||
|
equipInfo.type = CopyEnum.equip;
|
|||
|
equipInfo.totalRemainTimes = packet.copyEquipCount;
|
|||
|
copyBaseRemainTimeStateList[(int)CopyEnum.equip] = equipInfo;
|
|||
|
|
|||
|
//copyTotalRemainTime += packet.copyEquipCount;
|
|||
|
|
|||
|
CopyRemainTimeState advanceCopyInfo = new CopyRemainTimeState();
|
|||
|
advanceCopyInfo.type = CopyEnum.advance;
|
|||
|
var advanceRemainCount = 0;
|
|||
|
for (int index = 0; index < packet.copyAdvanceCountList.Count; index++)
|
|||
|
{
|
|||
|
advanceRemainCount += packet.copyAdvanceCountList[index].copyCount;
|
|||
|
|
|||
|
if (advanceCopyInfo.subTypeIndexAndCountDic == null)
|
|||
|
advanceCopyInfo.subTypeIndexAndCountDic = new Dictionary<int, int>();
|
|||
|
|
|||
|
advanceCopyInfo.subTypeIndexAndCountDic.Add(packet.copyAdvanceCountList[index].copyType, packet.copyAdvanceCountList[index].copyCount);
|
|||
|
}
|
|||
|
advanceCopyInfo.totalRemainTimes = advanceRemainCount;
|
|||
|
copyBaseRemainTimeStateList[(int)CopyEnum.advance] = advanceCopyInfo;
|
|||
|
|
|||
|
copyTotalRemainTime += advanceRemainCount;
|
|||
|
|
|||
|
CopyRemainTimeState testingCopyInfo = new CopyRemainTimeState();
|
|||
|
testingCopyInfo.type = CopyEnum.testing;
|
|||
|
var testingCopyRemainCount = 0;
|
|||
|
for (int index = 0; index < packet.copyTestCountList.Count; index++)
|
|||
|
{
|
|||
|
testingCopyRemainCount += packet.copyTestCountList[index].copyCount;
|
|||
|
|
|||
|
if (testingCopyInfo.subTypeIndexAndCountDic == null)
|
|||
|
testingCopyInfo.subTypeIndexAndCountDic = new Dictionary<int, int>();
|
|||
|
|
|||
|
testingCopyInfo.subTypeIndexAndCountDic.Add(packet.copyTestCountList[index].copyType, packet.copyTestCountList[index].copyCount);
|
|||
|
}
|
|||
|
testingCopyInfo.totalRemainTimes = testingCopyRemainCount;
|
|||
|
copyTotalRemainTime += testingCopyRemainCount;
|
|||
|
copyBaseRemainTimeStateList[(int)CopyEnum.testing] = testingCopyInfo;
|
|||
|
|
|||
|
CopyRemainTimeState dailyCopyInfo = new CopyRemainTimeState();
|
|||
|
dailyCopyInfo.type = CopyEnum.daily;
|
|||
|
dailyCopyInfo.totalRemainTimes = 0;
|
|||
|
for (int index = 0; index < packet.copyDailyCountList.Count; index++)
|
|||
|
{
|
|||
|
dailyCopyInfo.totalRemainTimes += packet.copyDailyCountList[index].copyCount;
|
|||
|
|
|||
|
if (dailyCopyInfo.subTypeIndexAndCountDic == null)
|
|||
|
dailyCopyInfo.subTypeIndexAndCountDic = new Dictionary<int, int>();
|
|||
|
|
|||
|
dailyCopyInfo.subTypeIndexAndCountDic.Add(packet.copyDailyCountList[index].copyType, packet.copyDailyCountList[index].copyCount);
|
|||
|
}
|
|||
|
copyTotalRemainTime += dailyCopyInfo.totalRemainTimes;
|
|||
|
copyBaseRemainTimeStateList[(int)CopyEnum.daily] = dailyCopyInfo;
|
|||
|
|
|||
|
if (FunctionButtonLogic.Instance())
|
|||
|
{
|
|||
|
FunctionButtonLogic.Instance().copyBtnFunc.ShowRemainTimeStateIcon(copyTotalRemainTime);
|
|||
|
}
|
|||
|
|
|||
|
//if (TestingCopyBseRootCtr.Instance)
|
|||
|
//{
|
|||
|
// TestingCopyBseRootCtr.Instance.RefreshMenuItemRemainTime();
|
|||
|
//}
|
|||
|
|
|||
|
if(CopyScenePanelCtr.Instance && CopyScenePanelCtr.Instance.isActiveAndEnabled)
|
|||
|
{
|
|||
|
CopyScenePanelCtr.Instance.ShowRemainTimeIcon();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public int GetopyRemainTime()
|
|||
|
{
|
|||
|
return copyTotalRemainTime >= 99 ? 99 : copyTotalRemainTime;
|
|||
|
}
|
|||
|
}
|