int UnityEngineObject_m_ToString(RealStatePtr L, int gen_param_count) { ObjectTranslator translator = this; UnityEngine.Object gen_to_be_invoked = (UnityEngine.Object)translator.FastGetCSObj(L, 1); { string gen_ret = gen_to_be_invoked.ToString( ); LuaAPI.lua_pushstring(L, gen_ret); return(1); } }
private async CTask readHeroModelSetting() { UnityEngine.Object configObj = await CSF.Mgr.Assetbundle.LoadAsset <UnityEngine.Object>("Data/HeroModelSetting.txt", "HeroModelSetting"); if (configObj != null) { string strconfig = configObj.ToString(); List <HeroModelSetting> list = JsonMapper.ToObject <List <HeroModelSetting> >(strconfig); for (int i = 0; i < list.Count; i++) { dicHeroModelSetting.Add(list[i].Model, list[i]); } } else { CLog.Error($"配置文件不存在HeroModelSetting"); } }
static int _m_ToString(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.Object __cl_gen_to_be_invoked = (UnityEngine.Object)translator.FastGetCSObj(L, 1); try { { string __cl_gen_ret = __cl_gen_to_be_invoked.ToString( ); LuaAPI.lua_pushstring(L, __cl_gen_ret); return(1); } } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } }
private async CTask readMapConfig() { UnityEngine.Object configObj = await CSF.Mgr.Assetbundle.LoadAsset <UnityEngine.Object>(configAssetbundle, "MapConfig"); if (configObj != null) { string strconfig = configObj.ToString(); List <MapConfig> maps = JsonMapper.ToObject <List <MapConfig> >(strconfig); Dictionary <int, MapConfig> list; foreach (var map in maps) { if (!dicMapsList.TryGetValue(map.type, out list)) { list = new Dictionary <int, MapConfig>(); dicMapsList.Add(map.type, list); } list.Add(map.id, map); } } CSF.Mgr.Assetbundle.UnloadAssetBundle(configAssetbundle); }
public static string UnityObject(UnityEngine.Object obj) { // First, try to use a more specific format, if one applies if (obj is UnityEngine.GameObject) { return(GameObject(obj as UnityEngine.GameObject)); } else if (obj is UnityEngine.Component) { return(Component(obj as UnityEngine.Component)); } // Unity overrides the equality operator of its objects, so // that they return true, if the object is destroyed. However, // the actual reference isn't null - it just reports to be // equal to null. // // We can use this to determine whether an object is destroyed, // and distinguish this from simply having a null reference. // bool isNull = object.ReferenceEquals(obj, null); bool isDestroyed = (!isNull && obj == null); if (isNull) { return("null"); } else if (isDestroyed) { return("destroyed"); } else { return(obj.ToString()); } }
internal JSONValue GetAssetText(string assetPath) { UnityEngine.Object @object = AssetDatabase.LoadAssetAtPath(assetPath, typeof(UnityEngine.Object)); if (@object == (UnityEngine.Object)null) { throw new RestRequestException(HttpStatusCode.BadRequest, "AssetNotFound"); } JSONValue jsonValue = new JSONValue(); jsonValue["file"] = (JSONValue)assetPath; jsonValue["contents"] = (JSONValue)Convert.ToBase64String(Encoding.UTF8.GetBytes(@object.ToString())); return(jsonValue); }