0

我在 MonoTouch 中集成 Game Center 时遇到问题,Game Center 登录视图正在加载,但它正在擦除当前加载的所有纹理。如果我注释掉 PresentModalViewController 行,那么游戏中心登录表单不会出现,但是已经加载的纹理会保留在内存中并且可以工作。我正在使用以下代码来显示游戏中心视图:

    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());
            }
        };

有没有人见过这个问题,如果是这样,显示游戏中心登录页面但保留加载的纹理的解决方案是什么?

4

1 回答 1

0

找到了这个问题的答案,它与 MonoTouch OpenTK 示例应用程序建议在 ViewWillDisappear 事件中销毁渲染缓冲区有关,该事件发生在 GameCentre 窗口出现时。当 Buffer 被销毁时,纹理随之而来,因此这里的解决方案是在 ViewWillDisappear 事件中不销毁渲染缓冲区(随后,不要在 ViewWillAppear 中重新创建它)。

于 2013-03-13T15:40:22.193 回答