Compare commits

..

No commits in common. '8e7a2b0060c6f65819d1a0bfe3f0d459842dbdfe' and 'd7699c93cdbe29266b25139e27f130287595f788' have entirely different histories.

  1. 49
      example/ios/Podfile
  2. 49
      example/ios/Runner.xcodeproj/project.pbxproj
  3. 21
      example/ios/Runner/AppDelegate.swift
  4. 1
      example/lib/screens/simple_screen.dart
  5. 55
      example/pubspec.lock
  6. 2
      example/pubspec.yaml
  7. 117
      ios/Classes/CocosPlayerUtils.swift
  8. 3
      ios/Classes/FLTCocosView.swift
  9. 40
      ios/Classes/FLTCocosWidgetController.swift
  10. 7
      ios/Classes/FlutterCocosViewPlugin.swift
  11. 10
      ios/Classes/FlutterCocosWidgetPlugin.m
  12. 8
      ios/Classes/flutter_cocos_view-Bridging-Header.h
  13. 12
      ios/flutter_cocos_view.podspec
  14. 4
      lib/src/io/device_method.dart
  15. 14
      pubspec.yaml

@ -1,49 +0,0 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '12.0'
platform :ios, '14.5'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
source 'https://gitea.sdws.shop/xim/open-im-sdk-repo.git' # 替换为实际的私有源 URL
source 'https://cdn.cocoapods.org/' # 默认的公共源
pod 'cocos_view_pod', '0.1.23'
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
end
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end

@ -106,6 +106,7 @@
181E7CAB9BFA90CDBBC625FE /* Pods-RunnerTests.release.xcconfig */,
26E556676FA54FF74E61CC9C /* Pods-RunnerTests.profile.xcconfig */,
);
name = Pods;
path = Pods;
sourceTree = "<group>";
};
@ -197,7 +198,7 @@
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
129AC22480F1A498B12D0823 /* [CP] Copy Pods Resources */,
C22789791D91DA87B0800321 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
@ -269,23 +270,6 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
129AC22480F1A498B12D0823 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
showEnvVarsInLog = 0;
};
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
@ -361,6 +345,23 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
C22789791D91DA87B0800321 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
@ -456,7 +457,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
OTHER_LIBTOOLFLAGS = "$(inherited)";
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
@ -471,14 +471,12 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = U4K6R29373;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
OTHER_LIBTOOLFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterCocosViewExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@ -589,7 +587,6 @@
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
OTHER_LIBTOOLFLAGS = "$(inherited)";
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
@ -640,7 +637,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
OTHER_LIBTOOLFLAGS = "$(inherited)";
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
@ -657,15 +653,12 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = U4K6R29373;
ENABLE_BITCODE = NO;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
OTHER_LIBTOOLFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterCocosViewExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@ -682,16 +675,12 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = U4K6R29373;
ENABLE_BITCODE = NO;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
ONLY_ACTIVE_ARCH = YES;
OTHER_LIBTOOLFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterCocosViewExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";

@ -7,28 +7,7 @@ import UIKit
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
///InitCocosIntegrationWithOptions(argc: CommandLine.argc, argv: CommandLine.unsafeArgv, launchOptions)
let flutterEngine = FlutterEngine(name: "io.flutter", project: nil)
flutterEngine.run()
let controller = FlutterViewControllerWithTransition(engine: flutterEngine, nibName: nil, bundle: nil)
self.window = UIWindow(frame: UIScreen.main.bounds)
self.window?.rootViewController = controller
self.window?.makeKeyAndVisible()
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
class FlutterViewControllerWithTransition: FlutterViewController {
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransition(to: size, with: coordinator)
NotificationCenter.default.post(name: NSNotification.Name("ViewWillTransition"), object: nil, userInfo: ["size": size, "coordinator": coordinator])
}
}

@ -106,7 +106,6 @@ class _SimpleScreenState extends State<SimpleScreen> {
// Callback that connects the created controller to the cocos controller
void _onCocosCreated(controller) {
print('Received _onCocosCreated: null');
controller.resume();
_cocosWidgetController = controller;
}

@ -57,6 +57,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.1"
file:
dependency: transitive
description:
name: file
sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c"
url: "https://pub.dev"
source: hosted
version: "7.0.0"
flutter:
dependency: "direct main"
description: flutter
@ -69,6 +77,11 @@ packages:
relative: true
source: path
version: "0.0.1"
flutter_driver:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
flutter_lints:
dependency: "direct dev"
description:
@ -82,6 +95,16 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
fuchsia_remote_debug_protocol:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
integration_test:
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"
leak_tracker:
dependency: transitive
description:
@ -146,6 +169,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.9.0"
platform:
dependency: transitive
description:
name: platform
sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65"
url: "https://pub.dev"
source: hosted
version: "3.1.5"
plugin_platform_interface:
dependency: transitive
description:
@ -162,6 +193,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.9.3+7"
process:
dependency: transitive
description:
name: process
sha256: "21e54fd2faf1b5bdd5102afd25012184a6793927648ea81eea80552ac9405b32"
url: "https://pub.dev"
source: hosted
version: "5.0.2"
sky_engine:
dependency: transitive
description: flutter
@ -207,6 +246,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.2.0"
sync_http:
dependency: transitive
description:
name: sync_http
sha256: "7f0cd72eca000d2e026bcd6f990b81d0ca06022ef4e32fb257b30d3d1014a961"
url: "https://pub.dev"
source: hosted
version: "0.3.1"
term_glyph:
dependency: transitive
description:
@ -239,6 +286,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "14.2.5"
webdriver:
dependency: transitive
description:
name: webdriver
sha256: "003d7da9519e1e5f329422b36c4dcdf18d7d2978d1ba099ea4e45ba490ed845e"
url: "https://pub.dev"
source: hosted
version: "3.0.3"
sdks:
dart: ">=3.4.4 <4.0.0"
flutter: ">=3.18.0-18.0.pre.54"

@ -30,6 +30,8 @@ dependencies:
cupertino_icons: ^1.0.8
pointer_interceptor: ^0.9.3+2
dev_dependencies:
integration_test:
sdk: flutter
flutter_test:
sdk: flutter

@ -6,6 +6,7 @@
//
import Foundation
import cocos_view_pod
private var cocos_warmed_up = false
@ -36,7 +37,7 @@ public func InitCocosIntegrationWithOptions(
/***********************************PLUGIN_ENTRY END**************************************/
// Load cocos framework for fisrt run
func CocosFrameworkLoad() -> dcocos_bridge? {
func CocosFrameworkLoad() -> CocosFramework? {
return dcocos_bridge.instance()
@ -57,7 +58,7 @@ func GetCocosPlayerUtils() -> CocosPlayerUtils {
/*********************************** GLOBAL FUNCS & VARS END****************************************/
//var controller: CocosAppController?
var controller: CocosAppController?
var sharedApplication: UIApplication?
@objc protocol CocosEventListener: AnyObject {
@ -66,74 +67,31 @@ var sharedApplication: UIApplication?
}
@objc public class CocosPlayerUtils: UIResponder, UIApplicationDelegate {
var ufw: dcocos_bridge!
@objc public class CocosPlayerUtils: UIResponder, UIApplicationDelegate, CocosFrameworkListener {
var ufw: CocosFramework!
private var _isCocosPaused = false
private var _isCocosReady = false
private var _isCocosLoaded = false
override init() {
super.init()
//
NotificationCenter.default.addObserver(self, selector: #selector(handleViewWillTransition), name: NSNotification.Name("ViewWillTransition"), object: nil)
}
deinit {
//
NotificationCenter.default.removeObserver(self)
}
@objc func handleViewWillTransition(notification: Notification) {
guard let size = notification.userInfo?["size"] as? CGSize,
let coordinator = notification.userInfo?["coordinator"] as? UIViewControllerTransitionCoordinator else {
return
}
//
print("CocosPlayerUtils will transition to size: \(size)")
//
let selector = NSSelectorFromString("viewWillTransitionToSize:withTransitionCoordinator:")
if self.ufw.responds(to: selector) {
self.ufw.perform(selector, with: size, with: coordinator)
}
}
func initCocos() {
if (self.cocosIsInitiallized()) {
//todo
//self.ufw?.showCocosWindow()
self.ufw?.showCocosWindow()
return
}
//
//UIDevice.current.beginGeneratingDeviceOrientationNotifications()
self.ufw = CocosFrameworkLoad()
// PodBundle
let bundle = Bundle(for: dcocos_bridge.self)
self.ufw = CocosFrameworkLoad()
// `YourPodResources.bundle`
if let bundleURL = bundle.url(forResource: "cocos_main_bundle", withExtension: "bundle") {
let bundlePath = bundleURL.path
print("Bundle absolute path: \(bundlePath)")
self.ufw.configureCocos2dSearchPaths(bundlePath)
} else {
print("Could not find the bundle.")
}
//self.ufw?.setDataBundleId("com.cocos3d.framework")
self.ufw.initPlatform()
let application = UIApplication.shared
self.ufw.application(application, didFinishLaunchingWithOptions: appLaunchOpts )
registerCocosListener()
// self.ufw?.runEmbedded(withArgc: gArgc, argv: gArgv, appLaunchOpts: appLaunchOpts)
// if self.ufw?.appController() != nil {
// controller = self.ufw?.appController()
// controller?.cocosMessageHandler = self.cocosMessageHandlers
// controller?.cocosSceneLoadedHandler = self.cocosSceneLoadedHandlers
// self.ufw?.appController()?.window?.windowLevel = UIWindow.Level(UIWindow.Level.normal.rawValue - 1)
// }
if self.ufw?.appController() != nil {
controller = self.ufw?.appController()
controller?.cocosMessageHandler = self.cocosMessageHandlers
controller?.cocosSceneLoadedHandler = self.cocosSceneLoadedHandlers
self.ufw?.appController()?.window?.windowLevel = UIWindow.Level(UIWindow.Level.normal.rawValue - 1)
}
_isCocosLoaded = true
}
@ -149,18 +107,13 @@ var sharedApplication: UIApplication?
// Create new cocos player
func createPlayer(completed: @escaping (_ view: UIView?) -> Void) {
if self.cocosIsInitiallized() && self._isCocosReady {
//todo
//completed(controller?.rootView)
completed(nil)
completed(controller?.rootView)
return
}
NotificationCenter.default.addObserver(forName: NSNotification.Name("CocosReady"), object: nil, queue: OperationQueue.main, using: { note in
self._isCocosReady = true
//todo
//completed(controller?.rootView)
completed(nil)
completed(controller?.rootView)
})
DispatchQueue.main.async {
@ -181,9 +134,7 @@ var sharedApplication: UIApplication?
self.listenAppState()
//todo
//completed(controller?.rootView)
completed(nil)
completed(controller?.rootView)
}
}
@ -212,30 +163,29 @@ var sharedApplication: UIApplication?
if !self._isCocosReady {
return
}
//todo
//let cocosAppController = self.ufw?.appController() as? CocosAppController
// let cocosAppController = nil
let cocosAppController = self.ufw?.appController() as? CocosAppController
let application = UIApplication.shared
if notification?.name == UIApplication.willResignActiveNotification {
self.ufw?.applicationWillResignActive(application)
cocosAppController?.applicationWillResignActive(application)
} else if notification?.name == UIApplication.didEnterBackgroundNotification {
// self.ufw?.applicationDidEnterBackground(application)
cocosAppController?.applicationDidEnterBackground(application)
} else if notification?.name == UIApplication.willEnterForegroundNotification {
// self.ufw?.applicationWillEnterForeground(application)
cocosAppController?.applicationWillEnterForeground(application)
} else if notification?.name == UIApplication.didBecomeActiveNotification {
self.ufw?.applicationDidBecomeActive(application)
cocosAppController?.applicationDidBecomeActive(application)
} else if notification?.name == UIApplication.willTerminateNotification {
self.ufw?.applicationWillTerminate(application)
cocosAppController?.applicationWillTerminate(application)
} else if notification?.name == UIApplication.didReceiveMemoryWarningNotification {
// self.ufw?.applicationDidReceiveMemoryWarning(application)
}
cocosAppController?.applicationDidReceiveMemoryWarning(application)
}
}
// Listener for app lifecycle eventa
func listenAppState() {
for name in [
UIApplication.didBecomeActiveNotification,
UIApplication.didEnterBackgroundNotification,
UIApplication.willTerminateNotification,
@ -252,22 +202,19 @@ var sharedApplication: UIApplication?
}
// Pause cocos player
func pause() {
//todo
// self.ufw?.pause(true)
self.ufw?.pause(true)
self._isCocosPaused = true
}
// Resume cocos player
func resume() {
//todo
//self.ufw?.pause(false)
self.ufw?.pause(false)
self._isCocosPaused = false
}
// Unoad cocos player
func unload() {
//todo
//self.ufw?.unloadApplication()
self.ufw?.unloadApplication()
}
func isCocosLoaded() -> Bool {
@ -280,16 +227,14 @@ var sharedApplication: UIApplication?
// Quit cocos player application
func quit() {
//todo
//self.ufw?.quitApplication(0)
self.ufw?.quitApplication(0)
self._isCocosLoaded = false
}
// Post message to cocos
func postMessageToCocos(gameObject: String?, cocosMethodName: String?, cocosMessage: String?) {
if self.cocosIsInitiallized() {
//todo
//self.ufw?.sendMessageToGO(withName: gameObject, functionName: cocosMethodName, message: cocosMessage)
self.ufw?.sendMessageToGO(withName: gameObject, functionName: cocosMethodName, message: cocosMessage)
}
}

@ -13,8 +13,7 @@ class FLTCocosView: UIView {
override func layoutSubviews() {
super.layoutSubviews()
if (!self.bounds.isEmpty) {
//todo
GetCocosPlayerUtils().ufw?.getCocosView()?.frame = self.bounds
GetCocosPlayerUtils().ufw?.appController()?.rootView.frame = self.bounds
}
}
}

@ -23,11 +23,9 @@ public class FLTCocosWidgetController: NSObject, FLTCocosOptionsSink, FlutterPla
arguments args: Any?,
registrar: NSObjectProtocol & FlutterPluginRegistrar
) {
//CGRect(x: 0, y: 0, width: 700, height: 700)
self._rootView = FLTCocosView(frame: frame)
super.init()
globalControllers.append(self)
self.viewId = viewId
@ -40,8 +38,6 @@ public class FLTCocosWidgetController: NSObject, FLTCocosOptionsSink, FlutterPla
}
func methodHandler(_ call: FlutterMethodCall, result: FlutterResult) {
NSLog("call : \(call.method)")
if call.method == "cocos#dispose" {
self.dispose()
result(nil)
@ -91,35 +87,33 @@ public class FLTCocosWidgetController: NSObject, FLTCocosOptionsSink, FlutterPla
private func startCocosIfNeeded() {
GetCocosPlayerUtils().createPlayer(completed: { [self] (view: UIView?) in
})
}
func attachView() {
startCocosIfNeeded()
//GetCocosPlayerUtils().ufw?.setCocosView(_rootView)
// self.channel?.invokeMethod("events#onViewReattached", arguments: "")
let cocosView = GetCocosPlayerUtils().ufw?.getCocosView()
if let superview = cocosView?.superview {
cocosView?.removeFromSuperview()
superview.layoutIfNeeded()
}
if let cocosView = cocosView {
_rootView.addSubview(cocosView)
_rootView.layoutIfNeeded()
self.channel?.invokeMethod("events#onViewReattached", arguments: "")
}
let cocosView = GetCocosPlayerUtils().ufw?.appController()?.rootView
if let superview = cocosView?.superview {
cocosView?.removeFromSuperview()
superview.layoutIfNeeded()
}
if let cocosView = cocosView {
_rootView.addSubview(cocosView)
_rootView.layoutIfNeeded()
self.channel?.invokeMethod("events#onViewReattached", arguments: "")
}
GetCocosPlayerUtils().resume()
}
func reattachView() {
//todo
let cocosView = GetCocosPlayerUtils().ufw?.getCocosView()
let cocosView = GetCocosPlayerUtils().ufw?.appController()?.rootView
let superview = cocosView?.superview
if superview != _rootView {
attachView()
}
}
GetCocosPlayerUtils().resume()
}
@ -129,7 +123,7 @@ public class FLTCocosWidgetController: NSObject, FLTCocosOptionsSink, FlutterPla
return
}
let cocosView = GetCocosPlayerUtils().ufw?.getCocosView()
let cocosView = GetCocosPlayerUtils().ufw?.appController()?.rootView
if _rootView == cocosView?.superview {
if globalControllers.isEmpty {
cocosView?.removeFromSuperview()

@ -1,10 +1,11 @@
import Flutter
import UIKit
public class SwiftFlutterCocosViewPlugin: NSObject, FlutterPlugin {
public class FlutterCocosViewPlugin: NSObject, FlutterPlugin {
public static func register(with registrar: FlutterPluginRegistrar) {
print("FlutterCocosViewPlugin registered~~~~~~~~~~~~~~") //
let channel = FlutterMethodChannel(name: "flutter_cocos_view", binaryMessenger: registrar.messenger())
let instance = FlutterCocosViewPlugin()
registrar.addMethodCallDelegate(instance, channel: channel)
let fuwFactory = FLTCocosWidgetFactory(registrar: registrar)
registrar.register(fuwFactory, withId: "plugin.gem.com/cocos_view", gestureRecognizersBlockingPolicy: FlutterPlatformViewGestureRecognizersBlockingPolicyWaitUntilTouchesEnded)

@ -1,12 +1,12 @@
#import "FlutterCocosWidgetPlugin.h"
#import FlutterCocosWidgetPlugin.h
#import <Foundation/Foundation.h>
#if __has_include(<flutter_cocos_view/flutter_cocos_-Swift.h>)
#import <flutter_cocos_view/flutter_cocos_view-Swift.h>
#if __has_include(<flutter_cocos_widget/flutter_cocos_widget-Swift.h>)
#import <flutter_cocos_widget/flutter_cocos_widget-Swift.h>
#else
// Support project import fallback if the generated compatibility header
// 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
#import <flutter_cocos_view/flutter_cocos_view-Swift.h>
#import "flutter_cocos_widget-Swift.h"
#endif
@implementation FlutterCocosWidgetPlugin {
@ -16,7 +16,7 @@
}
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
[SwiftFlutterCocosViewPlugin registerWithRegistrar:registrar];
[SwiftFlutterCocosWidgetPlugin registerWithRegistrar:registrar];
}
@end

@ -1,8 +0,0 @@
#ifndef your_plugin_Bridging_Header_h
#define your_plugin_Bridging_Header_h
#import <cocos_view_pod/dcocos_bridge.h>
#endif /* your_plugin_Bridging_Header_h */

@ -15,17 +15,11 @@ A new Flutter plugin project.
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.dependency 'Flutter'
s.dependency 'cocos_view_pod','0.1.23'
s.platform = :ios, '14.5'
#s.public_header_files = 'Classes/**/*.h'
#s.vendored_libraries = 'Libs/**/*.a'
#s.libraries = 'dcocos'
#s.private_header_files = 'Classes/flutter_cocos_view-Bridging-Header.h'
s.static_framework = true
s.dependency 'cocos_view_pod','0.1.7'
# Flutter.framework does not contain a i386 slice.
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES'}
s.user_target_xcconfig = { 'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES' }
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
s.swift_version = '5.0'
# If your plugin requires a privacy manifest, for example if it uses any

@ -40,7 +40,7 @@ class MethodChannelCocosWidget extends CocosWidgetPlatform {
MethodChannel ensureChannelInitialized(int cocosId) {
MethodChannel? channel = _channels[cocosId];
if (channel == null) {
channel = MethodChannel('plugin.gem.com/cocos_view_$cocosId');
channel = MethodChannel('plugin.xraph.com/cocos_view_$cocosId');
channel.setMethodCallHandler(
(MethodCall call) => _handleMethodCall(call, cocosId));
@ -158,7 +158,7 @@ class MethodChannelCocosWidget extends CocosWidgetPlatform {
bool? cocosWebSource,
String? cocosSrcUrl,
}) {
final String _viewType = 'plugin.gem.com/cocos_view';
final String _viewType = 'plugin.xraph.com/cocos_view';
if (useAndroidViewSurf != null) useAndroidViewSurface = useAndroidViewSurf;

@ -1,12 +1,11 @@
name: flutter_cocos_view
description: "A new Flutter plugin project."
version: 0.0.1
homepage: https://www.openim.io
homepage:
environment:
sdk: ">=3.0.0 <4.0.0"
flutter: ">=1.20.0"
sdk: ^3.4.4
flutter: '>=3.3.0'
dependencies:
flutter:
@ -35,15 +34,14 @@ flutter:
# All these are used by the tooling to maintain consistency when
# adding or updating assets for this project.
plugin:
platforms:
# This plugin project was generated without specifying any
# platforms with the `--platform` argument. If you see the `some_platform` map below, remove it and
# then add platforms following the instruction here:
# https://flutter.dev/to/pubspec-plugin-platforms
# -------------------
platforms:
ios:
pluginClass: FlutterCocosWidgetPlugin
some_platform:
pluginClass: somePluginClass
# -------------------
# To add assets to your plugin package, add an assets section, like this:

Loading…
Cancel
Save