Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
老鱼er
et
提交
7b543e40
E
et
项目概览
老鱼er
/
et
与 Fork 源项目一致
从无法访问的项目Fork
通知
10
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
et
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7b543e40
编写于
10月 27, 2016
作者:
T
tanghai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
命令行编辑器可以 添加 复制 重命名 删除 配置文件
上级
172ec9d9
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
55 addition
and
14 deletion
+55
-14
Unity/Assets/Editor/ServerCommandLineEditor/ServerCommandLineEditor.cs
...Editor/ServerCommandLineEditor/ServerCommandLineEditor.cs
+55
-14
未找到文件。
Unity/Assets/Editor/ServerCommandLineEditor/ServerCommandLineEditor.cs
浏览文件 @
7b543e40
...
@@ -20,7 +20,7 @@ namespace MyEditor
...
@@ -20,7 +20,7 @@ namespace MyEditor
private
string
fileName
;
private
string
fileName
;
private
string
addFileName
;
private
string
newFileName
=
""
;
private
int
copyNum
=
1
;
private
int
copyNum
=
1
;
...
@@ -89,6 +89,19 @@ namespace MyEditor
...
@@ -89,6 +89,19 @@ namespace MyEditor
return
Path
.
Combine
(
ConfigDir
,
this
.
fileName
);
return
Path
.
Combine
(
ConfigDir
,
this
.
fileName
);
}
}
private
void
Save
()
{
string
path
=
this
.
GetFilePath
();
using
(
StreamWriter
sw
=
new
StreamWriter
(
new
FileStream
(
path
,
FileMode
.
Create
)))
{
foreach
(
StartConfig
startConfig
in
this
.
startConfigs
)
{
sw
.
Write
(
MongoHelper
.
ToJson
(
startConfig
));
sw
.
Write
(
'\n'
);
}
}
}
private
void
OnGUI
()
private
void
OnGUI
()
{
{
GUILayout
.
BeginHorizontal
();
GUILayout
.
BeginHorizontal
();
...
@@ -103,16 +116,52 @@ namespace MyEditor
...
@@ -103,16 +116,52 @@ namespace MyEditor
this
.
LoadConfig
();
this
.
LoadConfig
();
}
}
this
.
addFileName
=
EditorGUILayout
.
TextField
(
"文件名"
,
this
.
add
FileName
);
this
.
newFileName
=
EditorGUILayout
.
TextField
(
"文件名"
,
this
.
new
FileName
);
if
(
GUILayout
.
Button
(
"添加
配置文件
"
))
if
(
GUILayout
.
Button
(
"添加"
))
{
{
this
.
fileName
=
this
.
add
FileName
;
this
.
fileName
=
this
.
new
FileName
;
this
.
add
FileName
=
""
;
this
.
new
FileName
=
""
;
File
.
WriteAllText
(
this
.
GetFilePath
(),
""
);
File
.
WriteAllText
(
this
.
GetFilePath
(),
""
);
this
.
files
=
this
.
GetConfigFiles
();
this
.
files
=
this
.
GetConfigFiles
();
this
.
selectedIndex
=
this
.
files
.
IndexOf
(
this
.
fileName
);
this
.
selectedIndex
=
this
.
files
.
IndexOf
(
this
.
fileName
);
this
.
LoadConfig
();
}
}
if
(
GUILayout
.
Button
(
"复制"
))
{
this
.
fileName
=
$"
{
this
.
fileName
}
-copy"
;
this
.
Save
();
this
.
files
=
this
.
GetConfigFiles
();
this
.
selectedIndex
=
this
.
files
.
IndexOf
(
this
.
fileName
);
this
.
newFileName
=
""
;
}
if
(
GUILayout
.
Button
(
"重命名"
))
{
if
(
this
.
newFileName
==
""
)
{
Log
.
Debug
(
"请输入新名字!"
);
}
else
{
File
.
Delete
(
this
.
GetFilePath
());
this
.
fileName
=
this
.
newFileName
;
this
.
Save
();
this
.
files
=
this
.
GetConfigFiles
();
this
.
selectedIndex
=
this
.
files
.
IndexOf
(
this
.
fileName
);
this
.
newFileName
=
""
;
}
}
if
(
GUILayout
.
Button
(
"删除"
))
{
File
.
Delete
(
this
.
GetFilePath
());
this
.
files
=
this
.
GetConfigFiles
();
this
.
selectedIndex
=
0
;
this
.
newFileName
=
""
;
}
GUILayout
.
EndHorizontal
();
GUILayout
.
EndHorizontal
();
GUILayout
.
Label
(
"配置内容:"
);
GUILayout
.
Label
(
"配置内容:"
);
...
@@ -193,15 +242,7 @@ namespace MyEditor
...
@@ -193,15 +242,7 @@ namespace MyEditor
if
(
GUILayout
.
Button
(
"保存"
))
if
(
GUILayout
.
Button
(
"保存"
))
{
{
string
path
=
this
.
GetFilePath
();
this
.
Save
();
using
(
StreamWriter
sw
=
new
StreamWriter
(
new
FileStream
(
path
,
FileMode
.
Create
)))
{
foreach
(
StartConfig
startConfig
in
this
.
startConfigs
)
{
sw
.
Write
(
MongoHelper
.
ToJson
(
startConfig
));
sw
.
Write
(
'\n'
);
}
}
}
}
if
(
GUILayout
.
Button
(
"启动"
))
if
(
GUILayout
.
Button
(
"启动"
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录