public override LuaValue getValue(LuaApp app, string name) { if (name != null) { if (name.Equals("scene")) { return LuaValue.objectValue(_currentScene); } } return LuaValue.nullValue(); }
public override bool invoke(LuaApp app, string name, IList<LuaValue> ctx) { if (name != null) { if (name.Equals("runScene")) { if (ctx.Count == 0) throw new ArgumentException("miss param"); Object obj = ctx[0].objectValue(); if (obj == null || !(obj is Control)) { throw new ArgumentException(obj+" not a Control"); } bool bPopAll = false; if (ctx.Count > 1) { bPopAll = ctx[1].booleanValue(); } if (bPopAll) { popAll(); } runScene(obj as Control); ctx.Clear(); return true; } if (name.Equals("pushScene")) { if (ctx.Count == 0) throw new ArgumentException("miss param"); Object obj = ctx[0].objectValue(); if (obj == null || !(obj is Control)) { throw new ArgumentException(obj + " not a Control"); } pushScene(obj as Control); ctx.Clear(); return true; } if (name.Equals("popScene")) { popScene(); ctx.Clear(); return true; } if (name.Equals("canPopScene")) { ctx.Clear(); ctx.Add(LuaValue.booleanValue(_sceneStack.Count > 0)); return true; } } ctx.Clear(); return false; }