feat(upserver): 保存M2客户端KV迁移至本人统计写检查点
保存独立KV用户服务、固定会话存档与原业务接线,以及C3d资料缓存和C3e本人统计写。 保留原PF/AGG路线、业务公式和时序;榜单读取、好友资料、公告、匹配及首场景闸仍待完成。 验证:ServiceHost两条件各33组646断言;Unity CLI Loop编译0错误269警告。 包含相关方案、评审裁决、测试及状态文档。未操作服务器、正式账号或打包。
This commit is contained in:
@@ -0,0 +1,111 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class LuckyTaskBtn : MonoBehaviour, IUIRedPoint
|
||||
{
|
||||
game.PlayerDataStorage.IPlayerSaveStore saveStore;
|
||||
|
||||
Button btn;
|
||||
ILuckyTaskGetData model;
|
||||
|
||||
public string key;
|
||||
public GameObject redPoint;
|
||||
public GameObject redpoint_big;
|
||||
public TMP_Text text_redpoint_big;
|
||||
void Awake()
|
||||
{
|
||||
saveStore = GContext.container.Resolve<game.PlayerDataStorage.IPlayerSaveStore>();
|
||||
btn = GetComponent<Button>();
|
||||
btn.onClick.AddListener(OnClick);
|
||||
}
|
||||
public void Init(ILuckyTaskGetData model, string key)
|
||||
{
|
||||
this.model = model;
|
||||
this.key = key;
|
||||
SetKey();
|
||||
}
|
||||
async void OnClick()
|
||||
{
|
||||
if (model != null)
|
||||
{
|
||||
GameObject taskPanelName = await UIManager.Instance.ShowUI(new UIType(model.TaskPanelName));
|
||||
if (this == null || !saveStore.IsCurrent) return;
|
||||
if (taskPanelName != null)
|
||||
{
|
||||
var panel = taskPanelName.GetComponent<LuckyTaskPanelBase>();
|
||||
if (panel != null)
|
||||
{
|
||||
panel.Init(model);
|
||||
int count = RedPointManager.Instance.GetRedPointCount(key);
|
||||
RedPointManager.Instance.SetRedPointState(key, count > 0, count);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(key))
|
||||
{
|
||||
RedPointManager.Instance.RemoveRedPoint(key);
|
||||
key = "";
|
||||
}
|
||||
}
|
||||
public void SetKey()
|
||||
{
|
||||
RedPointManager.Instance.AddRedPoint(key, this);
|
||||
SetRedPointState(RedPointManager.Instance.GetRedPointState(key));
|
||||
}
|
||||
|
||||
public void SetRedPointState(bool state)
|
||||
{
|
||||
int count = RedPointManager.Instance.GetRedPointCount(key);
|
||||
if (!state)
|
||||
{
|
||||
string adData = saveStore.Read(LuckyTaskData.ADTaskADKey).ValueOrThrow();
|
||||
if (!string.IsNullOrEmpty(adData))
|
||||
{
|
||||
string[] strings = adData.Split("|");
|
||||
int day = -1;
|
||||
int curDay = ZZTimeHelper.UtcNow().UtcNowOffset().DayOfYear;
|
||||
if (strings.Length != 2 || !int.TryParse(strings[1], out day) || day != curDay)
|
||||
{
|
||||
state = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
state = true;
|
||||
}
|
||||
}
|
||||
if (redpoint_big != null && text_redpoint_big != null)
|
||||
{
|
||||
if (count > 1)
|
||||
{
|
||||
redpoint_big.SetActive(true);
|
||||
if (count > 99)
|
||||
{
|
||||
text_redpoint_big.text = "99+";
|
||||
}
|
||||
else
|
||||
{
|
||||
text_redpoint_big.text = count.ToString();
|
||||
}
|
||||
state = false;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
redpoint_big.SetActive(false);
|
||||
}
|
||||
}
|
||||
if (redPoint != null)
|
||||
{
|
||||
redPoint.SetActive(state);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user