增加任务逻辑

This commit is contained in:
yaoyanwei
2025-09-02 16:58:21 +08:00
parent 1386d7d431
commit 011349132f
27 changed files with 1318 additions and 1 deletions

View File

@@ -0,0 +1,43 @@
using UnityEngine;
using TcgEngine.Client;
using TcgEngine.Gameplay;
namespace TcgEngine.Client
{
/// <summary>
/// 游戏客户端任务集成,用于将任务系统集成到游戏客户端中
/// </summary>
public class GameClientTaskIntegration : MonoBehaviour
{
private void Start()
{
// 在游戏客户端启动时初始化任务系统
GameClient client = GameClient.Get();
if (client != null)
{
// 玩家连接到游戏服务器时触发任务检查
client.onConnectServer += OnConnectToServer;
}
}
private void OnDestroy()
{
// 取消订阅事件
GameClient client = GameClient.Get();
if (client != null)
{
client.onConnectServer -= OnConnectToServer;
}
}
private void OnConnectToServer()
{
// 玩家登录时检查任务
TaskManager taskManager = TaskManager.Instance;
if (taskManager != null)
{
taskManager.OnPlayerLogin();
}
}
}
}