2013-02-09 53 views
0

我在加載Game Center登錄視圖時遇到了與Game Center集成的問題,但它正在刪除當前加載的任何紋理。如果我將PresentModalViewController行註釋掉,遊戲中心登錄表單不會出現,但已經加載的紋理會保留在內存中並且可以正常工作。我使用下面的代碼來顯示遊戲中心觀點:EAGLView中刪除紋理的遊戲中心

GKLocalPlayer.LocalPlayer.AuthenticateHandler = (ui, ErrorCode) => 
     { 
      if (ui != null) { 
       Debug.WriteLine ("GK Not authenticated, presenting login"); 
       PresentModalViewController (ui, true); 
      } else { 
       Debug.WriteLine ("GK Checking Authentication"); 
       bool authenticated = GKLocalPlayer.LocalPlayer.Authenticated; 

       if (authenticated) 
        Debug.WriteLine ("Game Center Authenticated. " + GKLocalPlayer.LocalPlayer.DisplayName); 
       else 
        Debug.WriteLine ("Game Center Not Authenticated. " + GKLocalPlayer.LocalPlayer.PlayerID + " " + ErrorCode.ToString()); 
      } 
     }; 

有沒有人見過這個問題,如果是這樣,什麼是顯示在網頁遊戲中心標誌,但保持加載紋理的解決方案?

回答

0

找到了這個問題的答案,它與MonoTouch OpenTK示例應用程序有關,建議在ViewWillDisappear事件中銷燬渲染緩衝區,這會在GameCentre窗口出現時發生。當Buffer被破壞時,紋理就會隨之消失,所以此處的解決方案是不要銷燬ViewWillDisappear事件中的渲染緩衝區(並且隨後不要在ViewWillAppear中重新創建它)。