备份CatanBuilding瘦身独立工程
This commit is contained in:
51
Assets/Scripts/Services/FootPrintService.cs
Normal file
51
Assets/Scripts/Services/FootPrintService.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
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,
|
||||
}
|
||||
Reference in New Issue
Block a user