少年修仙传客户端代码仓库
hch
2025-03-03 28785d6ddf9c08e49527ede9405c7b6c93c6ed32
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
using UnityEngine;
using System;
using System.IO;
 
#if UNITY_EDITOR
using UnityEditor;
#endif
 
public class SoGhostShadow : ScriptableObject
{
    public int count;// 存在数量的逻辑和依据时间的逻辑互斥
    public int duration;// 产生持续时间
    public int interval;// 产生间隔
    public int eachLastTime;// 每个幻影持续时间
 
    public Color color = new Color(1f, 1f, 1f, 0.98f);// 颜色
    public float intensity = 0.2f;// 颜色强度
}
 
#if UNITY_EDITOR
[CustomEditor(typeof(SoGhostShadow))]
public class SoGhostShadowEditor : Editor
{
    [MenuItem("程序/角色相关/技能配置/残影配置")]
    static void CreateSoGhostShadow()
    {
        SoGhostShadow _config = CreateInstance<SoGhostShadow>();
        string _createName = string.Format(ScriptableObjectLoader.SoGhostShadow_Suffix,
                                           DateTime.UtcNow.ToFileTimeUtc());
        string _path = ResourcesPath.ResourcesOutPath + "refdata/ScriptableObject/SoGhostShadow/";
        if (Directory.Exists(_path) == false)
        {
            Directory.CreateDirectory(_path);
        }
        _path = StringUtility.Contact(ResourcesPath.ResourcesOutAssetPath,
                                      "refdata/ScriptableObject/SoGhostShadow/",
                                      _createName,
                                      ".asset");
        AssetDatabase.CreateAsset(_config, _path);
        AssetDatabase.Refresh();
        ProjectWindowUtil.ShowCreatedAsset(_config);
    }
 
    public override void OnInspectorGUI()
    {
        serializedObject.Update();
 
        SoGhostShadow _target = target as SoGhostShadow;
 
        EditorGUILayout.HelpBox("数量和时间只取其一做逻辑, 当有数量的时候, 将会在此帧产生与上一帧坐标点间平均分配但是消失时间不等的残影; 如果是按照时间配置, 则为每隔一定时间产生一个残影, 总共产生多长时间. 优先时间. ", MessageType.Info, true);
 
        GUILayout.Space(10);
 
        _target.duration = EditorGUILayout.IntField("持续时间(毫秒)", _target.duration);
        _target.interval = EditorGUILayout.IntField("生成间隔(毫秒)", _target.interval);
        _target.eachLastTime = EditorGUILayout.IntField("生存时间(毫秒)", _target.eachLastTime);
 
        _target.count = EditorGUILayout.IntField("残影总数", _target.count);
 
        _target.color = EditorGUILayout.ColorField("残影颜色", _target.color);
        _target.intensity = EditorGUILayout.Slider("残影强度(浮点)", _target.intensity, 0, 2);
 
 
        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);
            serializedObject.ApplyModifiedProperties();
        }
    }
}
#endif