public static void test_push() { Heap <Testobj> test_heap = new Heap <Testobj>(); test_heap.Insert(new Testobj(9)); test_heap.Insert(new Testobj(2)); test_heap.Insert(new Testobj(6)); test_heap.Insert(new Testobj(7)); test_heap.Insert(new Testobj(3)); test_heap.Insert(new Testobj(4)); Testobj t1 = test_heap.Remove(); FDebug.LogError("" + t1.v); t1 = test_heap.Remove(); FDebug.LogError("" + t1.v); t1 = test_heap.Remove(); FDebug.LogError("" + t1.v); t1 = test_heap.Remove(); FDebug.LogError("" + t1.v); t1 = test_heap.Remove(); FDebug.LogError("" + t1.v); }
public void LoadFromFile(string strFileName) { TextAsset file = (TextAsset)(Resources.Load(strFileName, typeof(TextAsset))); if (file == null) { FDebug.LogError("载入TBL文件出错:" + strFileName); } string text = file.text; string[] vals = text.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); int nLineCounts = vals.Length; int nContentLineCounts = 0; for (int nIdx = 0; nIdx < nLineCounts; nIdx++) { if (!(vals[nIdx].StartsWith("//"))) { BuildLineCell(vals[nIdx], nIdx); nContentLineCounts++; } } if (nContentLineCounts > 1) { GotoLineByIndex(0); } }
public void Release(T element) { if (m_Stack.Count > 0 && ReferenceEquals(m_Stack.Peek(), element)) { FDebug.LogError("Internal error. Trying to destroy object that is already released to pool."); } if (m_ActionOnRelease != null) { m_ActionOnRelease(element); } m_Stack.Push(element); }