public GUIFrame PopFrame() { GUIFrame frame = null; FrameContextElement frameContextElement = this.m_frameChain.LastOrDefault(); if (frameContextElement != null) { frame = frameContextElement.TargetFrame; this.m_frameChain.Remove(frameContextElement); } return(frame); }
public void AddFrameToContext(GUIFrame targetFrame, GUIFrame openByFrame) { FrameContextElement frameContextElement = null; //无上下文 if (openByFrame == null) { m_exceptFrame.Add(targetFrame); } else { int alreadyChainIndex = GetFrameIndexOfChain(targetFrame); //Destroy already context info if (alreadyChainIndex != -1) { frameContextElement = this.m_frameChain[alreadyChainIndex]; //stack bottom //销毁整条链 if (alreadyChainIndex == 0) { ClearFrameContext(); } else { if (this.m_frameChain.Count - 1 < alreadyChainIndex) { Debug.LogError($"frame index error already index{alreadyChainIndex} , chain count {this.m_frameChain.Count}"); } FrameContextElement originNextFrameContextElement = this.m_frameChain[alreadyChainIndex + 1]; originNextFrameContextElement.OpenByFrame = frameContextElement.OpenByFrame; this.m_frameChain.RemoveAt(alreadyChainIndex); } } if (frameContextElement == null) { frameContextElement = new FrameContextElement(openByFrame); frameContextElement.NextFrame = targetFrame; } this.m_frameChain.Add(frameContextElement); } }