先修复一下,错误的场景 删除不必要的钓场资产 修复into场景 update:更新meta文件,修复报错 update:修复资源 修复第一章节建造 修复建造第三章 update:删除多余内容 update:更新README.md update:还原图标 update:更新README update:更新配置
94 lines
2.8 KiB
C#
94 lines
2.8 KiB
C#
using System;
|
|
using asap.core;
|
|
using game;
|
|
using GameCore;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class AccountSwitchPopupPanel : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
private Head currentAvatar;
|
|
[SerializeField]
|
|
private TMP_Text currentDisplayName;
|
|
[SerializeField]
|
|
private TMP_Text currentLevel;
|
|
|
|
[SerializeField]
|
|
private Toggle usingCurrentAccount;
|
|
|
|
[SerializeField]
|
|
private Head savedAvatar;
|
|
[SerializeField]
|
|
private TMP_Text savedDisplayName;
|
|
[SerializeField]
|
|
private TMP_Text savedLevel;
|
|
|
|
[SerializeField]
|
|
private Toggle usingSavedAccount;
|
|
|
|
|
|
[SerializeField]
|
|
private Button confirmBtn;
|
|
|
|
private AccountSwitchConfirmPopupPanel.ChangeLinkAccountData changeLinkAccountData = null;
|
|
|
|
private void OnEnable()
|
|
{
|
|
confirmBtn.onClick.AddListener(OnConfirm);
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
confirmBtn.onClick.RemoveListener(OnConfirm);
|
|
}
|
|
|
|
// public void SetData(string otherDisplayName, string otherAvatar, int otherLevel, int otherUserId, EAccoutType otherAccoutType)
|
|
// {
|
|
// var userService = GContext.container.Resolve<IUserService>();
|
|
// var playerData = GContext.container.Resolve<PlayerData>();
|
|
// currentDisplayName.text = userService.DisplayName;
|
|
// currentAvatar.SetData(userService.AvatarUrl);
|
|
// currentLevel.text = playerData.lv.ToString();
|
|
// usingCurrentAccount.isOn = otherLevel < playerData.lv;
|
|
//
|
|
// savedDisplayName.text = otherDisplayName;
|
|
// savedAvatar.SetData(otherAvatar);
|
|
// savedLevel.text = otherLevel.ToString();
|
|
//
|
|
// usingSavedAccount.isOn = otherLevel >= playerData.lv;
|
|
//
|
|
// changeLinkAccountData = new AccountSwitchConfirmPopupPanel.ChangeLinkAccountData()
|
|
// {
|
|
// accoutType = otherAccoutType,
|
|
// oldUserId = otherUserId,
|
|
// newUserId = int.Parse(userService.CustomId)
|
|
// };
|
|
// }
|
|
|
|
private async void OnConfirm()
|
|
{
|
|
try
|
|
{
|
|
var confirmGo = await UIManager.Instance.GetUIAsync(UITypes.AccountSwitchConfirmPopupPanel);
|
|
var confirmPanel = confirmGo.GetComponent<AccountSwitchConfirmPopupPanel>();
|
|
var isUsingSavedAccount = usingSavedAccount.isOn;
|
|
|
|
if (isUsingSavedAccount)
|
|
{
|
|
confirmPanel.SetData(savedDisplayName.text, savedAvatar.icon_head.sprite, int.Parse(savedLevel.text));
|
|
}
|
|
else
|
|
{
|
|
confirmPanel.SetData(currentDisplayName.text, currentAvatar.icon_head.sprite, int.Parse(currentLevel.text),
|
|
changeLinkAccountData);
|
|
}
|
|
UIManager.Instance.DestroyUI(UITypes.AccountSwitchPopupPanel);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
Debug.LogError(e);
|
|
}
|
|
}
|
|
} |