open source

This commit is contained in:
lvfulong
2020-11-11 16:17:13 +08:00
parent 4d989f3ecb
commit bc4ca748de
2441 changed files with 623057 additions and 2 deletions
@@ -0,0 +1,878 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
24760D5A2081B9D700594375 /* JSShaderActiveInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 24760D552081B9D600594375 /* JSShaderActiveInfo.cpp */; };
24760D5B2081B9D700594375 /* JSTextBitmapInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 24760D572081B9D700594375 /* JSTextBitmapInfo.cpp */; };
5E68064D1D7D0F82002A7575 /* NSString.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E68064C1D7D0F82002A7575 /* NSString.m */; };
5E7AB4D71DD2CE2B001AE49F /* LayaScreenShotter.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5E7AB4D61DD2CE2B001AE49F /* LayaScreenShotter.mm */; };
5E8E47811D8F939400662E69 /* LayaDeviceSensor.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5E8E47801D8F939400662E69 /* LayaDeviceSensor.mm */; };
9D8D6C6B1D43604A00EFE81A /* reflection.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9D8D6C6A1D43604900EFE81A /* reflection.mm */; };
A21E1BBE20A98675007F32F4 /* JSShaderPrecisionFormat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A21E1BBC20A98674007F32F4 /* JSShaderPrecisionFormat.cpp */; };
A2252F3520F4E33800A22490 /* JCScriptRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2252F3420F4E33700A22490 /* JCScriptRuntime.cpp */; };
A2252F3B20F4EDB000A22490 /* JSCallbackFuncObj.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2252F3920F4EDB000A22490 /* JSCallbackFuncObj.cpp */; };
A247BC00237109FB009B1189 /* LayaBulletExport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A247BBFD237109FA009B1189 /* LayaBulletExport.cpp */; };
A247BC01237109FB009B1189 /* LayaBulletExportImp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A247BBFF237109FA009B1189 /* LayaBulletExportImp.cpp */; };
A25F7B2F219AB6DC004FA571 /* IVideoRenderTarget.m in Sources */ = {isa = PBXBuildFile; fileRef = A25F7B2E219AB6DC004FA571 /* IVideoRenderTarget.m */; };
A25F7B32219ABD4D004FA571 /* VideoOutputRenderTarget.m in Sources */ = {isa = PBXBuildFile; fileRef = A25F7B31219ABD4D004FA571 /* VideoOutputRenderTarget.m */; };
A264F7C220C7DDC100D95F1B /* JSLayaGL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A264F7C020C7DDC100D95F1B /* JSLayaGL.cpp */; };
A270D73A2170FD8D000D994D /* JCConchBridge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A270D7392170FD8D000D994D /* JCConchBridge.cpp */; };
A2729C9A1D20C51C00EC01E6 /* JSHistory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2729C981D20C51C00EC01E6 /* JSHistory.cpp */; };
A2757BE6219AB43D00DB3683 /* PlayerLayerRenderTarget.m in Sources */ = {isa = PBXBuildFile; fileRef = A2757BE5219AB43D00DB3683 /* PlayerLayerRenderTarget.m */; };
A28DB2A31D2CB24400BAED5C /* LayaAlert.mm in Sources */ = {isa = PBXBuildFile; fileRef = A28DB2A21D2CB24400BAED5C /* LayaAlert.mm */; };
A2C56AB71C8ADAD3009DDC1D /* Reachability.m in Sources */ = {isa = PBXBuildFile; fileRef = A2C56AB61C8ADAD3009DDC1D /* Reachability.m */; };
A2C56AC21C8ADAF2009DDC1D /* LayaNotifyManager.m in Sources */ = {isa = PBXBuildFile; fileRef = A2C56AC11C8ADAF2009DDC1D /* LayaNotifyManager.m */; };
A2C56ACF1C8ADB37009DDC1D /* JCMp3Player.mm in Sources */ = {isa = PBXBuildFile; fileRef = A2C56ACE1C8ADB37009DDC1D /* JCMp3Player.mm */; };
A2C56AE01C8ADB5A009DDC1D /* conchConfig.mm in Sources */ = {isa = PBXBuildFile; fileRef = A2C56AD11C8ADB5A009DDC1D /* conchConfig.mm */; };
A2C56AE11C8ADB5A009DDC1D /* CToObjectCIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = A2C56AD31C8ADB5A009DDC1D /* CToObjectCIOS.mm */; };
A2C56AE21C8ADB5A009DDC1D /* LayaEditBox.mm in Sources */ = {isa = PBXBuildFile; fileRef = A2C56AD51C8ADB5A009DDC1D /* LayaEditBox.mm */; };
A2C56AE31C8ADB5A009DDC1D /* LayaEditBoxDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = A2C56AD71C8ADB5A009DDC1D /* LayaEditBoxDelegate.mm */; };
A2C56AE41C8ADB5A009DDC1D /* LayaWebView.mm in Sources */ = {isa = PBXBuildFile; fileRef = A2C56AD91C8ADB5A009DDC1D /* LayaWebView.mm */; };
A2C56AE51C8ADB5A009DDC1D /* LayaToast.mm in Sources */ = {isa = PBXBuildFile; fileRef = A2C56ADB1C8ADB5A009DDC1D /* LayaToast.mm */; };
A2C56AE61C8ADB5A009DDC1D /* TouchFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2C56ADC1C8ADB5A009DDC1D /* TouchFilter.cpp */; };
A2C56AE71C8ADB5A009DDC1D /* UIEditBox.mm in Sources */ = {isa = PBXBuildFile; fileRef = A2C56ADF1C8ADB5A009DDC1D /* UIEditBox.mm */; };
A2C56AEB1C8B179A009DDC1D /* JCAudioManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2C56AE91C8B179A009DDC1D /* JCAudioManager.cpp */; };
A2C56AEE1C8B17E4009DDC1D /* JCAudioMp3Player.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2C56AEC1C8B17E4009DDC1D /* JCAudioMp3Player.cpp */; };
A2D1195A1D0BC981004C229D /* WebSocket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2D119581D0BC981004C229D /* WebSocket.cpp */; };
A2D1197A1D0BCA06004C229D /* JCConch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2D1196D1D0BCA06004C229D /* JCConch.cpp */; };
A2D1197B1D0BCA06004C229D /* JCConchRender.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2D1196F1D0BCA06004C229D /* JCConchRender.cpp */; };
A2D1197E1D0BCA06004C229D /* JCSystemConfig.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2D119751D0BCA06004C229D /* JCSystemConfig.cpp */; };
A2D1197F1D0BCA06004C229D /* JCThreadCmdMgr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2D119771D0BCA06004C229D /* JCThreadCmdMgr.cpp */; };
A2D119911D0BCA59004C229D /* JSInterface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2D1198E1D0BCA59004C229D /* JSInterface.cpp */; };
A2D119CC1D0BCA70004C229D /* JSAppCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2D119941D0BCA70004C229D /* JSAppCache.cpp */; };
A2D119CD1D0BCA70004C229D /* JSAudio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2D119961D0BCA70004C229D /* JSAudio.cpp */; };
A2D119CE1D0BCA70004C229D /* JSConchConfig.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2D119991D0BCA70004C229D /* JSConchConfig.cpp */; };
A2D119CF1D0BCA70004C229D /* JSConsole.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2D1199B1D0BCA70004C229D /* JSConsole.cpp */; };
A2D119D01D0BCA70004C229D /* JSDOMParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2D1199D1D0BCA70004C229D /* JSDOMParser.cpp */; };
A2D119D11D0BCA70004C229D /* JSFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2D1199F1D0BCA70004C229D /* JSFile.cpp */; };
A2D119D21D0BCA70004C229D /* JSFileReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2D119A11D0BCA70004C229D /* JSFileReader.cpp */; };
A2D119D41D0BCA70004C229D /* JSGlobalExportCFun.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2D119A51D0BCA70004C229D /* JSGlobalExportCFun.cpp */; };
A2D119D51D0BCA70004C229D /* JSImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2D119A71D0BCA70004C229D /* JSImage.cpp */; };
A2D119D71D0BCA70004C229D /* JSInput.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2D119AB1D0BCA70004C229D /* JSInput.cpp */; };
A2D119DB1D0BCA70004C229D /* JSNotify.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2D119B31D0BCA70004C229D /* JSNotify.cpp */; };
A2D119DC1D0BCA70004C229D /* JSRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2D119B51D0BCA70004C229D /* JSRuntime.cpp */; };
A2D119DF1D0BCA70004C229D /* JSTextMemoryCanvas.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2D119BB1D0BCA70004C229D /* JSTextMemoryCanvas.cpp */; };
A2D119E11D0BCA70004C229D /* JSWebSocket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2D119BF1D0BCA70004C229D /* JSWebSocket.cpp */; };
A2D119E31D0BCA70004C229D /* JSXmlAttr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2D119C31D0BCA70004C229D /* JSXmlAttr.cpp */; };
A2D119E41D0BCA70004C229D /* JSXmlNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2D119C51D0BCA70004C229D /* JSXmlNode.cpp */; };
A2D119E51D0BCA70004C229D /* JSZip.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2D119C71D0BCA70004C229D /* JSZip.cpp */; };
A2D119E61D0BCA70004C229D /* XMLHttpRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2D119C91D0BCA70004C229D /* XMLHttpRequest.cpp */; };
A2D119EA1D0BCB84004C229D /* JSIOSEditBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2D119E81D0BCB84004C229D /* JSIOSEditBox.cpp */; };
A2D119F71D0BFA31004C229D /* JSCArrayBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2D119EB1D0BFA31004C229D /* JSCArrayBuffer.cpp */; };
A2D119F81D0BFA31004C229D /* JSCBinder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2D119ED1D0BFA31004C229D /* JSCBinder.cpp */; };
A2D119F91D0BFA31004C229D /* JSCEnv.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2D119EF1D0BFA31004C229D /* JSCEnv.cpp */; };
A2D11A051D0C30D1004C229D /* JSFileSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2D11A031D0C30D1004C229D /* JSFileSystem.cpp */; };
A2D11A221D0C402F004C229D /* JCIOSFreeType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2D11A201D0C402F004C229D /* JCIOSFreeType.cpp */; };
A2D8F386218C036F00E232A9 /* LayaVideoPlayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = A2D8F385218C036F00E232A9 /* LayaVideoPlayer.mm */; };
A2D8F38C218C06F100E232A9 /* JSVideo_CommonImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2D8F38A218C06F100E232A9 /* JSVideo_CommonImpl.cpp */; };
A2D8F38D218C06F100E232A9 /* VideoCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2D8F38B218C06F100E232A9 /* VideoCache.cpp */; };
A2D8F38F218C1D6E00E232A9 /* JSVideo_IOSImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2D8F38E218C1D6E00E232A9 /* JSVideo_IOSImpl.cpp */; };
A2DE586123C6DC6600A75F34 /* Uri.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2DE586023C6DC6600A75F34 /* Uri.cpp */; };
A2EE055D1C8A77B700A35FB6 /* conchRuntime.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = A2EE055C1C8A77B700A35FB6 /* conchRuntime.h */; };
A2EE055F1C8A77B700A35FB6 /* conchRuntime.mm in Sources */ = {isa = PBXBuildFile; fileRef = A2EE055E1C8A77B700A35FB6 /* conchRuntime.mm */; };
A2F3B7A1216CAB8B0016F0A2 /* bullet_glue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2F3B79E216CAB8B0016F0A2 /* bullet_glue.cpp */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
A2EE05571C8A77B700A35FB6 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "include/$(PRODUCT_NAME)";
dstSubfolderSpec = 16;
files = (
A2EE055D1C8A77B700A35FB6 /* conchRuntime.h in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
24760D512081B9D600594375 /* JSTextBitmapInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSTextBitmapInfo.h; path = ../../../../source/conch/JSWrapper/LayaWrap/JSTextBitmapInfo.h; sourceTree = "<group>"; };
24760D552081B9D600594375 /* JSShaderActiveInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSShaderActiveInfo.cpp; path = ../../../../source/conch/JSWrapper/LayaWrap/JSShaderActiveInfo.cpp; sourceTree = "<group>"; };
24760D562081B9D600594375 /* JSShaderActiveInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSShaderActiveInfo.h; path = ../../../../source/conch/JSWrapper/LayaWrap/JSShaderActiveInfo.h; sourceTree = "<group>"; };
24760D572081B9D700594375 /* JSTextBitmapInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSTextBitmapInfo.cpp; path = ../../../../source/conch/JSWrapper/LayaWrap/JSTextBitmapInfo.cpp; sourceTree = "<group>"; };
5E68064B1D7D0F82002A7575 /* NSString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSString.h; sourceTree = "<group>"; };
5E68064C1D7D0F82002A7575 /* NSString.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSString.m; sourceTree = "<group>"; };
5E7AB4D51DD2CE2B001AE49F /* LayaScreenShotter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayaScreenShotter.h; sourceTree = "<group>"; };
5E7AB4D61DD2CE2B001AE49F /* LayaScreenShotter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LayaScreenShotter.mm; sourceTree = "<group>"; };
5E8E477F1D8F939400662E69 /* LayaDeviceSensor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayaDeviceSensor.h; sourceTree = "<group>"; };
5E8E47801D8F939400662E69 /* LayaDeviceSensor.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LayaDeviceSensor.mm; sourceTree = "<group>"; };
9D8D6C691D43604900EFE81A /* refection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = refection.h; path = Reflection/refection.h; sourceTree = "<group>"; };
9D8D6C6A1D43604900EFE81A /* reflection.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = reflection.mm; path = Reflection/reflection.mm; sourceTree = "<group>"; };
A21E1BBC20A98674007F32F4 /* JSShaderPrecisionFormat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSShaderPrecisionFormat.cpp; path = ../../../../source/conch/JSWrapper/LayaWrap/JSShaderPrecisionFormat.cpp; sourceTree = "<group>"; };
A21E1BBD20A98674007F32F4 /* JSShaderPrecisionFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSShaderPrecisionFormat.h; path = ../../../../source/conch/JSWrapper/LayaWrap/JSShaderPrecisionFormat.h; sourceTree = "<group>"; };
A2252F3320F4E33700A22490 /* JCScriptRuntime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JCScriptRuntime.h; path = ../../../../source/conch/JCScriptRuntime.h; sourceTree = "<group>"; };
A2252F3420F4E33700A22490 /* JCScriptRuntime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JCScriptRuntime.cpp; path = ../../../../source/conch/JCScriptRuntime.cpp; sourceTree = "<group>"; };
A2252F3920F4EDB000A22490 /* JSCallbackFuncObj.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSCallbackFuncObj.cpp; path = ../../../../source/conch/JSWrapper/LayaWrap/JSCallbackFuncObj.cpp; sourceTree = "<group>"; };
A2252F3A20F4EDB000A22490 /* JSCallbackFuncObj.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSCallbackFuncObj.h; path = ../../../../source/conch/JSWrapper/LayaWrap/JSCallbackFuncObj.h; sourceTree = "<group>"; };
A247BBFD237109FA009B1189 /* LayaBulletExport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LayaBulletExport.cpp; path = ../../../../source/conch/JSWrapper/LayaWrap/Bullet/LayaBulletExport.cpp; sourceTree = "<group>"; };
A247BBFE237109FA009B1189 /* LayaBulletExport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LayaBulletExport.h; path = ../../../../source/conch/JSWrapper/LayaWrap/Bullet/LayaBulletExport.h; sourceTree = "<group>"; };
A247BBFF237109FA009B1189 /* LayaBulletExportImp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LayaBulletExportImp.cpp; path = ../../../../source/conch/JSWrapper/LayaWrap/Bullet/LayaBulletExportImp.cpp; sourceTree = "<group>"; };
A25F7B2E219AB6DC004FA571 /* IVideoRenderTarget.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = IVideoRenderTarget.m; path = Video/IVideoRenderTarget.m; sourceTree = "<group>"; };
A25F7B30219ABD2D004FA571 /* VideoOutputRenderTarget.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = VideoOutputRenderTarget.h; path = Video/VideoOutputRenderTarget.h; sourceTree = "<group>"; };
A25F7B31219ABD4D004FA571 /* VideoOutputRenderTarget.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = VideoOutputRenderTarget.m; path = Video/VideoOutputRenderTarget.m; sourceTree = "<group>"; };
A264F7BF20C7DDC000D95F1B /* JSLayaGL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSLayaGL.h; path = ../../../../source/conch/JSWrapper/LayaWrap/JSLayaGL.h; sourceTree = "<group>"; };
A264F7C020C7DDC100D95F1B /* JSLayaGL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSLayaGL.cpp; path = ../../../../source/conch/JSWrapper/LayaWrap/JSLayaGL.cpp; sourceTree = "<group>"; };
A270D7382170FD8D000D994D /* JCConchBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCConchBridge.h; sourceTree = "<group>"; };
A270D7392170FD8D000D994D /* JCConchBridge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JCConchBridge.cpp; sourceTree = "<group>"; };
A2729C981D20C51C00EC01E6 /* JSHistory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSHistory.cpp; path = ../../../../source/conch/JSWrapper/LayaWrap/JSHistory.cpp; sourceTree = "<group>"; };
A2729C991D20C51C00EC01E6 /* JSHistory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSHistory.h; path = ../../../../source/conch/JSWrapper/LayaWrap/JSHistory.h; sourceTree = "<group>"; };
A2757BE3219AB15500DB3683 /* IVideoRenderTarget.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = IVideoRenderTarget.h; path = Video/IVideoRenderTarget.h; sourceTree = "<group>"; };
A2757BE4219AB38200DB3683 /* PlayerLayerRenderTarget.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = PlayerLayerRenderTarget.h; path = Video/PlayerLayerRenderTarget.h; sourceTree = "<group>"; };
A2757BE5219AB43D00DB3683 /* PlayerLayerRenderTarget.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = PlayerLayerRenderTarget.m; path = Video/PlayerLayerRenderTarget.m; sourceTree = "<group>"; };
A28DB2A11D2CB24400BAED5C /* LayaAlert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayaAlert.h; sourceTree = "<group>"; };
A28DB2A21D2CB24400BAED5C /* LayaAlert.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LayaAlert.mm; sourceTree = "<group>"; };
A2C56AB51C8ADAD3009DDC1D /* Reachability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Reachability.h; path = Reachability/Reachability.h; sourceTree = "<group>"; };
A2C56AB61C8ADAD3009DDC1D /* Reachability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Reachability.m; path = Reachability/Reachability.m; sourceTree = "<group>"; };
A2C56ABF1C8ADAF2009DDC1D /* LayaNotifyInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LayaNotifyInterface.h; path = Notification/LayaNotifyInterface.h; sourceTree = "<group>"; };
A2C56AC01C8ADAF2009DDC1D /* LayaNotifyManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LayaNotifyManager.h; path = Notification/LayaNotifyManager.h; sourceTree = "<group>"; };
A2C56AC11C8ADAF2009DDC1D /* LayaNotifyManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = LayaNotifyManager.m; path = Notification/LayaNotifyManager.m; sourceTree = "<group>"; };
A2C56ACD1C8ADB37009DDC1D /* JCMp3Player.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JCMp3Player.h; path = Audio/JCMp3Player.h; sourceTree = "<group>"; };
A2C56ACE1C8ADB37009DDC1D /* JCMp3Player.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = JCMp3Player.mm; path = Audio/JCMp3Player.mm; sourceTree = "<group>"; };
A2C56AD01C8ADB5A009DDC1D /* conchConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = conchConfig.h; sourceTree = "<group>"; };
A2C56AD11C8ADB5A009DDC1D /* conchConfig.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = conchConfig.mm; sourceTree = "<group>"; };
A2C56AD21C8ADB5A009DDC1D /* CToObjectCIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CToObjectCIOS.h; sourceTree = "<group>"; };
A2C56AD31C8ADB5A009DDC1D /* CToObjectCIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CToObjectCIOS.mm; sourceTree = "<group>"; };
A2C56AD41C8ADB5A009DDC1D /* LayaEditBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayaEditBox.h; sourceTree = "<group>"; };
A2C56AD51C8ADB5A009DDC1D /* LayaEditBox.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LayaEditBox.mm; sourceTree = "<group>"; };
A2C56AD61C8ADB5A009DDC1D /* LayaEditBoxDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayaEditBoxDelegate.h; sourceTree = "<group>"; };
A2C56AD71C8ADB5A009DDC1D /* LayaEditBoxDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LayaEditBoxDelegate.mm; sourceTree = "<group>"; };
A2C56AD81C8ADB5A009DDC1D /* LayaWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayaWebView.h; sourceTree = "<group>"; };
A2C56AD91C8ADB5A009DDC1D /* LayaWebView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LayaWebView.mm; sourceTree = "<group>"; };
A2C56ADA1C8ADB5A009DDC1D /* LayaToast.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayaToast.h; sourceTree = "<group>"; };
A2C56ADB1C8ADB5A009DDC1D /* LayaToast.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LayaToast.mm; sourceTree = "<group>"; };
A2C56ADC1C8ADB5A009DDC1D /* TouchFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TouchFilter.cpp; sourceTree = "<group>"; };
A2C56ADD1C8ADB5A009DDC1D /* TouchFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TouchFilter.h; sourceTree = "<group>"; };
A2C56ADE1C8ADB5A009DDC1D /* UIEditBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIEditBox.h; sourceTree = "<group>"; };
A2C56ADF1C8ADB5A009DDC1D /* UIEditBox.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UIEditBox.mm; sourceTree = "<group>"; };
A2C56AE91C8B179A009DDC1D /* JCAudioManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JCAudioManager.cpp; path = ../../../../source/conch/Audio/JCAudioManager.cpp; sourceTree = "<group>"; };
A2C56AEA1C8B179A009DDC1D /* JCAudioManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JCAudioManager.h; path = ../../../../source/conch/Audio/JCAudioManager.h; sourceTree = "<group>"; };
A2C56AEC1C8B17E4009DDC1D /* JCAudioMp3Player.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JCAudioMp3Player.cpp; path = ../../../../source/conch/Audio/ios/JCAudioMp3Player.cpp; sourceTree = "<group>"; };
A2C56AED1C8B17E4009DDC1D /* JCAudioMp3Player.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JCAudioMp3Player.h; path = ../../../../source/conch/Audio/ios/JCAudioMp3Player.h; sourceTree = "<group>"; };
A2D119581D0BC981004C229D /* WebSocket.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebSocket.cpp; path = ../../../../source/conch/WebSocket/WebSocket.cpp; sourceTree = "<group>"; };
A2D119591D0BC981004C229D /* WebSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebSocket.h; path = ../../../../source/conch/WebSocket/WebSocket.h; sourceTree = "<group>"; };
A2D1196D1D0BCA06004C229D /* JCConch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JCConch.cpp; path = ../../../../source/conch/JCConch.cpp; sourceTree = "<group>"; };
A2D1196E1D0BCA06004C229D /* JCConch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JCConch.h; path = ../../../../source/conch/JCConch.h; sourceTree = "<group>"; };
A2D1196F1D0BCA06004C229D /* JCConchRender.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JCConchRender.cpp; path = ../../../../source/conch/JCConchRender.cpp; sourceTree = "<group>"; };
A2D119701D0BCA06004C229D /* JCConchRender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JCConchRender.h; path = ../../../../source/conch/JCConchRender.h; sourceTree = "<group>"; };
A2D119751D0BCA06004C229D /* JCSystemConfig.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JCSystemConfig.cpp; path = ../../../../source/conch/JCSystemConfig.cpp; sourceTree = "<group>"; };
A2D119761D0BCA06004C229D /* JCSystemConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JCSystemConfig.h; path = ../../../../source/conch/JCSystemConfig.h; sourceTree = "<group>"; };
A2D119771D0BCA06004C229D /* JCThreadCmdMgr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JCThreadCmdMgr.cpp; path = ../../../../source/conch/JCThreadCmdMgr.cpp; sourceTree = "<group>"; };
A2D119781D0BCA06004C229D /* JCThreadCmdMgr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JCThreadCmdMgr.h; path = ../../../../source/conch/JCThreadCmdMgr.h; sourceTree = "<group>"; };
A2D1198E1D0BCA59004C229D /* JSInterface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSInterface.cpp; path = ../../../../source/conch/JSWrapper/JSInterface/JSInterface.cpp; sourceTree = "<group>"; };
A2D1198F1D0BCA59004C229D /* JSInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSInterface.h; path = ../../../../source/conch/JSWrapper/JSInterface/JSInterface.h; sourceTree = "<group>"; };
A2D119901D0BCA59004C229D /* jsobjbase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = jsobjbase.h; path = ../../../../source/conch/JSWrapper/JSInterface/jsobjbase.h; sourceTree = "<group>"; };
A2D119941D0BCA70004C229D /* JSAppCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSAppCache.cpp; path = ../../../../source/conch/JSWrapper/LayaWrap/JSAppCache.cpp; sourceTree = "<group>"; };
A2D119951D0BCA70004C229D /* JSAppCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSAppCache.h; path = ../../../../source/conch/JSWrapper/LayaWrap/JSAppCache.h; sourceTree = "<group>"; };
A2D119961D0BCA70004C229D /* JSAudio.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSAudio.cpp; path = ../../../../source/conch/JSWrapper/LayaWrap/JSAudio.cpp; sourceTree = "<group>"; };
A2D119971D0BCA70004C229D /* JSAudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSAudio.h; path = ../../../../source/conch/JSWrapper/LayaWrap/JSAudio.h; sourceTree = "<group>"; };
A2D119981D0BCA70004C229D /* JsBlob.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JsBlob.h; path = ../../../../source/conch/JSWrapper/LayaWrap/JsBlob.h; sourceTree = "<group>"; };
A2D119991D0BCA70004C229D /* JSConchConfig.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSConchConfig.cpp; path = ../../../../source/conch/JSWrapper/LayaWrap/JSConchConfig.cpp; sourceTree = "<group>"; };
A2D1199A1D0BCA70004C229D /* JSConchConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSConchConfig.h; path = ../../../../source/conch/JSWrapper/LayaWrap/JSConchConfig.h; sourceTree = "<group>"; };
A2D1199B1D0BCA70004C229D /* JSConsole.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSConsole.cpp; path = ../../../../source/conch/JSWrapper/LayaWrap/JSConsole.cpp; sourceTree = "<group>"; };
A2D1199C1D0BCA70004C229D /* JSConsole.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSConsole.h; path = ../../../../source/conch/JSWrapper/LayaWrap/JSConsole.h; sourceTree = "<group>"; };
A2D1199D1D0BCA70004C229D /* JSDOMParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSDOMParser.cpp; path = ../../../../source/conch/JSWrapper/LayaWrap/JSDOMParser.cpp; sourceTree = "<group>"; };
A2D1199E1D0BCA70004C229D /* JSDOMParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSDOMParser.h; path = ../../../../source/conch/JSWrapper/LayaWrap/JSDOMParser.h; sourceTree = "<group>"; };
A2D1199F1D0BCA70004C229D /* JSFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSFile.cpp; path = ../../../../source/conch/JSWrapper/LayaWrap/JSFile.cpp; sourceTree = "<group>"; };
A2D119A01D0BCA70004C229D /* JSFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSFile.h; path = ../../../../source/conch/JSWrapper/LayaWrap/JSFile.h; sourceTree = "<group>"; };
A2D119A11D0BCA70004C229D /* JSFileReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSFileReader.cpp; path = ../../../../source/conch/JSWrapper/LayaWrap/JSFileReader.cpp; sourceTree = "<group>"; };
A2D119A21D0BCA70004C229D /* JSFileReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSFileReader.h; path = ../../../../source/conch/JSWrapper/LayaWrap/JSFileReader.h; sourceTree = "<group>"; };
A2D119A51D0BCA70004C229D /* JSGlobalExportCFun.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSGlobalExportCFun.cpp; path = ../../../../source/conch/JSWrapper/LayaWrap/JSGlobalExportCFun.cpp; sourceTree = "<group>"; };
A2D119A61D0BCA70004C229D /* JSGlobalExportCFun.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSGlobalExportCFun.h; path = ../../../../source/conch/JSWrapper/LayaWrap/JSGlobalExportCFun.h; sourceTree = "<group>"; };
A2D119A71D0BCA70004C229D /* JSImage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSImage.cpp; path = ../../../../source/conch/JSWrapper/LayaWrap/JSImage.cpp; sourceTree = "<group>"; };
A2D119A81D0BCA70004C229D /* JSImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSImage.h; path = ../../../../source/conch/JSWrapper/LayaWrap/JSImage.h; sourceTree = "<group>"; };
A2D119AB1D0BCA70004C229D /* JSInput.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSInput.cpp; path = ../../../../source/conch/JSWrapper/LayaWrap/JSInput.cpp; sourceTree = "<group>"; };
A2D119AC1D0BCA70004C229D /* JSInput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSInput.h; path = ../../../../source/conch/JSWrapper/LayaWrap/JSInput.h; sourceTree = "<group>"; };
A2D119B31D0BCA70004C229D /* JSNotify.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSNotify.cpp; path = ../../../../source/conch/JSWrapper/LayaWrap/JSNotify.cpp; sourceTree = "<group>"; };
A2D119B41D0BCA70004C229D /* JSNotify.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSNotify.h; path = ../../../../source/conch/JSWrapper/LayaWrap/JSNotify.h; sourceTree = "<group>"; };
A2D119B51D0BCA70004C229D /* JSRuntime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSRuntime.cpp; path = ../../../../source/conch/JSWrapper/LayaWrap/JSRuntime.cpp; sourceTree = "<group>"; };
A2D119B61D0BCA70004C229D /* JSRuntime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSRuntime.h; path = ../../../../source/conch/JSWrapper/LayaWrap/JSRuntime.h; sourceTree = "<group>"; };
A2D119BB1D0BCA70004C229D /* JSTextMemoryCanvas.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSTextMemoryCanvas.cpp; path = ../../../../source/conch/JSWrapper/LayaWrap/JSTextMemoryCanvas.cpp; sourceTree = "<group>"; };
A2D119BC1D0BCA70004C229D /* JSTextMemoryCanvas.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSTextMemoryCanvas.h; path = ../../../../source/conch/JSWrapper/LayaWrap/JSTextMemoryCanvas.h; sourceTree = "<group>"; };
A2D119BF1D0BCA70004C229D /* JSWebSocket.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSWebSocket.cpp; path = ../../../../source/conch/JSWrapper/LayaWrap/JSWebSocket.cpp; sourceTree = "<group>"; };
A2D119C01D0BCA70004C229D /* JSWebSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSWebSocket.h; path = ../../../../source/conch/JSWrapper/LayaWrap/JSWebSocket.h; sourceTree = "<group>"; };
A2D119C31D0BCA70004C229D /* JSXmlAttr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSXmlAttr.cpp; path = ../../../../source/conch/JSWrapper/LayaWrap/JSXmlAttr.cpp; sourceTree = "<group>"; };
A2D119C41D0BCA70004C229D /* JSXmlAttr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSXmlAttr.h; path = ../../../../source/conch/JSWrapper/LayaWrap/JSXmlAttr.h; sourceTree = "<group>"; };
A2D119C51D0BCA70004C229D /* JSXmlNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSXmlNode.cpp; path = ../../../../source/conch/JSWrapper/LayaWrap/JSXmlNode.cpp; sourceTree = "<group>"; };
A2D119C61D0BCA70004C229D /* JSXmlNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSXmlNode.h; path = ../../../../source/conch/JSWrapper/LayaWrap/JSXmlNode.h; sourceTree = "<group>"; };
A2D119C71D0BCA70004C229D /* JSZip.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSZip.cpp; path = ../../../../source/conch/JSWrapper/LayaWrap/JSZip.cpp; sourceTree = "<group>"; };
A2D119C81D0BCA70004C229D /* JSZip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSZip.h; path = ../../../../source/conch/JSWrapper/LayaWrap/JSZip.h; sourceTree = "<group>"; };
A2D119C91D0BCA70004C229D /* XMLHttpRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = XMLHttpRequest.cpp; path = ../../../../source/conch/JSWrapper/LayaWrap/XMLHttpRequest.cpp; sourceTree = "<group>"; };
A2D119CA1D0BCA70004C229D /* XMLHttpRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XMLHttpRequest.h; path = ../../../../source/conch/JSWrapper/LayaWrap/XMLHttpRequest.h; sourceTree = "<group>"; };
A2D119E71D0BCB68004C229D /* CToObjectC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CToObjectC.h; path = ../../../../source/conch/CToObjectC.h; sourceTree = "<group>"; };
A2D119E81D0BCB84004C229D /* JSIOSEditBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSIOSEditBox.cpp; path = ../../../../source/conch/JSWrapper/LayaWrap/JSIOSEditBox.cpp; sourceTree = "<group>"; };
A2D119E91D0BCB84004C229D /* JSIOSEditBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSIOSEditBox.h; path = ../../../../source/conch/JSWrapper/LayaWrap/JSIOSEditBox.h; sourceTree = "<group>"; };
A2D119EB1D0BFA31004C229D /* JSCArrayBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSCArrayBuffer.cpp; path = ../../../../source/conch/JSWrapper/JSInterface/JSC/JSCArrayBuffer.cpp; sourceTree = "<group>"; };
A2D119EC1D0BFA31004C229D /* JSCArrayBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSCArrayBuffer.h; path = ../../../../source/conch/JSWrapper/JSInterface/JSC/JSCArrayBuffer.h; sourceTree = "<group>"; };
A2D119ED1D0BFA31004C229D /* JSCBinder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSCBinder.cpp; path = ../../../../source/conch/JSWrapper/JSInterface/JSC/JSCBinder.cpp; sourceTree = "<group>"; };
A2D119EE1D0BFA31004C229D /* JSCBinder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSCBinder.h; path = ../../../../source/conch/JSWrapper/JSInterface/JSC/JSCBinder.h; sourceTree = "<group>"; };
A2D119EF1D0BFA31004C229D /* JSCEnv.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSCEnv.cpp; path = ../../../../source/conch/JSWrapper/JSInterface/JSC/JSCEnv.cpp; sourceTree = "<group>"; };
A2D119F01D0BFA31004C229D /* JSCEnv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSCEnv.h; path = ../../../../source/conch/JSWrapper/JSInterface/JSC/JSCEnv.h; sourceTree = "<group>"; };
A2D119F11D0BFA31004C229D /* JSCProxyArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSCProxyArray.h; path = ../../../../source/conch/JSWrapper/JSInterface/JSC/JSCProxyArray.h; sourceTree = "<group>"; };
A2D119F21D0BFA31004C229D /* JSCProxyClass.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSCProxyClass.h; path = ../../../../source/conch/JSWrapper/JSInterface/JSC/JSCProxyClass.h; sourceTree = "<group>"; };
A2D119F31D0BFA31004C229D /* JSCProxyFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSCProxyFunction.h; path = ../../../../source/conch/JSWrapper/JSInterface/JSC/JSCProxyFunction.h; sourceTree = "<group>"; };
A2D119F41D0BFA31004C229D /* JSCProxyTLS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSCProxyTLS.h; path = ../../../../source/conch/JSWrapper/JSInterface/JSC/JSCProxyTLS.h; sourceTree = "<group>"; };
A2D119F51D0BFA31004C229D /* JSCProxyTransfer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSCProxyTransfer.h; path = ../../../../source/conch/JSWrapper/JSInterface/JSC/JSCProxyTransfer.h; sourceTree = "<group>"; };
A2D119F61D0BFA31004C229D /* JSCProxyType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSCProxyType.h; path = ../../../../source/conch/JSWrapper/JSInterface/JSC/JSCProxyType.h; sourceTree = "<group>"; };
A2D11A031D0C30D1004C229D /* JSFileSystem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSFileSystem.cpp; path = ../../../../source/conch/JSWrapper/LayaWrap/JSFileSystem.cpp; sourceTree = "<group>"; };
A2D11A041D0C30D1004C229D /* JSFileSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSFileSystem.h; path = ../../../../source/conch/JSWrapper/LayaWrap/JSFileSystem.h; sourceTree = "<group>"; };
A2D11A201D0C402F004C229D /* JCIOSFreeType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JCIOSFreeType.cpp; path = ../../../../source/conch/IOSFreetype/JCIOSFreeType.cpp; sourceTree = "<group>"; };
A2D11A211D0C402F004C229D /* JCIOSFreeType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JCIOSFreeType.h; path = ../../../../source/conch/IOSFreetype/JCIOSFreeType.h; sourceTree = "<group>"; };
A2D8F384218C036F00E232A9 /* LayaVideoPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayaVideoPlayer.h; sourceTree = "<group>"; };
A2D8F385218C036F00E232A9 /* LayaVideoPlayer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LayaVideoPlayer.mm; sourceTree = "<group>"; };
A2D8F388218C06D600E232A9 /* JSVideo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = JSVideo.h; path = ../../../../source/conch/JSWrapper/LayaWrap/Video/JSVideo.h; sourceTree = "<group>"; };
A2D8F389218C06F100E232A9 /* VideoCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VideoCache.h; path = ../../../../source/conch/JSWrapper/LayaWrap/Video/VideoCache.h; sourceTree = "<group>"; };
A2D8F38A218C06F100E232A9 /* JSVideo_CommonImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSVideo_CommonImpl.cpp; path = ../../../../source/conch/JSWrapper/LayaWrap/Video/JSVideo_CommonImpl.cpp; sourceTree = "<group>"; };
A2D8F38B218C06F100E232A9 /* VideoCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = VideoCache.cpp; path = ../../../../source/conch/JSWrapper/LayaWrap/Video/VideoCache.cpp; sourceTree = "<group>"; };
A2D8F38E218C1D6E00E232A9 /* JSVideo_IOSImpl.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = JSVideo_IOSImpl.cpp; path = ../../../../source/conch/JSWrapper/LayaWrap/Video/JSVideo_IOSImpl.cpp; sourceTree = "<group>"; };
A2D8F39421901AE600E232A9 /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; };
A2DE585F23C6DC6600A75F34 /* Uri.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Uri.h; path = ../../../../source/conch/WebSocket/Uri.h; sourceTree = "<group>"; };
A2DE586023C6DC6600A75F34 /* Uri.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Uri.cpp; path = ../../../../source/conch/WebSocket/Uri.cpp; sourceTree = "<group>"; };
A2EE05591C8A77B700A35FB6 /* libconchRuntime.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libconchRuntime.a; sourceTree = BUILT_PRODUCTS_DIR; };
A2EE055C1C8A77B700A35FB6 /* conchRuntime.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = conchRuntime.h; sourceTree = "<group>"; };
A2EE055E1C8A77B700A35FB6 /* conchRuntime.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = conchRuntime.mm; sourceTree = "<group>"; };
A2F3B79E216CAB8B0016F0A2 /* bullet_glue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = bullet_glue.cpp; path = ../../../../source/conch/JSWrapper/LayaWrap/Bullet/bullet_glue.cpp; sourceTree = "<group>"; };
A2F3B79F216CAB8B0016F0A2 /* bullet_glue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = bullet_glue.h; path = ../../../../source/conch/JSWrapper/LayaWrap/Bullet/bullet_glue.h; sourceTree = "<group>"; };
A2F3B7A0216CAB8B0016F0A2 /* JSbtBindHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSbtBindHelper.h; path = ../../../../source/conch/JSWrapper/LayaWrap/Bullet/JSbtBindHelper.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
A2EE05561C8A77B700A35FB6 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
9D8D6C681D435F5C00EFE81A /* Reflection */ = {
isa = PBXGroup;
children = (
9D8D6C691D43604900EFE81A /* refection.h */,
9D8D6C6A1D43604900EFE81A /* reflection.mm */,
);
name = Reflection;
sourceTree = "<group>";
};
A270D7372170FD8D000D994D /* Bridge */ = {
isa = PBXGroup;
children = (
A270D7382170FD8D000D994D /* JCConchBridge.h */,
A270D7392170FD8D000D994D /* JCConchBridge.cpp */,
);
name = Bridge;
path = ../../../../source/conch/Bridge;
sourceTree = "<group>";
};
A2757BE2219AB0C800DB3683 /* Video */ = {
isa = PBXGroup;
children = (
A2757BE3219AB15500DB3683 /* IVideoRenderTarget.h */,
A25F7B2E219AB6DC004FA571 /* IVideoRenderTarget.m */,
A2757BE4219AB38200DB3683 /* PlayerLayerRenderTarget.h */,
A2757BE5219AB43D00DB3683 /* PlayerLayerRenderTarget.m */,
A25F7B30219ABD2D004FA571 /* VideoOutputRenderTarget.h */,
A25F7B31219ABD4D004FA571 /* VideoOutputRenderTarget.m */,
);
name = Video;
sourceTree = "<group>";
};
A2C56AAF1C8ADA77009DDC1D /* ios */ = {
isa = PBXGroup;
children = (
A2757BE2219AB0C800DB3683 /* Video */,
A2D8F384218C036F00E232A9 /* LayaVideoPlayer.h */,
A2D8F385218C036F00E232A9 /* LayaVideoPlayer.mm */,
5E7AB4D51DD2CE2B001AE49F /* LayaScreenShotter.h */,
5E7AB4D61DD2CE2B001AE49F /* LayaScreenShotter.mm */,
5E8E477F1D8F939400662E69 /* LayaDeviceSensor.h */,
5E8E47801D8F939400662E69 /* LayaDeviceSensor.mm */,
5E68064B1D7D0F82002A7575 /* NSString.h */,
5E68064C1D7D0F82002A7575 /* NSString.m */,
9D8D6C681D435F5C00EFE81A /* Reflection */,
A28DB2A11D2CB24400BAED5C /* LayaAlert.h */,
A28DB2A21D2CB24400BAED5C /* LayaAlert.mm */,
A2C56AD01C8ADB5A009DDC1D /* conchConfig.h */,
A2C56AD11C8ADB5A009DDC1D /* conchConfig.mm */,
A2C56AD21C8ADB5A009DDC1D /* CToObjectCIOS.h */,
A2C56AD31C8ADB5A009DDC1D /* CToObjectCIOS.mm */,
A2C56AD41C8ADB5A009DDC1D /* LayaEditBox.h */,
A2C56AD51C8ADB5A009DDC1D /* LayaEditBox.mm */,
A2C56AD61C8ADB5A009DDC1D /* LayaEditBoxDelegate.h */,
A2C56AD71C8ADB5A009DDC1D /* LayaEditBoxDelegate.mm */,
A2C56AD81C8ADB5A009DDC1D /* LayaWebView.h */,
A2C56AD91C8ADB5A009DDC1D /* LayaWebView.mm */,
A2C56ADA1C8ADB5A009DDC1D /* LayaToast.h */,
A2C56ADB1C8ADB5A009DDC1D /* LayaToast.mm */,
A2C56ADC1C8ADB5A009DDC1D /* TouchFilter.cpp */,
A2C56ADD1C8ADB5A009DDC1D /* TouchFilter.h */,
A2C56ADE1C8ADB5A009DDC1D /* UIEditBox.h */,
A2C56ADF1C8ADB5A009DDC1D /* UIEditBox.mm */,
A2C56AB41C8ADAB9009DDC1D /* Reachability */,
A2C56AB21C8ADAA8009DDC1D /* Notification */,
A2C56AB01C8ADA80009DDC1D /* Audio */,
);
name = ios;
sourceTree = "<group>";
};
A2C56AB01C8ADA80009DDC1D /* Audio */ = {
isa = PBXGroup;
children = (
A2C56ACD1C8ADB37009DDC1D /* JCMp3Player.h */,
A2C56ACE1C8ADB37009DDC1D /* JCMp3Player.mm */,
);
name = Audio;
sourceTree = "<group>";
};
A2C56AB21C8ADAA8009DDC1D /* Notification */ = {
isa = PBXGroup;
children = (
A2C56ABF1C8ADAF2009DDC1D /* LayaNotifyInterface.h */,
A2C56AC01C8ADAF2009DDC1D /* LayaNotifyManager.h */,
A2C56AC11C8ADAF2009DDC1D /* LayaNotifyManager.m */,
);
name = Notification;
sourceTree = "<group>";
};
A2C56AB41C8ADAB9009DDC1D /* Reachability */ = {
isa = PBXGroup;
children = (
A2C56AB51C8ADAD3009DDC1D /* Reachability.h */,
A2C56AB61C8ADAD3009DDC1D /* Reachability.m */,
);
name = Reachability;
sourceTree = "<group>";
};
A2C56AE81C8B1771009DDC1D /* Audio */ = {
isa = PBXGroup;
children = (
A2C56AEC1C8B17E4009DDC1D /* JCAudioMp3Player.cpp */,
A2C56AED1C8B17E4009DDC1D /* JCAudioMp3Player.h */,
A2C56AE91C8B179A009DDC1D /* JCAudioManager.cpp */,
A2C56AEA1C8B179A009DDC1D /* JCAudioManager.h */,
);
name = Audio;
sourceTree = "<group>";
};
A2D119501D0BC8EC004C229D /* Source */ = {
isa = PBXGroup;
children = (
A270D7372170FD8D000D994D /* Bridge */,
A2252F3420F4E33700A22490 /* JCScriptRuntime.cpp */,
A2252F3320F4E33700A22490 /* JCScriptRuntime.h */,
A2D11A1B1D0C3CBA004C229D /* IOSFreetype */,
A2D119E71D0BCB68004C229D /* CToObjectC.h */,
A2D1196D1D0BCA06004C229D /* JCConch.cpp */,
A2D1196E1D0BCA06004C229D /* JCConch.h */,
A2D1196F1D0BCA06004C229D /* JCConchRender.cpp */,
A2D119701D0BCA06004C229D /* JCConchRender.h */,
A2D119751D0BCA06004C229D /* JCSystemConfig.cpp */,
A2D119761D0BCA06004C229D /* JCSystemConfig.h */,
A2D119771D0BCA06004C229D /* JCThreadCmdMgr.cpp */,
A2D119781D0BCA06004C229D /* JCThreadCmdMgr.h */,
A2D119541D0BC924004C229D /* WebSocket */,
A2D119521D0BC911004C229D /* JSWrapper */,
A2C56AE81C8B1771009DDC1D /* Audio */,
);
name = Source;
sourceTree = "<group>";
};
A2D119521D0BC911004C229D /* JSWrapper */ = {
isa = PBXGroup;
children = (
A2D119571D0BC959004C229D /* LayaWrap */,
A2D119551D0BC946004C229D /* JSInterface */,
);
name = JSWrapper;
sourceTree = "<group>";
};
A2D119541D0BC924004C229D /* WebSocket */ = {
isa = PBXGroup;
children = (
A2DE586023C6DC6600A75F34 /* Uri.cpp */,
A2DE585F23C6DC6600A75F34 /* Uri.h */,
A2D119581D0BC981004C229D /* WebSocket.cpp */,
A2D119591D0BC981004C229D /* WebSocket.h */,
);
name = WebSocket;
sourceTree = "<group>";
};
A2D119551D0BC946004C229D /* JSInterface */ = {
isa = PBXGroup;
children = (
A2D1198E1D0BCA59004C229D /* JSInterface.cpp */,
A2D1198F1D0BCA59004C229D /* JSInterface.h */,
A2D119901D0BCA59004C229D /* jsobjbase.h */,
A2D119561D0BC955004C229D /* JSC */,
);
name = JSInterface;
sourceTree = "<group>";
};
A2D119561D0BC955004C229D /* JSC */ = {
isa = PBXGroup;
children = (
A2F3B79D216CAB020016F0A2 /* Bullet */,
A2D119EB1D0BFA31004C229D /* JSCArrayBuffer.cpp */,
A2D119EC1D0BFA31004C229D /* JSCArrayBuffer.h */,
A2D119ED1D0BFA31004C229D /* JSCBinder.cpp */,
A2D119EE1D0BFA31004C229D /* JSCBinder.h */,
A2D119EF1D0BFA31004C229D /* JSCEnv.cpp */,
A2D119F01D0BFA31004C229D /* JSCEnv.h */,
A2D119F11D0BFA31004C229D /* JSCProxyArray.h */,
A2D119F21D0BFA31004C229D /* JSCProxyClass.h */,
A2D119F31D0BFA31004C229D /* JSCProxyFunction.h */,
A2D119F41D0BFA31004C229D /* JSCProxyTLS.h */,
A2D119F51D0BFA31004C229D /* JSCProxyTransfer.h */,
A2D119F61D0BFA31004C229D /* JSCProxyType.h */,
);
name = JSC;
sourceTree = "<group>";
};
A2D119571D0BC959004C229D /* LayaWrap */ = {
isa = PBXGroup;
children = (
A2D8F387218C06BD00E232A9 /* Video */,
A2252F3920F4EDB000A22490 /* JSCallbackFuncObj.cpp */,
A2252F3A20F4EDB000A22490 /* JSCallbackFuncObj.h */,
A264F7C020C7DDC100D95F1B /* JSLayaGL.cpp */,
A264F7BF20C7DDC000D95F1B /* JSLayaGL.h */,
A21E1BBC20A98674007F32F4 /* JSShaderPrecisionFormat.cpp */,
A21E1BBD20A98674007F32F4 /* JSShaderPrecisionFormat.h */,
24760D552081B9D600594375 /* JSShaderActiveInfo.cpp */,
24760D562081B9D600594375 /* JSShaderActiveInfo.h */,
24760D572081B9D700594375 /* JSTextBitmapInfo.cpp */,
24760D512081B9D600594375 /* JSTextBitmapInfo.h */,
A2729C981D20C51C00EC01E6 /* JSHistory.cpp */,
A2729C991D20C51C00EC01E6 /* JSHistory.h */,
A2D11A031D0C30D1004C229D /* JSFileSystem.cpp */,
A2D11A041D0C30D1004C229D /* JSFileSystem.h */,
A2D119E81D0BCB84004C229D /* JSIOSEditBox.cpp */,
A2D119E91D0BCB84004C229D /* JSIOSEditBox.h */,
A2D119941D0BCA70004C229D /* JSAppCache.cpp */,
A2D119951D0BCA70004C229D /* JSAppCache.h */,
A2D119961D0BCA70004C229D /* JSAudio.cpp */,
A2D119971D0BCA70004C229D /* JSAudio.h */,
A2D119981D0BCA70004C229D /* JsBlob.h */,
A2D119991D0BCA70004C229D /* JSConchConfig.cpp */,
A2D1199A1D0BCA70004C229D /* JSConchConfig.h */,
A2D1199B1D0BCA70004C229D /* JSConsole.cpp */,
A2D1199C1D0BCA70004C229D /* JSConsole.h */,
A2D1199D1D0BCA70004C229D /* JSDOMParser.cpp */,
A2D1199E1D0BCA70004C229D /* JSDOMParser.h */,
A2D1199F1D0BCA70004C229D /* JSFile.cpp */,
A2D119A01D0BCA70004C229D /* JSFile.h */,
A2D119A11D0BCA70004C229D /* JSFileReader.cpp */,
A2D119A21D0BCA70004C229D /* JSFileReader.h */,
A2D119A51D0BCA70004C229D /* JSGlobalExportCFun.cpp */,
A2D119A61D0BCA70004C229D /* JSGlobalExportCFun.h */,
A2D119A71D0BCA70004C229D /* JSImage.cpp */,
A2D119A81D0BCA70004C229D /* JSImage.h */,
A2D119AB1D0BCA70004C229D /* JSInput.cpp */,
A2D119AC1D0BCA70004C229D /* JSInput.h */,
A2D119B31D0BCA70004C229D /* JSNotify.cpp */,
A2D119B41D0BCA70004C229D /* JSNotify.h */,
A2D119B51D0BCA70004C229D /* JSRuntime.cpp */,
A2D119B61D0BCA70004C229D /* JSRuntime.h */,
A2D119BB1D0BCA70004C229D /* JSTextMemoryCanvas.cpp */,
A2D119BC1D0BCA70004C229D /* JSTextMemoryCanvas.h */,
A2D119BF1D0BCA70004C229D /* JSWebSocket.cpp */,
A2D119C01D0BCA70004C229D /* JSWebSocket.h */,
A2D119C31D0BCA70004C229D /* JSXmlAttr.cpp */,
A2D119C41D0BCA70004C229D /* JSXmlAttr.h */,
A2D119C51D0BCA70004C229D /* JSXmlNode.cpp */,
A2D119C61D0BCA70004C229D /* JSXmlNode.h */,
A2D119C71D0BCA70004C229D /* JSZip.cpp */,
A2D119C81D0BCA70004C229D /* JSZip.h */,
A2D119C91D0BCA70004C229D /* XMLHttpRequest.cpp */,
A2D119CA1D0BCA70004C229D /* XMLHttpRequest.h */,
);
name = LayaWrap;
sourceTree = "<group>";
};
A2D11A1B1D0C3CBA004C229D /* IOSFreetype */ = {
isa = PBXGroup;
children = (
A2D11A201D0C402F004C229D /* JCIOSFreeType.cpp */,
A2D11A211D0C402F004C229D /* JCIOSFreeType.h */,
);
name = IOSFreetype;
sourceTree = "<group>";
};
A2D8F387218C06BD00E232A9 /* Video */ = {
isa = PBXGroup;
children = (
A2D8F38A218C06F100E232A9 /* JSVideo_CommonImpl.cpp */,
A2D8F38B218C06F100E232A9 /* VideoCache.cpp */,
A2D8F389218C06F100E232A9 /* VideoCache.h */,
A2D8F388218C06D600E232A9 /* JSVideo.h */,
A2D8F38E218C1D6E00E232A9 /* JSVideo_IOSImpl.cpp */,
);
name = Video;
sourceTree = "<group>";
};
A2D8F39321901AE600E232A9 /* Frameworks */ = {
isa = PBXGroup;
children = (
A2D8F39421901AE600E232A9 /* CoreMedia.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
A2EE05501C8A77B700A35FB6 = {
isa = PBXGroup;
children = (
A2EE055B1C8A77B700A35FB6 /* conchRuntime */,
A2EE055A1C8A77B700A35FB6 /* Products */,
A2D8F39321901AE600E232A9 /* Frameworks */,
);
sourceTree = "<group>";
};
A2EE055A1C8A77B700A35FB6 /* Products */ = {
isa = PBXGroup;
children = (
A2EE05591C8A77B700A35FB6 /* libconchRuntime.a */,
);
name = Products;
sourceTree = "<group>";
};
A2EE055B1C8A77B700A35FB6 /* conchRuntime */ = {
isa = PBXGroup;
children = (
A2D119501D0BC8EC004C229D /* Source */,
A2C56AAF1C8ADA77009DDC1D /* ios */,
A2EE055C1C8A77B700A35FB6 /* conchRuntime.h */,
A2EE055E1C8A77B700A35FB6 /* conchRuntime.mm */,
);
path = conchRuntime;
sourceTree = "<group>";
};
A2F3B79D216CAB020016F0A2 /* Bullet */ = {
isa = PBXGroup;
children = (
A247BBFD237109FA009B1189 /* LayaBulletExport.cpp */,
A247BBFE237109FA009B1189 /* LayaBulletExport.h */,
A247BBFF237109FA009B1189 /* LayaBulletExportImp.cpp */,
A2F3B79E216CAB8B0016F0A2 /* bullet_glue.cpp */,
A2F3B79F216CAB8B0016F0A2 /* bullet_glue.h */,
A2F3B7A0216CAB8B0016F0A2 /* JSbtBindHelper.h */,
);
name = Bullet;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
A2EE05581C8A77B700A35FB6 /* conchRuntime */ = {
isa = PBXNativeTarget;
buildConfigurationList = A2EE05621C8A77B700A35FB6 /* Build configuration list for PBXNativeTarget "conchRuntime" */;
buildPhases = (
A2EE05551C8A77B700A35FB6 /* Sources */,
A2EE05561C8A77B700A35FB6 /* Frameworks */,
A2EE05571C8A77B700A35FB6 /* CopyFiles */,
A28105611F735F140094C3CC /* ShellScript */,
);
buildRules = (
);
dependencies = (
);
name = conchRuntime;
productName = conchRuntime;
productReference = A2EE05591C8A77B700A35FB6 /* libconchRuntime.a */;
productType = "com.apple.product-type.library.static";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
A2EE05511C8A77B700A35FB6 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0720;
ORGANIZATIONNAME = LayaBox;
TargetAttributes = {
A2EE05581C8A77B700A35FB6 = {
CreatedOnToolsVersion = 7.2.1;
};
};
};
buildConfigurationList = A2EE05541C8A77B700A35FB6 /* Build configuration list for PBXProject "conchRuntime" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
);
mainGroup = A2EE05501C8A77B700A35FB6;
productRefGroup = A2EE055A1C8A77B700A35FB6 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
A2EE05581C8A77B700A35FB6 /* conchRuntime */,
);
};
/* End PBXProject section */
/* Begin PBXShellScriptBuildPhase section */
A28105611F735F140094C3CC /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "chmod u+x $SRCROOT/../../copyLib.sh\n$SRCROOT/../../copyLib.sh\n";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
A2EE05551C8A77B700A35FB6 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
9D8D6C6B1D43604A00EFE81A /* reflection.mm in Sources */,
A2D119F91D0BFA31004C229D /* JSCEnv.cpp in Sources */,
A2D119CF1D0BCA70004C229D /* JSConsole.cpp in Sources */,
A2D119DB1D0BCA70004C229D /* JSNotify.cpp in Sources */,
A2D119D71D0BCA70004C229D /* JSInput.cpp in Sources */,
A2C56AC21C8ADAF2009DDC1D /* LayaNotifyManager.m in Sources */,
A2C56AE11C8ADB5A009DDC1D /* CToObjectCIOS.mm in Sources */,
A2D119F81D0BFA31004C229D /* JSCBinder.cpp in Sources */,
A2D119D01D0BCA70004C229D /* JSDOMParser.cpp in Sources */,
A2C56AEB1C8B179A009DDC1D /* JCAudioManager.cpp in Sources */,
A270D73A2170FD8D000D994D /* JCConchBridge.cpp in Sources */,
A2D119CE1D0BCA70004C229D /* JSConchConfig.cpp in Sources */,
5E8E47811D8F939400662E69 /* LayaDeviceSensor.mm in Sources */,
A2D1197E1D0BCA06004C229D /* JCSystemConfig.cpp in Sources */,
A2D119E11D0BCA70004C229D /* JSWebSocket.cpp in Sources */,
A2C56AE31C8ADB5A009DDC1D /* LayaEditBoxDelegate.mm in Sources */,
A2D119E61D0BCA70004C229D /* XMLHttpRequest.cpp in Sources */,
A2D119DC1D0BCA70004C229D /* JSRuntime.cpp in Sources */,
A247BC00237109FB009B1189 /* LayaBulletExport.cpp in Sources */,
A2F3B7A1216CAB8B0016F0A2 /* bullet_glue.cpp in Sources */,
A2D1197B1D0BCA06004C229D /* JCConchRender.cpp in Sources */,
A2D8F386218C036F00E232A9 /* LayaVideoPlayer.mm in Sources */,
A25F7B2F219AB6DC004FA571 /* IVideoRenderTarget.m in Sources */,
A2C56AEE1C8B17E4009DDC1D /* JCAudioMp3Player.cpp in Sources */,
A2C56AE51C8ADB5A009DDC1D /* LayaToast.mm in Sources */,
A2D119F71D0BFA31004C229D /* JSCArrayBuffer.cpp in Sources */,
A2252F3B20F4EDB000A22490 /* JSCallbackFuncObj.cpp in Sources */,
A2C56ACF1C8ADB37009DDC1D /* JCMp3Player.mm in Sources */,
A2C56AE41C8ADB5A009DDC1D /* LayaWebView.mm in Sources */,
A21E1BBE20A98675007F32F4 /* JSShaderPrecisionFormat.cpp in Sources */,
A2D1195A1D0BC981004C229D /* WebSocket.cpp in Sources */,
A2D11A051D0C30D1004C229D /* JSFileSystem.cpp in Sources */,
A2C56AE01C8ADB5A009DDC1D /* conchConfig.mm in Sources */,
A2D119CC1D0BCA70004C229D /* JSAppCache.cpp in Sources */,
A2D119E31D0BCA70004C229D /* JSXmlAttr.cpp in Sources */,
A28DB2A31D2CB24400BAED5C /* LayaAlert.mm in Sources */,
24760D5A2081B9D700594375 /* JSShaderActiveInfo.cpp in Sources */,
A2D119EA1D0BCB84004C229D /* JSIOSEditBox.cpp in Sources */,
A2D119D41D0BCA70004C229D /* JSGlobalExportCFun.cpp in Sources */,
A2D1197F1D0BCA06004C229D /* JCThreadCmdMgr.cpp in Sources */,
A2D8F38C218C06F100E232A9 /* JSVideo_CommonImpl.cpp in Sources */,
A2D119CD1D0BCA70004C229D /* JSAudio.cpp in Sources */,
A2D119E41D0BCA70004C229D /* JSXmlNode.cpp in Sources */,
5E68064D1D7D0F82002A7575 /* NSString.m in Sources */,
A2C56AE61C8ADB5A009DDC1D /* TouchFilter.cpp in Sources */,
A2729C9A1D20C51C00EC01E6 /* JSHistory.cpp in Sources */,
A2C56AE71C8ADB5A009DDC1D /* UIEditBox.mm in Sources */,
A2D11A221D0C402F004C229D /* JCIOSFreeType.cpp in Sources */,
A2D119DF1D0BCA70004C229D /* JSTextMemoryCanvas.cpp in Sources */,
A247BC01237109FB009B1189 /* LayaBulletExportImp.cpp in Sources */,
A2D8F38F218C1D6E00E232A9 /* JSVideo_IOSImpl.cpp in Sources */,
A2D1197A1D0BCA06004C229D /* JCConch.cpp in Sources */,
A2D119D21D0BCA70004C229D /* JSFileReader.cpp in Sources */,
24760D5B2081B9D700594375 /* JSTextBitmapInfo.cpp in Sources */,
A2252F3520F4E33800A22490 /* JCScriptRuntime.cpp in Sources */,
A2D8F38D218C06F100E232A9 /* VideoCache.cpp in Sources */,
A2DE586123C6DC6600A75F34 /* Uri.cpp in Sources */,
A2D119D11D0BCA70004C229D /* JSFile.cpp in Sources */,
A2D119E51D0BCA70004C229D /* JSZip.cpp in Sources */,
A2D119D51D0BCA70004C229D /* JSImage.cpp in Sources */,
5E7AB4D71DD2CE2B001AE49F /* LayaScreenShotter.mm in Sources */,
A2C56AB71C8ADAD3009DDC1D /* Reachability.m in Sources */,
A2D119911D0BCA59004C229D /* JSInterface.cpp in Sources */,
A2757BE6219AB43D00DB3683 /* PlayerLayerRenderTarget.m in Sources */,
A264F7C220C7DDC100D95F1B /* JSLayaGL.cpp in Sources */,
A2EE055F1C8A77B700A35FB6 /* conchRuntime.mm in Sources */,
A2C56AE21C8ADB5A009DDC1D /* LayaEditBox.mm in Sources */,
A25F7B32219ABD4D004FA571 /* VideoOutputRenderTarget.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
A2EE05601C8A77B700A35FB6 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
};
name = Debug;
};
A2EE05611C8A77B700A35FB6 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
A2EE05631C8A77B700A35FB6 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
JS_JSC,
);
INSTALL_PATH = /Users/LayaBox/LayaBox/conch5/Trunk/ThirdParty/ios/lib;
OTHER_CFLAGS = (
"-I../../../include/common",
"-I../../../../ThirdParty/freetype/include/ios",
"-I../../../../ThirdParty/jpeg/include/ios",
"-I../../../../ThirdParty/websockets/include/ios",
"-I../../../../ThirdParty/zip/include/ios",
"-I../../../../ThirdParty/curl/include/ios",
"-I../../../../ThirdParty/png/include/ios",
"-I../../../../ThirdParty/ios2/libpng/include",
"-I../../../../ThirdParty/openssl/include/ios",
"-I../../../include/render",
"-I../../../include/webglPlus",
"-I../../../../ThirdParty/bullet/include",
);
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
VALID_ARCHS = "arm64 armv7 i386 x86_64";
};
name = Debug;
};
A2EE05641C8A77B700A35FB6 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_PREPROCESSOR_DEFINITIONS = JS_JSC;
INSTALL_PATH = /Users/LayaBox/LayaBox/conch5/Trunk/ThirdParty/ios/lib;
OTHER_CFLAGS = (
"-I../../../include/common",
"-I../../../../ThirdParty/freetype/include/ios",
"-I../../../../ThirdParty/jpeg/include/ios",
"-I../../../../ThirdParty/websockets/include/ios",
"-I../../../../ThirdParty/zip/include/ios",
"-I../../../../ThirdParty/curl/include/ios",
"-I../../../../ThirdParty/png/include/ios",
"-I../../../../ThirdParty/ios2/libpng/include",
"-I../../../../ThirdParty/openssl/include/ios",
"-I../../../include/render",
"-I../../../include/webglPlus",
"-I../../../../ThirdParty/bullet/include",
);
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
VALID_ARCHS = "arm64 armv7 i386 x86_64";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
A2EE05541C8A77B700A35FB6 /* Build configuration list for PBXProject "conchRuntime" */ = {
isa = XCConfigurationList;
buildConfigurations = (
A2EE05601C8A77B700A35FB6 /* Debug */,
A2EE05611C8A77B700A35FB6 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
A2EE05621C8A77B700A35FB6 /* Build configuration list for PBXNativeTarget "conchRuntime" */ = {
isa = XCConfigurationList;
buildConfigurations = (
A2EE05631C8A77B700A35FB6 /* Debug */,
A2EE05641C8A77B700A35FB6 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = A2EE05511C8A77B700A35FB6 /* Project object */;
}
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>
@@ -0,0 +1,34 @@
/**
@file JCMp3Player.h
@brief
@author wyw
@version 1.0
@date 2013_1_1
*/
#import <Foundation/Foundation.h>
#import <AudioToolbox/AudioToolbox.h>
#import <AVFoundation/AVFoundation.h>
#import <AudioToolbox/AudioServices.h>
@interface JCMp3Player : NSObject<AVAudioPlayerDelegate>
{
@public
AVAudioPlayer* m_pPlayer;
}
//初始化
-(JCMp3Player*)init;
//播放声音
-(void)playMp3:(NSString*)p_sFilePath times:(int)p_nTimes currentTime:(float)nCurrentTime;
-(void)stopMp3;
-(void)pauseMp3;
-(void)resumeMp3;
//设置音量
-(void)setVolume:(float)p_nVolume;
-(void)setCurrentTime: (double)nCurrentTime;
-(double)getCurrentTime;
-(double)getDuration;
@end
@@ -0,0 +1,103 @@
/**
@file JCMp3Player.mm
@brief
@author wyw
@version 1.0
@date 2013_1_1
*/
#import "JCMp3PLayer.h"
#import "../../../../../source/conch/Audio/JCAudioManager.h"
//------------------------------------------------------------------------------
@implementation JCMp3Player
//------------------------------------------------------------------------------
-(JCMp3Player*)init
{
self = [super init];
m_pPlayer = nil;
return self;
}
//------------------------------------------------------------------------------
-(void)playMp3:(NSString*)p_sFilePath times:(int)p_nTimes currentTime:(float)nCurrentTime
{
//先停止
if( m_pPlayer != nil )
{
if( m_pPlayer.playing )
{
[m_pPlayer stop];
}
}
//播放mp3
NSURL* sUrl = [NSURL fileURLWithPath:p_sFilePath];
m_pPlayer = [ [AVAudioPlayer alloc] initWithContentsOfURL:sUrl error:nil];
m_pPlayer.delegate = self;
m_pPlayer.numberOfLoops = p_nTimes;
m_pPlayer.currentTime = nCurrentTime;
[m_pPlayer prepareToPlay];
[m_pPlayer play];
}
//------------------------------------------------------------------------------
-(void)stopMp3
{
if( m_pPlayer != nil )
{
[m_pPlayer stop];
}
}
//------------------------------------------------------------------------------
-(void)setCurrentTime: (double)nCurrentTime
{
m_pPlayer.currentTime = nCurrentTime;
}
//------------------------------------------------------------------------------
-(double)getCurrentTime
{
return m_pPlayer.currentTime;
}
//------------------------------------------------------------------------------
-(double)getDuration
{
return m_pPlayer.duration;
}
-(void)pauseMp3
{
if( m_pPlayer != nil )
{
[m_pPlayer pause];
}
}
//------------------------------------------------------------------------------
-(void)resumeMp3
{
if( m_pPlayer != nil )
{
[m_pPlayer play];
}
}
//------------------------------------------------------------------------------
-(void)setVolume:(float)p_nVolume
{
[m_pPlayer setVolume:p_nVolume];
}
//------------------------------------------------------------------------------
-(void)dealloc
{
if( m_pPlayer.playing )
{
[m_pPlayer stop];
}
}
//------------------------------------------------------------------------------
- (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag
{
laya::JCAudioManager::GetInstance()->m_pMp3Player->onPlayEnd();
}
//------------------------------------------------------------------------------
- (void)audioPlayerDecodeErrorDidOccur:(AVAudioPlayer *)player error:(NSError *)error
{
NSLog(@">>>>>ios mp3 player audioPlayerDecodeErrorDidOccur error=%@",error );
}
//------------------------------------------------------------------------------
@end
@@ -0,0 +1,144 @@
/**
@file CToObjectCIOS.h
@brief CToObjectCIOS
@author wyw
@version 1.0
@date 2014_8_26
@company JoyChina
*/
//process用的,创建、关闭等都需要调用到主线程,线程传递用到的参数类
//-----------------------------------------------------------------
@interface postCmdToMainThreadParam : NSObject
{
@public
int cmd;
int nParam1;
int nParam2;
}
-(id)init:(int)__cmd _p1:(int)_nParam1 _p2:(int)_nParam2;
@end
//-----------------------------------------------------------------
//editBox的相关函数,因为涉及到ui界面,所以也投递到主线程,线程传递用到的参数类
@interface postCmdToEditBoxParam : NSObject
{
@public
int cmd;
int nParam1;
int nParam2;
bool bParam2;
std::string sParam3;
}
-(id)init:(int)__cmd _p1:(int)_nParam1 _p2:(int)_nParam2 _p3:(bool)_bParam2 _p4:(const char*)_sParam3;
@end
//-----------------------------------------------------------------
//-----------------------------------------------------------------
//因为涉及到ui界面,所以要投递到主线程,线程传递用到的参数类
//-----------------------------------------------------------------
@interface postCmdParam : NSObject
{
@public
bool bParam;
int iParam;
float fParam;
std::string sParam;
}
-(id)init:(bool)_bParam i:(int)_iParam f:(float)_fParam s:(const char*)_sParam;
@end
//-----------------------------------------------------------------
//iOS反射
//-----------------------------------------------------------------
@interface postCmdToReflectionParam : NSObject
{
@public
int iObjID;
bool bSync;
std::string sClsName;
std::string sMethodName;
std::string sParamStr;
}
-(id)init:(int)objid Sync:(bool)sync Class:(const char*)cls Method:(const char*)method Param:(const char*)param;
@end
//-----------------------------------------------------------------
//stringParam
@interface postCmdStringParam : NSObject
{
@public
std::string sParam;
}
-(id)init:(const char*)_sParam;
@end
//3 stringParam
@interface postCmd3StringParam : NSObject
{
@public
std::string sParam0;
std::string sParam1;
std::string sParam2;
}
-(id)init:(const char*)_sParam0 _p1:(const char*)_sParam1 _p2:(const char*)_sParam2 ;
@end
//2 float
@interface postCmd2FloatParam : NSObject
{
@public
float fParam0;
float fParam1;
}
-(id)init:(float)_fParam0 _p1:(float)_fParam1;
@end
//4 int
@interface postCmd4IntParam : NSObject
{
@public
int iParam0;
int iParam1;
int iParam2;
int iParam3;
}
-(id)init:(int)_iParam0 _p1:(int)_iParam1 _p2:(int)_iParam2 _p3:(int)_iParam3;
@end
//4 int
@interface postCmdString4IntParam : NSObject
{
@public
std::string sBuffer;
int iParam0;
int iParam1;
int iParam2;
int iParam3;
bool bParam4;
}
-(id)init:(const char*)s _p0:(int)_iParam0 _p1:(int)_iParam1 _p2:(int)_iParam2 _p3:(int)_iParam3 _p4:(bool)_bParam4;
@end
//函数调用ObjectC,好多静态方法都在这
//-----------------------------------------------------------------
@interface CToObjectCIOS : NSObject
{
}
+(void) postCmdToMainThread:(id)param;
+(void) postCmdToEditBox:(id)param;
+(char*)fontDataForCGFont:(CGFontRef)cgFont size:(long&)p_nSize;
+(void) showExternalWebview:(id)param;
+(void) setScreenWakeLock:(id)param;
+(NSString*) callMethod:(id)param;
+(void) runtimeJSCallWebviewJS:(id)param;
+(void) captureScreen:(id)param;
+(void) setWebViewRect:(id)param;
+(void) setWebViewPercent:(id)param;
//-----------------------------------------------------------------
void reflectionCallback(const std::string& jsonret);
@end
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,27 @@
/**
@file LayaAlert.h
@brief LayaAlert类
@author James
@version 1.0
@date 2016_7_6
@company LayaBox
*/
#import <UIKit/UIKit.h>
#import <GLKit/GLKit.h>
#import <string>
#import <vector>
@interface LayaAlert : NSObject<UIAlertViewDelegate>
{
@public
UIAlertView* m_pAlert;
std::vector<std::string> m_vSaveInfo;
bool m_bShow;
}
//初始化
-(id)init;
-(void)alert:(std::string)sInfo;
-(void)showAlert;
-(void)reset;
@end
@@ -0,0 +1,92 @@
/**
@file LayaAlert.mm
@brief
@author James
@version 1.0
@date 2016_7_6
@company LayaBox
*/
#import <UIKit/UIKit.h>
#import "LayaAlert.h"
//-----------------------------------------------------------------
@implementation LayaAlert
-(id)init
{
self = [super init];
if( self != nil )
{
m_pAlert = nil;
m_bShow = false;
}
return self;
}
-(void)reset
{
m_bShow = false;
m_vSaveInfo.clear();
}
-(void)alert:(std::string)sInfo
{
m_vSaveInfo.push_back(sInfo);
if( m_bShow == false )
{
[self showAlert];
}
if( m_vSaveInfo.size() >= 50 )
{
NSLog(@">>>>Too much alert");
}
}
-(void)showAlert
{
if( m_pAlert == nil)
{
m_pAlert = [[UIAlertView alloc] initWithTitle:@"alert" message:nil delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
}
if( m_vSaveInfo.size() >0 )
{
//取出第0个,显示然后删除
std::string sInfo = m_vSaveInfo[0];
std::vector<std::string>::iterator iter = m_vSaveInfo.begin();
iter = m_vSaveInfo.erase(iter);
NSString* nsMessage = [NSString stringWithUTF8String:sInfo.c_str()];
m_pAlert.message = nsMessage;
[m_pAlert show];
}
}
//根据被点击按钮的索引处理点击事件
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
}
//AlertView已经消失时执行的事件
-(void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
{
m_bShow = false;
[self showAlert];
}
//ALertView即将消失时的事件
-(void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex
{
}
//AlertView的取消按钮的事件
-(void)alertViewCancel:(UIAlertView *)alertView
{
}
//AlertView已经显示时的事件
-(void)didPresentAlertView:(UIAlertView *)alertView
{
}
//AlertView即将显示时
-(void)willPresentAlertView:(UIAlertView *)alertView
{
m_bShow = true;
}
@end
@@ -0,0 +1,11 @@
#import<CoreMotion/CoreMotion.h>
@interface LayaDeviceSensor : NSObject
+ (instancetype) GetInstance;
- (instancetype) init;
- (void) stop;
- (void) start;
- (void) active:(BOOL) active;
@end
@@ -0,0 +1,203 @@
#import "LayaDeviceSensor.h"
#import <CoreMotion/CMGyro.h>
#import "../../../../source/conch/JCScriptRuntime.h"
static const double UPDATE_INTERVAL = 1.0 / 60.0;
static const double G = 9.80665;
void handleDeviceMotionEvent(float ax, float ay, float az, float agx, float agy, float agz, float ra, float rb, float rg, float interval)
{
DeviceMotionEvent e;
e.nType = E_DEVICEMOTION;
e.ax = ax;
e.ay = ay;
e.az = az;
e.agx = agx;
e.agy = agy;
e.agz = agz;
e.ra = ra;
e.rb = rb;
e.rg = rg;
e.interval = interval;
strncpy(e.type, "devicemotion", 256);
JCScriptRuntime::s_JSRT->dispatchInputEvent(e);
}
double rad2deg(double rad)
{
return (rad * 180 * M_1_PI);
}
void handleDeviceOrientationEvent(double pitch, double roll, double yaw)
{
// Compose the raw motion data to an intermediate ZXY-based 3x3 rotation
// matrix (R) where [z=attitude.yaw, x=attitude.pitch, y=attitude.roll]
// in the form:
//
// / R[0] R[1] R[2] \
// | R[3] R[4] R[5] |
// \ R[6] R[7] R[8] /
double cX = cos(pitch);
double cY = cos(roll);
double cZ = cos(yaw);
double sX = sin(pitch);
double sY = sin(roll);
double sZ = sin(yaw);
double R[] = {
cZ * cY - sZ * sX * sY,
- cX * sZ,
cY * sZ * sX + cZ * sY,
cY * sZ + cZ * sX * sY,
cZ * cX,
sZ * sY - cZ * cY * sX,
- cX * sY,
sX,
cX * cY
};
// Compute correct, normalized values for DeviceOrientation from
// rotation matrix (R) according to the angle conventions defined in the
// W3C DeviceOrientation specification.
double zRot;
double xRot;
double yRot;
if (R[8] > 0) {
zRot = atan2(-R[1], R[4]);
xRot = asin(R[7]);
yRot = atan2(-R[6], R[8]);
} else if (R[8] < 0) {
zRot = atan2(R[1], -R[4]);
xRot = -asin(R[7]);
xRot += (xRot >= 0) ? -M_PI : M_PI;
yRot = atan2(R[6], -R[8]);
} else {
if (R[6] > 0) {
zRot = atan2(-R[1], R[4]);
xRot = asin(R[7]);
yRot = -M_PI_2;
} else if (R[6] < 0) {
zRot = atan2(R[1], -R[4]);
xRot = -asin(R[7]);
xRot += (xRot >= 0) ? -M_PI : M_PI;
yRot = -M_PI_2;
} else {
zRot = atan2(R[3], R[0]);
xRot = (R[7] > 0) ? M_PI_2 : -M_PI_2;
yRot = 0;
}
}
// Rotation around the Z axis (pointing up. normalized to [0, 360] deg).
double alpha = rad2deg(zRot > 0 ? zRot : (M_PI * 2 + zRot));
if (alpha >= 0 && alpha <= 270){
alpha += 90;
}
else{
alpha -= 270;
}
// Rotation around the X axis (top to bottom).
double beta = rad2deg(xRot);
// Rotation around the Y axis (side to side).
double gamma = rad2deg(yRot);
//NSLog(@"device orientation alpha[%f] beta[%f] gama[%f] ",alpha,beta,gamma);
DeviceOrientationEvent e;
e.nType = E_DEVICEORIENTATION;
e.ra = alpha;
e.rb = beta;
e.rg = gamma;
strncpy(e.type, "deviceorientation", 256);
JCScriptRuntime::s_JSRT->dispatchInputEvent(e);
}
@interface LayaDeviceSensor()
@property(nonatomic,strong) CMMotionManager *motionManager;
@property(nonatomic,strong) NSTimer* updateTimer;
@property(nonatomic,assign) BOOL active;
@end
@implementation LayaDeviceSensor
+ (instancetype) GetInstance
{
static LayaDeviceSensor *_instance;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_instance = [[LayaDeviceSensor alloc] init];
});
return _instance;
}
- (instancetype) init
{
if( (self = [super init]) ) {
self.motionManager = [[CMMotionManager alloc] init];
self.active = NO;
}
return self;
}
- (void) active:(BOOL) active
{
self.active = active;
}
- (void) start
{
if (!self.active || self.updateTimer != nil)
return;
if (self.motionManager.deviceMotionAvailable){
self.motionManager.deviceMotionUpdateInterval = UPDATE_INTERVAL;
[self.motionManager startDeviceMotionUpdatesUsingReferenceFrame:CMAttitudeReferenceFrameXTrueNorthZVertical];
}
else{
NSLog(@"This device do not support deviceMotion");
}
self.updateTimer = [NSTimer scheduledTimerWithTimeInterval:UPDATE_INTERVAL target:self selector:@selector(update) userInfo:nil repeats:YES];
}
- (void) stop
{
if (!self.active || self.updateTimer == nil)
return;
[self.motionManager stopDeviceMotionUpdates];
[self.updateTimer invalidate];
self.updateTimer = nil;
}
- (void) update
{
if (self.motionManager.deviceMotionAvailable){
double ax = self.motionManager.deviceMotion.userAcceleration.x * G;
double ay = self.motionManager.deviceMotion.userAcceleration.y * G;
double az = self.motionManager.deviceMotion.userAcceleration.z * G;
double agx = (self.motionManager.deviceMotion.userAcceleration.x + self.motionManager.deviceMotion.gravity.x) * G;
double agy = (self.motionManager.deviceMotion.userAcceleration.y + self.motionManager.deviceMotion.gravity.y) * G;
double agz = (self.motionManager.deviceMotion.userAcceleration.z + self.motionManager.deviceMotion.gravity.z) * G;
double ra = self.motionManager.deviceMotion.rotationRate.x * 180 * M_1_PI;
double rb = self.motionManager.deviceMotion.rotationRate.y * 180 * M_1_PI;
double rg = self.motionManager.deviceMotion.rotationRate.z * 180 * M_1_PI;
double interval = 1000 * UPDATE_INTERVAL;
//NSLog(@"acceleration x[%f] y[%f] z[%f]",ax,ay,az);
//NSLog(@"accelerationIncludingGravity x[%f] y[%f] z[%f]",agx,agy,agz);
//NSLog(@"rotationRate alpha[%f] beta[%f] gama[%f]",ra,rb,rg);
//NSLog(@"interval [%f]",interval);
handleDeviceMotionEvent( ax, ay, az, agx, agy, agz, ra, rb, rg, interval);
handleDeviceOrientationEvent(self.motionManager.deviceMotion.attitude.pitch,self.motionManager.deviceMotion.attitude.roll,self.motionManager.deviceMotion.attitude.yaw);
}
}
@end
@@ -0,0 +1,73 @@
/**
@file LayaEditBox.h
@brief editBox类
@author wyw
@version 1.0
@date 2012_12_17
@company JoyChina
*/
#import <UIKit/UIKit.h>
#import <GLKit/GLKit.h>
#import "UIEditBox.h"
@class LayaEditBoxDelegate;
@interface LayaEditBox : NSObject
{
@public
UIEditBox* m_pEditBox;
GLKView* m_pParentView;
int m_nPosX;
int m_nPoyY;
int m_nWidth;
int m_nHeight;
int m_nMaxLength;
NSString* m_pOldStr;
float m_fRetinaValue;
LayaEditBoxDelegate* m_pEditBoxDelegate;
}
//初始化
-(id)initWithParentView:(GLKView*)p_pParentView EditBoxDelegate:(LayaEditBoxDelegate*)p_pEditBoxDelegate ScreenRatio:(float)p_fScreenRatio;
//设置大小和为止
-(void) setLayoutParams;
//设置位置和宽高
-(void) setPosX:(int)p_pPosX;
-(void) setPosY:(int)p_pPosY;
-(void) setWidth:(int)p_pWidth;
-(void) setHeight:(int)p_pHeight;
//给editbox设置值
-(void) setValue:(NSString*)p_sValues;
//从editbox获得值
-(NSString*) getValue;
//设置背景颜色
-(void) setBackgroundColor:(UIColor*)p_nColor;
//设置是否为密码模式
-(void) setPasswordType:(BOOL)p_bPassWord;
//设置是否为NumberOnly
-(void) setNumberOnly:(BOOL)p_bNumberOnly;
//设置是否为禁止输入
-(void) setForbidEdit:(BOOL)p_bForbidEdit;
//设置是否允许多行
-(void)setMultiAble:(BOOL)p_bMultiAble;
//设置正则表达式
-(void) setRegular:(NSString*)p_sRegular;
//设置文字颜色
-(void) setTextColor:(UIColor*)p_nTextColor;
//设置文字大小
-(void) setTextSize:(int)p_nTextSize;
//设置是否可见
-(void) setVisible:(BOOL)p_bVisible;
//设置focus
-(void) setFocus:(BOOL)p_bFocus;
//设置最大输入值
-(void) setMaxLength:(int)p_nMaxLength;
//设置行数
-(void) setLines:(int)p_nLines;
//获得最大长度
-(int) getMaxLength;
//获得TextField 指针
-(UITextView*) getTextField;
//监听变化的
//-(void) textFieldDidChange:(UITextField*)p_pTextFiled;
@end
@@ -0,0 +1,253 @@
/**
@file LayaEditBox.mm
@brief editBox类
@author wyw
@version 1.0
@date 2012_12_17
@company JoyChina
*/
#import "LayaEditBox.h"
#import "LayaEditBoxDelegate.h"
//-------------------------------------------------------------------------------
@implementation LayaEditBox
//-------------------------------------------------------------------------------
-(id)initWithParentView:(GLKView*)p_pParentView EditBoxDelegate:(LayaEditBoxDelegate*)p_pEditBoxDelegate ScreenRatio:(float)p_fScreenRatio;
{
self = [super init];
if( self != nil )
{
m_pParentView = p_pParentView;
m_nPosX = 0;
m_nPoyY = 0;
m_nWidth = 0;
m_nHeight = 0;
m_nMaxLength = -1;
m_fRetinaValue = p_fScreenRatio;
m_pEditBox = [ [UIEditBox alloc] init ];
m_pEditBox.delegate = p_pEditBoxDelegate;
//m_pEditBox.borderStyle = UITextBorderStyleNone;
[self setLayoutParams];
UIColor* nColor = [UIColor colorWithRed:1 green:1 blue:1 alpha:0];
[m_pEditBox setBackgroundColor:nColor];
//设置字体
m_pEditBox.font = [UIFont fontWithName:@"ArialMT" size:16];
//当EditBox变化的时候监听到 暂时先不用了
//[m_pEditBox addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
m_pEditBox.autocapitalizationType = UITextAutocapitalizationTypeNone;
[m_pParentView addSubview:m_pEditBox];
[self setVisible:FALSE];
}
return self;
}
////-------------------------------------------------------------------------------
//-(void) textFieldDidChange:(UITextField*)p_pTextFiled
//{
// if( m_pEditBox == p_pTextFiled )
// {
// NSString* pValue = [self getValue];
// [[AppDelegate GetMainViewController]->m_pWebViewDelegate CallJSSetEditBoxValue:m_nID andDenominator:pValue];
// }
//}
//-------------------------------------------------------------------------------
-(void)OnTextFieldDidBegin:(id)sender
{
UIEditBox *pEditBox=(UIEditBox*)sender;
NSString* val = [pEditBox text];
m_pOldStr=val;
}
//-------------------------------------------------------------------------------
-(void)OnTextFieldDidChange:(id)sender
{
UIEditBox *pEditBox=(UIEditBox*)sender;
NSString* val = [pEditBox text];
if( [m_pOldStr compare:val] !=0 )
{
//TODO
}
m_pOldStr=val;
}
//-------------------------------------------------------------------------------
-(void)setLayoutParams
{
if( m_pEditBox != nil )
{
[m_pEditBox setBounds:CGRectMake(0,0,m_nWidth,m_nHeight) ];
[m_pEditBox setCenter:CGPointMake(m_nPosX+m_nWidth/2,m_nPoyY+m_nHeight/2) ];
}
}
//-------------------------------------------------------------------------------
-(void) setPosX:(int)p_nPosX
{
m_nPosX = p_nPosX / m_fRetinaValue;
[self setLayoutParams];
}
//-------------------------------------------------------------------------------
-(void) setPosY:(int)p_nPosY
{
m_nPoyY = p_nPosY / m_fRetinaValue;
[self setLayoutParams];
}
//-------------------------------------------------------------------------------
-(void) setWidth:(int)p_nWidth
{
m_nWidth = p_nWidth / m_fRetinaValue;
[self setLayoutParams];
}
//-------------------------------------------------------------------------------
-(void) setHeight:(int)p_nHeight
{
m_nHeight = p_nHeight / m_fRetinaValue;
[self setLayoutParams];
}
//-------------------------------------------------------------------------------
-(void) setValue:(NSString*)p_sValues
{
if( m_pEditBox != nil )
{
m_pEditBox.text=p_sValues;
}
}
//-------------------------------------------------------------------------------
-(NSString*) getValue
{
if( m_pEditBox != nil )
{
NSString* value = [m_pEditBox text];
return [value stringByReplacingOccurrencesOfString:@"\u2006" withString:@""];
}
return @"";
}
//-------------------------------------------------------------------------------
-(void) setBackgroundColor:(UIColor*)p_nColor
{
if( m_pEditBox != nil )
{
m_pEditBox.backgroundColor = p_nColor;
}
}
//-------------------------------------------------------------------------------
-(void) setPasswordType:(BOOL)p_bPassWord
{
if( m_pEditBox != nil )
{
m_pEditBox.secureTextEntry = p_bPassWord;
}
}
//-------------------------------------------------------------------------------
-(void) setNumberOnly:(BOOL)p_bNumberOnly
{
if( m_pEditBox != nil )
{
[m_pEditBox setNumberOnly:p_bNumberOnly];
}
}
-(void) setForbidEdit:(BOOL)p_bForbidEdit
{
if( m_pEditBox != nil )
{
[m_pEditBox setForbidEdit:p_bForbidEdit];
}
}
//-------------------------------------------------------------------------------
-(void)setMultiAble:(BOOL)p_bMultiAble
{
if(m_pEditBox!=nil)
{
[m_pEditBox setMultiAble:p_bMultiAble];
}
NSLog(@">>>>>>>>>>>>>>>>>>>>>>>");
}
//-------------------------------------------------------------------------------
-(void) setRegular:(NSString*)p_sRegular
{
if( m_pEditBox != nil )
{
[m_pEditBox setRegular:p_sRegular];
}
}
//-------------------------------------------------------------------------------
-(void) setTextColor:(UIColor*)p_nTextColor
{
if( m_pEditBox != nil )
{
m_pEditBox.textColor = p_nTextColor;
}
}
//-------------------------------------------------------------------------------
-(void) setTextSize:(int)p_nTextSize
{
if( m_pEditBox != nil )
{
m_pEditBox.font = [UIFont fontWithName:@"ArialMT" size:(p_nTextSize / m_fRetinaValue) ];
}
}
//-------------------------------------------------------------------------------
-(void) setVisible:(BOOL)p_bVisible
{
if ( m_pEditBox != nil )
{
[m_pEditBox setHidden:!p_bVisible];
}
}
//-------------------------------------------------------------------------------
-(void) setFocus:(BOOL)p_bFocus
{
if( m_pEditBox != nil )
{
//NSNumber* nsFocus = [NSNumber numberWithBool:p_bFocus];
//[self performSelectorOnMainThread:@selector(setFocusMainThread:) withObject:nsFocus waitUntilDone:YES];
if( p_bFocus == YES )
{
[m_pEditBox becomeFirstResponder];
[m_pEditBox setHidden:NO];
}
else
{
[m_pEditBox resignFirstResponder];
[m_pEditBox setHidden:YES];
}
}
}
//-------------------------------------------------------------------------------
-(void) setFocusMainThread:(id)param
{
NSNumber* pParam = (NSNumber*)param;
if( m_pEditBox != nil )
{
if( [pParam boolValue] == YES )
{
[m_pEditBox becomeFirstResponder];
}
else
{
[m_pEditBox resignFirstResponder];
}
}
}
//-------------------------------------------------------------------------------
-(void) setMaxLength:(int)p_nMaxLength
{
m_nMaxLength = p_nMaxLength;
[m_pEditBox SetMaxLength:m_nMaxLength];
}
//-------------------------------------------------------------------------------
-(int) getMaxLength
{
return m_nMaxLength;
}
//-------------------------------------------------------------------------------
-(UITextView*) getTextField
{
return m_pEditBox;
}
//-------------------------------------------------------------------------------
-(void) setLines:(int)p_nLines
{
//TODO
}
//-------------------------------------------------------------------------------
@end
@@ -0,0 +1,25 @@
/**
@file LayaEditBoxDelegate.h
@brief LayaEditBoxDelegate类
@author wyw
@version 1.0
@date 2012_12_17
@company JoyChina
*/
#import <UIKit/UIKit.h>
#import <GLKit/GLKit.h>
@interface LayaEditBoxDelegate : NSObject <UITextViewDelegate>
{
@public
float m_fRetinaValue;
int m_nEditBoxPosY;
UIDeviceOrientation m_orient;
UIDeviceOrientation m_lastOrient;
}
-(void) setRetinaValue:(float)fRetina;
-(void)keyboardWasShown:(NSNotification*)aNotification;
-(void)keyboardWasShownEnd:(NSNotification*)aNotification;
-(void)orientChange:(NSNotification *)aNotification;
-(void)postToC;
@end
@@ -0,0 +1,203 @@
/**
@file LayaEditBoxDelegate.mm
@brief LayaEditBoxDelegate类
@author wyw
@version 1.0
@date 2012_12_17
@company JoyChina
*/
#import "LayaEditBoxDelegate.h"
#import "UIEditBox.h"
#import <UIKit/UIKit.h>
#import <GLKit/GLKit.h>
#import "conchRuntime.h"
#import "JCScriptRuntime.h"
#import "LayaEditBox.h"
//-------------------------------------------------------------------------------
@implementation LayaEditBoxDelegate
#define NUMBERS @"0123456789\n"
//-------------------------------------------------------------------------------
-(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)p_sString
{
UIEditBox* pEditBox = (UIEditBox*)textView;
if([pEditBox getForbidEdit] == true)return NO;
if( [p_sString length] <= 0 )return YES;
int nMaxLength = [pEditBox GetMaxLength];
if( nMaxLength != -1 )
{
if(![pEditBox getMultiAble]&&[p_sString isEqualToString:@"\n"])
{
[pEditBox resignFirstResponder];
return NO;
}
NSString* sLanguage = [[UITextInputMode currentInputMode]primaryLanguage];
//中文输入
if( [sLanguage isEqualToString:@"zh-Hans"] )
{
//range.length 代表 后选字母,比如 中文情况下的 yyy 。变灰色了
if( range.length > 0 )
{
//如果已经够字数了,直接返回
if( range.location >= nMaxLength )
{
return NO;
}
else
{
//获得为输入前EditBox中的内容
NSString* sOldText = [pEditBox.text substringToIndex:range.location];
//再加上现在的内容 p_sString 是本次输入的字符内容
NSString* sCurrentAndOldText = [ NSString stringWithFormat: @"%@%@", sOldText,p_sString ];
//如果超过字数,进行裁掉后面的
if( sCurrentAndOldText.length > nMaxLength )
{
pEditBox.text = [sCurrentAndOldText substringToIndex:nMaxLength];
}
else
{
pEditBox.text = sCurrentAndOldText;
}
return NO;
}
}
}
else if([sLanguage isEqualToString:@"emoji"]){
return NO;
}
else
{
if( range.location >= nMaxLength )
{
return NO;
}
}
}
bool bNumberOnly = [pEditBox getNumberOnly];
if( bNumberOnly )
{
NSCharacterSet* cs = [[NSCharacterSet characterSetWithCharactersInString:NUMBERS] invertedSet];
NSString* nsFiltered = [[p_sString componentsSeparatedByCharactersInSet:cs] componentsJoinedByString:@""];
BOOL bBasicTest = [p_sString isEqualToString:nsFiltered];
if(!bBasicTest)
{
return NO;
}
}
return [pEditBox IsInputValid:p_sString];
}
//-------------------------------------------------------------------------------
-(void)textViewDidBeginEditing:(UITextView *)textField
{
m_nEditBoxPosY = ( textField.frame.origin.y + textField.frame.size.height ) * m_fRetinaValue;
}
//-------------------------------------------------------------------------------
-(void)textViewDidEndEditing:(UITextView *)textField
{
GLKView* pView = [conchRuntime GetIOSConchRuntime]->m_pGLKView;
if( [conchRuntime GetIOSConchRuntime]->m_nGLViewOffset != 0 )
{
float width = pView.frame.size.width;
float height = pView.frame.size.height;
CGRect rect = CGRectMake(0.0f, 0, width, height );
pView.frame = rect;
[conchRuntime GetIOSConchRuntime]->m_nGLViewOffset = 0;
m_nEditBoxPosY = 0;
}
}
- (void)keyboardWasShown:(NSNotification*)aNotification
{
[conchRuntime GetIOSConchRuntime]->m_bIgnoreCurEvent = true;
}
-(void)keyboardWasShownEnd:(NSNotification*)aNotification
{
[conchRuntime GetIOSConchRuntime]->m_bIgnoreCurEvent = false;
UITextView * textField=[conchRuntime GetIOSConchRuntime]->m_pEditBox->m_pEditBox;
m_nEditBoxPosY = ( textField.frame.origin.y + textField.frame.size.height ) * m_fRetinaValue;
NSDictionary* info = [aNotification userInfo];
//kbSize即為鍵盤尺寸 (有width, height)
CGSize kbSize = [[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue].size;//得到鍵盤的高度
NSLog(@"keyboard height:%f",kbSize.height);
GLKView* pView = [conchRuntime GetIOSConchRuntime]->m_pGLKView;
CGPoint* pResolution = [conchRuntime GetIOSConchRuntime]->m_pResolution;
float width = pResolution->x; // 当前宽的点
float height = pResolution->y; // 当前高的点
float realWidth = pView.frame.size.width;
float realHeight = pView.frame.size.height;
int nKbHeight = height == realHeight ? kbSize.height:kbSize.width;
int nOffset = 0;
if( (height*m_fRetinaValue - m_nEditBoxPosY)< nKbHeight*m_fRetinaValue){
nOffset = (height - m_nEditBoxPosY/m_fRetinaValue) - nKbHeight-5;
float fIOSVersion = [conchRuntime GetIOSConchRuntime]->m_fIOSVersion;
if( (m_orient == UIDeviceOrientationLandscapeLeft||
m_orient == UIDeviceOrientationPortraitUpsideDown||
(m_orient == UIDeviceOrientationFaceUp&&(
m_lastOrient == UIDeviceOrientationLandscapeLeft ||
m_lastOrient == UIDeviceOrientationPortraitUpsideDown)))&& fIOSVersion<8)
nOffset*=-1;
[conchRuntime GetIOSConchRuntime]->m_nGLViewOffset = nOffset;
int xOffset = width == realWidth ? 0 :nOffset;
int yOffset = height == realHeight ? nOffset: 0;
CGRect rect = CGRectMake( xOffset,yOffset, realWidth, realHeight );
pView.frame = rect;
}
}
-(void)orientChange:(NSNotification *)aNotification
{
//NSDictionary* ntfDict = [aNotification userInfo];
m_lastOrient = m_orient;
m_orient = [UIDevice currentDevice].orientation;
/*
UIDeviceOrientationUnknown,
UIDeviceOrientationPortrait, // Device oriented vertically, home button on the bottom
UIDeviceOrientationPortraitUpsideDown, // Device oriented vertically, home button on the top
UIDeviceOrientationLandscapeLeft, // Device oriented horizontally, home button on the right
UIDeviceOrientationLandscapeRight, // Device oriented horizontally, home button on the left
UIDeviceOrientationFaceUp, // Device oriented flat, face up
UIDeviceOrientationFaceDown // Device oriented flat, face down
*/
switch (m_orient)
{
case UIDeviceOrientationPortrait:
break;
case UIDeviceOrientationLandscapeLeft:
break;
case UIDeviceOrientationPortraitUpsideDown:
break;
case UIDeviceOrientationLandscapeRight:
break;
case UIDeviceOrientationFaceUp:
case UIDeviceOrientationFaceDown:
case UIDeviceOrientationUnknown:
default:
break;
}
}
//-------------------------------------------------------------------------------
-(void) setRetinaValue:(float)fRetina
{
m_fRetinaValue = fRetina;
}
-(void) postToC
{
if(JCScriptRuntime::s_JSRT->m_pCurEditBox!=NULL)
{
JCScriptRuntime::s_JSRT->m_pCurEditBox->onInput();
}
}
-(void)textViewDidChange:(UITextView *)textView
{
[self postToC];
}
@end
@@ -0,0 +1,12 @@
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface LayaScreenShotter : NSObject
+ (instancetype)sharedInstance;
- (void)getScreenImageWithCompletionBlock:(void(^)(UIImage *screenImage))completionBlock;
+ (unsigned char *) convertUIImageToBitmapRGBA8:(UIImage *) image length:(int*)len;
@end
@@ -0,0 +1,177 @@
//
// YKScreenshotter.m
// ScreenshotTest
#import "LayaScreenShotter.h"
@interface LayaScreenShotter ()
@property (nonatomic, strong) dispatch_queue_t screenImgQueue;
@end
@implementation LayaScreenShotter
+ (instancetype)sharedInstance
{
static LayaScreenShotter *_instance;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_instance = [[LayaScreenShotter alloc] init];
});
return _instance;
}
- (instancetype)init
{
if (self = [super init]) {
self.screenImgQueue = dispatch_queue_create("LayaScreenShotter.queue", DISPATCH_QUEUE_SERIAL);
dispatch_set_target_queue(self.screenImgQueue, dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_HIGH, 0));
}
return self;
}
- (void)getScreenImageWithCompletionBlock:(void (^)(UIImage *))completionBlock
{
dispatch_async(self.screenImgQueue, ^{
CGSize screenSize = [UIApplication sharedApplication].delegate.window.bounds.size;
CGFloat screenScale = [UIScreen mainScreen].scale;
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef bitmapContext = CGBitmapContextCreate(NULL, screenSize.width * screenScale, screenSize.height * screenScale, 8, screenSize.width * screenScale * 4, colorSpace, kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst);
CGContextScaleCTM(bitmapContext, screenScale, screenScale);
CGAffineTransform flipVertical = CGAffineTransformMake(1, 0, 0, -1, 0, screenSize.height);
CGContextConcatCTM(bitmapContext, flipVertical);
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
dispatch_async(dispatch_get_main_queue(), ^{
UIGraphicsPushContext(bitmapContext);
for (UIWindow *window in [UIApplication sharedApplication].windows) {
[window drawViewHierarchyInRect:CGRectMake(0.0, 0.0, screenSize.width, screenSize.height) afterScreenUpdates:NO];
}
UIGraphicsPopContext();
dispatch_semaphore_signal(sema);
});
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
CGImageRef imgRef = CGBitmapContextCreateImage(bitmapContext);
UIImage *screenImage = [UIImage imageWithCGImage:imgRef];
CGImageRelease(imgRef);
CGContextRelease(bitmapContext);
CGColorSpaceRelease(colorSpace);
if (completionBlock) {
dispatch_async(dispatch_get_main_queue(), ^{
completionBlock(screenImage);
});
}
});
}
+ (unsigned char *) convertUIImageToBitmapRGBA8:(UIImage *) image length:(int*)len {
CGImageRef imageRef = image.CGImage;
// Create a bitmap context to draw the uiimage into
CGContextRef context = [self newBitmapRGBA8ContextFromImage:imageRef];
if(!context) {
return NULL;
}
size_t width = CGImageGetWidth(imageRef);
size_t height = CGImageGetHeight(imageRef);
CGRect rect = CGRectMake(0, 0, width, height);
// Draw image into the context to get the raw image data
CGContextDrawImage(context, rect, imageRef);
// Get a pointer to the data
unsigned char *bitmapData = (unsigned char *)CGBitmapContextGetData(context);
// Copy the data and release the memory (return memory allocated with new)
size_t bytesPerRow = CGBitmapContextGetBytesPerRow(context);
size_t bufferLength = bytesPerRow * height;
unsigned char *newBitmap = NULL;
if(bitmapData) {
*len = sizeof(unsigned char) * bytesPerRow * height;
newBitmap = new unsigned char[sizeof(unsigned char) * bytesPerRow * height];
if(newBitmap) { // Copy the data
for(int i = 0; i < bufferLength; ++i) {
newBitmap[i] = bitmapData[i];
}
}
free(bitmapData);
} else {
NSLog(@"Error getting bitmap pixel data\n");
}
CGContextRelease(context);
return newBitmap;
}
+ (CGContextRef) newBitmapRGBA8ContextFromImage:(CGImageRef) image {
CGContextRef context = NULL;
CGColorSpaceRef colorSpace;
uint32_t *bitmapData;
size_t bitsPerPixel = 32;
size_t bitsPerComponent = 8;
size_t bytesPerPixel = bitsPerPixel / bitsPerComponent;
size_t width = CGImageGetWidth(image);
size_t height = CGImageGetHeight(image);
size_t bytesPerRow = width * bytesPerPixel;
size_t bufferLength = bytesPerRow * height;
colorSpace = CGColorSpaceCreateDeviceRGB();
if(!colorSpace) {
NSLog(@"Error allocating color space RGB\n");
return NULL;
}
// Allocate memory for image data
bitmapData = (uint32_t *)malloc(bufferLength);
if(!bitmapData) {
NSLog(@"Error allocating memory for bitmap\n");
CGColorSpaceRelease(colorSpace);
return NULL;
}
//Create bitmap context
context = CGBitmapContextCreate(bitmapData,
width,
height,
bitsPerComponent,
bytesPerRow,
colorSpace,
kCGImageAlphaPremultipliedLast); // RGBA
if(!context) {
free(bitmapData);
NSLog(@"Bitmap context not created");
}
CGColorSpaceRelease(colorSpace);
return context;
}
@end
@@ -0,0 +1,35 @@
/**
@file LayaToast.h
@brief Toast
@author James
@version 1.0
@date 2015_9_21
@company LayaBox
*/
#import <Foundation/Foundation.h>
#import "UIKit/UIKit.h"
#define DEFAULT_DISPLAY_DURATION 2.0f
@interface LayaToast : NSObject
{
NSString* m_sText;
UIButton* m_pContentView;
CGFloat m_nDuration;
}
- (id)initWithText:(NSString *)text_;
- (void)setDuration:(CGFloat) duration_;
- (void)dismisToast;
- (void)toastTaped:(UIButton *)sender_;
- (void)showAnimation;
- (void)hideAnimation;
- (void)show;
+ (void)showWithText:(NSString *) text_;
@end
@@ -0,0 +1,103 @@
/**
@file LayaToast.h
@brief Toast
@author James
@version 1.0
@date 2015_9_21
@company LayaBox
*/
#import "LayaToast.h"
#import <QuartzCore/QuartzCore.h>
#import <UIKit/UIStringDrawing.h>
#import "conchRuntime.h"
@implementation LayaToast
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIDeviceOrientationDidChangeNotification object:[UIDevice currentDevice]];
}
- (id)initWithText:(NSString *)text_
{
if (self = [super init])
{
m_sText = [text_ copy];
UIFont *font = [UIFont boldSystemFontOfSize:16];
CGSize textSize = [m_sText sizeWithFont:font constrainedToSize:CGSizeMake(320, MAXFLOAT) ];
UILabel *textLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, textSize.width + 12, textSize.height + 12)];
textLabel.backgroundColor = [UIColor clearColor];
textLabel.textAlignment = NSTextAlignment::NSTextAlignmentCenter;
textLabel.textColor = [UIColor whiteColor];
textLabel.font = font;
textLabel.text = m_sText;
textLabel.numberOfLines = 0;
m_pContentView = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, textLabel.frame.size.width, textLabel.frame.size.height)];
m_pContentView.layer.cornerRadius = 5.0f;
m_pContentView.layer.borderWidth = 1.0f;
m_pContentView.layer.borderColor = [[UIColor grayColor] colorWithAlphaComponent:0.5].CGColor;
m_pContentView.backgroundColor = [UIColor colorWithRed:0.2f green:0.2f blue:0.2f alpha:0.5f];
[m_pContentView addSubview:textLabel];
m_pContentView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
[m_pContentView addTarget:self action:@selector(toastTaped:) forControlEvents:UIControlEventTouchDown];
m_pContentView.alpha = 0.0f;
m_nDuration = DEFAULT_DISPLAY_DURATION;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deviceOrientationDidChanged:)
name:UIDeviceOrientationDidChangeNotification object:[UIDevice currentDevice]];
}
return self;
}
- (void)deviceOrientationDidChanged:(NSNotification *)notify_
{
[self hideAnimation];
}
-(void)dismisToast
{
[m_pContentView removeFromSuperview];
}
-(void)toastTaped:(UIButton *)sender_
{
[self hideAnimation];
}
- (void)setDuration:(CGFloat) duration_
{
m_nDuration = duration_;
}
-(void)showAnimation
{
[UIView beginAnimations:@"show" context:NULL];
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
[UIView setAnimationDuration:0.3];
m_pContentView.alpha = 1.0f;
[UIView commitAnimations];
}
-(void)hideAnimation
{
[UIView beginAnimations:@"hide" context:NULL];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(dismisToast)];
[UIView setAnimationDuration:0.3];
m_pContentView.alpha = 0.0f;
[UIView commitAnimations];
}
- (void)show
{
conchRuntime* pConchRuntime = [conchRuntime GetIOSConchRuntime];
[pConchRuntime->m_pGLKView addSubview:m_pContentView];
m_pContentView.center = CGPointMake( (pConchRuntime->m_pResolution->x)/2, pConchRuntime->m_pResolution->y - 80 );
[self showAnimation];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(m_nDuration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self hideAnimation];
});
}
+ (void)showWithText:(NSString *)text_
{
LayaToast* toast = [[LayaToast alloc] initWithText:text_];
[toast setDuration:DEFAULT_DISPLAY_DURATION];
[toast show];
}
@end
@@ -0,0 +1,93 @@
#import <AVFoundation/AVFoundation.h>
#import <GLKit/GLKit.h>
#import <functional>
#import "Video/IVideoRenderTarget.h"
const unsigned short HAVE_NOTHING = 0;
const unsigned short HAVE_METADATA = 1;
const unsigned short HAVE_CURRENT_DATA = 2;
const unsigned short HAVE_FUTURE_DATA = 3;
const unsigned short HAVE_ENOUGH_DATA = 4;
@interface LayaVideoPlayer : NSObject
{
AVPlayer* m_player;
AVPlayerItem *m_playerItem;
GLKView* m_pView;
NSString* m_curUrlStr;
std::function<void(const char*)> m_emitFunc;
CGSize m_videoSize;
unsigned short m_readyState;
CGFloat m_width;
CGFloat m_height;
CGFloat m_x;
CGFloat m_y;
id m_loopObserver;
bool m_isLoop;
bool m_isEnded;
bool m_isMuted;
float m_volume;
IVideoRenderTarget* m_renderTarget;
RenderTargetType m_renderTargetType;
}
@property(nonatomic, getter=getReadyState, readonly) unsigned short readyState;
@property(nonatomic, getter=getWidth, setter=setWidth:) CGFloat width;
@property(nonatomic, getter=getHeight, setter=setHeight:) CGFloat height;
@property(nonatomic, getter=getVolume, setter=setVolume:) float volume;
@property(nonatomic, getter=getLoop, setter=setLoop:) bool loop;
@property(nonatomic, getter=getMuted, setter=setMuted:) bool muted;
@property(nonatomic) bool autoplay;
+(void)setCurParentView:(GLKView*) view withRetianValue: (float) rentinaValue;
+(void)updateRentinaValue:(float)rentinaValue;
-(id)initDefault;
-(id)initDefaultWithType:(RenderTargetType)renderTargetType;
-(id)initWithParentView:(GLKView*) view withRenderTargetType:(RenderTargetType)renderTargetType;
-(void)initInternal;
-(void)load:(const char*) url;
-(void)play;
-(void)pause;
-(void)setEmit:(std::function<void(const char*)>) emitFunc;
-(float) getVideoWidth;
-(float) getVideoHeight;
-(void) setX:(double)val;
-(void) setY:(double)val;
-(void) setWidth:(double)val;
-(CGFloat) getWidth;
-(void) setHeight:(double)val;
-(CGFloat) getHeight;
-(float) currentTime;
-(void) setCurrentTime:(float) val;
-(float) duration;
-(unsigned short)getReadyState;
-(bool)isPaused;
-(float)getVolume;
-(void)setVolume:(float)val;
-(void)setLoop:(bool)val;
-(bool)getLoop;
-(void)setMuted:(bool) val;
-(bool)getMuted;
-(bool)isFrameUpdate;
-(IImageContainer*) getImage;
-(void)onVideoEnded:(NSNotification*) notification;
-(void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context;
-(void)dealloc;
-(void)_updateSize;
@end
@@ -0,0 +1,334 @@
//
// LayaPlayer.m
// conchRuntime
//
// Created by LayaBox on 2018/10/20.
// Copyright © 2018 LayaBox. All rights reserved.
//
#import "LayaVideoPlayer.h"
#import "Video/PlayerLayerRenderTarget.h"
#import "Video/VideoOutputRenderTarget.h"
static GLKView* ms_pCurParentView;
static float ms_rentinaValue;
@implementation LayaVideoPlayer
+(void)setCurParentView:(GLKView *)view withRetianValue: (float) rentinaValue {
ms_pCurParentView = view;
ms_rentinaValue = rentinaValue;
}
+(void)updateRentinaValue:(float)rentinaValue {
ms_rentinaValue = rentinaValue;
}
-(id)initDefault
{
m_pView = ms_pCurParentView;
m_renderTargetType = RT_LAYER;
[self initInternal];
return self;
}
-(id)initDefaultWithType:(RenderTargetType)renderTargetType {
m_pView = ms_pCurParentView;
m_renderTargetType = renderTargetType;
[self initInternal];
return self;
}
-(id)initWithParentView:(GLKView*) view withRenderTargetType:(RenderTargetType) renderTargetType {
self->m_pView = view;
self->m_renderTargetType = renderTargetType;
[self initInternal];
return self;
}
-(void)initInternal
{
self->m_loopObserver = nullptr;
m_isLoop = false;
self->m_playerItem = nullptr;
self->m_player = [[AVPlayer alloc] init];
self->m_x = 0;
self->m_y = 0;
self->m_width = 0;
self->m_height = 0;
self->m_isEnded = false;
self->m_isMuted = false;
self->m_volume = [self->m_player volume];
self->_autoplay = false;
[self performSelectorOnMainThread:@selector(_updateSize) withObject:nil waitUntilDone:NO];
if(self->m_renderTargetType == RT_LAYER) {
self->m_renderTarget = [[PlayerLayerRenderTarget alloc] initWithPlayer:self->m_player];
[self->m_pView.layer addSublayer:[self->m_renderTarget getLayer]];
}
else if(self->m_renderTargetType == RT_VIDEOOUTPUT) {
self->m_renderTarget = [[VideoOutputRenderTarget alloc] init];
}
self->m_videoSize = CGSizeZero;
}
-(void)dealloc {
[self->m_playerItem removeObserver:self forKeyPath:@"status"];
[NSNotificationCenter.defaultCenter removeObserver:self name:AVPlayerItemDidPlayToEndTimeNotification object:[self->m_player currentItem]];
if(self->m_loopObserver)
{
[self->m_player removeTimeObserver:self->m_loopObserver];
self->m_loopObserver = nullptr;
}
if(m_renderTarget != nullptr)
m_renderTarget = nullptr;
if(self->m_player)
{
self->m_player = nullptr;
}
}
-(void)load:(const char *)url
{
[self pause];
NSString *newUrlStr = [NSString stringWithUTF8String:url];
if(m_playerItem && [m_curUrlStr isEqualToString:newUrlStr])
{
return;
}
self->m_curUrlStr = newUrlStr;
self->m_readyState = HAVE_NOTHING;
NSURL *newUrl = [NSURL URLWithString:self->m_curUrlStr];
// NSURL *newUrl = [NSURL fileURLWithPath:self->m_curUrlStr];
self->m_playerItem = [AVPlayerItem playerItemWithURL:newUrl];
[self->m_playerItem addObserver:self forKeyPath:@"status" options:NSKeyValueObservingOptionNew context:nil];
if(self->m_renderTargetType == RT_VIDEOOUTPUT) {
[self->m_playerItem addOutput:[self->m_renderTarget getVideoOutput]];
}
[NSNotificationCenter.defaultCenter removeObserver:self name:AVPlayerItemDidPlayToEndTimeNotification object:[self->m_player currentItem]];
[self->m_player replaceCurrentItemWithPlayerItem:self->m_playerItem];
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(onVideoEnded:) name:AVPlayerItemDidPlayToEndTimeNotification object:[self->m_player currentItem]];
}
-(void)setEmit:(std::function<void(const char*)>) emitFunc {
self->m_emitFunc = emitFunc;
}
-(void)play {
if(self.readyState == HAVE_NOTHING)
{
return;
}
if(m_isEnded)
{
self->m_isEnded = false;
[self setCurrentTime:0];
}
[self->m_player play];
}
-(void)pause {
if(self.readyState == HAVE_NOTHING)
{
return;
}
[self->m_player pause];
}
-(float)getVideoWidth
{
return self->m_videoSize.width;
}
-(float)getVideoHeight
{
return self->m_videoSize.height;
}
-(void)setX:(double)val {
self->m_x = val;
if(self.readyState == HAVE_NOTHING)
return;
[self performSelectorOnMainThread:@selector(_updateSize) withObject:nil waitUntilDone:NO];
}
-(void)setY:(double)val {
self->m_y = val;
if(self.readyState == HAVE_NOTHING)
return;
[self performSelectorOnMainThread:@selector(_updateSize) withObject:nil waitUntilDone:NO];
}
-(void)setWidth:(double)val {
self->m_width = val;
if(self.readyState == HAVE_NOTHING)
return;
[self performSelectorOnMainThread:@selector(_updateSize) withObject:nil waitUntilDone:NO];
}
-(CGFloat)getWidth {
return self->m_width;
}
-(void)setHeight:(double)val {
self->m_height = val;
if(self.readyState == HAVE_NOTHING)
return;
[self performSelectorOnMainThread:@selector(_updateSize) withObject:nil waitUntilDone:NO];
}
-(CGFloat)getHeight {
return self->m_height;
}
-(bool)isFrameUpdate {
return [self->m_renderTarget isFrameUpdate];
}
-(IImageContainer*) getImage {
CMTime curTime = [self->m_player currentTime];
[self->m_renderTarget updateImageByTime:curTime];
return [self->m_renderTarget getImageContainer];
}
-(void)_updateSize {
// self->m_playerLayer.frame = CGRectMake(self->m_x, self->m_y, self->m_width, self->m_height);
if(self->m_width == 0 || self->m_height == 0)
return;
[self->m_renderTarget setBounds:self->m_x withY:self->m_y withWidth:self->m_width withHeight:self->m_height withRentinaValue: ms_rentinaValue];
}
-(float)currentTime
{
CMTime currentTime = [self->m_player currentTime];
return CMTimeGetSeconds(currentTime);
}
-(void)setCurrentTime:(float)val {
CMTime time = CMTimeMakeWithSeconds(val, 1 * NSEC_PER_SEC);
[self->m_player seekToTime:time];
}
-(float)duration {
CMTime duration = self->m_player.currentItem.asset.duration;
return CMTimeGetSeconds(duration);
}
-(unsigned short)getReadyState {
return self->m_readyState;
}
-(bool)isPaused {
float rate = [self->m_player rate];
return rate == 0;
}
-(float)getVolume {
return [self->m_player volume];
}
-(void)setVolume:(float)val {
m_volume = (val < 0.0 ? 0.0 : (val > 1.0 ? 1.0 : val));
if(m_isMuted)
return;
self->m_player.volume = val;
}
-(void)setLoop:(bool)val {
m_isLoop = val;
}
-(bool)getLoop {
return m_isLoop;
}
-(void)setMuted:(bool) val {
if(m_isMuted == val)
return;
m_isMuted = val;
float volume = m_isMuted ? 0.0 : m_volume;
[self setVolume:volume];
}
-(bool)getMuted {
return m_isMuted;
}
-(void)onVideoEnded:(NSNotification*) notification {
if(m_isEnded)
return;
if(m_emitFunc)
m_emitFunc("ended");
m_isEnded = true;
if(m_isLoop)
{
[self play];
}
}
-(void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context
{
if(object == self->m_playerItem)
{
if(self->m_readyState == HAVE_ENOUGH_DATA)
return;
if([keyPath isEqualToString:@"status"])
{
if(self->m_playerItem.status == AVPlayerItemStatusReadyToPlay)
{
for(AVPlayerItemTrack* track in self->m_playerItem.tracks)
{
if([track.assetTrack.mediaType isEqualToString: AVMediaTypeVideo])
{
self->m_videoSize = track.assetTrack.naturalSize;
break;
}
}
self->m_readyState = HAVE_ENOUGH_DATA;
if(m_emitFunc)
{
m_emitFunc("loadedmetadata");
m_emitFunc("canplay");
}
if(self->_autoplay)
[self play];
}
else if(self->m_playerItem.status == AVPlayerItemStatusFailed)
{
NSLog(@"PlayerItem has error : %@", self->m_playerItem.error);
m_emitFunc("error");
}
}
}
else
{
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
}
}
@end
@@ -0,0 +1,38 @@
/**
@file LayaWebView.h
@brief LayaWebView类 显示外部网页用的
@author wyw
@version 1.0
@date 2013_8_30
@company JoyChina
*/
#import <UIKit/UIKit.h>
#import <WebKit/WebKit.h>
//外部网页类
@interface LayaWebView : NSObject
{
@public
WKWebView* m_pWebView;
UIButton* m_pCloseButton;
int m_nX;
int m_nY;
int m_nWidth;
int m_nHeight;
}
//初始化
-(LayaWebView*)init;
//显示WebView
-(void)showWebView:(NSString*)p_sUrl posx:(int)p_nX posy:(int)p_nY width:(int)p_nWidth height:(int)p_nHeight showCloseButton:(bool)p_bShowCloseButton;
//关闭WebView
-(void)closeWebView;
//排版
-(void)composing:(int)p_nX posy:(int)p_nY width:(int)p_nWidth height:(int)p_nHeight;
//loadUrl
-(void)loadUrl:(NSString*)p_sUrl;
-(void)callWebviewJS:(NSString*)p_sMethodName para:(NSString*)p_sJsonPara callback:(NSString*)p_sCallback;
@end
@@ -0,0 +1,139 @@
/**
@file UIEditBox.mm
@brief 继承textField类
@author wyw
@version 1.0
@date 2012_12_17
@company JoyChina
*/
#import "LayaWebView.h"
#import "conchRuntime.h"
#import "../../../../source/conch/JCScriptRuntime.h"
#import "JCThreadCmdMgr.h"
#import "NSString.h"
@implementation LayaWebView
- (UIImage *)imagesNamedFromCustomBundle:(NSString *)imgName
{
NSString *bundlePath = [[NSBundle mainBundle].resourcePath stringByAppendingPathComponent:@"libconchRuntime.bundle"];
NSString *img_path = [bundlePath stringByAppendingPathComponent:imgName];
return [UIImage imageWithContentsOfFile:img_path];
}
-(LayaWebView*)init
{
m_nX = 0;
m_nY = 0;
m_nWidth = [conchRuntime GetIOSConchRuntime]->m_pResolution->x;
m_nHeight = [conchRuntime GetIOSConchRuntime]->m_pResolution->y;
WKWebViewConfiguration* config = [[WKWebViewConfiguration alloc]init];
config.preferences.javaScriptEnabled=true;
config.preferences.javaScriptCanOpenWindowsAutomatically = true;
config.userContentController = [[WKUserContentController alloc] init];
m_pWebView = [[WKWebView alloc] initWithFrame:CGRectMake( m_nX, m_nY, m_nWidth, m_nHeight) configuration:config];
m_pWebView.allowsBackForwardNavigationGestures = YES;
//m_pWebView.UIDelegate = self;
//m_pWebView.navigationDelegate = self;
m_pWebView.scrollView.bounces = false;
m_pWebView.scrollView.bouncesZoom = false;
//closeButton
m_pCloseButton = [UIButton buttonWithType:UIButtonTypeCustom];
UIImage* pImage = [self imagesNamedFromCustomBundle:@"close.png"];
[m_pCloseButton setImage:pImage forState:UIControlStateNormal];
[m_pCloseButton addTarget:self action:@selector(handleCloseButton:) forControlEvents: UIControlEventTouchUpInside];
[m_pCloseButton setFrame:CGRectMake( 5, 5, 32, 32)];
[m_pWebView addSubview:m_pCloseButton];
//排版
[self composing:m_nX posy:m_nY width:m_nWidth height:m_nHeight];
m_pWebView.hidden = YES;
return self;
}
//-------------------------------------------------------------------------------
-(void)showWebView:(NSString*)p_sUrl posx:(int)p_nX posy:(int)p_nY width:(int)p_nWidth height:(int)p_nHeight showCloseButton:(bool)p_bShowCloseButton
{
float fRetinaValue = [conchRuntime GetIOSConchRuntime]->m_fRetinaValue;
p_nX /= fRetinaValue;
p_nY /= fRetinaValue;
p_nWidth /= fRetinaValue;
p_nHeight /= fRetinaValue;
if(p_bShowCloseButton)
{
m_pCloseButton.hidden = NO;
}
else
{
m_pCloseButton.hidden = YES;
}
if(p_nWidth==0)p_nWidth = [conchRuntime GetIOSConchRuntime]->m_pResolution->x;
if(p_nHeight==0)p_nHeight = [conchRuntime GetIOSConchRuntime]->m_pResolution->y;
if( m_nWidth != p_nWidth || m_nHeight != p_nHeight || m_nX != p_nX || m_nY != p_nY )
{
m_nX = p_nX;
m_nY = p_nY;
m_nWidth = p_nWidth;
m_nHeight = p_nHeight;
[self composing:m_nX posy:m_nY width:m_nWidth height:m_nHeight];
m_pWebView.hidden = NO;
[self loadUrl:p_sUrl];
}
else
{
m_pWebView.hidden = NO;
[self loadUrl:p_sUrl];
}
}
//-------------------------------------------------------------------------------
-(void)closeWebView
{
m_pWebView.hidden = YES;
[m_pWebView loadHTMLString:@"" baseURL:nil];
}
//-------------------------------------------------------------------------------
-(void)composing:(int)p_nX posy:(int)p_nY width:(int)p_nWidth height:(int)p_nHeight
{
[m_pWebView setFrame:CGRectMake( p_nX,p_nY,p_nWidth,p_nHeight )];
}
//-------------------------------------------------------------------------------
-(void)loadUrl:(NSString*)p_sUrl
{
NSURL* pUrl = [NSURL URLWithString:p_sUrl];
NSURLRequest* pRequest =[NSURLRequest requestWithURL:pUrl];
[m_pWebView loadRequest:pRequest];
}
//-------------------------------------------------------------------------------
-(void)handleCloseButton:(UIButton *)button
{
[self closeWebView];
}
//-------------------------------------------------------------------------------
-(NSString*)encodeString:(NSString*)nsParam
{
return [nsParam stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet characterSetWithCharactersInString:@"!*'();:@&=+$,/?%#[]"]];
/*return (__bridge_transfer NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,
(__bridge CFStringRef)nsParam,
NULL,
CFSTR("!*'();:@&=+$,/?%#[]"),
kCFStringEncodingUTF8);*/
}
-(NSString*)decodeString:(NSString*)nsParam
{
return [nsParam stringByRemovingPercentEncoding];
/*return (__bridge_transfer NSString *)CFURLCreateStringByReplacingPercentEscapesUsingEncoding(kCFAllocatorDefault,
(__bridge CFStringRef)nsParam,
CFSTR(""),
kCFStringEncodingUTF8);*/
}
//-------------------------------------------------------------------------------
-(void)callWebviewJS:(NSString*)p_sMethodName para:(NSString*)p_sJsonPara callback:(NSString*)p_sCallback
{
NSLog(@"callWebviewJS is not implemented");
}
@end
@@ -0,0 +1,20 @@
/**
@file NSString.h
@brief 能够转换utf8编码用的,从js传入的符号必须通过这个类转换才好用,否则@ # 这个都不认
@author wyw
@version 1.0
@date 2012_12_17
@company JoyChina
*/
#import <Foundation/Foundation.h>
@interface NSString (OAURLEncodingAdditions)
- (NSString *)URLEncodedString;
- (NSString *)URLDecodedString;
@end
@@ -0,0 +1,31 @@
/**
@file NSString.m
@brief
@author wyw
@version 1.0
@date 2012_12_17
@company JoyChina
*/
#import "NSString.h"
@implementation NSString (OAURLEncodingAdditions)
- (NSString *)URLEncodedString
{
NSString *result = (__bridge_transfer NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,
(__bridge CFStringRef)self,
NULL,
CFSTR("!*'();:@&=+$,/?%#[]"),
kCFStringEncodingUTF8);
return result;
}
- (NSString*)URLDecodedString
{
NSString *result = (__bridge_transfer NSString *)CFURLCreateStringByReplacingPercentEscapesUsingEncoding(kCFAllocatorDefault,
(__bridge CFStringRef)self,
CFSTR(""),
kCFStringEncodingUTF8);
return result;
}
@end
@@ -0,0 +1,34 @@
/**
@file LayaNotifyInterface
@brief 本地推送接口
@author James
@version 1.0
@date 2014_1_16
@company JoyChina
*/
#import <UIKit/UIKit.h>
@protocol LayaNotifyInterface
//设置重复的消息
-(void)setRepeatNotify:(int)p_nID startTime:(long)p_nStartTime repeateType:(int)nRepeateType tickerText:(NSString*)p_sTickerText titleText:(NSString*)p_sTitleText desc:(NSString*)p_sDesc;
//设置只提示一次的消息
-(void)setOnceNotify:(int)p_nID startTime:(long)p_nStartTime tickerText:(NSString*)p_sTickerText titleText:(NSString*)p_sTitleText desc:(NSString*)p_sDesc;
//只删除消息,但是保留定时器
//-(void)removeNotify:(int)p_nID;
//删除某一个消息和定时器
-(void)deleteOnceNotify:(int)p_nID;
//只删除全部消息,但是保留定时器
//-(void)removeAllNotify;
//删除消息和定时器
-(void)deleteAllNotify;
//显示推送消息
-(void)showNotification:(UILocalNotification*)notifi needApplication:(UIApplication *)application;
@end
@@ -0,0 +1,19 @@
/**
@file LayaNotifyManager.h
@brief 本地推送
@author James
@version 1.0
@date 2014_1_16
@company JoyChina
*/
#import "LayaNotifyInterface.h"
@interface LayaNotifyManager : NSObject<LayaNotifyInterface>
{
}
+(LayaNotifyManager*)GetInstance;
@end
@@ -0,0 +1,174 @@
/**
@file LayaNotifyManager.m
@brief 本地推送
@author James
@version 1.0
@date 2014_1_16
@company JoyChina
*/
#import "LayaNotifyManager.h"
static LayaNotifyManager* g_spNotifyManager = nil;
@implementation LayaNotifyManager
- (id)init
{
self = [super init];
return self;
}
+(LayaNotifyManager*)GetInstance
{
if( g_spNotifyManager == nil )
{
g_spNotifyManager = [[LayaNotifyManager alloc] init];
}
return g_spNotifyManager;
}
-(void)setRepeatNotify:(int)p_nID startTime:(long)p_nStartTime repeateType:(int)nRepeateType tickerText:(NSString*)p_sTickerText titleText:(NSString*)p_sTitleText desc:(NSString*)p_sDesc
{
[self deleteOnceNotify:p_nID];
UILocalNotification *notification = [[UILocalNotification alloc] init];
//设置10秒之后
NSDate *pushDate = [NSDate dateWithTimeIntervalSinceNow:p_nStartTime/1000];
if (notification != nil) {
// 设置推送时间
notification.fireDate = pushDate;
// 设置时区
notification.timeZone = [NSTimeZone defaultTimeZone];
// 设置重复间隔
if (nRepeateType == 0) {
notification.repeatInterval = kCFCalendarUnitYear;
}else if(nRepeateType == 1){
notification.repeatInterval = kCFCalendarUnitMonth;
}else if(nRepeateType == 2){
notification.repeatInterval = kCFCalendarUnitDay;
}else if(nRepeateType == 3){
notification.repeatInterval = kCFCalendarUnitHour;
}else if(nRepeateType == 4){
notification.repeatInterval = kCFCalendarUnitMinute;
}else if(nRepeateType == 5){
notification.repeatInterval = kCFCalendarUnitSecond;
}
// 推送声音
notification.soundName = UILocalNotificationDefaultSoundName;
// 推送内容
notification.alertBody = p_sDesc;
//显示在icon上的红色圈中的数子
notification.applicationIconBadgeNumber = 1;
//设置userinfo 方便在之后需要撤销的时候使用
//NSDictionary *info = [NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"%d", p_nID] forKey:@"key"];
NSDictionary *info = [NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"%d", p_nID],@"key",p_sTickerText,@"ticker",p_sTitleText,@"title",nil];
notification.userInfo = info;
//添加推送到UIApplication
UIApplication *app = [UIApplication sharedApplication];
[app scheduleLocalNotification:notification];
}
}
//设置只提示一次的消息
-(void)setOnceNotify:(int)p_nID startTime:(long)p_nStartTime tickerText:(NSString*)p_sTickerText titleText:(NSString*)p_sTitleText desc:(NSString*)p_sDesc
{
[self deleteOnceNotify:p_nID];
UILocalNotification *notification = [[UILocalNotification alloc] init];
//设置10秒之后
NSDate *pushDate = [NSDate dateWithTimeIntervalSinceNow:p_nStartTime/1000];
//NSDate *now=[NSDate new];
if (notification != nil) {
// 设置推送时间
notification.fireDate = pushDate;
// 设置时区
notification.timeZone = [NSTimeZone defaultTimeZone];
// 设置重复间隔
//notification.repeatInterval = kCFCalendarUnitMinute;
notification.repeatInterval = 0;
// 推送声音
notification.soundName = UILocalNotificationDefaultSoundName;
// 推送内容
notification.alertBody = p_sDesc;
//显示在icon上的红色圈中的数子
notification.applicationIconBadgeNumber = 1;
//设置userinfo 方便在之后需要撤销的时候使用
//NSDictionary *info = [NSDictionary dictionaryWithObject:@"name"forKey:@"key"];
//NSDictionary *info = [NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"%d", p_nID] forKey:@"key"];
NSDictionary *info = [NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"%d", p_nID],@"key",p_sTickerText,@"ticker",p_sTitleText,@"title",nil];
notification.userInfo = info;
//添加推送到UIApplication
UIApplication *app = [UIApplication sharedApplication];
[app scheduleLocalNotification:notification];
}
}
//只删除消息,但是保留定时器
//-(void)removeNotify:(int)p_nID;
//只删除全部消息,但是保留定时器
//-(void)removeAllNotify;
//删除某一个消息和定时器
-(void)deleteOnceNotify:(int)p_nID
{
UIApplication *app = [UIApplication sharedApplication];
//获取本地推送数组
NSArray *localArray = [app scheduledLocalNotifications];
//声明本地通知对象
UILocalNotification *localNotification;
if (localArray) {
for (UILocalNotification *noti in localArray) {
NSDictionary *dict = noti.userInfo;
if (dict) {
NSString *inKey = [dict objectForKey:@"key"];
if ([inKey isEqualToString:[NSString stringWithFormat:@"%d", p_nID]]) {
if (!localNotification){
localNotification = noti;
}
break;
}
}
}
//判断是否找到已经存在的相同key的推送
if (!localNotification) {
//不存在初始化
localNotification = [[UILocalNotification alloc] init];
}
if (localNotification) {
//不推送 取消推送
[app cancelLocalNotification:localNotification];
return;
}
}
}
//删除所有消息和定时器
-(void)deleteAllNotify
{
//8.0需要设置权限
float fVersion = [[[UIDevice currentDevice] systemVersion] floatValue];
if ( fVersion >= 8.0 )
{
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeBadge categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:settings];
}
[[UIApplication sharedApplication] cancelAllLocalNotifications];
[UIApplication sharedApplication].applicationIconBadgeNumber=0;
}
//显示推送消息
-(void)showNotification:(UILocalNotification*)notifi needApplication:(UIApplication *)application
{
NSString *ticker;
NSString *title;
NSDictionary *dict = notifi.userInfo;
if (dict) {
title = [dict objectForKey:@"title"];
ticker = [dict objectForKey:@"ticker"];
}
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title message:notifi.alertBody delegate:nil cancelButtonTitle:ticker otherButtonTitles:nil];
[alert show];
// notification.applicationIconBadgeNumber -= 1;
application.applicationIconBadgeNumber -= 1;
}
@end
@@ -0,0 +1,100 @@
/*
File: Reachability.h
Abstract: Basic demonstration of how to use the SystemConfiguration Reachablity APIs.
Version: 3.5
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
"Apple Software"), to use, reproduce, modify and redistribute the Apple
Software, with or without modifications, in source and/or binary forms;
provided that if you redistribute the Apple Software in its entirety and
without modifications, you must retain this notice and the following
text and disclaimers in all such redistributions of the Apple Software.
Neither the name, trademarks, service marks or logos of Apple Inc. may
be used to endorse or promote products derived from the Apple Software
without specific prior written permission from Apple. Except as
expressly stated in this notice, no other rights or licenses, express or
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Copyright (C) 2014 Apple Inc. All Rights Reserved.
*/
#import <Foundation/Foundation.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <netinet/in.h>
typedef enum : NSInteger {
NotReachable = 0,
ReachableViaWiFi,
ReachableViaWWAN
} LayaNetworkStatus;
extern NSString *LayakReachabilityChangedNotification;
@interface LayaReachability : NSObject
/*!
* Use to check the reachability of a given host name.
*/
+ (instancetype)reachabilityWithHostName:(NSString *)hostName;
/*!
* Use to check the reachability of a given IP address.
*/
+ (instancetype)reachabilityWithAddress:(const struct sockaddr_in *)hostAddress;
/*!
* Checks whether the default route is available. Should be used by applications that do not connect to a particular host.
*/
+ (instancetype)reachabilityForInternetConnection;
/*!
* Checks whether a local WiFi connection is available.
*/
+ (instancetype)reachabilityForLocalWiFi;
/*!
* Start listening for reachability notifications on the current run loop.
*/
- (BOOL)startNotifier;
- (void)stopNotifier;
- (LayaNetworkStatus)currentReachabilityStatus;
/*!
* WWAN may be available, but not active until a connection has been established. WiFi may require a connection for VPN on Demand.
*/
- (BOOL)connectionRequired;
@end
@@ -0,0 +1,311 @@
/*
File: Reachability.m
Abstract: Basic demonstration of how to use the SystemConfiguration Reachablity APIs.
Version: 3.5
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
"Apple Software"), to use, reproduce, modify and redistribute the Apple
Software, with or without modifications, in source and/or binary forms;
provided that if you redistribute the Apple Software in its entirety and
without modifications, you must retain this notice and the following
text and disclaimers in all such redistributions of the Apple Software.
Neither the name, trademarks, service marks or logos of Apple Inc. may
be used to endorse or promote products derived from the Apple Software
without specific prior written permission from Apple. Except as
expressly stated in this notice, no other rights or licenses, express or
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Copyright (C) 2014 Apple Inc. All Rights Reserved.
*/
#import <arpa/inet.h>
#import <ifaddrs.h>
#import <netdb.h>
#import <sys/socket.h>
#import <CoreFoundation/CoreFoundation.h>
#import "Reachability.h"
NSString *LayakReachabilityChangedNotification = @"LayakNetworkReachabilityChangedNotification";
#pragma mark - Supporting functions
#define kShouldPrintReachabilityFlags 1
static void PrintReachabilityFlags(SCNetworkReachabilityFlags flags, const char* comment)
{
#if kShouldPrintReachabilityFlags
NSLog(@"Reachability Flag Status: %c%c %c%c%c%c%c%c%c %s\n",
(flags & kSCNetworkReachabilityFlagsIsWWAN) ? 'W' : '-',
(flags & kSCNetworkReachabilityFlagsReachable) ? 'R' : '-',
(flags & kSCNetworkReachabilityFlagsTransientConnection) ? 't' : '-',
(flags & kSCNetworkReachabilityFlagsConnectionRequired) ? 'c' : '-',
(flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) ? 'C' : '-',
(flags & kSCNetworkReachabilityFlagsInterventionRequired) ? 'i' : '-',
(flags & kSCNetworkReachabilityFlagsConnectionOnDemand) ? 'D' : '-',
(flags & kSCNetworkReachabilityFlagsIsLocalAddress) ? 'l' : '-',
(flags & kSCNetworkReachabilityFlagsIsDirect) ? 'd' : '-',
comment
);
#endif
}
static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void* info)
{
#pragma unused (target, flags)
NSCAssert(info != NULL, @"info was NULL in ReachabilityCallback");
NSCAssert([(__bridge NSObject*) info isKindOfClass: [LayaReachability class]], @"info was wrong class in ReachabilityCallback");
LayaReachability* noteObject = (__bridge LayaReachability *)info;
// Post a notification to notify the client that the network reachability changed.
[[NSNotificationCenter defaultCenter] postNotificationName: LayakReachabilityChangedNotification object: noteObject];
}
#pragma mark - Reachability implementation
@implementation LayaReachability
{
BOOL _alwaysReturnLocalWiFiStatus; //default is NO
SCNetworkReachabilityRef _reachabilityRef;
}
+ (instancetype)reachabilityWithHostName:(NSString *)hostName
{
LayaReachability* returnValue = NULL;
SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(NULL, [hostName UTF8String]);
if (reachability != NULL)
{
returnValue= [[self alloc] init];
if (returnValue != NULL)
{
returnValue->_reachabilityRef = reachability;
returnValue->_alwaysReturnLocalWiFiStatus = NO;
}
}
return returnValue;
}
+ (instancetype)reachabilityWithAddress:(const struct sockaddr_in *)hostAddress
{
SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr *)hostAddress);
LayaReachability* returnValue = NULL;
if (reachability != NULL)
{
returnValue = [[self alloc] init];
if (returnValue != NULL)
{
returnValue->_reachabilityRef = reachability;
returnValue->_alwaysReturnLocalWiFiStatus = NO;
}
}
return returnValue;
}
+ (instancetype)reachabilityForInternetConnection
{
struct sockaddr_in zeroAddress;
bzero(&zeroAddress, sizeof(zeroAddress));
zeroAddress.sin_len = sizeof(zeroAddress);
zeroAddress.sin_family = AF_INET;
return [self reachabilityWithAddress:&zeroAddress];
}
+ (instancetype)reachabilityForLocalWiFi
{
struct sockaddr_in localWifiAddress;
bzero(&localWifiAddress, sizeof(localWifiAddress));
localWifiAddress.sin_len = sizeof(localWifiAddress);
localWifiAddress.sin_family = AF_INET;
// IN_LINKLOCALNETNUM is defined in <netinet/in.h> as 169.254.0.0.
localWifiAddress.sin_addr.s_addr = htonl(IN_LINKLOCALNETNUM);
LayaReachability* returnValue = [self reachabilityWithAddress: &localWifiAddress];
if (returnValue != NULL)
{
returnValue->_alwaysReturnLocalWiFiStatus = YES;
}
return returnValue;
}
#pragma mark - Start and stop notifier
- (BOOL)startNotifier
{
BOOL returnValue = NO;
SCNetworkReachabilityContext context = {0, (__bridge void *)(self), NULL, NULL, NULL};
if (SCNetworkReachabilitySetCallback(_reachabilityRef, ReachabilityCallback, &context))
{
if (SCNetworkReachabilityScheduleWithRunLoop(_reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode))
{
returnValue = YES;
}
}
return returnValue;
}
- (void)stopNotifier
{
if (_reachabilityRef != NULL)
{
SCNetworkReachabilityUnscheduleFromRunLoop(_reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
}
}
- (void)dealloc
{
[self stopNotifier];
if (_reachabilityRef != NULL)
{
CFRelease(_reachabilityRef);
}
}
#pragma mark - Network Flag Handling
- (LayaNetworkStatus)localWiFiStatusForFlags:(SCNetworkReachabilityFlags)flags
{
PrintReachabilityFlags(flags, "localWiFiStatusForFlags");
LayaNetworkStatus returnValue = NotReachable;
if ((flags & kSCNetworkReachabilityFlagsReachable) && (flags & kSCNetworkReachabilityFlagsIsDirect))
{
returnValue = ReachableViaWiFi;
}
return returnValue;
}
- (LayaNetworkStatus)networkStatusForFlags:(SCNetworkReachabilityFlags)flags
{
PrintReachabilityFlags(flags, "networkStatusForFlags");
if ((flags & kSCNetworkReachabilityFlagsReachable) == 0)
{
// The target host is not reachable.
return NotReachable;
}
LayaNetworkStatus returnValue = NotReachable;
if ((flags & kSCNetworkReachabilityFlagsConnectionRequired) == 0)
{
/*
If the target host is reachable and no connection is required then we'll assume (for now) that you're on Wi-Fi...
*/
returnValue = ReachableViaWiFi;
}
if ((((flags & kSCNetworkReachabilityFlagsConnectionOnDemand ) != 0) ||
(flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) != 0))
{
/*
... and the connection is on-demand (or on-traffic) if the calling application is using the CFSocketStream or higher APIs...
*/
if ((flags & kSCNetworkReachabilityFlagsInterventionRequired) == 0)
{
/*
... and no [user] intervention is needed...
*/
returnValue = ReachableViaWiFi;
}
}
if ((flags & kSCNetworkReachabilityFlagsIsWWAN) == kSCNetworkReachabilityFlagsIsWWAN)
{
/*
... but WWAN connections are OK if the calling application is using the CFNetwork APIs.
*/
returnValue = ReachableViaWWAN;
}
return returnValue;
}
- (BOOL)connectionRequired
{
NSAssert(_reachabilityRef != NULL, @"connectionRequired called with NULL reachabilityRef");
SCNetworkReachabilityFlags flags;
if (SCNetworkReachabilityGetFlags(_reachabilityRef, &flags))
{
return (flags & kSCNetworkReachabilityFlagsConnectionRequired);
}
return NO;
}
- (LayaNetworkStatus)currentReachabilityStatus
{
NSAssert(_reachabilityRef != NULL, @"currentNetworkStatus called with NULL SCNetworkReachabilityRef");
LayaNetworkStatus returnValue = NotReachable;
SCNetworkReachabilityFlags flags;
if (SCNetworkReachabilityGetFlags(_reachabilityRef, &flags))
{
if (_alwaysReturnLocalWiFiStatus)
{
returnValue = [self localWiFiStatusForFlags:flags];
}
else
{
returnValue = [self networkStatusForFlags:flags];
}
}
return returnValue;
}
@end
@@ -0,0 +1,21 @@
/**
@file
@brief
@author
@version 1.0
@date
@company LayaBox
*/
#import <objc/NSObject.h>
#import <objc/objc.h>
#import <Foundation/NSString.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSInvocation.h>
@interface Reflection : NSObject
-(id)init;
-(void)clearReflectionObjects;
-(NSString*)callMethod:(int)objid className:(NSString*)cls methodName:(NSString*)method param:(NSString*)param;
-(void)callbackToJSWithClass:(Class)cls methodName:(NSString*)name ret:(NSObject*)retObj;
-(void)callbackToJSWithClassName:(NSString*)cls methodName:(NSString*)name ret:(NSObject*)retObj;
-(void)callbackToJSWithObject:(id)obj methodName:(NSString*)name ret:(NSObject*)retObj;
@end
@@ -0,0 +1,219 @@
#import "refection.h"
//#import "../../../../source/conch/CToObjectC.h"
//#import "CToObjectCIOS.h"
#import "../../../../../source/conch/JCScriptRuntime.h"
#import "JCThreadCmdMgr.h"
extern void reflectionCallback(const std::string& jsonret);
@implementation Reflection
{
NSMutableDictionary* m_pIDToObjectDic;
NSMutableDictionary* m_pObjectToIDDic;
NSLock* m_lock;
}
-(id)init
{
self = [super init];
if( self != nil )
{
m_pIDToObjectDic = [NSMutableDictionary dictionary];
m_pObjectToIDDic = [NSMutableDictionary dictionary];
m_lock = [NSLock new];
return self;
}
return nil;
}
-(void)clearReflectionObjects
{
[m_lock lock];
[m_pIDToObjectDic removeAllObjects];
[m_pObjectToIDDic removeAllObjects];
[m_lock unlock];
}
-(NSString*)invoke: (Class) objc_class isStatic:(BOOL) isStatic target:(id)target select:(SEL)select Param:(NSString*)param
{
NSMethodSignature* signature = isStatic ? [objc_class methodSignatureForSelector:select] : [objc_class instanceMethodSignatureForSelector:select];
if (signature == nil){
NSLog(@"reflection error: can not find method signature");
return @"{}";
}
NSInvocation* invocation = [NSInvocation invocationWithMethodSignature:signature];
if (invocation == nil){
NSLog(@"reflection error: can not find invocation");
return @"{}";
}
[invocation setTarget:target];
[invocation setSelector:select];
NSUInteger numArgs = [signature numberOfArguments];
NSData* jsonData = [param dataUsingEncoding:NSUTF8StringEncoding];
if (jsonData == nil){
NSLog(@"reflection error");
return @"{}";
}
NSError* error = nil;
id idPara = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&error];
if (idPara == nil || ![idPara isKindOfClass:[NSArray class]]){
NSLog(@"reflection error");
return @"{}";
}
NSArray* paraArray = idPara;
NSUInteger num = [paraArray count];
if (numArgs != num + 2){
NSLog(@"reflection error: argument number is [%lu] but need [%lu]",(unsigned long)num,(unsigned long)(numArgs-2));
return @"{}";
}
for(int i = 2; i < num + 2; i++){
NSObject* obj = [paraArray objectAtIndex:i-2];
[invocation setArgument:&obj atIndex:i];
}
[invocation invoke];
if (!strcmp(signature.methodReturnType, @encode(void))) {
return @"{}";
}
const char* methodReturnType = signature.methodReturnType;
if (!strcmp(methodReturnType, "@")) {
NSLog(@"method return type %s",methodReturnType);
id returnValue;
[invocation getReturnValue:&returnValue];
NSDictionary* dic = [NSDictionary dictionaryWithObjectsAndKeys:returnValue, @"v",nil];
NSError* pError = nil;
NSData* pJsonData = [NSJSONSerialization dataWithJSONObject:dic options:NSJSONWritingPrettyPrinted error:&pError];
if (pError) {
NSLog(@"%@ %@", pError.debugDescription, pError.description);
return @"{}";
}
return [[NSString alloc] initWithData:pJsonData encoding:NSUTF8StringEncoding];
}
else {
NSLog(@"method return type %s not supported",methodReturnType);
return @"{}";
}
return @"{}";
}
-(NSString*)callMethod:(int)objid className:(NSString*)cls methodName:(NSString*)method param:(NSString*)param
{
Class objc_class = NSClassFromString(cls);
if (objc_class == nil){
NSLog(@"reflection error : can not find class [%@]",cls);
return @"{}";
}
if (objid == -1){
SEL select = NSSelectorFromString(method);
if (select == 0){
NSLog(@"reflection error");
return @"{}";
}
return [self invoke:objc_class isStatic:TRUE target:objc_class select:select Param:param];
}
else{
if ([method isEqualToString:@"<init>"]){//构造函数
NSObject* object = [[objc_class alloc] init];
if (object == nil){
NSLog(@"reflection error : alloc init class [%@] object failed",cls);
return @"{}";
}
[m_lock lock];
[m_pIDToObjectDic setObject:object forKey:[NSNumber numberWithInt:objid]];
[m_pObjectToIDDic setObject:[NSNumber numberWithInt:objid] forKey:[NSNumber numberWithInteger:(NSInteger)object]];
[m_lock unlock];
}
else{
NSObject* object = [m_pIDToObjectDic objectForKey:[NSNumber numberWithInt:objid]];
if (object == nil){
NSLog(@"reflection error : can not find object id [%i]",objid);
return @"{}";
}
if (![object isKindOfClass:objc_class]){
NSLog(@"reflection error : object of id [%i] is not king of class [%@]",objid,cls);
return @"{}";
}
SEL select = NSSelectorFromString(method);
if (select == 0){
NSLog(@"reflection error");
return @"{}";
}
return [self invoke:objc_class isStatic:FALSE target:object select:select Param:param];
}
}
return @"{}";
}
-(void)callbackToJSWithClass:(Class)cls methodName:(NSString*)name ret:(NSObject*)retObj
{
[self callbackToJSWithClassName:NSStringFromClass(cls) methodName:name ret:retObj];
}
-(void)callbackToJSWithClassName:(NSString*)cls methodName:(NSString*)name ret:(NSObject*)retObj
{
NSMutableDictionary* dic = [NSMutableDictionary dictionary];
[dic setObject:@-1 forKey:@"objId"];
[dic setObject:cls forKey:@"cName"];
[dic setObject:name forKey:@"mName"];
if (retObj == nil)
[dic setObject:@"" forKey:@"v"];
else
[dic setObject:retObj forKey:@"v"];
NSError* error = nil;
NSData* jsonData = [NSJSONSerialization dataWithJSONObject:dic options:NSJSONWritingPrettyPrinted error:&error];
if (error != nil){
NSLog(@"callbackToJS error");
return;
}
const char* jason = [[[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding] UTF8String];
auto pFunction = std::bind(&reflectionCallback,std::string(jason));
if (JCScriptRuntime::s_JSRT->m_pPoster){
JCScriptRuntime::s_JSRT->m_pPoster->postToJS(pFunction);
}
}
-(void)callbackToJSWithObject:(id)obj methodName:(NSString*)name ret:(NSObject*)retObj
{
NSMutableDictionary* dic = [NSMutableDictionary dictionary];
[m_lock lock];
[dic setObject:[m_pObjectToIDDic objectForKey:[NSNumber numberWithInteger:(NSInteger)obj]] forKey:@"objId"];
[m_lock unlock];
[dic setObject:@"" forKey:@"cName"];
[dic setObject:name forKey:@"mName"];
if (retObj == nil)
[dic setObject:@"" forKey:@"v"];
else
[dic setObject:retObj forKey:@"v"];
NSError* error = nil;
NSData* jsonData = [NSJSONSerialization dataWithJSONObject:dic options:NSJSONWritingPrettyPrinted error:&error];
if (error != nil){
NSLog(@"callbackToJS error");
return;
}
const char* jason = [[[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding] UTF8String];
auto pFunction = std::bind(&reflectionCallback,std::string(jason));
if (JCScriptRuntime::s_JSRT->m_pPoster){
JCScriptRuntime::s_JSRT->m_pPoster->postToJS(pFunction);
}
}
@end
@@ -0,0 +1,270 @@
/**
@file TouchFilter.cpp
@brief
@author wyw
@version 1.0
@date 2012_12_26
*/
//包含头文件
#include "TouchFilter.h"
#include "../../../../source/conch/JSWrapper/LayaWrap/JSInput.h"
#include "../../../../source/conch/JCScriptRuntime.h"
#include <util/Log.h>
static const int __iMoveRangeDefault = 10;
//------------------------------------------------------------------------------
JCTouchFilter::JCTouchFilter( void )
{
for( int i=0; i < TOUCH_EVENT_SIZE; i++ )
{
m_vTouches[i] = new MyTouchPt();
m_vTouches[i]->m_nID=-1;
m_vTouches[i]->m_nLastMoveX = 0;
m_vTouches[i]->m_nLastMoveY = 0;
m_vTouches[i]->m_nTouchState = PTSTATE_NOTOUCH;
}
m_nMovRange=__iMoveRangeDefault;
}
//------------------------------------------------------------------------------
JCTouchFilter::~JCTouchFilter( void )
{
for( int i=0; i < TOUCH_EVENT_SIZE; i++ )
{
if ( m_vTouches[i] != NULL )
{
delete m_vTouches[i];
m_vTouches[i] = NULL;
}
}
}
void JCTouchFilter::AdjustMoveRange( int p_iScale )
{
m_nMovRange = __iMoveRangeDefault * p_iScale;
if( m_nMovRange < __iMoveRangeDefault )
m_nMovRange = __iMoveRangeDefault;
}
//------------------------------------------------------------------------------
MyTouchPt* JCTouchFilter::GetTouchPt( int p_nID )
{
for( int i = 0; i < TOUCH_EVENT_SIZE; i++ )
{
if( m_vTouches[i]->m_nID<0 )
{
continue;
}
if( m_vTouches[i]->m_nID==p_nID )
{
return m_vTouches[i];
}
}
return NULL;
}
//------------------------------------------------------------------------------
void JCTouchFilter::AddTouchPt(int p_nID, int p_nX, int p_nY )
{
for( int i = 0; i < TOUCH_EVENT_SIZE; i++ )
{
if( m_vTouches[i]->m_nID < 0 )
{
m_vTouches[i]->m_nID = p_nID;
m_vTouches[i]->m_nLastMoveX = p_nX;
m_vTouches[i]->m_nLastMoveY = p_nY;
m_vTouches[i]->m_nTouchState = PTSTATE_DOWNSTILL;
break;
}
}
}
//------------------------------------------------------------------------------
void JCTouchFilter::DelTouchPt(int p_nID)
{
for( int i = 0; i < TOUCH_EVENT_SIZE; i++ )
{
if( m_vTouches[i]->m_nID < 0 )
{
continue;
}
if( m_vTouches[i]->m_nID == p_nID )
{
m_vTouches[i]->m_nID = -1;
m_vTouches[i]->m_nLastMoveX = 0;
m_vTouches[i]->m_nLastMoveY = 0;
m_vTouches[i]->m_nTouchState = PTSTATE_NOTOUCH;
}
}
}
//------------------------------------------------------------------------------
void JCTouchFilter::ClearTouchPt( void )
{
for( int i=0; i < TOUCH_EVENT_SIZE; i++ )
{
m_vTouches[i]->m_nID = -1;
m_vTouches[i]->m_nLastMoveX = 0;
m_vTouches[i]->m_nLastMoveY = 0;
}
}
//------------------------------------------------------------------------------
int JCTouchFilter::GetPointerNum( void )
{
int nSum = 0;
for( int i=0; i<TOUCH_EVENT_SIZE; i++)
{
if( m_vTouches[i]->m_nID >=0)
{
nSum++;
}
}
return nSum;
}
//------------------------------------------------------------------------------
void JCTouchFilter::onTouchEvent( IOSTouch& p_kTouch, float p_fRatio,int p_nViewOffset )
{
int pointerCount = p_kTouch.m_nCount;
for( int i = 0; i < pointerCount; i++ )
{
int action = p_kTouch.m_nType;
int id = p_kTouch.m_nID[i];
int nx = p_kTouch.m_nX[i];
nx *= p_fRatio;
if( nx<0 ) nx = 0;
int ny = p_kTouch.m_nY[i];
ny *= p_fRatio;
if( ny<0 ) ny = 0;
bool bIgnoreCurEvent=false;
if( action == TOUCH_BEGAIN )
{
AddTouchPt(id, nx, ny);
}
else if( action == TOUCHE_END )
{
ClearTouchPt();
}
else if( action == TOUCHE_MOVED )
{
MyTouchPt* curTouch = GetTouchPt(id);
if( curTouch != NULL )
{
if( nx == curTouch->m_nLastMoveX && ny == curTouch->m_nLastMoveY )
{
bIgnoreCurEvent = true;
}
else
{
if( curTouch->m_nTouchState == PTSTATE_DOWNSTILL )
{
if( abs( nx-curTouch->m_nLastMoveX ) > m_nMovRange || abs( ny-curTouch->m_nLastMoveY ) > m_nMovRange )
{
curTouch->m_nLastMoveX = nx;
curTouch->m_nLastMoveY = ny;
curTouch->m_nTouchState = PTSTATE_MOVING;
}
else
{
bIgnoreCurEvent = true;
}
}
else if( curTouch->m_nTouchState== PTSTATE_MOVING )
{
curTouch->m_nLastMoveX = nx;
curTouch->m_nLastMoveY = ny;
}
}
}
else
{
//LOG
}
}
else if( action == ACTION_POINTER_DOWN )
{
AddTouchPt(id, nx, ny);
}
else if( action == ACTION_POINTER_UP )
{
DelTouchPt(id);
}
if( !bIgnoreCurEvent )
{
handleTouch( action, id>10?0:id, nx, ny + p_nViewOffset );
}
}
}
void JCTouchFilter::handleTouch( int type,int id,int x,int y )
{
switch(type)
{
case TOUCH_BEGAIN:
{
laya::inputEvent e;
e.nType = laya::E_ONTOUCHSTART;
e.nTouchType = type;
e.posX = x;
e.posY = y;
e.id = id;
strncpy(e.type, "touchstart", 256 );
//LOGE( "=================action_down=%d",id );
laya::JSInput::getInstance()->activeCall(e);
}
break;
case TOUCHE_END:
{
laya::inputEvent e;
e.nType = laya::E_ONTOUCHEND;
e.nTouchType = type;
e.posX = x;
e.posY = y;
e.id = id;
//LOGE( "=================action_UP=%d",id );
strncpy(e.type, "touchend", 256 );
laya::JSInput::getInstance()->activeCall(e);
}
break;
case TOUCHE_MOVED:
{
laya::inputEvent e;
e.nType = laya::E_ONTOUCHMOVE;
e.nTouchType = type;
e.posX = x;
e.posY = y;
e.id = id;
//LOGE( "=================move id=%d,posX=%d,posY=%d",id,x,y );
strncpy(e.type, "touchmove", 256 );
laya::JSInput::getInstance()->activeCall(e);
}
break;
case ACTION_POINTER_DOWN:
{
laya::inputEvent e;
e.nType = laya::E_ONACTION_POINTER_DOWN;
e.nTouchType = type;
e.posX = x;
e.posY = y;
e.id = id;
strncpy(e.type, "touchstart", 256 );
//LOGE( "=================pointer_down=%d",id );
laya::JSInput::getInstance()->activeCall(e);
}
break;
case ACTION_POINTER_UP:
{
laya::inputEvent e;
e.nType = laya::E_ONACTION_POINTER_UP;
e.nTouchType = type;
e.posX = x;
e.posY = y;
e.id = id;
strncpy(e.type, "touchend", 256 );
//LOGE( "======touchend===========pointer_up=%d",id );
laya::JSInput::getInstance()->activeCall(e);
}
break;
}
}
//------------------------------------------------------------------------------
//-----------------------------END FILE--------------------------------
@@ -0,0 +1,113 @@
/**
@file TouchFilter.h
@brief
@author wyw
@version 1.0
@date 2012_12_26
*/
#ifndef __TouchFilter_H__
#define __TouchFilter_H__
#include <stdio.h>
#include <string>
//定义状态的宏
#define PTSTATE_NOTOUCH 0
#define PTSTATE_DOWNSTILL 1
#define PTSTATE_MOVING 2
//touch 的开始 移动 结束
#define TOUCH_BEGAIN 0
#define TOUCHE_END 1
#define TOUCHE_MOVED 2
#define ACTION_POINTER_DOWN 5
#define ACTION_POINTER_UP 6
#define TOUCH_EVENT_SIZE 10
class IOSTouch
{
public:
int m_nType;
int m_nCount;
int m_nID[TOUCH_EVENT_SIZE];
int m_nX[TOUCH_EVENT_SIZE];
int m_nY[TOUCH_EVENT_SIZE];
IOSTouch()
{
m_nType = -1;
m_nCount = 0;
for( int i = 0 ; i < TOUCH_EVENT_SIZE ; i++ )
{
m_nX[i] = -100;
m_nY[i] = -100;
m_nID[i] = -1;
}
}
};
/**
* @brief touch定义
*/
class MyTouchPt
{
public:
MyTouchPt()
{
m_nID = 0;
m_nTouchState = PTSTATE_NOTOUCH;
m_nLastMoveX = 0;
m_nLastMoveY = 0;
}
public:
int m_nID; //手指ID
int m_nTouchState; //touch的状态
int m_nLastMoveX; //保存信息 过滤用的
int m_nLastMoveY; //保存信息 过滤用的
};
/**
* @brief
*/
class JCTouchFilter
{
public:
/** @brief构造函数
*/
JCTouchFilter( void );
/** @brief析构函数
*/
~JCTouchFilter( void );
public:
MyTouchPt* GetTouchPt( int p_nID );
void AddTouchPt(int p_nID, int p_nX, int p_nY );
void DelTouchPt(int p_nID);
void ClearTouchPt( void );
int GetPointerNum( void );
void onTouchEvent( IOSTouch& p_kTouch, float p_fRatio,int p_nViewOffset );
void AdjustMoveRange( int p_iScale );
void handleTouch( int type,int id,int x,int y );
protected:
int m_nMovRange; //移动检测范围。move后,超过1秒钟没有超出此范围则认为静止了
MyTouchPt* m_vTouches[TOUCH_EVENT_SIZE]; //数组
};
#endif //__TouchFilter_H__
//-----------------------------END FILE--------------------------------
@@ -0,0 +1,32 @@
/**
@file UIEditBox.h
@brief editBox类 继承 uitextField
@author wyw
@version 1.0
@date 2012_12_17
@company JoyChina
*/
#import "UIKit/UIKit.h"
@interface UIEditBox : UITextView
{
bool m_bNumberOnly;
bool m_bForbidEdit;
bool m_bIsMultiAble;
int m_nMaxLength;
NSString* m_sRegular;
NSRegularExpression* m_pRegular;
}
-(UIEditBox*)init;
-(void) SetMaxLength:(int)p_nMaxLength;
-(int) GetMaxLength;
-(void) setNumberOnly:(bool)p_bNumberOnly;
-(void) setForbidEdit:(bool)p_bForbidEdit;
-(bool) getNumberOnly;
-(bool) getForbidEdit;
-(void) setRegular:(NSString*)p_sRegular;
-(BOOL) IsInputValid:(NSString*)p_sBuffer;
-(void)setMultiAble:(bool)p_bMultiAble;
-(BOOL) getMultiAble;
@end
@@ -0,0 +1,83 @@
/**
@file UIEditBox.mm
@brief 继承textField类
@author wyw
@version 1.0
@date 2012_12_17
@company JoyChina
*/
#import "UIEditBox.h"
//-------------------------------------------------------------------------------
@implementation UIEditBox
//-------------------------------------------------------------------------------
-(UIEditBox*)init
{
self = [super init];
m_nMaxLength = -1;
m_sRegular = NULL;
m_pRegular = NULL;
m_bNumberOnly = false;
m_bIsMultiAble=false;
//[self setRegular:@"\\d+"];
m_bForbidEdit = false;
return self;
}
//-------------------------------------------------------------------------------
-(void) setNumberOnly:(bool)p_bNumberOnly
{
m_bNumberOnly = p_bNumberOnly;
}
-(void) setForbidEdit:(bool)p_bForbidEdit
{
m_bForbidEdit = p_bForbidEdit;
}
//-------------------------------------------------------------------------------
-(bool) getNumberOnly
{
return m_bNumberOnly;
}
//-------------------------------------------------------------------------------
-(bool) getForbidEdit
{
return m_bForbidEdit;
}
//-------------------------------------------------------------------------------
-(void) SetMaxLength:(int)p_nMaxLength
{
m_nMaxLength = p_nMaxLength;
}
//-------------------------------------------------------------------------------
-(int) GetMaxLength
{
return m_nMaxLength;
}
//-------------------------------------------------------------------------------
-(void) setRegular:(NSString*)p_sRegular
{
m_sRegular = p_sRegular;
NSError *error = NULL;
m_pRegular = [ NSRegularExpression regularExpressionWithPattern:m_sRegular options:NSRegularExpressionCaseInsensitive error:&error];
}
//-------------------------------------------------------------------------------
-(BOOL) IsInputValid:(NSString*)p_sBuffer
{
if( m_pRegular == NULL || m_sRegular == NULL )return true;
NSArray* vArrays = [m_pRegular matchesInString:p_sBuffer options:NSMatchingCompleted range:NSMakeRange( 0, [p_sBuffer length] )];
if( vArrays != NULL && [vArrays count] > 0 )
{
return true;
}
return false;
}
//-------------------------------------------------------------------------------
-(void)setMultiAble:(bool)p_bMultiAble
{
m_bIsMultiAble=p_bMultiAble;
}
-(BOOL) getMultiAble
{
return m_bIsMultiAble;
}
@end
@@ -0,0 +1,46 @@
//
// IVideoRenderTarget.h
// conchRuntime
//
// Created by LayaBox on 2018/11/13.
// Copyright © 2018 LayaBox. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
NS_ASSUME_NONNULL_BEGIN
typedef enum {
RT_UNKOWN,
RT_LAYER,
RT_VIDEOOUTPUT,
} RenderTargetType;
@interface IImageContainer : NSObject
@property(nonatomic) int width;
@property(nonatomic) int height;
-(void)copyToBitmap:(char*)imagePtr;
@end
@interface IVideoRenderTarget : NSObject
-(void)dealloc;
-(CALayer*) getLayer;
-(AVPlayerItemVideoOutput*) getVideoOutput;
-(bool)isFrameUpdate;
-(void)updateImageByTime:(CMTime) time;
-(IImageContainer*) getImageContainer;
-(RenderTargetType) getType;
-(void)setBounds:(CGFloat)x withY:(CGFloat)y
withWidth:(CGFloat) width withHeight:(CGFloat)height
withRentinaValue:(CGFloat) rentinaValue;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,51 @@
//
// IVideoRenderTarget.m
// conchRuntime
//
// Created by LayaBox on 2018/11/13.
// Copyright © 2018 LayaBox. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "IVideoRenderTarget.h"
@implementation IImageContainer
-(void)copyToBitmap:(char*)imagePtr {
}
@end
@implementation IVideoRenderTarget
-(void)dealloc {
}
-(CALayer*) getLayer {
return NULL;
}
-(bool)isFrameUpdate {
return false;
}
-(IImageContainer*) getImageContainer {
return NULL;
}
-(AVPlayerItemVideoOutput*) getVideoOutput {
return NULL;
}
-(RenderTargetType) getType {
return RT_UNKOWN;
}
-(void)updateImageByTime:(CMTime) time {
return;
}
-(void)setBounds:(CGFloat)x withY:(CGFloat)y withWidth:(CGFloat) width
withHeight:(CGFloat)height withRentinaValue:(CGFloat) rentinaValue {
}
@end
@@ -0,0 +1,20 @@
//
// PlayerLayerRenderTarget.h
// conchRuntime
//
// Created by LayaBox on 2018/11/13.
// Copyright © 2018 LayaBox. All rights reserved.
//
#import "IVideoRenderTarget.h"
@interface PlayerLayerRenderTarget : IVideoRenderTarget
{
AVPlayerLayer* m_playerLayer;
}
-(void)dealloc;
-(PlayerLayerRenderTarget*)initWithPlayer:(AVPlayer*)player;
@end
@@ -0,0 +1,49 @@
//
// PlayerLayerRenderTarget.m
// conchRuntime
//
// Created by LayaBox on 2018/11/13.
// Copyright © 2018 LayaBox. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "PlayerLayerRenderTarget.h"
@implementation PlayerLayerRenderTarget
-(void)dealloc {
[self->m_playerLayer removeFromSuperlayer];
self->m_playerLayer = nil;
}
-(PlayerLayerRenderTarget*)initWithPlayer:(AVPlayer*)player {
self = [super init];
if(!self)
return nil;
m_playerLayer = [AVPlayerLayer playerLayerWithPlayer:player];
return self;
}
-(CALayer*) getLayer {
return m_playerLayer;
}
-(RenderTargetType) getType {
return RT_LAYER;
}
-(void)setBounds:(CGFloat)x withY:(CGFloat)y withWidth:(CGFloat) width
withHeight:(CGFloat)height withRentinaValue:(CGFloat) rentinaValue {
CGRect frame = self->m_playerLayer.frame;
frame.origin.x = x / rentinaValue;
frame.origin.y = y / rentinaValue;
frame.size.width = width / rentinaValue;
frame.size.height = height / rentinaValue;
self->m_playerLayer.frame = frame;
}
@end
@@ -0,0 +1,34 @@
//
// VideoOutRenderTarget.h
// conchRuntime
//
// Created by LayaBox on 2018/11/13.
// Copyright © 2018 LayaBox. All rights reserved.
//
#import "IVideoRenderTarget.h"
@interface VTImageContainer : IImageContainer
-(VTImageContainer*) init;
-(void) dealloc;
@property(nonatomic) CIImage* image;
@property(nonatomic) CIContext* context;
@property(nonatomic, readonly) CGColorSpaceRef colorSpace;
-(CGRect)getBounds;
@end
@interface VideoOutputRenderTarget : IVideoRenderTarget
{
AVPlayerItemVideoOutput* m_videoOutput;
VTImageContainer* m_imageContainer;
}
-(VideoOutputRenderTarget*)init;
@end
@@ -0,0 +1,91 @@
//
// VideoOutputRenderTarget.m
// conchRuntime
//
// Created by LayaBox on 2018/11/13.
// Copyright © 2018 LayaBox. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "VideoOutputRenderTarget.h"
#import <GLKit/GLKit.h>
@implementation VTImageContainer
-(VTImageContainer*)init {
self = [super init];
if(!self)
return nil;
self->_image = nil;
self.context = [CIContext contextWithOptions: nil];
self.width = 0;
self.height = 0;
self->_colorSpace = CGColorSpaceCreateDeviceRGB();
return self;
}
-(void)dealloc {
CGColorSpaceRelease(self.colorSpace);
}
-(CGRect)getBounds {
return CGRectMake(0, 0, self.width, self.height);
}
-(void)copyToBitmap:(char*)imagePtr {
[self.context render:self.image toBitmap:imagePtr rowBytes:self.width * sizeof(int) bounds: [self getBounds] format:kCIFormatRGBA8 colorSpace:self.colorSpace];
}
@end
@implementation VideoOutputRenderTarget
-(VideoOutputRenderTarget*)init {
self = [super init];
if(!self)
return nil;
self->m_videoOutput = [[AVPlayerItemVideoOutput alloc] init];
self->m_imageContainer = [[VTImageContainer alloc] init];
return self;
}
-(IImageContainer*) getImageContainer {
return self->m_imageContainer;
}
-(bool)isFrameUpdate {
return true;
}
-(void)updateImageByTime:(CMTime) time {
if(![self->m_videoOutput hasNewPixelBufferForItemTime:time])
return;
CVPixelBufferRef pixelBuffer = [self->m_videoOutput copyPixelBufferForItemTime:time itemTimeForDisplay:nil];
if(pixelBuffer != nil)
{
self->m_imageContainer.image = [[CIImage alloc] initWithCVPixelBuffer:pixelBuffer];
self->m_imageContainer.width = (int)CVPixelBufferGetWidth(pixelBuffer);
self->m_imageContainer.height = (int)CVPixelBufferGetHeight(pixelBuffer);
CVBufferRelease(pixelBuffer);
}
}
-(AVPlayerItemVideoOutput*) getVideoOutput {
return self->m_videoOutput;
}
-(RenderTargetType) getType {
return RT_VIDEOOUTPUT;
}
@end
@@ -0,0 +1,32 @@
/**
@file conchConfig.h
@brief 配置用到的,比如版本号 或者描述信息
@author James
@version 1.0
@date 2013_7_5
@company LayaBox
*/
#import "UIKit/UIKit.h"
#import <GLKit/GLKit.h>
#import <string>
@interface conchConfig : NSObject
{
@public
NSString* m_sAppVersion; //对外版本号
NSString* m_sAppLocalVersion; //对内版本号
NSString* m_sGameID; //appStroe用到的
bool m_bCheckNetwork; //是否检查网络
bool m_bNotification; //是否打开推送
/*
UIInterfaceOrientationMaskPortrait, ===2
UIInterfaceOrientationMaskPortraitUpsideDown, ===4
UIInterfaceOrientationMaskLandscapeLeft, ===8
UIInterfaceOrientationMaskLandscapeRight, ===16
*/
int m_nOrientationType; //游戏的方向
}
+(conchConfig*)GetInstance;
-(bool)readIni;
-(conchConfig*)init;
@end
@@ -0,0 +1,138 @@
/**
@file conchConfig.h
@brief 配置用到的,比如版本号 或者描述信息
@author wyw
@version 1.0
@date 2013_7_5
@company JoyChina
*/
#import "conchConfig.h"
#import <util/JCIniFile.h>
#import <string>
#import "conchRuntime.h"
#import "../../../../source/conch/JCSystemConfig.h"
//-------------------------------------------------------------------------------
static conchConfig* g_pConchConfig = nil;
//-------------------------------------------------------------------------------
@implementation conchConfig
//-------------------------------------------------------------------------------
+(conchConfig*)GetInstance
{
if( g_pConchConfig == nil )
{
g_pConchConfig = [[conchConfig alloc] init];
}
return g_pConchConfig;
}
//-------------------------------------------------------------------------------
-(conchConfig*)init
{
self = [super init];
m_sGameID=nil; //appStroe用到的
m_bCheckNetwork=true; //是否检查网络
m_bNotification=false; //是否打开消息推送
m_nOrientationType = 30; //屏幕的方向
[self readIni];
m_sAppVersion=nil; //版本号
m_sAppLocalVersion = nil; //对内版本号
NSDictionary* infoDictionary = [[NSBundle mainBundle] infoDictionary];
// 当前应用软件版本 Bundle versions string, short
m_sAppVersion = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
NSLog(@"当前应用软件版本:%@",m_sAppVersion);
// 当前应用版本号码 Bundle versions
m_sAppLocalVersion = [infoDictionary objectForKey:@"CFBundleVersion"];
NSLog(@"当前应用Local版本号码:%@",m_sAppLocalVersion);
return self;
}
//-------------------------------------------------------------------------------
-(bool) readIni
{
std::string sIniFileName = [[self getResourcePath] cStringUsingEncoding:NSUTF8StringEncoding];
sIniFileName += "/config.ini";
// 初始化 IAP
laya::JCIniFile *pConfigFile = laya::JCIniFile::loadFile( sIniFileName.c_str() );
if( 0 == pConfigFile )
{
return false;
}
else
{
const char* sGameID=pConfigFile->GetValue("gameID");
const char* sCheckNetwork=pConfigFile->GetValue("checkNetwork");
const char* sOrientation=pConfigFile->GetValue("orientation");
const char* sNotification = pConfigFile->GetValue("notification");
const char* sThreadMode = pConfigFile->GetValue("ThreadMode");
if( sGameID )
{
m_sGameID = [[NSString alloc] initWithUTF8String:sGameID ];
}
else
{
NSLog(@"读取ini gameID 错误");
}
if( sCheckNetwork )
{
m_bCheckNetwork = atoi(sCheckNetwork)>0;
}
else
{
NSLog(@"读取ini checkNetworkd 错误");
}
if( sOrientation )
{
m_nOrientationType = atoi(sOrientation);
if( m_nOrientationType < 1 )
{
NSLog(@"读取ini orientation 错误");
}
}
else
{
NSLog(@"读取ini orientation错误");
}
if( sNotification )
{
m_bNotification = atoi(sNotification)>0;
}
else
{
NSLog(@"读取ini notification 错误");
}
if(sThreadMode)
{
int nThreadMode = atoi(sThreadMode);
laya::THREAD_MODE nMode = (laya::THREAD_MODE)nThreadMode;
if (nMode == laya::THREAD_MODE_SINGLE)
{
laya::g_kSystemConfig.m_nThreadMODE = nMode;
NSLog(@">>>>>>Thread Mode = single");
}
else if (nMode == laya::THREAD_MODE_DOUBLE)
{
laya::g_kSystemConfig.m_nThreadMODE = nMode;
NSLog(@">>>>>>Thread Mode = double");
}
else
{
NSLog(@">>>>>>Thread Mode = %d", laya::g_kSystemConfig.m_nThreadMODE);
}
}
else
{
NSLog(@"读取ini ThreadMode错误");
}
delete pConfigFile;
pConfigFile = NULL;
}
return true;
}
//------------------------------------------------------------------------------
-(NSString*) getResourcePath
{
return [[NSBundle mainBundle] resourcePath];
}
@end
@@ -0,0 +1,122 @@
/**
@file conchRuntime.h
@brief runtime类
@author James
@version 1.0
@date 2015_8_28
@company LayaBox
*/
#import <UIKit/UIKit.h>
#import <GLKit/GLKit.h>
#import "conchConfig.h"
#import <functional>
typedef char* (*HandleFileData)(const char* data, int& len);
class JCTouchFilter;
@class LayaReachability;
@class JCMp3Player;
@class LayaWebView;
@class LayaEditBox;
@class LayaEditBoxDelegate;
@class LayaAlert;
@class Reflection;
@interface FuncObj : NSObject
{
@public
std::function<void(void)> m_Fuction;
};
-(id)init:(std::function<void(void)>)func;
@end
@interface conchRuntime : NSObject
{
@public
GLKView* m_pGLKView;
EAGLContext* m_pGLContext;
bool m_bEngineInited;
//-----------------------------------------------------------------
//touch用的
JCTouchFilter* m_pTouchFilter;
UITouch* m_vTouch[10];
int m_nTouchCount;
//-----------------------------------------------------------------
//editBox相关的
int m_nGLViewOffset; //因为editBox导致得移动
LayaEditBox* m_pEditBox; //EditBox
LayaEditBoxDelegate* m_pEditBoxDelegate; //eiditBoxDelegate
//-----------------------------------------------------------------
JCMp3Player* m_pMp3Player; //MP3播放器
//界面相关的
//-----------------------------------------------------------------
LayaWebView* m_pWebView; //webView
LayaReachability* m_pNetworkListener; //网络监听
//-----------------------------------------------------------------
float m_fRetinaValue; //Retina的缩放比例
NSString* m_nsRootResourcePath; //Resoure的路径
NSString* m_nsRootCachePath; //Cache的根路径
CGPoint* m_pResolution; //当前分辨率
float m_fIOSVersion; //ios设备的版本
NSTimer* m_pNSTimer; //定时器
bool m_bIgnoreCurEvent;
LayaAlert* m_pLayaAlert;
Reflection* m_pReflection;
int m_nCurrentOrientation;
bool m_bStopEngine;
NSRunLoop* m_pJSRunLoop;
}
//全局的MainView
+(conchRuntime*)GetIOSConchRuntime;
-(id)initWithView:(GLKView*)pGLView EAGLContext:(EAGLContext*) pGLContext downloadThreadNum:(int)nDownloadThreadNum;
-(id)initWithView:(GLKView*)pGLView EAGLContext:(EAGLContext*) pGLContext downloadThreadNum:(int)nDownloadThreadNum URL:(NSString*)pUrl;
-(void)setConchRuntimeParam:(GLKView*)pGLView EAGLContext:(EAGLContext*) pGLContext downloadThreadNum:(int)nDownloadThreadNum;
-(void)didReceiveMemoryWarning;
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
-(void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event;
-(void)renderFrame;
-(void)onVsync:(double)vsyncTmMs;
-(int)checkNetworkState;
-(NSString*)getRootCachePath;
-(NSString*)getResourcePath;
-(void) setScreenOrientation:(int)p_nType;
-(void)reset;
-(void)callbackToJSWithClass:(Class)cls methodName:(NSString*)name ret:(NSObject*)retObj;
-(void)callbackToJSWithClassName:(NSString*)cls methodName:(NSString*)name ret:(NSObject*)retObj;
-(void)callbackToJSWithObject:(id)obj methodName:(NSString*)name ret:(NSObject*)retObj;
-(void)runJS:(NSString*)script;
-(void)setFileDataHandler:(HandleFileData)func;
-(void)destory;
-(void)runJsLoop;
-(void)runFunc:(NSTimer*)timer;
@end
@@ -0,0 +1,870 @@
#import "conchRuntime.h"
#import <util/JCColor.h>
#import "../../../../source/conch/JCScriptRuntime.h"
#import "../../../../source/conch/CToObjectC.h"
#import "conchConfig.h"
#import "LayaToast.h"
#import "Notification/LayaNotifyManager.h"
#import <downloadCache/JCIosFileSource.h>
#import "../../../../source/conch/JCConch.h"
#import "../../../../source/conch/Audio/JCAudioManager.h"
#import "../../../../source/conch/JSWrapper/JSInterface/JSInterface.h"
#import "LayaEditBoxDelegate.h"
#import "LayaEditBox.h"
#import "TouchFilter.h"
#import "Audio/JCMp3Player.h"
#import "LayaWebView.h"
#import "Reachability/Reachability.h"
#import "LayaAlert.h"
#import "CToObjectCIOS.h"
#import "Reflection/refection.h"
#import <AudioToolBox/AudioSession.h>
#import "LayaDeviceSensor.h"
#import <resource/JCFileResManager.h>
#import "JCSystemConfig.h"
#import "LayaVideoPlayer.h"
@implementation FuncObj
-(id)init:(std::function<void(void)>)func
{
self = [super init];
if( self != nil)
{
m_Fuction = func;
return self;
}
return nil;
}
@end
@implementation conchRuntime
extern bool g_bGLCanvasSizeChanged;
extern int g_nInnerWidth;
extern int g_nInnerHeight;
extern std::string gRedistPath;
extern std::string gResourcePath;
extern std::string gAssetRootPath;
extern bool gbBackground;
//------------------------------------------------------------------------------
static conchRuntime* g_pIOSConchRuntime = nil;
laya::JCConch* m_pConchEngine = NULL;
+(conchRuntime*)GetIOSConchRuntime
{
return g_pIOSConchRuntime;
}
-(id)initWithView:(GLKView*)pGLView EAGLContext:(EAGLContext*) pGLContext downloadThreadNum:(int)nDownloadThreadNum URL:(NSString*)pUrl
{
self = [super init];
if( self != nil )
{
if (pUrl != nil)
{
g_kSystemConfig.m_strStartURL = pUrl.UTF8String;
}
m_bEngineInited = false;
m_pGLKView = nil;
m_pGLContext = nil;
m_pConchEngine = NULL;
m_pTouchFilter = NULL;
for( int i = 0; i < 10; i++ )
{
m_vTouch[i] = NULL;
}
m_nTouchCount = 0;
m_nGLViewOffset = 0;
m_pEditBox = NULL;
m_pEditBoxDelegate = NULL;
m_pMp3Player = NULL;
m_pWebView = NULL;
m_pNetworkListener = NULL;
m_fRetinaValue = 1;
m_nsRootResourcePath = nil;
m_nsRootCachePath = nil;
m_pNSTimer = nil;
m_bIgnoreCurEvent = false;
m_fIOSVersion = 0;
g_pIOSConchRuntime = self;
m_pJSRunLoop = nil;
m_pLayaAlert=[[LayaAlert alloc]init];
m_pReflection = [[Reflection alloc] init];
[self setConchRuntimeParam:pGLView EAGLContext:pGLContext downloadThreadNum:nDownloadThreadNum];
m_nCurrentOrientation=-1;
m_bStopEngine=false;
return self;
}
return nil;
}
-(id)initWithView:(GLKView*)pGLView EAGLContext:(EAGLContext*) pGLContext downloadThreadNum:(int)nDownloadThreadNum;
{
self = [self initWithView:pGLView EAGLContext:pGLContext downloadThreadNum:nDownloadThreadNum URL:nil];
if( self != nil )
{
return self;
}
return nil;
}
-(void)setConchRuntimeParam:(GLKView*)pGLView EAGLContext:(EAGLContext*) pGLContext downloadThreadNum:(int)nDownloadThreadNum;
{
float fIOSVersion = [[[UIDevice currentDevice] systemVersion] floatValue];
//获得retina屏的缩放值
float fRetinaValue = [UIScreen mainScreen].scale;
float fIosVersion = [[[UIDevice currentDevice] systemVersion] floatValue];
if( fIosVersion >= 8.0 )
fRetinaValue = [UIScreen mainScreen].nativeScale;
m_pGLKView = pGLView;
m_pGLContext = pGLContext;
m_fRetinaValue = fRetinaValue;
m_nsRootResourcePath = [self getResourcePath];
m_nsRootCachePath = [self getRootCachePath];
NSLog(@"AppVersion=%@",[conchConfig GetInstance]->m_sAppVersion );
if( [conchConfig GetInstance]->m_bNotification)
{
[[LayaNotifyManager GetInstance]deleteAllNotify];
}
m_pTouchFilter = new JCTouchFilter();
m_nTouchCount = 0;
m_fIOSVersion = fIosVersion;
m_pResolution = new CGPoint();
CGRect kRect = [UIScreen mainScreen].bounds;
int nOrientationType = [conchConfig GetInstance]->m_nOrientationType;
if( ( nOrientationType & UIInterfaceOrientationMaskLandscapeLeft ) == UIInterfaceOrientationMaskLandscapeLeft ||
( nOrientationType & UIInterfaceOrientationMaskLandscapeRight ) == UIInterfaceOrientationMaskLandscapeRight )
{
m_pResolution->x = MAX( kRect.size.width , kRect.size.height );
m_pResolution->y = MIN( kRect.size.width , kRect.size.height );
}
//竖屏
else if( ( nOrientationType & UIInterfaceOrientationMaskPortrait ) == UIInterfaceOrientationMaskPortrait ||
( nOrientationType & UIInterfaceOrientationMaskPortraitUpsideDown ) == UIInterfaceOrientationMaskPortraitUpsideDown )
{
m_pResolution->x = MIN( kRect.size.width , kRect.size.height );
m_pResolution->y = MAX( kRect.size.width , kRect.size.height );
}
[self initNetworkListener];
int nNetworkState = [self checkNetworkState];
[self onGLReady:m_pResolution->x*m_fRetinaValue height:m_pResolution->y*m_fRetinaValue downloadThreadNum:nDownloadThreadNum];
m_nGLViewOffset = 0;
m_pGLKView.multipleTouchEnabled = true;
m_pEditBoxDelegate = [[LayaEditBoxDelegate alloc]init];
[m_pEditBoxDelegate setRetinaValue:m_fRetinaValue];
m_pEditBox = [[LayaEditBox alloc]initWithParentView:m_pGLKView EditBoxDelegate:m_pEditBoxDelegate ScreenRatio:m_fRetinaValue ];
m_pMp3Player = [[JCMp3Player alloc] init];
[self initExternalWebview];
// 注册监听键盘弹出的事件
[[NSNotificationCenter defaultCenter] addObserver:m_pEditBoxDelegate
selector:@selector(keyboardWasShown:)
name:UIKeyboardWillShowNotification
object:nil];
// 注册监听键盘弹出完成的事件
[[NSNotificationCenter defaultCenter] addObserver:m_pEditBoxDelegate
selector:@selector(keyboardWasShownEnd:)
name:UIKeyboardDidShowNotification
object:nil];
// 注册屏幕方向改变的事件
[[NSNotificationCenter defaultCenter] addObserver:m_pEditBoxDelegate
selector:@selector(orientChange:)
name:UIDeviceOrientationDidChangeNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(orientChange:)
name:UIDeviceOrientationDidChangeNotification
object:nil];
/*[[NSNotificationCenter defaultCenter] addObserver:m_pEditBoxDelegate
selector:@selector(changeValue:)
name:@"changeValue" object:nil];*/
//[m_pEditBox->m_pEditBox addTarget:m_pEditBoxDelegate action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
if ([[[UIDevice currentDevice] systemVersion] intValue] > 5) {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleInterruption:) name:AVAudioSessionInterruptionNotification object:[AVAudioSession sharedInstance]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleInterruption:) name:UIApplicationDidBecomeActiveNotification object:nil];
}
else {
//AudioSessionInitialize(NULL, NULL, AudioEngineInterruptionListenerCallback, NULL);
}
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willResignActive:) name:UIApplicationWillResignActiveNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(enterBackground:) name:UIApplicationDidEnterBackgroundNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(enterForeground:) name:UIApplicationWillEnterForegroundNotification object:nil];
// initialize the default values of LayaVideoPlayer
[LayaVideoPlayer setCurParentView: pGLView withRetianValue:m_fRetinaValue];
}
void AudioEngineInterruptionListenerCallback(void* user_data, UInt32 interruption_state)
{
ALCcontext *context = JCAudioManager::GetInstance()->m_pWavPlayer->m_pContext;
if (kAudioSessionBeginInterruption == interruption_state)
{
alcMakeContextCurrent(nullptr);
}
else if (kAudioSessionEndInterruption == interruption_state)
{
OSStatus result = AudioSessionSetActive(true);
if (result) NSLog(@"Error setting audio session active! %d\n", result);
alcMakeContextCurrent(context);
}
}
-(void)handleInterruption:(NSNotification*)notification
{
static bool resumeOnBecomingActive = false;
ALCcontext *context = JCAudioManager::GetInstance()->m_pWavPlayer->m_pContext;
if ([notification.name isEqualToString:AVAudioSessionInterruptionNotification]) {
NSInteger reason = [[[notification userInfo] objectForKey:AVAudioSessionInterruptionTypeKey] integerValue];
if (reason == AVAudioSessionInterruptionTypeBegan) {
alcMakeContextCurrent(NULL);
}
if (reason == AVAudioSessionInterruptionTypeEnded) {
if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive) {
NSError *error = nil;
[[AVAudioSession sharedInstance] setActive:YES error:&error];
alcMakeContextCurrent(context);
laya::JCScriptRuntime::s_JSRT->restoreAudio();
} else {
resumeOnBecomingActive = true;
}
}
}
if ([notification.name isEqualToString:UIApplicationDidBecomeActiveNotification] && resumeOnBecomingActive) {
resumeOnBecomingActive = false;
NSError *error = nil;
BOOL success = [[AVAudioSession sharedInstance]
setCategory: AVAudioSessionCategoryAmbient
error: &error];
if (!success) {
printf("set audio session failed.\n");
return;
}
[[AVAudioSession sharedInstance] setActive:YES error:&error];
alcMakeContextCurrent(context);
laya::JCScriptRuntime::s_JSRT->restoreAudio();
}
}
-(void)renderFrame
{
if( laya::JCConch::s_pConchRender)
laya::JCConch::s_pConchRender->renderFrame(0,false);
}
-(void)onVsync:(double)vsyncTmMs{
if(laya::JCScriptRuntime::s_JSRT){
laya::JCScriptRuntime::s_JSRT->onVSyncEvent(vsyncTmMs);
}
}
-(void) initExternalWebview
{
m_pWebView = [[LayaWebView alloc] init];
[m_pGLKView addSubview:m_pWebView->m_pWebView];
}
-(void) initNetworkListener
{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkStateChange) name:LayakReachabilityChangedNotification object:nil];
m_pNetworkListener=[LayaReachability reachabilityForInternetConnection];
[m_pNetworkListener startNotifier];
}
//------------------------------------------------------------------------------
-(NSString*) getRootCachePath
{
NSString* sAppDirctory = NSHomeDirectory();
NSString* sDownloadRootPath = [ NSString stringWithFormat: @"%@/Library/Caches/", sAppDirctory ];
return sDownloadRootPath;
}
//------------------------------------------------------------------------------
-(NSString*) getResourcePath
{
return [[NSBundle mainBundle] resourcePath];
}
//------------------------------------------------------------------------------
-(void)destory
{
if( m_pConchEngine != NULL )
{
m_bStopEngine = true;
m_pConchEngine->onAppDestory();
delete m_pConchEngine;
m_pConchEngine = NULL;
}
}
- (void)dealloc
{
if( m_pConchEngine != NULL )
{
delete m_pConchEngine;
m_pConchEngine = NULL;
}
[[NSNotificationCenter defaultCenter] removeObserver:m_pEditBoxDelegate name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:m_pEditBoxDelegate name:UIKeyboardDidShowNotification object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:m_pEditBoxDelegate name:UIDeviceOrientationDidChangeNotification object:nil];
//移除网络监控
[m_pNetworkListener stopNotifier];
[[NSNotificationCenter defaultCenter] removeObserver:self];
[[NSNotificationCenter defaultCenter] removeObserver:self name:AVAudioSessionInterruptionNotification object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidBecomeActiveNotification object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillResignActiveNotification object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidEnterBackgroundNotification object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillEnterForegroundNotification object:nil];
}
//------------------------------------------------------------------------------
- (void)didReceiveMemoryWarning
{
if(laya::JCScriptRuntime::s_JSRT){
laya::JCScriptRuntime::s_JSRT->jsGC();
laya::JCScriptRuntime::s_JSRT->jsGC();
}
}
//------------------------------------------------------------------------------
-(void) onGLReady:(int)p_nWidth height:(int)p_nHeight downloadThreadNum:(int)nDownloadThreadNum
{
if( m_bEngineInited == false )
{
NSLog(@"=============onGLReady width=%d,height=%d",p_nWidth,p_nHeight );
g_nInnerWidth = p_nWidth;
g_nInnerHeight = p_nHeight;
gRedistPath = [m_nsRootCachePath cStringUsingEncoding:NSUTF8StringEncoding];
const char* sResourcePath = [m_nsRootResourcePath cStringUsingEncoding:NSUTF8StringEncoding];
laya::JCIosFileSource* pRedistFileResource = new laya::JCIosFileSource();
gResourcePath = sResourcePath;
gResourcePath += "/";
gAssetRootPath= gResourcePath+"/cache/";
pRedistFileResource->Init( gResourcePath.c_str() );
laya::JCConch::s_pAssetsFiles = pRedistFileResource;
m_pConchEngine = new laya::JCConch(nDownloadThreadNum,laya::JS_DEBUG_MODE_OFF,0);
m_pConchEngine->onAppStart();
laya::JCConch::s_pConchRender->onGLReady();
m_bEngineInited = true;
}
}
//-------------------------------------------------------------------------------
- (int) AddTouchToArray:(UITouch*)p_pTouch
{
if( m_nTouchCount < 10 )
{
for( int i = 0; i < 10 ;i++ )
{
if( m_vTouch[i] == NULL )
{
m_vTouch[i] = p_pTouch;
m_nTouchCount++;
return i;
}
}
}
return -1;
}
//-------------------------------------------------------------------------------
- (int) RemoveTouchToArray:(UITouch*)p_pTouch
{
if( m_nTouchCount > 0 )
{
for( int i = 0; i < 10 ;i++ )
{
if( m_vTouch[i] == p_pTouch )
{
m_vTouch[i] = NULL;
m_nTouchCount--;
return i;
}
}
for( int i = 0; i < 10 ;i++ )
{
m_vTouch[i] = NULL;
}
m_nTouchCount=0;
}
return -1;
}
//-------------------------------------------------------------------------------
- (int) FindTouchToArray:(UITouch*)p_pTouch
{
if( m_nTouchCount > 0 )
{
for( int i = 0; i < 10 ;i++ )
{
if( m_vTouch[i] == p_pTouch )
{
return i;
}
}
}
return -1;
}
//-------------------------------------------------------------------------------
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
NSSet* allTouches = [event allTouches];
int nCount = (int)[allTouches count];
//如果<=0 就发送down
if( m_nTouchCount <= 0 )
{
//第一个手指
IOSTouch kIOSTouch;
kIOSTouch.m_nType = TOUCH_BEGAIN;
//不是第一个手指
IOSTouch kIOSTouchPD;
kIOSTouchPD.m_nType = ACTION_POINTER_DOWN;
int nNum = 0;
for( int i = 0 ; i < nCount ;i++ )
{
UITouch* pSysTouch = [[allTouches allObjects] objectAtIndex:i];
CGPoint kTouchLocation = [pSysTouch locationInView:[pSysTouch view]];
int nID = [self AddTouchToArray:pSysTouch];
if( nID != -1 )
{
//第一个手指是发送 TOUCH_BEGAIN
if( i == 0 )
{
kIOSTouch.m_nID[0] = nID;
kIOSTouch.m_nX[0] = kTouchLocation.x;
kIOSTouch.m_nY[0] = kTouchLocation.y;
}
//剩下的发送 POINTER_DOWN
else
{
if( nNum >= TOUCH_EVENT_SIZE )
{
NSLog(@"can't support touch num > %d",TOUCH_EVENT_SIZE);
}
kIOSTouchPD.m_nID[nNum] = nID;
kIOSTouchPD.m_nX[nNum] = kTouchLocation.x;
kIOSTouchPD.m_nY[nNum] = kTouchLocation.y;
nNum++;
}
}
}
//发送 TOUCH_BEGAIN
kIOSTouch.m_nCount = 1;
[self sendTouchEvent:kIOSTouch ratio:m_fRetinaValue offset:m_nGLViewOffset];
//发送 POINTER_DOWN
if( nNum > 0 )
{
kIOSTouchPD.m_nCount = nNum;
[self sendTouchEvent:kIOSTouch ratio:m_fRetinaValue offset:m_nGLViewOffset];
}
}
else
{
IOSTouch kIOSTouch;
kIOSTouch.m_nType = ACTION_POINTER_DOWN;
int nNum = 0;
for( int i = 0 ; i < nCount ;i++ )
{
UITouch* pSysTouch = [[allTouches allObjects] objectAtIndex:i];
if( [self FindTouchToArray:pSysTouch ] == -1 )
{
CGPoint kTouchLocation = [pSysTouch locationInView:[pSysTouch view]];
int nID = [self AddTouchToArray:pSysTouch];
if( nID != -1 )
{
if( nNum >= TOUCH_EVENT_SIZE )
{
NSLog(@"can't support touch num > %d",TOUCH_EVENT_SIZE);
}
kIOSTouch.m_nID[nNum] = nID;
kIOSTouch.m_nX[nNum] = kTouchLocation.x;
kIOSTouch.m_nY[nNum] = kTouchLocation.y;
nNum++;
}
}
}
kIOSTouch.m_nCount = nNum;
[self sendTouchEvent:kIOSTouch ratio:m_fRetinaValue offset:m_nGLViewOffset];
}
}
//-------------------------------------------------------------------------------
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
NSSet* allTouches = [event allTouches];
int nCount = (int)[allTouches count];
IOSTouch kIosTouch;
kIosTouch.m_nCount = nCount;
kIosTouch.m_nType = TOUCHE_MOVED;
for( int i = 0 ; i < nCount ;i++ )
{
UITouch* pSysTouch = [[allTouches allObjects] objectAtIndex:i];
CGPoint kTouchLocation = [pSysTouch locationInView:[pSysTouch view]];
kIosTouch.m_nID[i] = [self FindTouchToArray:pSysTouch];
kIosTouch.m_nX[i] = kTouchLocation.x;
kIosTouch.m_nY[i] = kTouchLocation.y;
}
[self sendTouchEvent:kIosTouch ratio:m_fRetinaValue offset:m_nGLViewOffset];
}
-(void) sendTouchEvent:(IOSTouch&) p_kTouch ratio:(float)p_fRatio offset:(int)p_nViewOffset
{
if(m_bIgnoreCurEvent)
{
return;
}
m_pTouchFilter->onTouchEvent( p_kTouch, p_fRatio,p_nViewOffset );
}
//-------------------------------------------------------------------------------
- (void)HandleTouchEnd:(NSSet*)allTouches state:(int)p_nState
{
int nCount = (int)[allTouches count];
int nNum = 0;//要发送 pointer_up 的总数
IOSTouch kIOSTouch;
kIOSTouch.m_nType = ACTION_POINTER_UP;
IOSTouch kLastTouch;//要发送的end
kLastTouch.m_nType = TOUCHE_END;
kLastTouch.m_nCount = 1;
for( int i = 0 ; i < nCount ;i++ )
{
UITouch* pSysTouch = [[allTouches allObjects] objectAtIndex:i];
if( p_nState == -1 || pSysTouch.phase == p_nState )
{
CGPoint kTouchLocation = [pSysTouch locationInView:[pSysTouch view]];
int nID = [self RemoveTouchToArray:pSysTouch];
if( nID != -1 )
{
if( m_nTouchCount <= 0 )
{
kLastTouch.m_nID[0] = nID;
kLastTouch.m_nX[0] = kTouchLocation.x;
kLastTouch.m_nY[0] = kTouchLocation.y;
break;
}
else
{
kIOSTouch.m_nID[nNum] = nID;
kIOSTouch.m_nX[nNum] = kTouchLocation.x;
kIOSTouch.m_nY[nNum] = kTouchLocation.y;
nNum++;
}
}
else
{
NSLog(@"Can't find this touch pointer!!");
}
}
}
if(nNum>0)
{
kIOSTouch.m_nCount = nNum;
[self sendTouchEvent:kIOSTouch ratio:m_fRetinaValue offset:m_nGLViewOffset];
}
//发送最后一个
if( m_nTouchCount <= 0 )
{
[self sendTouchEvent:kLastTouch ratio:m_fRetinaValue offset:m_nGLViewOffset];
}
}
//-------------------------------------------------------------------------------
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
NSSet* allTouches = [event allTouches];
[self HandleTouchEnd:allTouches state:3];
}
//-------------------------------------------------------------------------------
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
{
NSSet* allTouches = [event allTouches];
[self HandleTouchEnd:allTouches state:-1];
}
//-------------------------------------------------------------------------------
-(void) runJsLoop
{
laya::JSThreadInterface* pJSThread = laya::JCScriptRuntime::s_JSRT->m_pScriptThread;
pJSThread->run(NULL,NULL);
if(m_bStopEngine)
{
dispatch_async(dispatch_get_main_queue(), ^{
[self reset];
});
[m_pNSTimer invalidate];
CFRunLoopStop( [[NSRunLoop currentRunLoop] getCFRunLoop] );
}
}
-(void)runFunc:(NSTimer*)timer;
{
FuncObj* pFunObj = [[timer userInfo] objectForKey:@"fun"];
if( !m_bStopEngine && pFunObj && pFunObj->m_Fuction )
{
pFunObj->m_Fuction();
}
[timer invalidate];
timer=nil;
}
//-------------------------------------------------------------------------------
- (void)networkStateChange
{
int nState = [self checkNetworkState];
laya::JCScriptRuntime::s_JSRT->onNetworkChanged(nState);
}
-(int)checkNetworkState
{
// 1.检测手机是否能上网络(WIFI\3G\2.5G\4G)
LayaReachability *conn = [LayaReachability reachabilityForInternetConnection];
if ([conn currentReachabilityStatus] == NotReachable)
{
NSLog(@">>>>>>>checkNetworkState 没有网络");
return laya::NET_NO;
}
else
{
NSLog(@">>>>>>>checkNetworkState 有网络");
return laya::NET_YES;
}
}
//-------------------------------------------------------------------------------
-(void) setScreenOrientation:(int)p_nType
{
switch(p_nType)
{
case 0://landscape 16
{
[conchConfig GetInstance]->m_nOrientationType = UIInterfaceOrientationMaskLandscapeRight;
NSNumber *value=[NSNumber numberWithInt:UIInterfaceOrientationLandscapeRight];
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];
}
break;
case 1://portrait 2
{
[conchConfig GetInstance]->m_nOrientationType = UIInterfaceOrientationMaskPortrait;
NSNumber *value=[NSNumber numberWithInt:UIInterfaceOrientationPortrait];
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];
}
break;
case 8://reverse_landscape 8
{
[conchConfig GetInstance]->m_nOrientationType = UIInterfaceOrientationMaskLandscapeLeft;
NSNumber *value=[NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft];
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];
}
break;
case 9://reverse_portrait 4
{
[conchConfig GetInstance]->m_nOrientationType = UIInterfaceOrientationMaskPortraitUpsideDown;
NSNumber *value=[NSNumber numberWithInt:UIInterfaceOrientationPortraitUpsideDown];
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];
}
break;
case 4://sensor all
{
[conchConfig GetInstance]->m_nOrientationType = UIInterfaceOrientationMaskAll;
}
break;
case 10://full sensor all
{
[conchConfig GetInstance]->m_nOrientationType = UIInterfaceOrientationMaskAll;
}
break;
case 2://user full
{
[conchConfig GetInstance]->m_nOrientationType = UIInterfaceOrientationMaskAll;
}
break;
case 6://sensor_landscape 16+8
{
[conchConfig GetInstance]->m_nOrientationType = UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskLandscapeLeft;
if (!UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation))
{
switch([UIApplication sharedApplication].statusBarOrientation)
{
case UIInterfaceOrientationLandscapeRight:
{
NSNumber *value=[NSNumber numberWithInt:UIInterfaceOrientationLandscapeRight];
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];
}
break;
case UIInterfaceOrientationLandscapeLeft:
{
NSNumber *value=[NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft];
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];
}
default:
{
NSNumber *value=[NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft];
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];
}
break;
}
}
}
break;
case 7://reverse_portrait 2+4
{
[conchConfig GetInstance]->m_nOrientationType = UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown;
if (!UIDeviceOrientationIsPortrait([UIDevice currentDevice].orientation))
{
switch([UIApplication sharedApplication].statusBarOrientation)
{
case UIInterfaceOrientationMaskPortrait:
{
NSNumber *value=[NSNumber numberWithInt:UIInterfaceOrientationPortrait];
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];
}
break;
case UIInterfaceOrientationMaskPortraitUpsideDown:
{
NSNumber *value=[NSNumber numberWithInt:UIInterfaceOrientationMaskPortraitUpsideDown];
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];
}
break;
default:
{
NSNumber *value=[NSNumber numberWithInt:UIInterfaceOrientationPortrait];
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];
}
break;
}
}
}
break;
default://behind nosensor
break;
}
[self updateResolution];
}
-(void)updateResolution
{
CGRect kRect = [UIScreen mainScreen].bounds;
int nOrientation=[UIDevice currentDevice].orientation;
//竖屏
if( nOrientation == UIInterfaceOrientationPortrait ||
nOrientation == UIInterfaceOrientationPortraitUpsideDown )
{
m_pResolution->x = MIN( kRect.size.width , kRect.size.height );
m_pResolution->y = MAX( kRect.size.width , kRect.size.height );
}
//横屏
else if( nOrientation == UIInterfaceOrientationLandscapeLeft ||
nOrientation == UIInterfaceOrientationLandscapeRight )
{
m_pResolution->x = MAX( kRect.size.width , kRect.size.height );
m_pResolution->y = MIN( kRect.size.width , kRect.size.height );
}
}
-(void)orientChange:(NSNotification *)aNotification
{
int nOrientation=[UIDevice currentDevice].orientation;
if (!UIDeviceOrientationIsValidInterfaceOrientation((UIDeviceOrientation)nOrientation))
{
return;
}
if( m_nCurrentOrientation == nOrientation )
{
return;
}
if ( ( [conchConfig GetInstance]->m_nOrientationType & nOrientation ) != nOrientation )
{
return;
}
int nOldOrientation = m_nCurrentOrientation;
m_nCurrentOrientation = nOrientation;
switch(nOrientation)
{
case UIDeviceOrientationPortrait: // Device oriented vertically, home button on the bottom
case UIDeviceOrientationPortraitUpsideDown: // Device oriented vertically, home button on the top
{
if(UIInterfaceOrientationIsLandscape((UIInterfaceOrientation)nOldOrientation))
{
int w = MIN(g_nInnerWidth,g_nInnerHeight);
int h = MAX(g_nInnerWidth,g_nInnerHeight);
g_nInnerWidth = w;
g_nInnerHeight = h;
g_bGLCanvasSizeChanged = true;
[self updateResolution];
}
}
break;
case UIDeviceOrientationLandscapeLeft: // Device oriented horizontally, home button on the right
case UIDeviceOrientationLandscapeRight: // Device oriented horizontally, home button on the left
{
if(UIInterfaceOrientationIsPortrait((UIInterfaceOrientation)nOldOrientation))
{
int w = MAX(g_nInnerWidth,g_nInnerHeight);
int h = MIN(g_nInnerWidth,g_nInnerHeight);
g_nInnerWidth = w;
g_nInnerHeight = h;
g_bGLCanvasSizeChanged = true;
[self updateResolution];
}
}
break;
case UIDeviceOrientationFaceUp: // Device oriented flat, face up
case UIDeviceOrientationFaceDown: // Device oriented flat, face down
{
}
break;
};
}
-(void)reset
{
if(m_pLayaAlert)
{
[m_pLayaAlert reset];
}
if (m_pReflection){
[m_pReflection clearReflectionObjects];
}
}
-(void)callbackToJSWithClass:(Class)cls methodName:(NSString*)name ret:(NSObject*)retObj
{
[m_pReflection callbackToJSWithClass:cls methodName:name ret:retObj];
}
-(void)callbackToJSWithClassName:(NSString*)cls methodName:(NSString*)name ret:(NSObject*)retObj
{
[m_pReflection callbackToJSWithClassName:cls methodName:name ret:retObj];
}
-(void)callbackToJSWithObject:(id)obj methodName:(NSString*)name ret:(NSObject*)retObj
{
[m_pReflection callbackToJSWithObject:obj methodName:name ret:retObj];
}
- (void)enterBackground:(NSNotification *)notification {
CToObjectCOnBlur();
[[LayaDeviceSensor GetInstance] stop];
}
- (void)enterForeground:(NSNotification *)notification {
CToObjectCOnFocus();
[[LayaDeviceSensor GetInstance] start];
}
- (void)willResignActive:(NSNotification *)notification {
//CToObjectCOnBlur();
}
-(void)runJS:(NSString*)script{
const char* pScript = [script UTF8String];
if (pScript){
auto pFunction = std::bind(&CToObjectCRunJS,std::string(pScript));
if (JCScriptRuntime::s_JSRT && JCScriptRuntime::s_JSRT->m_pPoster){
JCScriptRuntime::s_JSRT->m_pPoster->postToJS(pFunction);
}
}
}
-(void)setFileDataHandler:(HandleFileData)func
{
laya::setFileDataHandler(func);
}
@end