public OrdinaryObjectObject CreateOrdinaryObject(int id) { OrdinaryObjectObject o = GetOrdinaryObject(id); if (o != null) { return(o); } Neptune.OrdinaryObject ordinary = Neptune.DataManager.Instance.Data.GetNode <Neptune.OrdinaryObject>(id); if (ordinary != null) { return(CreateOrdinaryObject(ordinary)); } return(null); }
static int _m_CreateOrdinaryObject(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); xc.Dungeon.OrdinaryObjectManager __cl_gen_to_be_invoked = (xc.Dungeon.OrdinaryObjectManager)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.OrdinaryObjectObject __cl_gen_ret = __cl_gen_to_be_invoked.CreateOrdinaryObject(id); translator.Push(L, __cl_gen_ret); return(1); } if (__gen_param_count == 2 && translator.Assignable <Neptune.OrdinaryObject>(L, 2)) { Neptune.OrdinaryObject data = (Neptune.OrdinaryObject)translator.GetObject(L, 2, typeof(Neptune.OrdinaryObject)); xc.Dungeon.OrdinaryObjectObject __cl_gen_ret = __cl_gen_to_be_invoked.CreateOrdinaryObject(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.OrdinaryObjectManager.CreateOrdinaryObject!")); }
/// <summary> /// 创建普通节点对象 /// </summary> /// <param name="data"></param> /// <returns></returns> public OrdinaryObjectObject CreateOrdinaryObject(Neptune.OrdinaryObject data) { if (OrdinaryObjects.ContainsKey(data.Id) == true) { GameDebug.LogError("Create ordinary object error, id " + data.Id + " has already exist!!!"); return(null); } OrdinaryObjectObject o = new OrdinaryObjectObject(data); if (o != null) { if (OrdinaryObjects.ContainsKey(o.Id) == false) { OrdinaryObjects.Add(o.Id, o); } else { GameDebug.LogError("Add ordinary object error, id " + o.Id + " has already exist!!!"); } } return(o); }