Esempio n. 1
0
    static int GetType(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(NTGApplicationController)))
            {
                NTGApplicationController obj = (NTGApplicationController)ToLua.ToObject(L, 1);
                System.Type o = obj.GetType();
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(string)))
            {
                string      arg0 = ToLua.ToString(L, 1);
                System.Type o    = NTGApplicationController.GetType(arg0);
                ToLua.Push(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: NTGApplicationController.GetType"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Esempio n. 2
0
        private IEnumerator doLoadAsset()
        {
            abname = abname.ToLower();
            yield return(rc.StartCoroutine(LoadAssetBundle(abname)));

            if (string.IsNullOrEmpty(assettype))
            {
                var r = bundle.LoadAssetAsync <GameObject>(assetname);
                while (!r.isDone)
                {
                    yield return(new WaitForSeconds(0.05f));
                }
                Asset = r.asset;
            }
            else
            {
                var r = bundle.LoadAssetAsync(assetname, NTGApplicationController.GetType(assettype));
                while (!r.isDone)
                {
                    yield return(new WaitForSeconds(0.05f));
                }
                Asset = r.asset;
            }
            Done = true;
        }
Esempio n. 3
0
    public UnityEngine.Object LoadAsset(string abname, string assetname, string assettype)
    {
        if (DebugLevel > 1)
        {
            Debug.LogWarning("LoadAsset " + abname + " " + assetname);
        }

        abname = abname.ToLower();
        AssetBundle bundle = LoadAssetBundle(abname);

        //return (UnityEngine.Object) typeof (AssetBundle).GetMethods(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance)
        //    .Single(x => x.Name == "LoadAsset" && x.IsGenericMethod &&
        //                 x.GetParameters().Length == 1 && x.GetParameters()[0].ParameterType == typeof (string))
        //    .MakeGenericMethod(LuaScriptMgr.GetType(assettype)).Invoke(bundle, new object[] {assetname});
        return(bundle.LoadAsset(assetname, NTGApplicationController.GetType(assettype)));
    }
Esempio n. 4
0
 public static Type GetType(string TypeName)
 {
     return(NTGApplicationController.GetType(TypeName));
 }