Tencent / xLua

xLua is a lua programming solution for C# ( Unity, .Net, Mono) , it supports android, ios, windows, linux, osx, etc.
Other
9.43k stars 2.46k forks source link

在hotfix继承链中间类的虚方法时,无法调用hotfix的原方法 #774

Open chenjie13 opened 4 years ago

chenjie13 commented 4 years ago
util.hotfix_ex(
    CS.HeroBase,
    "Update",
    function(self)
        self:Update() --调用Hero.Update()
        base(self):Update() --调用Creature.Update()
        --要怎么才能调用HeroBase.Update()?
    end
)
public class Creature
{
    public virtual void Update() {}
}
public class HeroBase : Creature
{
    public override void Update() { }
}
public class Hero : HeroBase
{
    public override void Update() { }
}
chexiongsheng commented 4 years ago

这种场景确实没法掉

chexiongsheng commented 4 years ago

用InjectFix就没这烦恼了