コード例 #1
0
    public HotfixTest()
    {
        DelegateBridge c__Hotfix0_ctor = HotfixTest._c__Hotfix0_ctor;

        if (c__Hotfix0_ctor != null)
        {
            c__Hotfix0_ctor.__Gen_Delegate_Imp13(this);
        }
    }
コード例 #2
0
    //------------------------------------------


    public StatefullTest()
    {
        //------------------------------------------
        DelegateBridge c__Hotfix0_ctor = StatefullTest._c__Hotfix0_ctor;

        if (c__Hotfix0_ctor != null)
        {
            c__Hotfix0_ctor.__Gen_Delegate_Imp13(this);
        }
        //------------------------------------------
    }
コード例 #3
0
    void Update()
    {
        //------------------------------------------
        DelegateBridge _Hotfix0_Update = StatefullTest.__Hotfix0_Update;

        if (_Hotfix0_Update != null)
        {
            _Hotfix0_Update.__Gen_Delegate_Imp13(this);
            return;
        }
        //------------------------------------------
    }
コード例 #4
0
    public void Start()
    {
        //------------------------------------------
        DelegateBridge _Hotfix0_Start = StatefullTest.__Hotfix0_Start;

        if (_Hotfix0_Start != null)
        {
            _Hotfix0_Start.__Gen_Delegate_Imp13(this);
            return;
        }
        //------------------------------------------
    }
コード例 #5
0
    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);
    }
コード例 #6
0
    //------------------------------------------

    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 + "}");
    }
コード例 #7
0
    // 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);
        }
    }