增加任务逻辑
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 222f46c5f21da1d47a9d2fed11d3d48c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user