Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
老鱼er
et
提交
0c02304c
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,发现更多精彩内容 >>
提交
0c02304c
编写于
10月 21, 2017
作者:
T
tanghai
提交者:
GitHub
10月 21, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #20 from bsyx/dev01
修改日志路径,兼容手机平台
上级
d04ae8ac
f8f3ceba
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
60 addition
and
10 deletion
+60
-10
Unity/Assets/Scripts/Base/Log.cs
Unity/Assets/Scripts/Base/Log.cs
+9
-10
Unity/Assets/Scripts/Helper/PathHelp.cs
Unity/Assets/Scripts/Helper/PathHelp.cs
+51
-0
未找到文件。
Unity/Assets/Scripts/Base/Log.cs
浏览文件 @
0c02304c
...
@@ -10,20 +10,19 @@ namespace Model
...
@@ -10,20 +10,19 @@ namespace Model
private
static
readonly
StreamWriter
error
;
private
static
readonly
StreamWriter
error
;
#if UNITY_EDITOR
public
static
bool
IsNeedFlush
=
true
;
private
static
bool
IsNeedFlush
=
true
;
private
static
string
dirName
=
"Logs"
;
#else
private
static
string
infoFileName
=
"/Log-Client-Info.txt"
;
private
static
bool
IsNeedFlush
=
true
;
private
static
string
errorFileName
=
"/Log-Client-Error.txt"
;
#endif
static
Log
()
static
Log
()
{
{
if
(!
Directory
.
Exists
(
"./Logs"
))
string
dirPath
=
PathHelp
.
AppHotfixResPath
+
dirName
;
if
(!
Directory
.
Exists
(
dirPath
))
{
{
Directory
.
CreateDirectory
(
"./Logs"
);
Directory
.
CreateDirectory
(
dirPath
);
}
}
info
=
new
StreamWriter
(
"./Logs/Log-Client-Info.txt"
,
false
,
Encoding
.
Unicode
,
1024
);
info
=
new
StreamWriter
(
dirPath
+
infoFileName
,
false
,
Encoding
.
Unicode
,
1024
);
error
=
new
StreamWriter
(
"./Logs/Log-Client-Error.txt"
,
false
,
Encoding
.
Unicode
,
1024
);
error
=
new
StreamWriter
(
dirPath
+
errorFileName
,
false
,
Encoding
.
Unicode
,
1024
);
}
}
public
static
void
Warning
(
string
msg
)
public
static
void
Warning
(
string
msg
)
...
...
Unity/Assets/Scripts/Helper/PathHelp.cs
0 → 100644
浏览文件 @
0c02304c
using
System
;
using
System.Text
;
using
UnityEngine
;
namespace
Model
{
public
static
class
PathHelp
{
/// <summary>
///应用程序外部资源路径存放路径(热更新资源路径)
/// </summary>
public
static
string
AppHotfixResPath
{
get
{
string
game
=
Application
.
productName
;
string
path
=
AppResPath
;
if
(
Application
.
isMobilePlatform
)
{
path
=
$"
{
Application
.
persistentDataPath
}
{
"/"
}
{
game
}
{
"/"
}
"
;
}
return
path
;
}
}
/// <summary>
/// 应用程序内部资源路径存放路径
/// </summary>
public
static
string
AppResPath
{
get
{
string
path
=
string
.
Empty
;
switch
(
Application
.
platform
)
{
case
RuntimePlatform
.
Android
:
path
=
$"
{
"jar:file://"
}{
Application
.
dataPath
}{
"!!/assets/"
}
"
;
break
;
case
RuntimePlatform
.
IPhonePlayer
:
path
=
$"
{
Application
.
dataPath
}{
"/Raw/"
}
"
;
break
;
default
:
path
=
$"
{
Application
.
dataPath
}{
"/StreamingAssets/"
}
"
;
break
;
}
return
path
;
}
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录