static int Load(IntPtr L) { L.ChkArgsCount(5); ZFrame.UGUI.UITexture obj = (ZFrame.UGUI.UITexture)L.ChkUnityObjectSelf(1, "ZFrame.UGUI.UITexture"); var arg0 = L.ToLuaString(2); ZFrame.Asset.DelegateObjectLoaded arg1 = null; LuaTypes funcType3 = L.Type(3); if (funcType3 != LuaTypes.LUA_TFUNCTION) { arg1 = (ZFrame.Asset.DelegateObjectLoaded)L.ChkUserData(3, typeof(ZFrame.Asset.DelegateObjectLoaded)); } else { LuaFunction func = L.ChkLuaFunction(3); arg1 = (param0, param1) => { int top = func.BeginPCall(); L.PushLightUserData(param0); L.PushAnyObject(param1); func.PCall(top, 2); func.EndPCall(top); }; } var arg2 = L.ToAnyObject(4); var arg3 = L.ChkBoolean(5); obj.Load(arg0, arg1, arg2, arg3); return(0); }
private static int SetPhoto(ILuaState lua) { var tex = LibUnity.FindCom <UITexture>(lua); string name = lua.ChkString(2); var funcRef = lua.ToLuaFunction(3); ZFrame.Asset.DelegateObjectLoaded onLoaded = null; if (funcRef != null) { onLoaded = (o, p) => { LogMgr.D("loaded {0}, {1}", o, p); funcRef.Invoke(o, p); funcRef.Dispose(); var disposer = p as System.IDisposable; if (disposer != null) { disposer.Dispose(); } }; } SDKMgr.Instance.OnLoadPhoto(tex, name, onLoaded); return(0); }
IEnumerator LoadTexture(UITexture tex, string name, ZFrame.Asset.DelegateObjectLoaded onLoaded) { //注解1 Debug.Log("Starting Load Image!"); string path = get_image_path(name); // Debug.Log (path); // if (File.Exists (path)) { WWW www = new WWW(path); int i = 0; while (!www.isDone) { if (i > 100) { break; } i++; } yield return(www); if (www.error == null) { tex.enabled = true; tex.texture = www.texture; onLoaded(www.texture, true); Debug.Log("Loaded Image!"); } else { onLoaded(null, false); } // } else { // Debug.Log ("File is not Exist!"); // } }
public void OnLoadPhoto(UITexture tex, string name, ZFrame.Asset.DelegateObjectLoaded onLoaded) { StartCoroutine(LoadTexture(tex, name, onLoaded)); }