60 lines
1.4 KiB
C#
60 lines
1.4 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
|
|
{
|
|
[asap.core.Inject]
|
|
public game.PlayerDataStorage.IPlayerSaveStore SaveStore
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
private EFootPrint _footPrint;
|
|
public EFootPrint FootPrint => _footPrint;
|
|
public void UpdateFootPrint(EFootPrint newState)
|
|
{
|
|
_footPrint |= newState;
|
|
UploadData();
|
|
}
|
|
|
|
public void UploadData()
|
|
{
|
|
var data = (ulong)_footPrint;
|
|
SaveStore.Write("FootPrint", data.ToString()).RequireAccepted();
|
|
}
|
|
|
|
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,
|
|
IsFaceBookRewardLink = 1 << 7,
|
|
}
|