修复问题,优化bug和游戏,resource资源拆迁
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
|
||||
[CreateAssetMenu(fileName = "NewAllyHero", menuName = "SO_Data/AllyHero")]
|
||||
@@ -171,4 +171,34 @@ public class AllyHero_SO : ScriptableObject
|
||||
if (best == null) return levelStats[0];
|
||||
return best;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
private class EquippedSkillGroupIDsPayload
|
||||
{
|
||||
public int[] equippedSkillGroupIDs;
|
||||
}
|
||||
|
||||
private string GetEquippedSkillsPrefsKey()
|
||||
{
|
||||
return "ally_equippedSkillGroupIDs_" + ally_heroID;
|
||||
}
|
||||
|
||||
public void SaveEquippedSkillsToLocal()
|
||||
{
|
||||
var payload = new EquippedSkillGroupIDsPayload { equippedSkillGroupIDs = equippedSkillGroupIDs ?? new int[0] };
|
||||
string json = JsonUtility.ToJson(payload);
|
||||
PlayerPrefs.SetString(GetEquippedSkillsPrefsKey(), json);
|
||||
PlayerPrefs.Save();
|
||||
}
|
||||
|
||||
public void LoadEquippedSkillsFromLocal()
|
||||
{
|
||||
string key = GetEquippedSkillsPrefsKey();
|
||||
if (!PlayerPrefs.HasKey(key)) return;
|
||||
string json = PlayerPrefs.GetString(key, "");
|
||||
if (string.IsNullOrEmpty(json)) return;
|
||||
var payload = JsonUtility.FromJson<EquippedSkillGroupIDsPayload>(json);
|
||||
if (payload == null) return;
|
||||
equippedSkillGroupIDs = payload.equippedSkillGroupIDs ?? new int[0];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user