什么是在运行时完全禁用每个游戏的最佳方法?

时间:2013-05-28 00:21:10

标签: everyplay

我想在运行iphone4 / 3G / 3GS时禁用每个播放器,内置统一性

但我不确定全局禁用它的最简单的地方。有什么建议?

if (iPhone.generation == iPhoneGeneration.iPhone4  || iPhone.generation == iPhoneGeneration.iPhone3G || iPhone.generation == iPhoneGeneration.iPhone3GS )

1 个答案:

答案 0 :(得分:2)

您可以通过在游戏的第一个场景中调用Everyplay.SharedInstance.SetDisableSingleCoreDevices(true)轻松禁用单核设备(3GS / 4 / iPad1)。之后,如果您在单个核心设备上呼叫StartRecording,则不必担心,因为Everyplay会忽略呼叫。 3G(和Unity编辑器)首先不支持录制。

如果您需要在iPad 1上支持录制,一种方法是创建一个Everyplay单例包装器,它不会在您已定义为不支持的设备上调用录制功能。

简单的包装器示例(未经测试但给出了您的想法):

using UnityEngine;

public static class MyEveryplayWrapper {
    private static iPhoneGeneration[] unsupportedDevices = {
        iPhoneGeneration.iPad1Gen,
        iPhoneGeneration.iPhone,
        iPhoneGeneration.iPhone3G,
        iPhoneGeneration.iPhone3GS,
        iPhoneGeneration.iPodTouch1Gen,
        iPhoneGeneration.iPodTouch2Gen,
        iPhoneGeneration.iPodTouch3Gen
    };

    private static bool CheckIfRecordingSupported() {
        bool recordingSupported = !Application.isEditor;

        foreach(iPhoneGeneration device in unsupportedDevices) {
            if(device == iPhone.generation) {
                recordingSupported = false;
                break;
            }
        }

        Debug.Log ("Everyplay recording support: " + recordingSupported);

        return recordingSupported;
    }

    public static bool IsRecordingSupported = CheckIfRecordingSupported();

    public static void StartRecording() {
        if(IsRecordingSupported) {
            Everyplay.SharedInstance.StartRecording();
        }
    }

    public static void StopRecording() {
        if(IsRecordingSupported) {
            Everyplay.SharedInstance.StopRecording();
        }
    }
}

要使用它,您只需拨打MyEveryplayWrapper.MethodName而不是Everyplay.SharedInstance.MethodName。在渲染UI时,您可以考虑IsRecordingSupported来显示/隐藏Everplay相关按钮等。