/// <summary> /// 从缓存中获取节点 /// </summary> /// <param name="cube"></param> /// <returns></returns> public bool TryHitCache(QuadTreeSpaceCube cube) { CubeTime hitCube = null; for (int i = 0; i < cachedCube.Count; ++i) { var cache_info = cachedCube[i]; if (cache_info == null) { continue; } if (cache_info.mCube == cube) { hitCube = cache_info; break; } } if (hitCube != null) { // 将节点移动到队列结尾,并设置新的访问时间 cachedCube.Remove(hitCube); cachedCube.Add(hitCube); hitCube.mTime = Time.unscaledTime; return(true); } else { return(false); } }
public void SaveScrambleTime(double scrambleTime, string scrambleType) { using (var context = new ApplicationDbContext()) { var cubeTime = new CubeTime(1, User.Identity.GetUserId(), scrambleTime, scrambleType); context.CubeTimes.Add(cubeTime); try { context.SaveChanges(); } catch (Exception) { //pass } } }