public DoorObject CreateDoorObject(int id) { if (GetDoorObject(id) != null) { RemoveDoorObject(id); } Neptune.Door door = Neptune.DataManager.Instance.Data.GetNode <Neptune.Door>(id); if (door != null) { return(CreateDoorObject(door)); } return(null); }
static int _m_CreateDoorObject(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); xc.Dungeon.DoorObjectManager __cl_gen_to_be_invoked = (xc.Dungeon.DoorObjectManager)translator.FastGetCSObj(L, 1); int __gen_param_count = LuaAPI.lua_gettop(L); try { if (__gen_param_count == 2 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2)) { int id = LuaAPI.xlua_tointeger(L, 2); xc.Dungeon.DoorObject __cl_gen_ret = __cl_gen_to_be_invoked.CreateDoorObject(id); translator.Push(L, __cl_gen_ret); return(1); } if (__gen_param_count == 2 && translator.Assignable <Neptune.Door>(L, 2)) { Neptune.Door data = (Neptune.Door)translator.GetObject(L, 2, typeof(Neptune.Door)); xc.Dungeon.DoorObject __cl_gen_ret = __cl_gen_to_be_invoked.CreateDoorObject(data); translator.Push(L, __cl_gen_ret); return(1); } } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to xc.Dungeon.DoorObjectManager.CreateDoorObject!")); }
/// <summary> /// 创建门 /// </summary> /// <param name="data"></param> /// <returns></returns> public DoorObject CreateDoorObject(Neptune.Door data) { if (DoorObjects.ContainsKey(data.Id) == true) { GameDebug.LogError("Create collider object error, id " + data.Id + " has already exist!!!"); return(null); } DoorObject o = new DoorObject(data); if (o != null) { if (DoorObjects.ContainsKey(o.Id) == false) { DoorObjects.Add(o.Id, o); } else { GameDebug.LogError("Create collider object error, id " + o.Id + " has already exist!!!"); } } return(o); }