-
Notifications
You must be signed in to change notification settings - Fork 9
/
Example3.cs
55 lines (51 loc) · 1.07 KB
/
Example3.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using Puerts;
using XLua;
/// <summary>
/// 静态方法调用
/// 逻辑: 无
/// 参数: 一个值类型参数
/// 返回值: 无
/// </summary>
[Test]
[TestGroup("ParameterCompare")]
public class Example3 : IExecute
{
public bool Static => true;
public string Method => "void Payload(int);";
public CallTarget Target => CallTarget.ScriptCallCSharp;
public object RunCS(int count)
{
for (var i = 0; i < count; i++)
{
Example3.Payload(i);
}
return null;
}
public object RunJS(JsEnv env, int count)
{
env.Eval(string.Format(
@"(function() {{
var Example = require('csharp').Example3;
for(let i = 0; i < {0}; i++){{
Example.Payload(i);
}}
}})()", count));
return null;
}
public object RunLua(LuaEnv env, int count)
{
env.DoString(string.Format(
@"
(function()
local Example = CS.Example3;
for i = 1,{0} do
Example.Payload(i);
end
end)()
", count));
return null;
}
public static void Payload(int param1)
{
}
}