miduo_client/Assets/Scripts/Debug/RoleProperty.cs

78 lines
1.9 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System.Collections.Generic;
using System.IO;
using System.Linq;
using UnityEngine;
public class RoleProperty : MonoBehaviour
{
private static string[] ERoleProperty = {
"等级",
"生命",
"最大生命",
"攻击力",
"护甲",
"魔抗",
"速度",
"伤害加成系数(%",
"伤害减免系数(%",
"施法率(%",
"后期基础施法率(%",
"暴击率(%",
"暴击伤害系数(%",
"抗暴率(%",
"治疗加成系数(%",
"受到治疗加成系数(%",
"队伍伤害加成系数(%",
"队伍伤害减免系数(%",
"火系伤害减免系数(%",
"风系伤害减免系数(%",
"冰系伤害减免系数(%",
"地系伤害减免系数(%",
"光系伤害减免系数(%",
"暗系伤害减免系数(%",
"属性伤害加成系数(%",
"初始怒气值",
};
private Dictionary<string, float> _dic = new Dictionary<string, float>();
private void Awake()
{
if (!Directory.Exists(Application.dataPath + "/../BattleRecord"))
{
Directory.CreateDirectory(Application.dataPath + "/../BattleRecord");
}
}
public int uid;
public void AddProperty(int id, float value)
{
string name = ERoleProperty[id-1];
if (!_dic.ContainsKey(name))
{
_dic.Add(name, value);
}
else
{
_dic[name] = value;
}
}
public void SetValue(int id, float value)
{
string name = ERoleProperty[id - 1];
if (_dic.ContainsKey(name))
{
_dic[name] = value;
}
}
public float GetValue(string name)
{
return _dic[name];
}
public string[] GetNames()
{
return _dic.Keys.ToArray();
}
}