62 lines
2.0 KiB
C#
62 lines
2.0 KiB
C#
|
|
using UnityEngine;
|
||
|
|
using UnityEditor;
|
||
|
|
using Gameplay.Skill;
|
||
|
|
using cfg.SkillCfg;
|
||
|
|
using Framework;
|
||
|
|
|
||
|
|
namespace SkillEditor
|
||
|
|
{
|
||
|
|
public class CreateSummonHandler : BaseSkillActionHandler
|
||
|
|
{
|
||
|
|
private readonly DataSkill _skillConfig;
|
||
|
|
|
||
|
|
public CreateSummonHandler(DataSkill skillConfig)
|
||
|
|
{
|
||
|
|
_skillConfig = skillConfig;
|
||
|
|
}
|
||
|
|
|
||
|
|
public override void HandleAction(SkillActionClip clip)
|
||
|
|
{
|
||
|
|
if (clip == null) return;
|
||
|
|
|
||
|
|
DrawWarningLabel("id改为提前预先配置,然后通过index进行索引");
|
||
|
|
|
||
|
|
// 参数索引
|
||
|
|
clip.intId = EditorGUILayout.IntField("参数Index:(从0开始)", clip.intId);
|
||
|
|
|
||
|
|
// 创建位置类型
|
||
|
|
EditorGUILayout.BeginHorizontal();
|
||
|
|
EditorGUILayout.LabelField("创建位置类型:");
|
||
|
|
var createPosTypes = new int[] { 0, 1 };
|
||
|
|
clip.intParam1 = EditorGUILayout.IntPopup(clip.intParam1, SkillEditorConfig.CreatePosTypes, createPosTypes);
|
||
|
|
EditorGUILayout.EndHorizontal();
|
||
|
|
|
||
|
|
// 获取召唤物ID
|
||
|
|
var summonId = -1;
|
||
|
|
if (_skillConfig.ReferIds.Count > clip.intId)
|
||
|
|
{
|
||
|
|
summonId = _skillConfig.ReferIds[clip.intId];
|
||
|
|
}
|
||
|
|
|
||
|
|
if (summonId < 0)
|
||
|
|
{
|
||
|
|
ShowErrorMessage("index越界:" + clip.intId);
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 显示召唤物信息
|
||
|
|
if (EditorTableManager.instance.tables.SummonConfig.DataMap.TryGetValue(summonId, out var config))
|
||
|
|
{
|
||
|
|
EditorGUILayout.LabelField("召唤物id:" + config.RoleID);
|
||
|
|
EditorGUILayout.LabelField("召唤物名字:" + config.Name);
|
||
|
|
EditorGUILayout.LabelField("召唤物类型:" + config.LogicType);
|
||
|
|
EditorGUILayout.LabelField("召唤物存在时间:" + config.ExistTime);
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
ShowErrorMessage("无效的召唤物id:" + summonId);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|