static public int constructor(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.U2D.SpriteAtlas o; o = new UnityEngine.U2D.SpriteAtlas(); pushValue(l, true); pushValue(l, o); return(2); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
public static Sprite[] AccessPackedSprites(UnityEngine.U2D.SpriteAtlas spriteAtlas) { Sprite[] sprites = null; #if UNITY_EDITOR if (!Application.isPlaying) { if (GetPackedSpritesMethod == null) { System.Type T = Type.GetType("UnityEditor.U2D.SpriteAtlasExtensions,UnityEditor"); GetPackedSpritesMethod = T.GetMethod("GetPackedSprites", BindingFlags.NonPublic | BindingFlags.Static); } if (GetPackedSpritesMethod != null) { object retval = GetPackedSpritesMethod.Invoke(null, new object[] { spriteAtlas }); var spritesArray = retval as Sprite[]; if (spritesArray != null && spritesArray.Length > 0) { sprites = spritesArray; } } } #endif if (sprites == null) { sprites = new UnityEngine.Sprite[spriteAtlas.spriteCount]; spriteAtlas.GetSprites(sprites); if (sprites.Length == 0) { return(null); } } return(sprites); }
static int GetSprites(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2) { UnityEngine.U2D.SpriteAtlas obj = (UnityEngine.U2D.SpriteAtlas)ToLua.CheckObject <UnityEngine.U2D.SpriteAtlas>(L, 1); UnityEngine.Sprite[] arg0 = ToLua.CheckObjectArray <UnityEngine.Sprite>(L, 2); int o = obj.GetSprites(arg0); LuaDLL.lua_pushinteger(L, o); return(1); } else if (count == 3) { UnityEngine.U2D.SpriteAtlas obj = (UnityEngine.U2D.SpriteAtlas)ToLua.CheckObject <UnityEngine.U2D.SpriteAtlas>(L, 1); UnityEngine.Sprite[] arg0 = ToLua.CheckObjectArray <UnityEngine.Sprite>(L, 2); string arg1 = ToLua.CheckString(L, 3); int o = obj.GetSprites(arg0, arg1); LuaDLL.lua_pushinteger(L, o); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.U2D.SpriteAtlas.GetSprites")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static public int get_isVariant(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.U2D.SpriteAtlas self = (UnityEngine.U2D.SpriteAtlas)checkSelf(l); pushValue(l, true); pushValue(l, self.isVariant); return(2); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
static int LoadSpriteAtlas(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 1) { string arg0 = ToLua.CheckString(L, 1); UnityEngine.U2D.SpriteAtlas o = ShibaInu.ResManager.LoadSpriteAtlas(arg0); ToLua.Push(L, o); return(1); } else if (count == 2) { string arg0 = ToLua.CheckString(L, 1); string arg1 = ToLua.CheckString(L, 2); UnityEngine.U2D.SpriteAtlas o = ShibaInu.ResManager.LoadSpriteAtlas(arg0, arg1); ToLua.Push(L, o); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: ShibaInu.ResManager.LoadSpriteAtlas")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static public int GetSprites(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); if (argc == 2) { UnityEngine.U2D.SpriteAtlas self = (UnityEngine.U2D.SpriteAtlas)checkSelf(l); UnityEngine.Sprite[] a1; checkArray(l, 2, out a1); var ret = self.GetSprites(a1); pushValue(l, true); pushValue(l, ret); return(2); } else if (argc == 3) { UnityEngine.U2D.SpriteAtlas self = (UnityEngine.U2D.SpriteAtlas)checkSelf(l); UnityEngine.Sprite[] a1; checkArray(l, 2, out a1); System.String a2; checkType(l, 3, out a2); var ret = self.GetSprites(a1, a2); pushValue(l, true); pushValue(l, ret); return(2); } pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function to call"); return(2); } catch (Exception e) { return(error(l, e)); } }
IEnumerator TestLoad() { Debug.Log(Time.time + "-==111==kaishi"); var loader = AssetBundleManager.Instance.LoadAssetAsync(producePrefabPath, typeof(UnityEngine.U2D.SpriteAtlas), (objd) => { UnityEngine.U2D.SpriteAtlas producePrefab1 = objd as UnityEngine.U2D.SpriteAtlas; Debug.Log(producePrefab1.name + Time.time + "==1111==huidiao"); }); yield return loader; Debug.Log(Time.time + "-====kaishi"); UnityEngine.U2D.SpriteAtlas producePrefab = loader.asset as UnityEngine.U2D.SpriteAtlas; string ip = GetCurrentMachineLocalIP(); loader.Dispose(); // var abloader = AssetBundleManager.Instance.LoadAssetBundleAsync("testab/uiapk_lua_bytes.assetbundle", (objd) => // { // Debug.LogError(objd); // Debug.LogError(Time.time + "==huidiao"); // }); // yield return abloader; // abloader.Dispose(); // Debug.LogError(Time.time + "-=-=-=-=jieshu"); yield break; }
static public int get_spriteCount(IntPtr l) { try { UnityEngine.U2D.SpriteAtlas self = (UnityEngine.U2D.SpriteAtlas)checkSelf(l); pushValue(l, true); pushValue(l, self.spriteCount); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int GetSprites(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif int argc = LuaDLL.lua_gettop(l); if (argc == 2) { UnityEngine.U2D.SpriteAtlas self = (UnityEngine.U2D.SpriteAtlas)checkSelf(l); UnityEngine.Sprite[] a1; checkArray(l, 2, out a1); var ret = self.GetSprites(a1); pushValue(l, true); pushValue(l, ret); return(2); } else if (argc == 3) { UnityEngine.U2D.SpriteAtlas self = (UnityEngine.U2D.SpriteAtlas)checkSelf(l); UnityEngine.Sprite[] a1; checkArray(l, 2, out a1); System.String a2; checkType(l, 3, out a2); var ret = self.GetSprites(a1, a2); pushValue(l, true); pushValue(l, ret); return(2); } pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function GetSprites to call"); return(2); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
static public int constructor(IntPtr l) { try { UnityEngine.U2D.SpriteAtlas o; o = new UnityEngine.U2D.SpriteAtlas(); pushValue(l, true); pushValue(l, o); return(2); } catch (Exception e) { return(error(l, e)); } }
/// <summary> /// 加载UI图片 /// </summary> public void LoadUITextures() { if (Dict_UITex == null) { Dict_UITex = new Dictionary <string, Sprite>(); BundleConf bundleConf = MeaninglessJson.LoadJsonFromFile <BundleConf>(Application.dataPath + "/StreamingAssets/" + "BC_UITextures.json"); AssetBundle ab = AssetBundle.LoadFromFile(Application.dataPath + "/StreamingAssets/" + bundleConf.BundlePath); UnityEngine.U2D.SpriteAtlas spriteAtlas = ab.LoadAsset <UnityEngine.U2D.SpriteAtlas>("BagIcon"); foreach (string str in bundleConf.ResName) { Dict_UITex.Add(str, spriteAtlas.GetSprite(str)); } } }
static public int CanBindTo(IntPtr l) { try { UnityEngine.U2D.SpriteAtlas self = (UnityEngine.U2D.SpriteAtlas)checkSelf(l); UnityEngine.Sprite a1; checkType(l, 2, out a1); var ret = self.CanBindTo(a1); pushValue(l, true); pushValue(l, ret); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int GetSprite(IntPtr l) { try { UnityEngine.U2D.SpriteAtlas self = (UnityEngine.U2D.SpriteAtlas)checkSelf(l); System.String a1; checkType(l, 2, out a1); var ret = self.GetSprite(a1); pushValue(l, true); pushValue(l, ret); return(2); } catch (Exception e) { return(error(l, e)); } }
static int CanBindTo(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); UnityEngine.U2D.SpriteAtlas obj = (UnityEngine.U2D.SpriteAtlas)ToLua.CheckObject <UnityEngine.U2D.SpriteAtlas>(L, 1); UnityEngine.Sprite arg0 = (UnityEngine.Sprite)ToLua.CheckObject(L, 2, typeof(UnityEngine.Sprite)); bool o = obj.CanBindTo(arg0); LuaDLL.lua_pushboolean(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int GetSprite(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); UnityEngine.U2D.SpriteAtlas obj = (UnityEngine.U2D.SpriteAtlas)ToLua.CheckObject <UnityEngine.U2D.SpriteAtlas>(L, 1); string arg0 = ToLua.CheckString(L, 2); UnityEngine.Sprite o = obj.GetSprite(arg0); ToLua.PushSealed(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int DoAction(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); System.Action <UnityEngine.U2D.SpriteAtlas> arg0 = (System.Action <UnityEngine.U2D.SpriteAtlas>)ToLua.CheckDelegate <System.Action <UnityEngine.U2D.SpriteAtlas> >(L, 1); UnityEngine.U2D.SpriteAtlas arg1 = (UnityEngine.U2D.SpriteAtlas)ToLua.CheckObject <UnityEngine.U2D.SpriteAtlas>(L, 2); bool o = Framework.Utility.Util.DoAction(arg0, arg1); LuaDLL.lua_pushboolean(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int get_tag(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.U2D.SpriteAtlas obj = (UnityEngine.U2D.SpriteAtlas)o; string ret = obj.tag; LuaDLL.lua_pushstring(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index tag on a nil value")); } }
static int get_isVariant(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.U2D.SpriteAtlas obj = (UnityEngine.U2D.SpriteAtlas)o; bool ret = obj.isVariant; LuaDLL.lua_pushboolean(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index isVariant on a nil value")); } }
static int get_spriteCount(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.U2D.SpriteAtlas obj = (UnityEngine.U2D.SpriteAtlas)o; int ret = obj.spriteCount; LuaDLL.lua_pushinteger(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index spriteCount on a nil value")); } }
static int _CreateUnityEngine_U2D_SpriteAtlas(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 0) { UnityEngine.U2D.SpriteAtlas obj = new UnityEngine.U2D.SpriteAtlas(); ToLua.Push(L, obj); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.U2D.SpriteAtlas.New")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public static List <Sprite> GetAllSprites(this SpriteAtlas spriteAtlas) { List <Sprite> resultSprites = new List <Sprite>(); Object[] objects = spriteAtlas.GetPackables(); for (int i = 0; i < objects.Length; i++) { Object packable = objects[i]; if (packable is DefaultAsset defaultAsset) { List <Sprite> sprites = GetAllSpritesFromFolder(AssetDatabase.GetAssetPath(defaultAsset)); resultSprites.AddRange(sprites); } else if (packable is Sprite || packable is Texture2D) { string path = AssetDatabase.GetAssetPath(packable); resultSprites.AddRange(AssetDatabase.LoadAllAssetsAtPath(path).Where(o => o is Sprite) .Cast <Sprite>().ToArray()); } } return(resultSprites); }
private static extern void Internal_Create([Writable] SpriteAtlas self);
extern internal static void Register(SpriteAtlas spriteAtlas);
public SpriteAtlas() { SpriteAtlas.Internal_Create(this); }
private static void PostRegisteredAtlas(SpriteAtlas spriteAtlas) { atlasRegistered?.Invoke(spriteAtlas); }
// Use this for initialization IEnumerator Start() { //Setup myABK.ABM_PATH = new FileURL() { fullURL = "https://s3-ap-northeast-1.amazonaws.com/hooloopplayground/" + SystemInfoChecker.GetPlatformName() + "/" + SystemInfoChecker.GetPlatformName(), localPath = Application.persistentDataPath + "/ABM" }; yield return(null); //download ABM myABK.DownloadABM(); while (!myABK.IsManifestReady()) { yield return(null); } Debug.Log("ABM is ready"); foreach (var name in myABK.GetABNames()) { Debug.Log(name); } UnityEngine.U2D.SpriteAtlas tmpSASA = null; //LoadSpriteAtlasFromAB yield return(StartCoroutine(myABK.LoadSpriteAtlasFromAB(new ABFileURL() { fullURL = "https://s3-ap-northeast-1.amazonaws.com/hooloopplayground/" + SystemInfoChecker.GetPlatformName() + "/icons", fileName = "icons" }, (UnityEngine.U2D.SpriteAtlas _sa) => { tmpSASA = _sa; }, "IconSA"// SA Name ))); Sprite tmptmp = null; for (int i = 0; i < 500; i++) { tmptmp = tmpSASA.GetSprite("baseline_backup_black_18dp"); yield return(null); } Resources.UnloadUnusedAssets(); yield return(null); //DestroyImmediate(tmptmp, true); tmptmp = null; Debug.Log("IconSA Finished"); //LoadTextureFromAB yield return(StartCoroutine(myABK.LoadTextureFromAB(new ABFileURL() { fullURL = "https://s3-ap-northeast-1.amazonaws.com/hooloopplayground/" + SystemInfoChecker.GetPlatformName() + "/icons", fileName = "icons" }, (List <Texture2D> _textures) => { }, "round_alternate_email_black_48dp" // Texture Names ))); Debug.Log("round_alternate_email_black_48dp Finished"); ////LoadGameObjectFromAB //yield return StartCoroutine(myABK.LoadGameObjetFromAB(new ABFileURL() //{ // fullURL = "https://s3-ap-northeast-1.amazonaws.com/hooloopplayground/" + SystemInfoChecker.GetPlatformName() + "/tester001", // fileName = "tester001" //}, //new List<ObjectNamePosition>() //{ // new ObjectNamePosition(){ name="Cube", position=Vector3.down} //} // List of ObjectNamePosition //)); //Debug.Log("Cube Finished"); ////Load Textures FromAB //yield return StartCoroutine(myABK.LoadTextureFromAB(new ABFileURL() //{ // fullURL = "https://s3-ap-northeast-1.amazonaws.com/hooloopplayground/" + SystemInfoChecker.GetPlatformName() + "/icons", // fileName = "icons" //}, //(List<Texture2D> _textures) => //{ //}, //new string[]{ "baseline_3d_rotation_black_18dp", "round_alternate_email_black_48dp" } // ObjectNamePositions //)); //Debug.Log("baseline_3d_rotation_black_18dp round_alternate_email_black_48dp Finished"); }
IEnumerator Login(string userID, string pletformID = "", LoginType loginType = LoginType.GuestLogin) { Debug.Log("로그인 시작"); loginPanel.SetActive(false); //로그인 시 유저 데이터 구성부분 WWWForm form = new WWWForm(); form.AddField("userID", userID, System.Text.Encoding.UTF8); //테스트 아이디로 로그인한다. string googleID = ""; if (PlayerPrefs.HasKey("google")) { googleID = PlayerPrefs.GetString("google"); } else { if (loginType == LoginType.GoogleLogin) { googleID = pletformID; } } string facebookID = ""; if (PlayerPrefs.HasKey("facebook")) { facebookID = PlayerPrefs.GetString("facebook"); } else { if (loginType == LoginType.FacebookLogin) { facebookID = pletformID; } } tipMessageText.text = "로그인 정보를 내려받는 중.."; form.AddField("google", googleID, System.Text.Encoding.UTF8); form.AddField("facebook", facebookID, System.Text.Encoding.UTF8); form.AddField("deviceModel", SystemInfo.deviceModel); form.AddField("deviceID", SystemInfo.deviceUniqueIdentifier); form.AddField("type", (int)loginType); string result = ""; string php = "Login.php"; yield return(StartCoroutine(WebServerConnectManager.Instance.WWWCoroutine(php, form, x => result = x))); JsonData jsonData = ParseCheckDodge(result); PlayerPrefs.SetString("userID", JsonParser.ToString(jsonData["id"].ToString())); if (loginType == LoginType.GoogleLogin) { PlayerPrefs.SetString("google", JsonParser.ToString(jsonData["google"].ToString())); } if (loginType == LoginType.FacebookLogin) { PlayerPrefs.SetString("facebook", JsonParser.ToString(jsonData["facebook"].ToString())); } // 아틀라스 캐싱 string atlasName = "Atlas_Product"; AssetBundleLoadAssetOperation r = AssetBundleManager.LoadAssetAsync("sprite/product", atlasName, typeof(UnityEngine.U2D.SpriteAtlas)); yield return(StartCoroutine(r)); UnityEngine.U2D.SpriteAtlas atlas = r.GetAsset <UnityEngine.U2D.SpriteAtlas>(); if (atlas != null) { if (!AssetLoader.cachedAtlasDic.ContainsKey(atlasName)) { AssetLoader.cachedAtlasDic.Add(atlasName, atlas); } } string atlasName2 = "Atlas_Material"; AssetBundleLoadAssetOperation r2 = AssetBundleManager.LoadAssetAsync("sprite/material", atlasName2, typeof(UnityEngine.U2D.SpriteAtlas)); yield return(StartCoroutine(r2)); UnityEngine.U2D.SpriteAtlas atlas2 = r2.GetAsset <UnityEngine.U2D.SpriteAtlas>(); if (atlas2 != null) { if (!AssetLoader.cachedAtlasDic.ContainsKey(atlasName2)) { AssetLoader.cachedAtlasDic.Add(atlasName2, atlas2); } } //// 게임 데이타 초기화 끝날 때 까지 대기 //while (!GameDataManager.isInitialized) // yield return null; if (User.Instance) { User.Instance.InitUserData(jsonData); } Debug.Log("유저 데이터 초기화"); while (!User.isInitialized) { yield return(null); } Debug.Log("완료"); // 유저 데이터 초기화 시작 StartCoroutine(UserDataManager.Instance.Init()); // 유저 데이터 초기화 완료 했는가 체크 while (!UserDataManager.isInitialized) { yield return(null); } tipMessageText.text = "왕국으로 진입중.."; Debug.Log("Login UserID : " + JsonParser.ToString(jsonData["id"])); //enterButton.SetActive(true); //if (onFadeOutStart != null) // onFadeOutStart(); ////페이드아웃 기다리는 시간 //yield return new WaitForSeconds(1.5f); yield return(StartCoroutine(LoadingManager.FadeOutScreen())); string nextSceneBundleName = "scene/lobby"; string nextSceneName = "Lobby"; AssetBundleLoadOperation operation = AssetBundleManager.LoadLevelAsync(nextSceneBundleName, nextSceneName, true); //// 몬스터 풀 초기화 끝났는가 체크 //while (!MonsterPool.Instance) // yield return null; //while (!MonsterPool.Instance.isInitialization) // yield return null; //while (!Battle.Instance || !Battle.Instance.isInitialized) // yield return null; while (!operation.IsDone()) { yield return(null); } versionText.gameObject.SetActive(false); messagePanel.SetActive(false); StopCoroutine(messageCoroutine()); //while (!UILoginManager.isFinished) // yield return null; Scene lobby = SceneManager.GetSceneByName("Lobby"); Scene login = SceneManager.GetSceneByName("Login"); Scene preLogin = SceneManager.GetSceneByName("PreLogin"); SceneManager.SetActiveScene(lobby); SceneManager.UnloadSceneAsync(login); SceneManager.UnloadSceneAsync(preLogin); }
private Atlas LoadAtlas(UnityEngine.U2D.SpriteAtlas spriteAtlas) { List <AtlasPage> pages = new List <AtlasPage>(); List <AtlasRegion> regions = new List <AtlasRegion>(); Sprite[] sprites = new UnityEngine.Sprite[spriteAtlas.spriteCount]; spriteAtlas.GetSprites(sprites); if (sprites.Length == 0) { return(new Atlas(pages, regions)); } Texture2D texture = null; #if UNITY_EDITOR if (!Application.isPlaying) { texture = AccessPackedTextureEditor(spriteAtlas); } else #endif texture = AccessPackedTexture(sprites); Material material = materials[0]; #if !UNITY_EDITOR material.mainTexture = texture; #endif Spine.AtlasPage page = new AtlasPage(); page.name = spriteAtlas.name; page.width = texture.width; page.height = texture.height; page.format = Spine.Format.RGBA8888; page.minFilter = TextureFilter.Linear; page.magFilter = TextureFilter.Linear; page.uWrap = TextureWrap.ClampToEdge; page.vWrap = TextureWrap.ClampToEdge; page.rendererObject = material; pages.Add(page); sprites = AccessPackedSprites(spriteAtlas); int i = 0; for (; i < sprites.Length; ++i) { var sprite = sprites[i]; AtlasRegion region = new AtlasRegion(); region.name = sprite.name.Replace("(Clone)", ""); region.page = page; region.degrees = sprite.packingRotation == SpritePackingRotation.None ? 0 : 90; region.u2 = 1; region.v2 = 1; region.width = page.width; region.height = page.height; region.originalWidth = page.width; region.originalHeight = page.height; region.index = i; regions.Add(region); } var atlas = new Atlas(pages, regions); AssignRegionsFromSavedRegions(sprites, atlas); return(atlas); }
extern private static void Internal_Create([Writable] SpriteAtlas mono);