public void DestroyPopup(CLSceneContext single) { //Check exists.. int idx = -1; for (int i = 0; i < stackList.Count; i++) { if (stackList[i] == single) { idx = i; break; } } if (idx == -1) { throw new Exception("Cannot dispose which not exists!"); } if (stackList.Count - 1 == idx) { //Need this to be disposed normally. PopPopup(); } else { //Might be middle of popup.. stackList[idx].Dispose(); stackList.RemoveAt(idx); } }
void Push(CLSceneContext temp) { stackList.Add(temp); }