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 = {
"等级",
"生命",
"最大生命",
"攻击力",
"护甲",
"魔抗",
"速度",
"伤害加成系数(%",
"伤害减免系数(%",
"命中lv%",
"闪避率(%",
"暴击率(%",
"暴击伤害系数(%",
"抗暴率(%",
"治疗加成系数(%",
"受到治疗加成系数(%",
"人系伤害加成(%",
"佛系伤害加成(%",
"妖系伤害加成(%",
"道系伤害加成(%",
"人系伤害减免(%",
"佛系伤害减免(%",
"妖系伤害减免(%",
"道系伤害减免(%",
"暴击伤害减免(%",
"初始怒气值",
};
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();
}
}