我想在运行 iphone4/3G/3GS 时禁用内置统一的everyplay
但我不确定全局禁用它的最简单的地方。有什么建议么?
if (iPhone.generation == iPhoneGeneration.iPhone4 || iPhone.generation == iPhoneGeneration.iPhone3G || iPhone.generation == iPhoneGeneration.iPhone3GS )
我想在运行 iphone4/3G/3GS 时禁用内置统一的everyplay
但我不确定全局禁用它的最简单的地方。有什么建议么?
if (iPhone.generation == iPhoneGeneration.iPhone4 || iPhone.generation == iPhoneGeneration.iPhone3G || iPhone.generation == iPhoneGeneration.iPhone3GS )
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 相关按钮等。