Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
魔术师Dix
Unity脚本自动生成工具:红丝线
提交
de60ffc5
Unity脚本自动生成工具:红丝线
项目概览
魔术师Dix
/
Unity脚本自动生成工具:红丝线
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Unity脚本自动生成工具:红丝线
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
de60ffc5
编写于
11月 15, 2022
作者:
魔术师Dix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改创建脚本的KV值设置,重新整理文件;
上级
53b2830b
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
117 addition
and
63 deletion
+117
-63
Asset/LycianthesScriptCreator.asset
Asset/LycianthesScriptCreator.asset
+17
-23
Asset/LycianthesTemplateGroup.asset
Asset/LycianthesTemplateGroup.asset
+14
-0
Asset/LycianthesTemplateGroup.asset.meta
Asset/LycianthesTemplateGroup.asset.meta
+8
-0
Editor/E_ScriptType.cs
Editor/E_ScriptType.cs
+0
-29
Editor/LycianthesScriptCreator.cs
Editor/LycianthesScriptCreator.cs
+45
-8
Editor/LycianthesScriptWindow.cs
Editor/LycianthesScriptWindow.cs
+5
-2
Editor/LycianthesTemplateGroup.cs
Editor/LycianthesTemplateGroup.cs
+27
-0
Editor/LycianthesTemplateGroup.cs.meta
Editor/LycianthesTemplateGroup.cs.meta
+1
-1
未找到文件。
Asset/LycianthesScriptCreator.asset
浏览文件 @
de60ffc5
...
...
@@ -26,18 +26,12 @@ MonoBehaviour:
SerializationNodes
:
-
Name
:
dictTemplate
Entry
:
7
Data
:
0|System.Collections.Generic.Dictionary`2[[
Lycianthes.E_ScriptType, Lycianthes
],[Lycianthes.LycianthesScriptInfo,
Data
:
0|System.Collections.Generic.Dictionary`2[[
System.String, mscorlib
],[Lycianthes.LycianthesScriptInfo,
Lycianthes]], mscorlib
-
Name
:
comparer
Entry
:
7
Data
:
1|System.Collections.Generic.EnumEqualityComparer`1[[Lycianthes.E_ScriptType,
Lycianthes]], mscorlib
-
Name
:
Entry
:
12
Data
:
0
-
Name
:
Entry
:
13
Data
:
Data
:
1|System.Collections.Generic.GenericEqualityComparer`1[[System.String,
mscorlib]], mscorlib
-
Name
:
Entry
:
8
Data
:
...
...
@@ -48,8 +42,8 @@ MonoBehaviour:
Entry
:
7
Data
:
-
Name
:
$k
Entry
:
3
Data
:
0
Entry
:
1
Data
:
CSharpCommon
-
Name
:
$v
Entry
:
7
Data
:
2|Lycianthes.LycianthesScriptInfo, Lycianthes
...
...
@@ -58,10 +52,10 @@ MonoBehaviour:
Data
:
0
-
Name
:
DefaultName
Entry
:
1
Data
:
Lycianthes_
Data
:
Lycianthes
Common
_
-
Name
:
DefaultFolder
Entry
:
1
Data
:
Assets
/Scripts/Common
Data
:
Assets
-
Name
:
Entry
:
8
Data
:
...
...
@@ -72,8 +66,8 @@ MonoBehaviour:
Entry
:
7
Data
:
-
Name
:
$k
Entry
:
3
Data
:
1
Entry
:
1
Data
:
CSharpScriptableObject
-
Name
:
$v
Entry
:
7
Data
:
3|Lycianthes.LycianthesScriptInfo, Lycianthes
...
...
@@ -82,10 +76,10 @@ MonoBehaviour:
Data
:
1
-
Name
:
DefaultName
Entry
:
1
Data
:
Lycianthes_
Data
:
Lycianthes
ScriptableObject
_
-
Name
:
DefaultFolder
Entry
:
1
Data
:
Assets
/Scripts
Data
:
Assets
-
Name
:
Entry
:
8
Data
:
...
...
@@ -96,8 +90,8 @@ MonoBehaviour:
Entry
:
7
Data
:
-
Name
:
$k
Entry
:
3
Data
:
2
Entry
:
1
Data
:
CSharpMonoBehaviour
-
Name
:
$v
Entry
:
7
Data
:
4|Lycianthes.LycianthesScriptInfo, Lycianthes
...
...
@@ -106,10 +100,10 @@ MonoBehaviour:
Data
:
2
-
Name
:
DefaultName
Entry
:
1
Data
:
Lycianthes_
Data
:
Lycianthes
MonoBehaviour
_
-
Name
:
DefaultFolder
Entry
:
1
Data
:
Assets
/Scripts/Core/System
Data
:
Assets
-
Name
:
Entry
:
8
Data
:
...
...
@@ -122,7 +116,7 @@ MonoBehaviour:
-
Name
:
Entry
:
8
Data
:
Company
:
GYYX
Version
:
A.2.1
Company
:
Chief
Version
:
1.0
AuthorName
:
Chief
NameSpace
:
Lycianthes
Asset/LycianthesTemplateGroup.asset
0 → 100644
浏览文件 @
de60ffc5
%YAML
1.1
%TAG
!u!
tag:unity3d.com,2011:
---
!u!114
&11400000
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
0
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
27752d2b796118843a746b67b337476c
,
type
:
3
}
m_Name
:
LycianthesTemplateGroup
m_EditorClassIdentifier
:
Asset/LycianthesTemplateGroup.asset.meta
0 → 100644
浏览文件 @
de60ffc5
fileFormatVersion: 2
guid: 78f67d703404d664fb1ea0ca4a7829c4
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
Editor/E_ScriptType.cs
已删除
100644 → 0
浏览文件 @
53b2830b
/*
*Copyright(C) 2020 by Chief All rights reserved.
*Unity版本:2019.4.8f1
*作者:Chief
*创建日期: 2020-08-17
*模块说明:
*版本: 1.0.0
*/
namespace
Lycianthes
{
public
enum
E_ScriptType
{
/// <summary>
/// 通用
/// </summary>
Common
,
/// <summary>
/// ScriptObject;
/// </summary>
ScriptObject
,
/// <summary>
/// MonoBehaviour;
/// </summary>
MonoBehaviour
,
}
}
Editor/LycianthesScriptCreator.cs
浏览文件 @
de60ffc5
...
...
@@ -20,11 +20,22 @@ namespace Lycianthes
{
#
region
自动获取配置方法
private
static
LycianthesScriptCreator
_Instance
;
public
static
LycianthesScriptCreator
Instance
{
get
{
if
(
_Instance
==
null
)
AutoLoadAsset
();
return
_Instance
;
}
}
/// <summary>
/// 自动获取路径的方法;
/// </summary>
[
InitializeOnLoadMethod
]
private
static
void
Auto
SelectPath
()
private
static
void
Auto
LoadAsset
()
{
string
assetName
=
"LycianthesScriptCreator"
;
string
[]
guids
=
AssetDatabase
.
FindAssets
(
assetName
);
...
...
@@ -35,13 +46,13 @@ namespace Lycianthes
if
(
path
.
EndsWith
(
".asset"
))
{
LycianthesScriptWindow
.
AssetPath
=
path
;
_Instance
=
AssetDatabase
.
LoadAssetAtPath
<
LycianthesScriptCreator
>(
path
);
#if UNITY_EDITOR
Debug
.
Log
(
$"[Lycianthes] : 配置路径
{
path
}
"
);
Debug
.
Log
(
$"[Lycianthes] : 配置路径
{
path
}
|
{
_Instance
}
"
);
#endif
return
;
}
}
Debug
.
LogError
(
$"[Lycianthes] : 未找到目标资源:
{
assetName
}
"
);
}
...
...
@@ -61,13 +72,13 @@ namespace Lycianthes
public
string
NameSpace
=
"RedPanda"
;
[
Title
(
"预设脚本配置"
),
HideLabel
]
public
Dictionary
<
E_ScriptType
,
LycianthesScriptInfo
>
dictTemplate
=
new
Dictionary
<
E_ScriptType
,
LycianthesScriptInfo
>();
public
Dictionary
<
string
,
LycianthesScriptInfo
>
dictTemplate
=
new
Dictionary
<
string
,
LycianthesScriptInfo
>();
/// <summary>
/// 新建脚本
/// </summary>
[
Title
(
"脚本创建"
),
Button
(
"创建脚本"
,
ButtonSizes
.
Medium
)]
public
void
CreateNewScript
(
E_ScriptType
type
)
public
void
CreateNewScript
(
string
type
)
{
LycianthesScriptInfo
temp
;
if
(
dictTemplate
.
TryGetValue
(
type
,
out
temp
))
...
...
@@ -88,7 +99,7 @@ namespace Lycianthes
}
}
public
void
CreateNewScript
(
E_ScriptType
type
,
string
curPath
,
string
name
)
public
void
CreateNewScript
(
string
type
,
string
curPath
,
string
name
)
{
LycianthesScriptInfo
temp
;
if
(
dictTemplate
.
TryGetValue
(
type
,
out
temp
))
...
...
@@ -114,6 +125,32 @@ namespace Lycianthes
[
Button
(
"刷新"
)]
public
void
Refresh
()
{
AssetDatabase
.
Refresh
();
}
}
}
public
void
AddTemlateGroup
(
LycianthesTemplateGroup
group
)
{
if
(
group
==
null
)
return
;
foreach
(
var
item
in
group
.
dictTemplate
)
{
var
k
=
item
.
Key
;
var
v
=
item
.
Value
;
if
(
dictTemplate
.
ContainsKey
(
k
))
{
Debug
.
LogError
(
$"[Lycianthes]: 已存在Key :
{
k
}
"
);
continue
;
}
dictTemplate
.
Add
(
k
,
v
);
}
}
private
List
<
string
>
tempKeyList
=
new
List
<
string
>();
public
List
<
string
>
GetScriptTemplateKey
()
{
tempKeyList
.
Clear
();
foreach
(
var
item
in
dictTemplate
)
tempKeyList
.
Add
(
item
.
Key
);
return
tempKeyList
;
}
}
}
\ No newline at end of file
Editor/LycianthesScriptWindow.cs
浏览文件 @
de60ffc5
...
...
@@ -114,8 +114,10 @@ namespace Lycianthes
PlayerPrefs
.
SetString
(
KEY_USER_NAMESPACE
,
NameSpace
);
}
[
HideLabel
,
Title
(
"脚本类型"
),
OnValueChanged
(
"OnScriptTypeChanged"
),
EnumToggleButtons
]
public
E_ScriptType
scriptType
=
E_ScriptType
.
Common
;
[
HideLabel
,
Title
(
"脚本类型"
),
OnValueChanged
(
"OnScriptTypeChanged"
)]
[
ValueDropdown
(
"GetScriptKey"
)]
public
string
scriptType
=
"CSharpCommon"
;
private
List
<
string
>
GetScriptKey
()
{
return
creator
.
GetScriptTemplateKey
();
}
[
Title
(
"保存位置"
),
Space
(
15
)]
[
LabelWidth
(
LABEL_WIDTH
),
LabelText
(
"批量创建"
)]
...
...
@@ -126,6 +128,7 @@ namespace Lycianthes
[
HideIf
(
"IsList"
)]
public
string
ScriptName
=
""
;
[
LabelText
(
"脚本列表"
),
LabelWidth
(
LABEL_WIDTH
),
ShowIf
(
"IsList"
)]
public
List
<
string
>
ListScriptName
=
new
List
<
string
>();
...
...
Editor/LycianthesTemplateGroup.cs
0 → 100644
浏览文件 @
de60ffc5
/*
*Copyright(C) 2023 by Chief All rights reserved.
*Unity版本:2020.3.41f1c1
*作者:Chief
*创建日期: 2022-11-15
*模块说明:
*版本: 1.0
*/
using
Sirenix.OdinInspector
;
using
System.Collections.Generic
;
using
UnityEngine
;
namespace
Lycianthes
{
/// <summary>
/// 自定义脚本模板组
/// </summary>
[
CreateAssetMenu
(
fileName
=
"LycianthesTemplateGroup"
,
menuName
=
"Lycianthes/自定义脚本模板组"
,
order
=
1
)]
public
class
LycianthesTemplateGroup
:
SerializedScriptableObject
{
[
Title
(
"预设脚本配置"
),
HideLabel
]
public
Dictionary
<
string
,
LycianthesScriptInfo
>
dictTemplate
=
new
Dictionary
<
string
,
LycianthesScriptInfo
>();
}
}
\ No newline at end of file
Editor/
E_ScriptType
.cs.meta
→
Editor/
LycianthesTemplateGroup
.cs.meta
浏览文件 @
de60ffc5
fileFormatVersion: 2
guid:
9fa905ce86a1b2e46b745bbeafd38b94
guid:
27752d2b796118843a746b67b337476c
MonoImporter:
externalObjects: {}
serializedVersion: 2
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录