52 lines
1.9 KiB
C#
52 lines
1.9 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEditor;
|
|
|
|
namespace BFEditor
|
|
{
|
|
[CustomEditor(typeof(BF.BattleUnitAttr))]
|
|
public class BattleUnitAttrInspector : Editor
|
|
{
|
|
BF.BattleUnitAttr helper;
|
|
void OnEnable()
|
|
{
|
|
helper = target as BF.BattleUnitAttr;
|
|
}
|
|
|
|
public override void OnInspectorGUI()
|
|
{
|
|
DrawAttribute();
|
|
DrawButton();
|
|
}
|
|
|
|
private void DrawAttribute()
|
|
{
|
|
helper.UnitAttribute.hp = EditorGUILayout.LongField("生命(hp)", helper.UnitAttribute.hp);
|
|
helper.UnitAttribute.max_hp = EditorGUILayout.LongField("最大生命(max_hp)", helper.UnitAttribute.max_hp);
|
|
helper.UnitAttribute.atk = EditorGUILayout.LongField("无属性攻击力(atk)", helper.UnitAttribute.atk);
|
|
helper.UnitAttribute.atk_red = EditorGUILayout.LongField("攻击力红(atk_red)", helper.UnitAttribute.atk_red);
|
|
helper.UnitAttribute.atk_yellow = EditorGUILayout.LongField("攻击力黄(atk_yellow)", helper.UnitAttribute.atk_yellow);
|
|
helper.UnitAttribute.atk_green = EditorGUILayout.LongField("攻击力绿(atk_green)", helper.UnitAttribute.atk_green);
|
|
helper.UnitAttribute.atk_blue = EditorGUILayout.LongField("攻击力蓝(atk_blue)", helper.UnitAttribute.atk_blue);
|
|
helper.UnitAttribute.atk_purple = EditorGUILayout.LongField("攻击力紫(atk_purple)", helper.UnitAttribute.atk_purple);
|
|
helper.UnitAttribute.sheild_hp = EditorGUILayout.LongField("护盾(sheild_hp)", helper.UnitAttribute.sheild_hp);
|
|
}
|
|
|
|
private void DrawButton()
|
|
{
|
|
GUILayout.BeginHorizontal();
|
|
if (GUILayout.Button("刷新属性", GUILayout.Width(120)))
|
|
{
|
|
GetAttributeData();
|
|
}
|
|
GUILayout.EndHorizontal();
|
|
}
|
|
|
|
private void GetAttributeData()
|
|
{
|
|
helper.TryGetAttributeFromLua();
|
|
}
|
|
}
|
|
}
|