Files
back_cantanBuilding/Assets/Scripts/Services/FootPrintService.cs
2026-05-26 16:15:54 +08:00

52 lines
1.3 KiB
C#

using System;
public interface IFootPrintService
{
public EFootPrint FootPrint { get; }
public void UpdateFootPrint(EFootPrint newState);
public void UploadData();
public void LoadData(string data);
public bool HasFootPrint(EFootPrint state);
}
// ReSharper disable once ClassNeverInstantiated.Global
public class FootPrintService : IFootPrintService
{
private EFootPrint _footPrint;
public EFootPrint FootPrint => _footPrint;
public void UpdateFootPrint(EFootPrint newState)
{
_footPrint |= newState;
UploadData();
}
public void UploadData()
{
var data = (ulong)_footPrint;
PlayFabMgr.Instance.UpdateUserDataValue("FootPrint", data.ToString());
}
public void LoadData(string data)
{
_footPrint = (EFootPrint) ulong.Parse(data);
}
public bool HasFootPrint(EFootPrint state)
{
return (_footPrint & state) == state;
}
}
/// <summary>
/// Record Status. Max out at 64th record.
/// </summary>
[Flags]
public enum EFootPrint : int
{
HasCommunityGuidancePanelBeenOpened = 1 << 0,
IsFaceBookRewardClaimed = 1 << 1,
IsInstagramRewardClaimed = 1 << 2,
IsDiscordRewardClaimed = 1 << 3,
IsTiktokRewardClaimed = 1 << 4,
IsYouTubeRewardClaimed = 1 << 5,
IsEventCanGuidePoped = 1 << 6,
}