216 lines
8.6 KiB
C#
216 lines
8.6 KiB
C#
|
using Thousandto.Code.Logic;
|
|||
|
using Thousandto.SkillEditor;
|
|||
|
using Thousandto.SkillEditor.DIY;
|
|||
|
using Thousandto.SkillEditor.Support;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.IO;
|
|||
|
using System.Text.RegularExpressions;
|
|||
|
using UnityEditor;
|
|||
|
using UnityEngine;
|
|||
|
|
|||
|
namespace Thousandto.SkillEditor.DIY
|
|||
|
{
|
|||
|
public class SkillCreateEventMenu
|
|||
|
{
|
|||
|
[MenuItem("CONTEXT/SkillEvent/Delete")]
|
|||
|
private static void DeleteEvent(MenuCommand command)
|
|||
|
{
|
|||
|
var paramsArray = command.context.name.Split(';');
|
|||
|
var skillName = paramsArray[1];
|
|||
|
var eventID = int.Parse(paramsArray[2]);
|
|||
|
var curSkill = SkillEditorData.FindSkill(skillName);
|
|||
|
if (curSkill != null)
|
|||
|
{
|
|||
|
var skillEvent = curSkill.FindEventByID(eventID);
|
|||
|
if (skillEvent != null)
|
|||
|
{
|
|||
|
if(SkillEventEditor.EventInfo == skillEvent)
|
|||
|
{
|
|||
|
SkillEventEditor.Hide();
|
|||
|
}
|
|||
|
curSkill.DataList.Remove(skillEvent);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
[MenuItem("CONTEXT/SkillEvent/Delete", true)]
|
|||
|
private static bool IsShowDeleteMenu(MenuCommand command)
|
|||
|
{
|
|||
|
if (command.context != null && command.context.name.StartsWith("edit"))
|
|||
|
{
|
|||
|
return true;
|
|||
|
}
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
[MenuItem("CONTEXT/SkillEvent/Copy")]
|
|||
|
private static void CopyEvent(MenuCommand command)
|
|||
|
{
|
|||
|
var paramsArray = command.context.name.Split(';');
|
|||
|
var skillName = paramsArray[1];
|
|||
|
var eventID = int.Parse(paramsArray[2]);
|
|||
|
var curSkill = SkillEditorData.FindSkill(skillName);
|
|||
|
if (curSkill != null)
|
|||
|
{
|
|||
|
var skillEvent = curSkill.FindEventByID(eventID);
|
|||
|
if (skillEvent != null)
|
|||
|
{
|
|||
|
SkillBaseEventInfo newEvent = SkillVisualInfoLoader.NewEventInfo(skillEvent.EventType);
|
|||
|
newEvent.EventID = curSkill.GetCanUseEventID(skillEvent.EventFrame);
|
|||
|
newEvent.EventFrame = skillEvent.EventFrame;
|
|||
|
newEvent.EventType = skillEvent.EventType;
|
|||
|
newEvent.ParseData(skillEvent.ToString());
|
|||
|
curSkill.DataList.Add(newEvent);
|
|||
|
|
|||
|
if(SkillEventEditor.IsOpen)
|
|||
|
{
|
|||
|
SkillEventEditor.Open(newEvent);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
[MenuItem("CONTEXT/SkillEvent/Copy", true)]
|
|||
|
private static bool IsShowCopyMenu(MenuCommand command)
|
|||
|
{
|
|||
|
if (command.context != null && command.context.name.StartsWith("edit"))
|
|||
|
{
|
|||
|
return true;
|
|||
|
}
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
private static void NewEvent(string commandString, SkillEventDefine eventType)
|
|||
|
{
|
|||
|
var paramsArray = commandString.Split(';');
|
|||
|
var skillName = paramsArray[1];
|
|||
|
var param2 = int.Parse(paramsArray[2]);
|
|||
|
|
|||
|
var curSkill = SkillEditorData.FindSkill(skillName);
|
|||
|
if (curSkill != null)
|
|||
|
{
|
|||
|
int frameIndex = 0;
|
|||
|
if (commandString.StartsWith("edit"))
|
|||
|
{
|
|||
|
var skillEvent = curSkill.FindEventByID(param2);
|
|||
|
if (skillEvent != null)
|
|||
|
{
|
|||
|
frameIndex = skillEvent.EventFrame;
|
|||
|
}
|
|||
|
}
|
|||
|
else if (commandString.StartsWith("create"))
|
|||
|
{
|
|||
|
frameIndex = param2;
|
|||
|
}
|
|||
|
|
|||
|
var newEvent = SkillVisualInfoLoader.NewEventInfo(eventType);
|
|||
|
if (newEvent != null)
|
|||
|
{
|
|||
|
newEvent.EventID = curSkill.GetCanUseEventID(frameIndex);
|
|||
|
newEvent.EventFrame = frameIndex;
|
|||
|
newEvent.EventType = eventType;
|
|||
|
newEvent.ParseData(string.Empty);
|
|||
|
curSkill.DataList.Add(newEvent);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
[MenuItem("CONTEXT/SkillEvent/Create/播放动作", true)]
|
|||
|
[MenuItem("CONTEXT/SkillEvent/Create/播放减速效果", true)]
|
|||
|
[MenuItem("CONTEXT/SkillEvent/Create/禁止移动", true)]
|
|||
|
[MenuItem("CONTEXT/SkillEvent/Create/禁止转向", true)]
|
|||
|
[MenuItem("CONTEXT/SkillEvent/Create/播放弹道效果(锁定)", true)]
|
|||
|
[MenuItem("CONTEXT/SkillEvent/Create/播放简单召唤物", true)]
|
|||
|
[MenuItem("CONTEXT/SkillEvent/Create/播放复杂召唤物", true)]
|
|||
|
[MenuItem("CONTEXT/SkillEvent/Create/播放自身移动", true)]
|
|||
|
[MenuItem("CONTEXT/SkillEvent/Create/隐藏武器", true)]
|
|||
|
[MenuItem("CONTEXT/SkillEvent/Create/隐藏武器", true)]
|
|||
|
private static bool IsShowCreateEventMenu(MenuCommand command)
|
|||
|
{
|
|||
|
var paramsArray = command.context.name.Split(';');
|
|||
|
var skillName = paramsArray[1];
|
|||
|
|
|||
|
var curSkill = SkillEditorData.FindSkill(skillName);
|
|||
|
if (curSkill != null && curSkill.IsSkillObject)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
return true;
|
|||
|
}
|
|||
|
[MenuItem("CONTEXT/SkillEvent/Create/播放动作")]
|
|||
|
private static void CreatePlayAnim(MenuCommand command)
|
|||
|
{
|
|||
|
NewEvent(command.context.name, SkillEventDefine.PlayAnimation);
|
|||
|
}
|
|||
|
[MenuItem("CONTEXT/SkillEvent/Create/播放特效")]
|
|||
|
private static void CreatePlayVfx(MenuCommand command)
|
|||
|
{
|
|||
|
NewEvent(command.context.name, SkillEventDefine.PlayVfx);
|
|||
|
}
|
|||
|
[MenuItem("CONTEXT/SkillEvent/Create/播放音效")]
|
|||
|
private static void CreatePlaySfx(MenuCommand command)
|
|||
|
{
|
|||
|
NewEvent(command.context.name, SkillEventDefine.PlaySfx);
|
|||
|
}
|
|||
|
[MenuItem("CONTEXT/SkillEvent/Create/播放摄像机震动")]
|
|||
|
private static void CreatePlayCameraShake(MenuCommand command)
|
|||
|
{
|
|||
|
NewEvent(command.context.name, SkillEventDefine.PlayCameraShake);
|
|||
|
}
|
|||
|
[MenuItem("CONTEXT/SkillEvent/Create/播放模糊效果")]
|
|||
|
private static void CreatePlayRadiaBlur(MenuCommand command)
|
|||
|
{
|
|||
|
NewEvent(command.context.name, SkillEventDefine.PlayBlur);
|
|||
|
}
|
|||
|
[MenuItem("CONTEXT/SkillEvent/Create/播放减速效果")]
|
|||
|
private static void CreatePlaySlow(MenuCommand command)
|
|||
|
{
|
|||
|
NewEvent(command.context.name, SkillEventDefine.PlaySlow);
|
|||
|
}
|
|||
|
[MenuItem("CONTEXT/SkillEvent/Create/禁止移动")]
|
|||
|
private static void CreateDisableMove(MenuCommand command)
|
|||
|
{
|
|||
|
NewEvent(command.context.name, SkillEventDefine.DisableMove);
|
|||
|
}
|
|||
|
[MenuItem("CONTEXT/SkillEvent/Create/禁止转向")]
|
|||
|
private static void CreateDisableChangeDir(MenuCommand command)
|
|||
|
{
|
|||
|
NewEvent(command.context.name, SkillEventDefine.DisableChangeDir);
|
|||
|
}
|
|||
|
[MenuItem("CONTEXT/SkillEvent/Create/播放自身移动")]
|
|||
|
private static void CreatePlaySelfMove(MenuCommand command)
|
|||
|
{
|
|||
|
NewEvent(command.context.name, SkillEventDefine.PlaySelfMove);
|
|||
|
}
|
|||
|
[MenuItem("CONTEXT/SkillEvent/Create/播放产生伤害效果")]
|
|||
|
private static void CreatePlayHit(MenuCommand command)
|
|||
|
{
|
|||
|
NewEvent(command.context.name, SkillEventDefine.PlayHit);
|
|||
|
}
|
|||
|
[MenuItem("CONTEXT/SkillEvent/Create/播放弹道效果(锁定)")]
|
|||
|
private static void CreatePlayCollider(MenuCommand command)
|
|||
|
{
|
|||
|
NewEvent(command.context.name, SkillEventDefine.PlayLockTrajectory);
|
|||
|
}
|
|||
|
[MenuItem("CONTEXT/SkillEvent/Create/播放简单召唤物")]
|
|||
|
private static void CreatePlaySimpleSkillObject(MenuCommand command)
|
|||
|
{
|
|||
|
NewEvent(command.context.name, SkillEventDefine.PlaySimpleSkillObject);
|
|||
|
}
|
|||
|
[MenuItem("CONTEXT/SkillEvent/Create/播放复杂召唤物")]
|
|||
|
private static void CreatePlaySkillObject(MenuCommand command)
|
|||
|
{
|
|||
|
NewEvent(command.context.name, SkillEventDefine.PlaySkillObject);
|
|||
|
}
|
|||
|
[MenuItem("CONTEXT/SkillEvent/Create/隐藏武器")]
|
|||
|
private static void CreatePlayHideWeapon(MenuCommand command)
|
|||
|
{
|
|||
|
NewEvent(command.context.name, SkillEventDefine.PlayHideWeapon);
|
|||
|
}
|
|||
|
[MenuItem("CONTEXT/SkillEvent/Create/播放链接伤害")]
|
|||
|
private static void CreatePlayLinkDamage(MenuCommand command)
|
|||
|
{
|
|||
|
NewEvent(command.context.name, SkillEventDefine.PlayLinkDamage);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|