101 lines
3.5 KiB
C#
101 lines
3.5 KiB
C#
using cfg.BulletCfg;
|
|
using UnityEngine;
|
|
using UnityEditor;
|
|
using Gameplay.Skill;
|
|
using cfg.SkillCfg;
|
|
using Framework;
|
|
using Gameplay.Bullet;
|
|
|
|
namespace SkillEditor
|
|
{
|
|
public interface ISkillActionHandler
|
|
{
|
|
void HandleAction(SkillActionClip clip);
|
|
}
|
|
|
|
public abstract class BaseSkillActionHandler : ISkillActionHandler
|
|
{
|
|
protected void DrawCenteredLabel(string text, Color color)
|
|
{
|
|
var style = new GUIStyle(EditorStyles.label) { alignment = TextAnchor.MiddleCenter };
|
|
style.normal.textColor = color;
|
|
EditorGUILayout.LabelField(text, style);
|
|
}
|
|
|
|
protected void ShowErrorMessage(string message)
|
|
{
|
|
EditorGUILayout.HelpBox(message, MessageType.Error);
|
|
}
|
|
|
|
protected void ShowInfoMessage(string message)
|
|
{
|
|
EditorGUILayout.HelpBox(message, MessageType.Info);
|
|
}
|
|
|
|
protected void DrawWarningLabel(string text)
|
|
{
|
|
DrawCenteredLabel(text, SkillEditorConfig.WarningTextColor);
|
|
}
|
|
|
|
protected void DrawBulletInfo(SkillActionClip clip, DataSkill skillConfig)
|
|
{
|
|
clip.intId = EditorGUILayout.IntField("参数Index:(从0开始)", clip.intId);
|
|
var skillId = -1;
|
|
if (skillConfig.ReferIds.Count > clip.intId)
|
|
{
|
|
skillId = skillConfig.ReferIds[clip.intId];
|
|
}
|
|
if (skillId < 0)
|
|
{
|
|
ShowErrorMessage("index越界:" + clip.intId);
|
|
return;
|
|
}
|
|
|
|
if (EditorTableManager.instance.tables.BulletConfig.DataMap.TryGetValue(skillId, out var config))
|
|
{
|
|
EditorGUILayout.LabelField("子弹名字:" + config.Name);
|
|
EditorGUILayout.LabelField("子弹索敌类型:" + config.LockType);
|
|
switch (config.LockType)
|
|
{
|
|
case ELockType.None:
|
|
EditorGUILayout.LabelField("无弹道子弹");
|
|
break;
|
|
case ELockType.LockPos:
|
|
EditorGUILayout.LabelField("位置锁定导弹");
|
|
EditorGUILayout.LabelField("子弹飞行速度:" + config.FlySpeed);
|
|
_DrawBulletBoomInfo(config.AreaId);
|
|
break;
|
|
case ELockType.LockUnit:
|
|
EditorGUILayout.LabelField("目标锁定导弹");
|
|
EditorGUILayout.LabelField("子弹飞行速度:" + config.FlySpeed);
|
|
break;
|
|
default:
|
|
EditorGUILayout.LabelField($"子弹类型:{config.LockType} - 暂不支持的子弹类型");
|
|
break;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ShowErrorMessage("无效的子弹id:" + skillId);
|
|
}
|
|
}
|
|
|
|
private void _DrawBulletBoomInfo(int bulletAreaId)
|
|
{
|
|
EditorGUILayout.LabelField("爆炸区域ID:" + bulletAreaId);
|
|
if (EditorTableManager.instance.tables.AreaConfig.DataMap.TryGetValue((int)bulletAreaId, out var config))
|
|
{
|
|
EditorGUILayout.LabelField("爆炸区域名字:" + config.Name);
|
|
EditorGUILayout.LabelField("爆炸区域描述:" + config.DESC);
|
|
}
|
|
else
|
|
{
|
|
EditorGUILayout.HelpBox("无效的爆炸区域id:" + bulletAreaId, MessageType.Error);
|
|
}
|
|
|
|
}
|
|
|
|
public abstract void HandleAction(SkillActionClip clip);
|
|
}
|
|
}
|