|
|
|
@ -6,6 +6,7 @@ |
|
|
|
|
// |
|
|
|
|
|
|
|
|
|
import Foundation |
|
|
|
|
import cocos_view_pod |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private var cocos_warmed_up = false |
|
|
|
@ -37,16 +38,9 @@ public func InitCocosIntegrationWithOptions( |
|
|
|
|
|
|
|
|
|
// Load cocos framework for fisrt run |
|
|
|
|
func CocosFrameworkLoad() -> CocosFramework? { |
|
|
|
|
var bundlePath: String? = nil |
|
|
|
|
bundlePath = Bundle.main.bundlePath |
|
|
|
|
bundlePath = (bundlePath ?? "") + "/Frameworks/CocosFramework.framework" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let bundle = Bundle(path: bundlePath ?? "") |
|
|
|
|
if bundle?.isLoaded == false { |
|
|
|
|
bundle?.load() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return bundle?.principalClass?.getInstance() |
|
|
|
|
return dcocos_bridge.instance() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*********************************** GLOBAL FUNCS & VARS START**************************************/ |
|
|
|
@ -87,10 +81,10 @@ var sharedApplication: UIApplication? |
|
|
|
|
|
|
|
|
|
self.ufw = CocosFrameworkLoad() |
|
|
|
|
|
|
|
|
|
self.ufw?.setDataBundleId("com.cocos3d.framework") |
|
|
|
|
//self.ufw?.setDataBundleId("com.cocos3d.framework") |
|
|
|
|
|
|
|
|
|
registerCocosListener() |
|
|
|
|
self.ufw?.runEmbedded(withArgc: gArgc, argv: gArgv, appLaunchOpts: appLaunchOpts) |
|
|
|
|
// self.ufw?.runEmbedded(withArgc: gArgc, argv: gArgv, appLaunchOpts: appLaunchOpts) |
|
|
|
|
|
|
|
|
|
if self.ufw?.appController() != nil { |
|
|
|
|
controller = self.ufw?.appController() |
|
|
|
@ -147,13 +141,13 @@ var sharedApplication: UIApplication? |
|
|
|
|
|
|
|
|
|
func registerCocosListener() { |
|
|
|
|
if self.cocosIsInitiallized() { |
|
|
|
|
self.ufw?.register(self) |
|
|
|
|
// self.ufw?.register(self) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func unregisterCocosListener() { |
|
|
|
|
if self.cocosIsInitiallized() { |
|
|
|
|
self.ufw?.unregisterFrameworkListener(self) |
|
|
|
|
// self.ufw?.unregisterFrameworkListener(self) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|