上传UI信息和替换,修正战斗页面的UI处理

This commit is contained in:
YiHan0621
2025-09-26 14:32:52 +08:00
parent 25cf205770
commit eba34c083a
29 changed files with 615 additions and 672 deletions

View File

@@ -45,14 +45,14 @@ namespace TcgEngine.Client
return;
CardbackData cb = CardbackData.Get(player.cardback);
string targetDeckPath = cb != null && !string.IsNullOrEmpty(cb.deck_path) ? cb.deck_path : "Cardbacks/deck_silver.png";
string targetDeckPath = cb != null && !string.IsNullOrEmpty(cb.deck_path) ? cb.deck_path : "Cardbacks/Load_card_group.png";
if (deck_render != null && (deck_render.sprite == null || prev_deck_path != targetDeckPath))
{
Sprite sprite = SpriteLoader.Get()?.LoadSprite(targetDeckPath);
if (sprite != null)
{
deck_render.sprite = sprite;
deck_render.gameObject.transform.localScale = Vector3.one * 0.5f;
deck_render.gameObject.transform.localScale = Vector3.one;
prev_deck_path = targetDeckPath;
}
else

View File

@@ -57,6 +57,9 @@ namespace TcgEngine.Gameplay
// 订阅游戏事件
gameClient = FindFirstObjectByType<GameClient>();
gameClient = GameClient.Get();
ApiClient client = ApiClient.Get();
if (gameClient != null)
{
LoadTasks();
@@ -65,6 +68,17 @@ namespace TcgEngine.Gameplay
gameClient.onGameEnd += OnGameEnd;
// gameClient.onConnectServer?.Invoke();
}
// else if (client.UserData != null)
// {
// LoadTasks();
// LoadPlayerData();
// client.onLogin += OnGameStart;
// client.onLogin += OnGameEnd;
// }
else
{
Debug.Log("绑定失败!");
}
// 移除对GameLogic.Instance的错误引用改为检查gameLogic变量
if (gameLogic != null)
@@ -548,6 +562,11 @@ namespace TcgEngine.Gameplay
UpdateTaskProgress(TaskConditionType.PlayGames);
}
private void OnGameStart(LoginResponse login)
{
UpdateTaskProgress(TaskConditionType.PlayGames);
}
private void OnGameEnd(int winner)
{
int player_id = GameClient.Get().GetPlayerID();

View File

@@ -1,31 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using TcgEngine;
using TcgEngine.Gameplay;
using TcgEngine.Client;
using System.Threading.Tasks;
namespace TcgEngine.Gameplay
{
/// <summary>
/// 任务管理器,负责任务的分配、进度追踪和奖励发放等功能
/// </summary>
public class TaskManagerGx : MonoBehaviour
{
public List<PlayerTask> PlayerTasks = new List<PlayerTask>();
public async void SavePayerData()
{
PlayerTasksResponse saveData = new PlayerTasksResponse();
// PlayerTaskResponse[] taskResponses = new PlayerTaskResponse[ taskResponses.taskId="login_task_1",
// assignedTime=1757067900,
// taskResponses.expireTime=1757154300,
// taskResponses.status=2,
// taskResponses.progress=1]
;
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 7d388b20392c45e6b37f010373e2c729
timeCreated: 1757061071

View File

@@ -128,6 +128,9 @@ namespace TcgEngine.UI
}
}
/// <summary>
/// 添加好友请求
/// </summary>
private async void AddFriend(string fuser)
{
FriendAddRequest req = new FriendAddRequest();
@@ -147,6 +150,9 @@ namespace TcgEngine.UI
}
}
/// <summary>
/// 移除好友请求
/// </summary>
private async void RemoveFriend(string fuser)
{
FriendAddRequest req = new FriendAddRequest();

View File

@@ -50,6 +50,7 @@ namespace TcgEngine.UI
public InputField user_password_new;
public InputField user_password_confirm;
public Button edit_change_email;
public Button edit_email_text;
public Button edit_change_password;
public Button resend_button;
public Button confirm_button;
@@ -72,6 +73,14 @@ namespace TcgEngine.UI
foreach (CardbackUI icon in cardbacks)
icon.onClick += OnClickCardback;
}
protected override void Start()
{
base.Start();
renameButton.onClick.AddListener(OnPlayerRename);
edit_change_email.onClick.AddListener(OnClickChangeEmail);
}
protected override void Update()
{
@@ -79,11 +88,7 @@ namespace TcgEngine.UI
}
protected override void Start()
{
base.Start();
renameButton.onClick.AddListener(OnPlayerRename);
}
private async void LoadData()
{
@@ -268,6 +273,7 @@ namespace TcgEngine.UI
user_password_confirm.readOnly = true;
user_password_new.gameObject.SetActive(false);
user_password_confirm.gameObject.SetActive(false);
edit_email_text.gameObject.SetActive(false);
UserData udata = Authenticator.Get().UserData;
user_email.text = udata.email;
@@ -282,6 +288,9 @@ namespace TcgEngine.UI
edit_panel.Show();
}
/// <summary>
/// 点击更改密码
/// </summary>
public void OnClickChangePass()
{
OnClickEdit();
@@ -300,6 +309,9 @@ namespace TcgEngine.UI
user_password_prev.Select();
}
/// <summary>
/// 点击更改邮箱
/// </summary>
public void OnClickChangeEmail()
{
OnClickEdit();
@@ -308,9 +320,13 @@ namespace TcgEngine.UI
edit_change_password.gameObject.SetActive(false);
resend_button.gameObject.SetActive(false);
confirm_button.gameObject.SetActive(true);
edit_email_text.gameObject.SetActive(true);
user_email.Select();
}
/// <summary>
/// 重新发送确认请求
/// </summary>
public async void OnClickResendConfirm()
{
edit_error.text = "";

View File

@@ -6,8 +6,8 @@ using UnityEngine;
namespace TcgEngine
{
/// <summary>
/// This authenticator require external UserLogin API asset
/// It works with an actual web API and database containing all user info
/// 此身份验证器需要外部用户登录API资产
/// 它与包含所有用户信息的实际Web API和数据库一起工作
/// </summary>
public class AuthenticatorApi : Authenticator