Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
guo450212436
et
提交
3eacbdaa
E
et
项目概览
guo450212436
/
et
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
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,发现更多精彩内容 >>
提交
3eacbdaa
编写于
4月 16, 2019
作者:
T
tanghai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1.修复il2cpp下使用mongo bson的问题,去掉emit
2.修复NumericComponent组件的bug
上级
a1c37f22
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
29 addition
and
60 deletion
+29
-60
Unity/Assets/Model/Base/Helper/MongoHelper.cs
Unity/Assets/Model/Base/Helper/MongoHelper.cs
+2
-8
Unity/Assets/Model/Module/Numeric/NumericComponent.cs
Unity/Assets/Model/Module/Numeric/NumericComponent.cs
+14
-3
Unity/Assets/ThirdParty/MongoDB/MongoDB.Bson/Serialization/BsonMemberMap.cs
...Party/MongoDB/MongoDB.Bson/Serialization/BsonMemberMap.cs
+13
-49
未找到文件。
Unity/Assets/Model/Base/Helper/MongoHelper.cs
浏览文件 @
3eacbdaa
...
...
@@ -22,8 +22,6 @@ namespace ETModel
BsonClassMap
.
LookupClassMap
(
type
);
}
BsonSerializer
.
RegisterSerializer
(
new
EnumSerializer
<
NumericType
>(
BsonType
.
String
));
}
public
static
string
ToJson
(
object
obj
)
...
...
@@ -118,12 +116,8 @@ namespace ETModel
ArraySerializer
<
int
>
aint
=
new
ArraySerializer
<
int
>();
ArraySerializer
<
string
>
astring
=
new
ArraySerializer
<
string
>();
ArraySerializer
<
long
>
along
=
new
ArraySerializer
<
long
>();
EnumerableInterfaceImplementerSerializer
<
List
<
int
>>
e
=
new
EnumerableInterfaceImplementerSerializer
<
List
<
int
>>();
EnumerableInterfaceImplementerSerializer
<
List
<
int
>,
int
>
elistint
=
new
EnumerableInterfaceImplementerSerializer
<
List
<
int
>,
int
>();
EnumerableInterfaceImplementerSerializer
<
List
<
int
>>
e
=
new
EnumerableInterfaceImplementerSerializer
<
List
<
int
>>();
EnumerableInterfaceImplementerSerializer
<
List
<
int
>,
int
>
elistint
=
new
EnumerableInterfaceImplementerSerializer
<
List
<
int
>,
int
>();
}
}
...
...
Unity/Assets/Model/Module/Numeric/NumericComponent.cs
浏览文件 @
3eacbdaa
...
...
@@ -13,7 +13,7 @@ namespace ETModel
public
class
NumericComponent
:
Component
{
public
readonly
Dictionary
<
int
,
int
>
NumericDic
=
new
Dictionary
<
int
,
int
>();
public
Dictionary
<
int
,
int
>
NumericDic
=
new
Dictionary
<
int
,
int
>();
public
void
Awake
()
{
...
...
@@ -24,11 +24,21 @@ namespace ETModel
{
return
(
float
)
GetByKey
((
int
)
numericType
)
/
10000
;
}
public
float
GetAsFloat
(
int
numericType
)
{
return
(
float
)
GetByKey
(
numericType
)
/
10000
;
}
public
int
GetAsInt
(
NumericType
numericType
)
{
return
GetByKey
((
int
)
numericType
);
}
public
int
GetAsInt
(
int
numericType
)
{
return
GetByKey
(
numericType
);
}
public
void
Set
(
NumericType
nt
,
float
value
)
{
...
...
@@ -82,8 +92,9 @@ namespace ETModel
// 一个数值可能会多种情况影响,比如速度,加个buff可能增加速度绝对值100,也有些buff增加10%速度,所以一个值可以由5个值进行控制其最终结果
// final = (((base + add) * (100 + pct) / 100) + finalAdd) * (100 + finalPct) / 100;
this
.
NumericDic
[
final
]
=
((
this
.
GetByKey
(
bas
)
+
this
.
GetByKey
(
add
))
*
(
100
+
this
.
GetByKey
(
pct
))
/
100
+
this
.
GetByKey
(
finalAdd
))
*
(
100
+
this
.
GetByKey
(
finalPct
))
/
100
;
Game
.
EventSystem
.
Run
(
EventIdType
.
NumbericChange
,
this
.
Entity
.
Id
,
(
NumericType
)
final
,
final
);
int
result
=
(
int
)(((
this
.
GetByKey
(
bas
)
+
this
.
GetByKey
(
add
))
*
(
100
+
this
.
GetAsFloat
(
pct
))
/
100f
+
this
.
GetByKey
(
finalAdd
))
*
(
100
+
this
.
GetAsFloat
(
finalPct
))
/
100f
*
10000
);
this
.
NumericDic
[
final
]
=
result
;
Game
.
EventSystem
.
Run
(
EventIdType
.
NumbericChange
,
this
.
Entity
.
Id
,
(
NumericType
)
final
,
result
);
}
}
}
\ No newline at end of file
Unity/Assets/ThirdParty/MongoDB/MongoDB.Bson/Serialization/BsonMemberMap.cs
浏览文件 @
3eacbdaa
...
...
@@ -14,9 +14,7 @@
*/
using
System
;
using
System.Linq.Expressions
;
using
System.Reflection
;
using
System.Reflection.Emit
;
using
MongoDB.Bson.Serialization.Serializers
;
namespace
MongoDB.Bson.Serialization
...
...
@@ -570,13 +568,12 @@ namespace MongoDB.Bson.Serialization
private
Action
<
object
,
object
>
GetFieldSetter
()
{
var
fieldInfo
=
(
FieldInfo
)
_memberInfo
;
FieldInfo
fieldInfo
=
(
FieldInfo
)
_memberInfo
;
if
(
IsReadOnly
)
{
var
message
=
string
.
Format
(
"The field '{0} {1}' of class '{2}' is readonly. To avoid this exception, call IsReadOnly to ensure that setting a value is allowed."
,
fieldInfo
.
FieldType
.
FullName
,
fieldInfo
.
Name
,
fieldInfo
.
DeclaringType
.
FullName
);
string
message
=
$"The field '
{
fieldInfo
.
FieldType
.
FullName
}
{
fieldInfo
.
Name
}
' of class '
{
fieldInfo
.
DeclaringType
.
FullName
}
' is readonly. To avoid this exception, call IsReadOnly to ensure that setting a value is allowed."
;
throw
new
BsonSerializationException
(
message
);
}
...
...
@@ -585,61 +582,28 @@ namespace MongoDB.Bson.Serialization
private
Func
<
object
,
object
>
GetGetter
()
{
var
propertyInfo
=
_memberInfo
as
PropertyInfo
;
PropertyInfo
propertyInfo
=
_memberInfo
as
PropertyInfo
;
if
(
propertyInfo
!=
null
)
{
var
getMethodInfo
=
propertyInfo
.
GetMethod
;
MethodInfo
getMethodInfo
=
propertyInfo
.
GetMethod
;
if
(
getMethodInfo
==
null
)
{
var
message
=
string
.
Format
(
"The property '{0} {1}' of class '{2}' has no 'get' accessor."
,
propertyInfo
.
PropertyType
.
FullName
,
propertyInfo
.
Name
,
propertyInfo
.
DeclaringType
.
FullName
);
string
message
=
$"The property '
{
propertyInfo
.
PropertyType
.
FullName
}
{
propertyInfo
.
Name
}
' of class '
{
propertyInfo
.
DeclaringType
.
FullName
}
' has no 'get' accessor."
;
throw
new
BsonSerializationException
(
message
);
}
}
// lambdaExpression = (obj) => (object) ((TClass) obj).Member
var
objParameter
=
Expression
.
Parameter
(
typeof
(
object
),
"obj"
);
var
lambdaExpression
=
Expression
.
Lambda
<
Func
<
object
,
object
>>(
Expression
.
Convert
(
Expression
.
MakeMemberAccess
(
Expression
.
Convert
(
objParameter
,
_memberInfo
.
DeclaringType
),
_memberInfo
),
typeof
(
object
)
),
objParameter
);
return
obj
=>
{
return
propertyInfo
.
GetValue
(
obj
);
};
}
return
lambdaExpression
.
Compile
();
FieldInfo
fieldInfo
=
_memberInfo
as
FieldInfo
;
return
obj
=>
{
return
fieldInfo
.
GetValue
(
obj
);
};
}
private
Action
<
object
,
object
>
GetPropertySetter
()
{
var
propertyInfo
=
(
PropertyInfo
)
_memberInfo
;
var
setMethodInfo
=
propertyInfo
.
SetMethod
;
if
(
IsReadOnly
)
{
var
message
=
string
.
Format
(
"The property '{0} {1}' of class '{2}' has no 'set' accessor. To avoid this exception, call IsReadOnly to ensure that setting a value is allowed."
,
propertyInfo
.
PropertyType
.
FullName
,
propertyInfo
.
Name
,
propertyInfo
.
DeclaringType
.
FullName
);
throw
new
BsonSerializationException
(
message
);
}
// lambdaExpression = (obj, value) => ((TClass) obj).SetMethod((TMember) value)
var
objParameter
=
Expression
.
Parameter
(
typeof
(
object
),
"obj"
);
var
valueParameter
=
Expression
.
Parameter
(
typeof
(
object
),
"value"
);
var
lambdaExpression
=
Expression
.
Lambda
<
Action
<
object
,
object
>>(
Expression
.
Call
(
Expression
.
Convert
(
objParameter
,
_memberInfo
.
DeclaringType
),
setMethodInfo
,
Expression
.
Convert
(
valueParameter
,
_memberType
)
),
objParameter
,
valueParameter
);
return
lambdaExpression
.
Compile
();
PropertyInfo
propertyInfo
=
(
PropertyInfo
)
_memberInfo
;
return
(
obj
,
value
)
=>
{
propertyInfo
.
SetValue
(
obj
,
value
);
};
}
private
void
ThrowFrozenException
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录