2013-02-09 65 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中重新创建它)。