public static void Test() { #if UNITY_EDITOR System.Reflection.Assembly .GetAssembly(typeof(UnityEditor.SceneView)) .GetType("UnityEditor.LogEntries") .GetMethod("Clear") .Invoke(new object(), null); #endif var sw = new System.Diagnostics.Stopwatch(); sw.Stop(); sw.Reset(); sw.Start(); Mem.Test(); Log("Mem test: {0:N0}", sw.ElapsedTicks); sw.Reset(); sw.Start(); Algo.Test(); Log("Algo test: {0:N0}", sw.ElapsedTicks); sw.Reset(); sw.Start(); Pool.Test(); Log("Pool2 test: {0:N0}", sw.ElapsedTicks); sw.Reset(); sw.Start(); PtrLst.Test(); Log("PtrLst2 test: {0:N0}", sw.ElapsedTicks); sw.Reset(); sw.Start(); PtrIntDict.Test(); Log("NumDict test: {0:N0}", sw.ElapsedTicks); sw.Reset(); sw.Start(); }
public static void ReleaseAtlases(params int[] ids) { for (int i = 0, len = ids.Length; i < len; i += 1) { int id = ids[i]; var atlasMeta = (TpAtlasMeta *)atlasMetaLst->arr[i]; if (atlasMeta->name == id) { ReleaseTexture(id); for (int j = 0, jlen = atlasMeta->spriteCount; j < jlen; j += 1) { var spriteMeta = atlasMeta->sprites + j; PtrIntDict.Remove(spriteMetaDict, spriteMeta->name); } TpAtlasMeta.Decon(atlasMeta); Mem.Free(atlasMeta); PtrLst.RemoveAt(atlasMetaLst, i); i -= 1; } } }
void SetImgAttrEased(SetImgAttrEasedCmd cmd) { #if FDB Should.True("nodeIdxDict.ContainsKey(cmd.id)", PtrIntDict.Contains(nodeDict, cmd.id)); Should.InRange("cmd.imgAttrId", cmd.imgAttrId, 0, ImgAttr.End - 1); Should.GreaterThan("cmd.duration", cmd.duration, 0); Should.InRange("cmd.esType", cmd.esType, 0, EsType.End - 1); #endif float endTime = time + cmd.duration; if (endTime > lastEsEndTime) { lastEsEndTime = endTime; } var img = (TpSprite *)PtrIntDict.Get(nodeDict, cmd.id); var args = cmd.args; switch (cmd.imgAttrId) { case ImgAttr.Position: esJobList.AddLast(new EsSetImgPositionJob { node = img, duration = cmd.duration, esType = cmd.esType, x = img->pos[0], dx = (float)args[0] - img->pos[0], y = img->pos[1], dy = (float)args[1] - img->pos[1], z = img->pos[2], dz = 0 }); break; // (float)args[2] - img->pos[2] }); break; case ImgAttr.Rotation: esJobList.AddLast(new EsSetImgRotationJob { node = img, duration = cmd.duration, esType = cmd.esType, r = img->rot, dr = (float)args[0] - img->rot }); break; case ImgAttr.Scale: esJobList.AddLast(new EsSetImgScaleJob { node = img, duration = cmd.duration, esType = cmd.esType, x = img->scl[0], dx = (float)args[0] - img->scl[0], y = img->scl[1], dy = (float)args[1] - img->scl[1] }); break; case ImgAttr.Alpha: esJobList.AddLast(new EsSetImgAlphaJob { node = img, duration = cmd.duration, esType = cmd.esType, a = img->color[3], da = (float)args[0] - img->color[3] }); break; case ImgAttr.Tint: esJobList.AddLast(new EsSetImgTintJob { node = img, duration = cmd.duration, esType = cmd.esType, r = img->color[0], dr = (float)args[0] - img->color[0], g = img->color[1], dg = (float)args[1] - img->color[1], b = img->color[2], db = (float)args[2] - img->color[2] }); break; } }
public static bool HasSpriteMeta(int id) { return(PtrIntDict.Contains(spriteMetaDict, id)); // return spriteMetaLstIdxDict.ContainsKey(id); }
public static TpSpriteMeta *GetSpriteMeta(int id) { return((TpSpriteMeta *)PtrIntDict.Get(spriteMetaDict, id)); // return (TpSpriteMeta *)spriteMetaLst->arr[spriteMetaLstIdxDict[id]]; }