/// <summary> /// 次のページ遷移 /// </summary> private void TransitionNextPage() { if (this.nextPage == PageBack) { // 戻るだった場合はスタックから取得 this.nextPage = (hasPageHistory) ? pageHistory.Pop() : string.Empty; } else { if (this.currentPage != string.Empty) { // 遷移前のページを記録 pageHistory.Push(this.currentPage); } } if (this.nextPage == string.Empty) { return; } // ページ更新 this.currentPage = this.nextPage; this.nextPage = string.Empty; this.drawerCache = null; }
/// <summary> /// ウィンドウを開く(Rect指定あり) /// </summary> public void Open(int id, Rect rect, string page, Draw callback) { this.windowRect = rect; this.Id = id; this.scrollPosition = Vector2.zero; this.IsClosed = false; this.drawerCache = null; pageDraws.Clear(); if (callback != null) { RegisterDraw(page, callback); } OpenPage(page); }
/// <summary> /// ウィンドウを開く /// </summary> public void Open(int id, string page, Draw callback) { // 位置オフセット const float offset = 10f; this.windowRect = new Rect(id * offset, id * offset, Screen.width * 0.5f, Screen.height * 0.5f); this.Id = id; this.scrollPosition = Vector2.zero; this.IsClosed = false; this.drawerCache = null; pageDraws.Clear(); if (callback != null) { pageDraws.Add(page, callback); } OpenPage(page); }
/// <summary> /// 内容描画 /// </summary> private void DrawContent() { using (var sv = new GUILayout.ScrollViewScope(scrollPosition)) { // スクロール更新 scrollPosition = sv.scrollPosition; // ページ内容描画 if (pageDraws.TryGetValue(currentPage, out Draw draw)) { draw?.Invoke(this); } else { var drawer = DebugManager.Instance.GetDrawer(currentPage); if (drawer != null) { drawer?.Draw(this); drawerCache = drawer; } } } }