@@ -16,97 +16,13 @@ using namespace UnityEngine;
1616
1717void PrintPlatformDefines ();
1818
19- struct PlainAction : System::Action
20- {
21- void operator ()() override
22- {
23- Debug::Log (String (" PlainAction invoked" ));
24- }
25- };
26-
27- struct FloatAction : System::Action1<float >
28- {
29- void operator ()(float param) override
30- {
31- Debug::Log (String (" FloatAction invoked" ));
32- }
33- };
34-
35- struct MyClickHandler : System::Action2<float , float >
36- {
37- void operator ()(float x, float y) override
38- {
39- Debug::Log (String (" clicked" ));
40- }
41- };
42-
43- struct MyIntFloatDoubleFunc : System::Func3<int32_t , float , double >
44- {
45- double operator ()(int32_t i, float f) override
46- {
47- Debug::Log (String (" int float double Func invoked" ));
48- return 2.34 ;
49- }
50- };
51-
52- struct FuncReturningString : System::Func3<int16_t , int32_t , String>
53- {
54- String operator ()(int16_t s, int32_t i) override
55- {
56- Debug::Log (String (" returning a string" ));
57- return String (" returned from Func" );
58- }
59- };
60-
61- struct MyAppDomainInitializer : AppDomainInitializer
62- {
63- void operator ()(System::Array1<System::String> args) override
64- {
65- for (int i = 0 , len = args.GetLength (); i < len; ++i)
66- {
67- Debug::Log (args.GetItem (i));
68- }
69- }
70- };
71-
7219// Called when the plugin is initialized
7320// This is mostly full of test code. Feel free to remove it all.
7421void PluginMain ()
7522{
7623 PrintPlatformDefines ();
7724 Debug::Log (String (" Game booted up" ));
7825
79- MyClickHandler mch1;
80- MyClickHandler mch2;
81- mch1 += mch2;
82- mch1.Invoke (123 , 456 );
83- Debug::Log (String (" Removed" ));
84- mch1 -= mch2;
85- mch1.Invoke (123 , 456 );
86-
87- MyIntFloatDoubleFunc mifdf;
88- double d = mifdf.Invoke (123 , 3 .14f );
89- char buf[1024 ];
90- sprintf (buf, " %lf" , d);
91- Debug::Log (String (buf));
92-
93- FuncReturningString frs;
94- String str = frs.Invoke (11 , 22 );
95- Debug::Log (str);
96-
97- FloatAction fa;
98- fa.Invoke (3 .14f );
99-
100- PlainAction pa;
101- pa.Invoke ();
102-
103- MyAppDomainInitializer madi;
104- AppDomainSetup ads;
105- ads.SetAppDomainInitializer (madi);
106- Array1<String> invokeParams (1 );
107- invokeParams.SetItem (0 , " Hello" );
108- ads.GetAppDomainInitializer ().Invoke (invokeParams);
109-
11026 GameObject go (String (" GameObject with a TestScript" ));
11127 go.AddComponent <MyGame::MonoBehaviours::TestScript>();
11228}
0 commit comments