public int this[string field] { get { //------------------------------------------ DelegateBridge _Hotfix0_get_Item = StatefullTest.__Hotfix0_get_Item; if (_Hotfix0_get_Item != null) { return(_Hotfix0_get_Item.__Gen_Delegate_Imp25(this, field)); } //------------------------------------------ return(1); } set { //------------------------------------------ DelegateBridge _Hotfix0_set_Item = StatefullTest.__Hotfix0_set_Item; if (_Hotfix0_set_Item != null) { _Hotfix0_set_Item.__Gen_Delegate_Imp26(this, field, value); return; } //------------------------------------------ } }
public Hotfix(System.Type type, string fieldName, string funName, System.Type hotfixType, string hotfixFunName) { field = type.GetField(fieldName, wxb.hotMgr.bindingFlags); if (field == null) { wxb.L.LogErrorFormat("type field:{0}.{1} not find!", type.Name, fieldName); return; } method = IL.Help.GetMethod(type, funName); if (method == null) { wxb.L.LogErrorFormat("type method {0}.{1} not find!", type.Name, funName); return; } var hotMethod = hotfixType.GetMethod(hotfixFunName, wxb.hotMgr.bindingFlags); if (hotMethod == null) { wxb.L.LogErrorFormat("{0}.{1} Replace {2}.{3}", type.Name, funName, hotfixType.Name, hotfixFunName); return; } if (!hotMgr.IsStatic(hotMethod)) { wxb.L.LogErrorFormat("Hotfix type:{0} funName:{1} methodInfo is not static!", hotfixType.Name, hotfixFunName); return; } bridge = new DelegateBridge(hotMethod); field.SetValue(null, bridge); wxb.L.LogFormat("{0}.{1} Replace {2}.{3}", type.Name, funName, hotfixType.Name, hotfixFunName); }
public HotfixTest() { DelegateBridge c__Hotfix0_ctor = HotfixTest._c__Hotfix0_ctor; if (c__Hotfix0_ctor != null) { c__Hotfix0_ctor.__Gen_Delegate_Imp13(this); } }
//------------------------------------------ public StatefullTest() { //------------------------------------------ DelegateBridge c__Hotfix0_ctor = StatefullTest._c__Hotfix0_ctor; if (c__Hotfix0_ctor != null) { c__Hotfix0_ctor.__Gen_Delegate_Imp13(this); } //------------------------------------------ }
public int TestOut(int a, out double b, ref string c, GameObject go) { //------------------------------------------ DelegateBridge _Hotfix1_TestOut = HotfixCalc.__Hotfix1_TestOut; if (_Hotfix1_TestOut != null) { return(_Hotfix1_TestOut.__Gen_Delegate_Imp17(this, a, out b, ref c, go)); } //------------------------------------------ return(TestOut(a, out b, ref c)); }
public string Proxy() { //------------------------------------------ DelegateBridge _Hotfix0_Proxy = StructTest.__Hotfix0_Proxy; if (_Hotfix0_Proxy != null) { return(_Hotfix0_Proxy.__Gen_Delegate_Imp21(this)); } //------------------------------------------ return(base.ToString()); }
public void Start() { //------------------------------------------ DelegateBridge _Hotfix0_Start = StatefullTest.__Hotfix0_Start; if (_Hotfix0_Start != null) { _Hotfix0_Start.__Gen_Delegate_Imp13(this); return; } //------------------------------------------ }
static public void StaticFunc(int a, int b) { //------------------------------------------ DelegateBridge _Hotfix0_StaticFunc = StatefullTest.__Hotfix0_StaticFunc; if (_Hotfix0_StaticFunc != null) { _Hotfix0_StaticFunc.__Gen_Delegate_Imp27(a, b); return; } //------------------------------------------ }
public GameObject GetGo(int a, object b) { //------------------------------------------ DelegateBridge _Hotfix0_GetGo = StructTest.__Hotfix0_GetGo; if (_Hotfix0_GetGo != null) { return(_Hotfix0_GetGo.__Gen_Delegate_Imp20(this, a, b)); } //------------------------------------------ return(go); }
public override string ToString() { //------------------------------------------ DelegateBridge _Hotfix0_ToString = StructTest.__Hotfix0_ToString; if (_Hotfix0_ToString != null) { return(_Hotfix0_ToString.__Gen_Delegate_Imp21(this)); } //------------------------------------------ return(base.ToString()); }
void Update() { //------------------------------------------ DelegateBridge _Hotfix0_Update = StatefullTest.__Hotfix0_Update; if (_Hotfix0_Update != null) { _Hotfix0_Update.__Gen_Delegate_Imp13(this); return; } //------------------------------------------ }
public StructTest(GameObject go) { this.go = go; //------------------------------------------ DelegateBridge c__Hotfix0_ctor = StructTest._c__Hotfix0_ctor; if (c__Hotfix0_ctor != null) { c__Hotfix0_ctor.__Gen_Delegate_Imp22(this, go); } //------------------------------------------ }
static public void StaticFunc(string a, int b, int c) { //------------------------------------------ DelegateBridge _Hotfix1_StaticFunc = StatefullTest.__Hotfix1_StaticFunc; if (_Hotfix1_StaticFunc != null) { _Hotfix1_StaticFunc.__Gen_Delegate_Imp28(a, b, c); return; } //------------------------------------------ }
//------------------------------------------ public int Add(int a, int b) { //------------------------------------------ DelegateBridge _Hotfix0_Add = HotfixCalc.__Hotfix0_Add; if (_Hotfix0_Add != null) { return(_Hotfix0_Add.__Gen_Delegate_Imp14(this, a, b)); } //------------------------------------------ return(a - b); }
public Vector3 Add(Vector3 a, Vector3 b) { //------------------------------------------ DelegateBridge _Hotfix1_Add = HotfixCalc.__Hotfix1_Add; if (_Hotfix1_Add != null) { return(_Hotfix1_Add.__Gen_Delegate_Imp15(this, a, b)); } //------------------------------------------ return(a - b); }
public int TestOut(int a, out double b, ref string c) { //------------------------------------------ DelegateBridge _Hotfix0_TestOut = HotfixCalc.__Hotfix0_TestOut; if (_Hotfix0_TestOut != null) { return(_Hotfix0_TestOut.__Gen_Delegate_Imp16(this, a, out b, ref c)); } //------------------------------------------ b = a + 2; c = "wrong version"; return(a + 3); }
public void Proxy(int p) { //------------------------------------------ DelegateBridge _Hotfix0_Proxy = BaseTest.__Hotfix0_Proxy; if (_Hotfix0_Proxy != null) { _Hotfix0_Proxy.__Gen_Delegate_Imp18(this, p); return; } //------------------------------------------ base.Foo(p); }
//------------------------------------------ public override void Foo(int p) { //------------------------------------------ DelegateBridge _Hotfix0_Foo = BaseTest.__Hotfix0_Foo; if (_Hotfix0_Foo != null) { _Hotfix0_Foo.__Gen_Delegate_Imp18(this, p); return; } //------------------------------------------ Debug.Log("BaseTest<>.Foo, p = " + p); }
public T Func2() { //------------------------------------------ DelegateBridge _Hotfix0_Func = GenericClass <T> .__Hotfix0_Func2; if (_Hotfix0_Func != null) { _Hotfix0_Func.InvokeSessionStart(); _Hotfix0_Func.InParam <GenericClass <T> >(this); _Hotfix0_Func.Invoke(1); return(_Hotfix0_Func.InvokeSessionEndWithResult <T>()); } //------------------------------------------ return(default(T)); }
public static int Test3 <T>(T a) { //------------------------------------------ DelegateBridge _Hotfix0_Test = HotfixCalc.__Hotfix0_Test3; if (_Hotfix0_Test != null) { _Hotfix0_Test.InvokeSessionStart(); _Hotfix0_Test.InParam <T>(a); _Hotfix0_Test.Invoke(1); return(_Hotfix0_Test.InvokeSessionEndWithResult <int>()); } //------------------------------------------ return(0); }
public T Test1 <T>() { //------------------------------------------ DelegateBridge _Hotfix0_Test = HotfixCalc.__Hotfix0_Test1; if (_Hotfix0_Test != null) { _Hotfix0_Test.InvokeSessionStart(); _Hotfix0_Test.InParam <HotfixCalc>(this); _Hotfix0_Test.Invoke(1); return(_Hotfix0_Test.InvokeSessionEndWithResult <T>()); } //------------------------------------------ return(default(T)); }
public static void Test4 <T>(T a) { //------------------------------------------ DelegateBridge _Hotfix0_Test = HotfixCalc.__Hotfix0_Test4; if (_Hotfix0_Test != null) { _Hotfix0_Test.InvokeSessionStart(); _Hotfix0_Test.InParam <T>(a); _Hotfix0_Test.Invoke(0); _Hotfix0_Test.InvokeSessionEnd(); return; } //------------------------------------------ }
public override void OnGUI() { //------------------------------------------ DelegateBridge _Hotfix0_OnGUI = HotfixTest.__Hotfix0_OnGUI; if (_Hotfix0_OnGUI != null) { _Hotfix0_OnGUI.__Gen_Delegate_Imp13(this); return; } //------------------------------------------ if (GUI.Button(new Rect(10, 10, 300, 80), "Hotfix")) { luaenv.DoString(@" xlua.hotfix(CS.HotfixTest, 'Update', function(self) self.tick = self.tick + 1 if (self.tick % 50) == 0 then print('<<<<<<<<Update in lua, tick = ' .. self.tick) end end) "); } string chHint = @"在运行该示例之前,请细致阅读xLua文档,并执行以下步骤: 1.宏定义:添加 HOTFIX_ENABLE 到 'Edit > Project Settings > Player > Other Settings > Scripting Define Symbols'。 (注意:各平台需要分别设置) 2.生成代码:执行 'XLua > Generate Code' 菜单,等待Unity编译完成。 3.注入:执行 'XLua > Hotfix Inject In Editor' 菜单。注入成功会打印 'hotfix inject finish!' 或者 'had injected!' 。"; string enHint = @"Read documents carefully before you run this example, then follow the steps below: 1. Define: Add 'HOTFIX_ENABLE' to 'Edit > Project Settings > Player > Other Settings > Scripting Define Symbols'. (Note: Each platform needs to set this respectively) 2.Generate Code: Execute menu 'XLua > Generate Code', wait for Unity's compilation. 3.Inject: Execute menu 'XLua > Hotfix Inject In Editor'.There should be 'hotfix inject finish!' or 'had injected!' print in the Console if the Injection is successful."; GUIStyle style = GUI.skin.textArea; style.normal.textColor = Color.red; style.fontSize = 16; GUI.TextArea(new Rect(10, 100, 500, 290), chHint, style); GUI.TextArea(new Rect(10, 400, 500, 290), enHint, style); }
public void GenericTest <T>(T a) { //------------------------------------------ DelegateBridge _Hotfix0_GenericTest = StatefullTest.__Hotfix0_GenericTest; if (_Hotfix0_GenericTest != null) { _Hotfix0_GenericTest.InvokeSessionStart(); _Hotfix0_GenericTest.InParam <StatefullTest>(this); _Hotfix0_GenericTest.InParam <T>(a); _Hotfix0_GenericTest.Invoke(0); _Hotfix0_GenericTest.InvokeSessionEnd(); return; } //------------------------------------------ }
//------------------------------------------ public void Foo() { //------------------------------------------ DelegateBridge _Hotfix0_Foo = InnerTypeTest.__Hotfix0_Foo; if (_Hotfix0_Foo != null) { _Hotfix0_Foo.__Gen_Delegate_Imp13(this); return; } //------------------------------------------ _InnerStruct ret = Bar(); Debug.Log("{x=" + ret.x + ",y= " + ret.y + "}"); }
public GenericClass(T a) { this.a = a; //------------------------------------------ DelegateBridge c__Hotfix0_ctor = GenericClass <T> ._c__Hotfix0_ctor; if (c__Hotfix0_ctor != null) { c__Hotfix0_ctor.InvokeSessionStart(); c__Hotfix0_ctor.InParam <GenericClass <T> >(this); c__Hotfix0_ctor.InParam <T>(a); c__Hotfix0_ctor.Invoke(0); c__Hotfix0_ctor.InvokeSessionEnd(); } //------------------------------------------ }
public T GetA(int p) { //------------------------------------------ DelegateBridge _Hotfix0_GetA = GenericStruct <T> .__Hotfix0_GetA; if (_Hotfix0_GetA != null) { _Hotfix0_GetA.InvokeSessionStart(); _Hotfix0_GetA.InParam <GenericStruct <T> >(this); _Hotfix0_GetA.InParam <int>(p); _Hotfix0_GetA.Invoke(1); return(_Hotfix0_GetA.InvokeSessionEndWithResult <T>()); } //------------------------------------------ return(a); }
public void Func1() { //------------------------------------------ DelegateBridge _Hotfix0_Func = GenericClass <T> .__Hotfix0_Func1; if (_Hotfix0_Func != null) { _Hotfix0_Func.InvokeSessionStart(); _Hotfix0_Func.InParam <GenericClass <T> >(this); _Hotfix0_Func.Invoke(0); _Hotfix0_Func.InvokeSessionEnd(); return; } //------------------------------------------ Debug.Log("a=" + a); }
_InnerStruct Bar() { //------------------------------------------ DelegateBridge _Hotfix0_Bar = InnerTypeTest.__Hotfix0_Bar; if (_Hotfix0_Bar != null) { _Hotfix0_Bar.InvokeSessionStart(); _Hotfix0_Bar.InParam <InnerTypeTest>(this); _Hotfix0_Bar.Invoke(1); return(_Hotfix0_Bar.InvokeSessionEndWithResult <InnerTypeTest._InnerStruct>()); } //------------------------------------------ return(new _InnerStruct { x = 1, y = 2 }); }
// Update is called once per frame public override void Update() { //------------------------------------------ DelegateBridge _Hotfix0_Update = HotfixTest.__Hotfix0_Update; if (_Hotfix0_Update != null) { _Hotfix0_Update.__Gen_Delegate_Imp13(this); return; } //------------------------------------------ if (++tick % 50 == 0) { Debug.Log(">>>>>>>>Update in C#, tick = " + tick); } }