备份CatanBuilding瘦身独立工程
This commit is contained in:
36
Assets/Scripts/UI/ShootingRange/BaseEventData.cs
Normal file
36
Assets/Scripts/UI/ShootingRange/BaseEventData.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using cfg;
|
||||
using UnityEngine;
|
||||
|
||||
public abstract class BaseEventData<T> where T: BaseEventRawData
|
||||
{
|
||||
private T _rawData;
|
||||
public int EventId => _rawData.EventId;
|
||||
public int RedirectId => _rawData.RedirectId;
|
||||
private string _key;
|
||||
|
||||
public virtual void UploadData()
|
||||
{
|
||||
PlayFabMgr.Instance.UpdateUserDataValue(_key, Newtonsoft.Json.JsonConvert.SerializeObject(_rawData));
|
||||
}
|
||||
|
||||
public virtual void LoadData(string s)
|
||||
{
|
||||
_rawData = Newtonsoft.Json.JsonConvert.DeserializeObject<T>(s);
|
||||
}
|
||||
|
||||
public abstract void UpdateData(FishingEvent e);
|
||||
|
||||
}
|
||||
|
||||
public abstract class BaseEventRawData
|
||||
{
|
||||
public readonly int EventId;
|
||||
public readonly int RedirectId;
|
||||
protected BaseEventRawData(int eventId, int redirectId)
|
||||
{
|
||||
EventId = eventId;
|
||||
RedirectId = redirectId;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user