```
docs(clipboard): 添加剪贴板功能相关图片资源 添加了两个剪贴板功能的截图文件,用于文档说明和功能展示。 ```
This commit is contained in:
1 parent
47f01ecd2e
commit
f93d69d8ee
77 files changed
+5482
-307
No files matched your search
@@ -0,0 +1,60 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerDataManager : MonoBehaviour
|
||||
{
|
||||
public static PlayerDataManager Instance { get; private set; }
|
||||
|
||||
[Header("玩家拥有的角色(临时写死)")]
|
||||
public List<PlayerCharacterData> ownedCharacters = new List<PlayerCharacterData>();
|
||||
|
||||
[Header("当前卡组(临时写死)")]
|
||||
public PlayerCharacterData[] currentDeck = new PlayerCharacterData[5];
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (Instance != null && Instance != this)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
return;
|
||||
}
|
||||
Instance = this;
|
||||
|
||||
InitializeTempData();
|
||||
}
|
||||
|
||||
private void InitializeTempData()
|
||||
{
|
||||
ownedCharacters.Clear();
|
||||
|
||||
ownedCharacters.Add(new PlayerCharacterData("human_soldier", 1, 0));
|
||||
ownedCharacters.Add(new PlayerCharacterData("archer", 1, 0));
|
||||
|
||||
currentDeck[0] = ownedCharacters[0];
|
||||
currentDeck[1] = ownedCharacters[1];
|
||||
}
|
||||
|
||||
public PlayerCharacterData GetCharacterData(string characterId)
|
||||
{
|
||||
return ownedCharacters.Find(c => c.characterId == characterId);
|
||||
}
|
||||
|
||||
public PlayerCharacterData GetDeckCharacter(int slot)
|
||||
{
|
||||
if (slot < 0 || slot >= currentDeck.Length)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return currentDeck[slot];
|
||||
}
|
||||
|
||||
public void UpgradeCharacter(string characterId)
|
||||
{
|
||||
var character = GetCharacterData(characterId);
|
||||
if (character != null)
|
||||
{
|
||||
character.level++;
|
||||
Debug.Log($"角色 {characterId} 升级到 {character.level} 级");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user