Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
老鱼er
et
提交
06c30eb9
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,体验更适合开发者的 AI 搜索 >>
提交
06c30eb9
编写于
9月 01, 2017
作者:
T
tanghai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
简化脚本层UI创建,异常兼容ilruntime与非ilruntime
上级
87ef2a32
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
31 addition
and
64 deletion
+31
-64
Unity/Assets/Scripts/Component/BehaviorTreeComponent.cs
Unity/Assets/Scripts/Component/BehaviorTreeComponent.cs
+1
-1
Unity/Assets/Scripts/Component/ResourcesComponent.cs
Unity/Assets/Scripts/Component/ResourcesComponent.cs
+1
-1
Unity/Assets/Scripts/Other/Define.cs
Unity/Assets/Scripts/Other/Define.cs
+8
-10
Unity/Hotfix/Base/Helper/ExceptionHelper.cs
Unity/Hotfix/Base/Helper/ExceptionHelper.cs
+7
-1
Unity/Hotfix/Component/UIComponent.cs
Unity/Hotfix/Component/UIComponent.cs
+8
-50
Unity/Unity.sln
Unity/Unity.sln
+6
-1
未找到文件。
Unity/Assets/Scripts/Component/BehaviorTreeComponent.cs
浏览文件 @
06c30eb9
...
...
@@ -118,7 +118,7 @@ namespace Model
BehaviorTreeConfig
behaviorTreeConfig
=
treeGo
.
GetComponent
<
BehaviorTreeConfig
>();
Node
node
=
this
.
CreateTreeNode
(
behaviorTreeConfig
.
RootNodeProto
);
tree
=
new
BehaviorTree
(
scene
,
node
);
if
(
Define
.
LoadResourceType
==
LoadResourceType
.
Async
)
if
(
Define
.
Is
Async
)
{
this
.
treeCache
.
Add
(
treeGo
,
tree
);
}
...
...
Unity/Assets/Scripts/Component/ResourcesComponent.cs
浏览文件 @
06c30eb9
...
...
@@ -30,7 +30,7 @@ namespace Model
return
resource
as
K
;
}
if
(
Define
.
LoadResourceType
==
LoadResourceType
.
Async
)
if
(
Define
.
Is
Async
)
{
if
(!
this
.
bundleCaches
.
ContainsKey
(
$"
{
bundleName
}
.unity3d"
.
ToLower
()))
{
...
...
Unity/Assets/Scripts/Other/Define.cs
浏览文件 @
06c30eb9
namespace
Model
{
public
enum
LoadResourceType
{
Async
,
Sync
}
public
static
class
Define
{
public
const
int
FlyStartV
=
7
;
public
const
int
GravityAcceleration
=
36
;
#if UNITY_EDITOR && !ASYNC
public
static
LoadResourceType
LoadResourceType
=
LoadResourceType
.
Sync
;
public
static
bool
IsAsync
=
false
;
#else
public
static
LoadResourceType
LoadResourceType
=
LoadResourceType
.
Async
;
public
static
bool
IsAsync
=
true
;
#endif
#if UNITY_EDITOR
...
...
@@ -27,5 +19,11 @@
#else
public
static
bool
IsDevelopmentBuild
=
false
;
#endif
#if ILRuntime
public
static
bool
IsILRuntime
=
true
;
#else
public
static
bool
IsILRuntime
=
false
;
#endif
}
}
\ No newline at end of file
Unity/Hotfix/Base/Helper/ExceptionHelper.cs
浏览文件 @
06c30eb9
using
System
;
using
Model
;
namespace
Hotfix
{
...
...
@@ -6,7 +7,12 @@ namespace Hotfix
{
public
static
string
ToStr
(
this
Exception
exception
)
{
return
(
string
)
exception
.
Data
[
"StackTrace"
];
if
(
Define
.
IsILRuntime
)
{
return
(
string
)
exception
.
Data
[
"StackTrace"
];
}
return
exception
.
ToString
();
}
}
}
Unity/Hotfix/Component/UIComponent.cs
浏览文件 @
06c30eb9
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Reflection
;
using
ILRuntime.CLR.Method
;
using
Model
;
using
UnityEngine
;
namespace
Hotfix
{
#if ILRuntime
public
class
IILUIFactoryMethod
:
IUIFactory
{
private
readonly
object
instance
;
private
readonly
IMethod
methodInfo
;
private
readonly
object
[]
params3
=
new
object
[
3
];
public
IILUIFactoryMethod
(
Type
type
)
{
this
.
instance
=
Activator
.
CreateInstance
(
type
);
this
.
methodInfo
=
DllHelper
.
GetType
(
type
.
FullName
).
GetMethod
(
"Create"
,
3
);
}
public
UI
Create
(
Scene
scene
,
UIType
type
,
GameObject
parent
)
{
this
.
params3
[
0
]
=
scene
;
this
.
params3
[
1
]
=
type
;
this
.
params3
[
2
]
=
parent
;
return
(
UI
)
Model
.
Init
.
Instance
.
AppDomain
.
Invoke
(
methodInfo
,
instance
,
params3
);
}
}
#else
public
class
IMonoUIFactoryMethod
:
IUIFactory
{
private
readonly
object
instance
;
private
readonly
MethodInfo
methodInfo
;
private
readonly
object
[]
params3
=
new
object
[
3
];
public
IMonoUIFactoryMethod
(
Type
type
)
{
this
.
instance
=
Activator
.
CreateInstance
(
type
);
this
.
methodInfo
=
type
.
GetMethod
(
"Create"
);
}
public
UI
Create
(
Scene
scene
,
UIType
type
,
GameObject
parent
)
{
this
.
params3
[
0
]
=
scene
;
this
.
params3
[
1
]
=
type
;
this
.
params3
[
2
]
=
parent
;
return
(
UI
)
this
.
methodInfo
.
Invoke
(
this
.
instance
,
this
.
params3
);
}
}
#endif
/// <summary>
/// 管理所有UI
/// </summary>
...
...
@@ -107,13 +63,15 @@ namespace Hotfix
Log
.
Debug
(
$"已经存在同类UI Factory:
{
attribute
.
Type
}
"
);
throw
new
Exception
(
$"已经存在同类UI Factory:
{
attribute
.
Type
}
"
);
}
#if ILRuntime
IUIFactory
iuiFactory
=
new
IILUIFactoryMethod
(
type
);
#else
IUIFactory
iuiFactory
=
new
IMonoUIFactoryMethod
(
type
);
#endif
object
o
=
Activator
.
CreateInstance
(
type
);
IUIFactory
factory
=
o
as
IUIFactory
;
if
(
factory
==
null
)
{
Log
.
Error
(
$"
{
o
.
GetType
().
FullName
}
没有继承 IUIFactory"
);
continue
;
}
this
.
UiTypes
.
Add
((
UIType
)
attribute
.
Type
,
iuiF
actory
);
this
.
UiTypes
.
Add
((
UIType
)
attribute
.
Type
,
f
actory
);
}
}
...
...
Unity/Unity.sln
浏览文件 @
06c30eb9
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2017
# Visual Studio 15
VisualStudioVersion = 15.0.26730.10
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Plugins", "Unity.Plugins.csproj", "{D1FDB199-0FB7-099D-3771-C6A942E4E326}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity", "Unity.csproj", "{CF118143-7E37-744F-BE45-3F55345FEC40}"
...
...
@@ -35,4 +37,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0AB8BABF-C9E8-4CFB-B2C5-0A6CD8350FC4}
EndGlobalSection
EndGlobal
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录