no message
This commit is contained in:
parent
e5f1398bc3
commit
d7699c93cd
@ -6,6 +6,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
import cocos_view_pod
|
||||||
|
|
||||||
|
|
||||||
private var cocos_warmed_up = false
|
private var cocos_warmed_up = false
|
||||||
@ -37,16 +38,9 @@ public func InitCocosIntegrationWithOptions(
|
|||||||
|
|
||||||
// Load cocos framework for fisrt run
|
// Load cocos framework for fisrt run
|
||||||
func CocosFrameworkLoad() -> CocosFramework? {
|
func CocosFrameworkLoad() -> CocosFramework? {
|
||||||
var bundlePath: String? = nil
|
|
||||||
bundlePath = Bundle.main.bundlePath
|
|
||||||
bundlePath = (bundlePath ?? "") + "/Frameworks/CocosFramework.framework"
|
|
||||||
|
|
||||||
let bundle = Bundle(path: bundlePath ?? "")
|
return dcocos_bridge.instance()
|
||||||
if bundle?.isLoaded == false {
|
|
||||||
bundle?.load()
|
|
||||||
}
|
|
||||||
|
|
||||||
return bundle?.principalClass?.getInstance()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************** GLOBAL FUNCS & VARS START**************************************/
|
/*********************************** GLOBAL FUNCS & VARS START**************************************/
|
||||||
@ -87,10 +81,10 @@ var sharedApplication: UIApplication?
|
|||||||
|
|
||||||
self.ufw = CocosFrameworkLoad()
|
self.ufw = CocosFrameworkLoad()
|
||||||
|
|
||||||
self.ufw?.setDataBundleId("com.cocos3d.framework")
|
//self.ufw?.setDataBundleId("com.cocos3d.framework")
|
||||||
|
|
||||||
registerCocosListener()
|
registerCocosListener()
|
||||||
self.ufw?.runEmbedded(withArgc: gArgc, argv: gArgv, appLaunchOpts: appLaunchOpts)
|
// self.ufw?.runEmbedded(withArgc: gArgc, argv: gArgv, appLaunchOpts: appLaunchOpts)
|
||||||
|
|
||||||
if self.ufw?.appController() != nil {
|
if self.ufw?.appController() != nil {
|
||||||
controller = self.ufw?.appController()
|
controller = self.ufw?.appController()
|
||||||
@ -147,13 +141,13 @@ var sharedApplication: UIApplication?
|
|||||||
|
|
||||||
func registerCocosListener() {
|
func registerCocosListener() {
|
||||||
if self.cocosIsInitiallized() {
|
if self.cocosIsInitiallized() {
|
||||||
self.ufw?.register(self)
|
// self.ufw?.register(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func unregisterCocosListener() {
|
func unregisterCocosListener() {
|
||||||
if self.cocosIsInitiallized() {
|
if self.cocosIsInitiallized() {
|
||||||
self.ufw?.unregisterFrameworkListener(self)
|
// self.ufw?.unregisterFrameworkListener(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import CocosFramework
|
|
||||||
|
|
||||||
// Defines cocos controllable from Flutter.
|
// Defines cocos controllable from Flutter.
|
||||||
public class FLTCocosWidgetController: NSObject, FLTCocosOptionsSink, FlutterPlatformView {
|
public class FLTCocosWidgetController: NSObject, FLTCocosOptionsSink, FlutterPlatformView {
|
||||||
@ -30,7 +30,7 @@ public class FLTCocosWidgetController: NSObject, FLTCocosOptionsSink, FlutterPla
|
|||||||
|
|
||||||
self.viewId = viewId
|
self.viewId = viewId
|
||||||
|
|
||||||
let channelName = String(format: "plugin.xraph.com/cocos_view_%lld", viewId)
|
let channelName = String(format: "plugin.gem.com/cocos_view_%lld", viewId)
|
||||||
self.channel = FlutterMethodChannel(name: channelName, binaryMessenger: registrar.messenger())
|
self.channel = FlutterMethodChannel(name: channelName, binaryMessenger: registrar.messenger())
|
||||||
|
|
||||||
self.channel?.setMethodCallHandler(self.methodHandler)
|
self.channel?.setMethodCallHandler(self.methodHandler)
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
#import FlutterCocosWidgetPlugin.h
|
#import FlutterCocosWidgetPlugin.h
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#if __has_include(<flutter_unity_widget/flutter_unity_widget-Swift.h>)
|
#if __has_include(<flutter_cocos_widget/flutter_cocos_widget-Swift.h>)
|
||||||
#import <flutter_unity_widget/flutter_unity_widget-Swift.h>
|
#import <flutter_cocos_widget/flutter_cocos_widget-Swift.h>
|
||||||
#else
|
#else
|
||||||
// Support project import fallback if the generated compatibility header
|
// Support project import fallback if the generated compatibility header
|
||||||
// is not copied when this plugin is created as a library.
|
// is not copied when this plugin is created as a library.
|
||||||
// https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816
|
// https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816
|
||||||
#import "flutter_unity_widget-Swift.h"
|
#import "flutter_cocos_widget-Swift.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@implementation FlutterCocosWidgetPlugin {
|
@implementation FlutterCocosWidgetPlugin {
|
||||||
NSObject<FlutterPluginRegistrar>* _registrar;
|
NSObject<FlutterPluginRegistrar>* _registrar;
|
||||||
FlutterMethodChannel* _channel;
|
FlutterMethodChannel* _channel;
|
||||||
NSMutableDictionary* _unityControllers;
|
NSMutableDictionary* _cocosControllers;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
|
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user