Compare commits
8 Commits
f3e0de5122
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e7a2b0060 | ||
|
|
40409fd882 | ||
|
|
d7699c93cd | ||
|
|
e5f1398bc3 | ||
|
|
cacb3d6e75 | ||
|
|
f5ae749849 | ||
|
|
c6026f57dc | ||
|
|
dd9fd10b9b |
@@ -1 +1,2 @@
|
||||
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
|
||||
#include "Generated.xcconfig"
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
|
||||
#include "Generated.xcconfig"
|
||||
|
||||
49
example/ios/Podfile
Normal file
49
example/ios/Podfile
Normal file
@@ -0,0 +1,49 @@
|
||||
# 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
|
||||
@@ -10,10 +10,12 @@
|
||||
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
|
||||
331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; };
|
||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
|
||||
5DFC82D505B7D878460FE3E5 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 566E03A70139F3BCD911B76A /* Pods_RunnerTests.framework */; };
|
||||
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
|
||||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
|
||||
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
|
||||
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
|
||||
F2CF9E0D5F20E9E1D99D25D2 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0190B4CCE1292F34FDFD8151 /* Pods_Runner.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
@@ -40,14 +42,21 @@
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
0190B4CCE1292F34FDFD8151 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
|
||||
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
|
||||
181E7CAB9BFA90CDBBC625FE /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = "<group>"; };
|
||||
26E556676FA54FF74E61CC9C /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = "<group>"; };
|
||||
331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = "<group>"; };
|
||||
331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
|
||||
3F39FE77CF4838A5F85AE6BF /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
|
||||
566E03A70139F3BCD911B76A /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
5E717CF08AD94015B459B1ED /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
|
||||
800B374E32B0D88B219FBC31 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
|
||||
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
|
||||
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
|
||||
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
@@ -55,6 +64,7 @@
|
||||
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
F40E1506896C23CEC1C36A98 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@@ -62,12 +72,43 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
F2CF9E0D5F20E9E1D99D25D2 /* Pods_Runner.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
BF05E436C0B6168D1507C3DB /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
5DFC82D505B7D878460FE3E5 /* Pods_RunnerTests.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
012E8D281E8C576679677DD0 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0190B4CCE1292F34FDFD8151 /* Pods_Runner.framework */,
|
||||
566E03A70139F3BCD911B76A /* Pods_RunnerTests.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
144C6510A12B7E4C577F477D /* Pods */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
5E717CF08AD94015B459B1ED /* Pods-Runner.debug.xcconfig */,
|
||||
3F39FE77CF4838A5F85AE6BF /* Pods-Runner.release.xcconfig */,
|
||||
800B374E32B0D88B219FBC31 /* Pods-Runner.profile.xcconfig */,
|
||||
F40E1506896C23CEC1C36A98 /* Pods-RunnerTests.debug.xcconfig */,
|
||||
181E7CAB9BFA90CDBBC625FE /* Pods-RunnerTests.release.xcconfig */,
|
||||
26E556676FA54FF74E61CC9C /* Pods-RunnerTests.profile.xcconfig */,
|
||||
);
|
||||
path = Pods;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
331C8082294A63A400263BE5 /* RunnerTests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -94,6 +135,8 @@
|
||||
97C146F01CF9000F007C117D /* Runner */,
|
||||
97C146EF1CF9000F007C117D /* Products */,
|
||||
331C8082294A63A400263BE5 /* RunnerTests */,
|
||||
144C6510A12B7E4C577F477D /* Pods */,
|
||||
012E8D281E8C576679677DD0 /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
@@ -128,8 +171,10 @@
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */;
|
||||
buildPhases = (
|
||||
746D3606AB8A25B42F5865F2 /* [CP] Check Pods Manifest.lock */,
|
||||
331C807D294A63A400263BE5 /* Sources */,
|
||||
331C807F294A63A400263BE5 /* Resources */,
|
||||
BF05E436C0B6168D1507C3DB /* Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -145,12 +190,14 @@
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
|
||||
buildPhases = (
|
||||
80987C0A78853D4777CA9485 /* [CP] Check Pods Manifest.lock */,
|
||||
9740EEB61CF901F6004384FC /* Run Script */,
|
||||
97C146EA1CF9000F007C117D /* Sources */,
|
||||
97C146EB1CF9000F007C117D /* Frameworks */,
|
||||
97C146EC1CF9000F007C117D /* Resources */,
|
||||
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
||||
129AC22480F1A498B12D0823 /* [CP] Copy Pods Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -222,6 +269,23 @@
|
||||
/* 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;
|
||||
@@ -238,6 +302,50 @@
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
|
||||
};
|
||||
746D3606AB8A25B42F5865F2 /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
80987C0A78853D4777CA9485 /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
9740EEB61CF901F6004384FC /* Run Script */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
alwaysOutOfDate = 1;
|
||||
@@ -348,6 +456,7 @@
|
||||
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";
|
||||
@@ -362,12 +471,14 @@
|
||||
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";
|
||||
@@ -378,6 +489,7 @@
|
||||
};
|
||||
331C8088294A63A400263BE5 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = F40E1506896C23CEC1C36A98 /* Pods-RunnerTests.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
@@ -395,6 +507,7 @@
|
||||
};
|
||||
331C8089294A63A400263BE5 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 181E7CAB9BFA90CDBBC625FE /* Pods-RunnerTests.release.xcconfig */;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
@@ -410,6 +523,7 @@
|
||||
};
|
||||
331C808A294A63A400263BE5 /* Profile */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 26E556676FA54FF74E61CC9C /* Pods-RunnerTests.profile.xcconfig */;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
@@ -475,6 +589,7 @@
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
OTHER_LIBTOOLFLAGS = "$(inherited)";
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
@@ -525,6 +640,7 @@
|
||||
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;
|
||||
@@ -541,12 +657,15 @@
|
||||
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";
|
||||
@@ -563,12 +682,16 @@
|
||||
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";
|
||||
|
||||
@@ -4,4 +4,7 @@
|
||||
<FileRef
|
||||
location = "group:Runner.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Pods/Pods.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
|
||||
@@ -7,7 +7,28 @@ 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,6 +106,7 @@ 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,14 +57,6 @@ 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
|
||||
@@ -77,11 +69,6 @@ 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:
|
||||
@@ -95,32 +82,22 @@ 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:
|
||||
name: leak_tracker
|
||||
sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
|
||||
sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "10.0.4"
|
||||
version: "10.0.5"
|
||||
leak_tracker_flutter_testing:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: leak_tracker_flutter_testing
|
||||
sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
|
||||
sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.3"
|
||||
version: "3.0.5"
|
||||
leak_tracker_testing:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -149,18 +126,18 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: material_color_utilities
|
||||
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
|
||||
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.8.0"
|
||||
version: "0.11.1"
|
||||
meta:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: meta
|
||||
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
|
||||
sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.12.0"
|
||||
version: "1.15.0"
|
||||
path:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -169,14 +146,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.9.0"
|
||||
platform:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: platform
|
||||
sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.4"
|
||||
plugin_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -193,14 +162,6 @@ 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
|
||||
@@ -246,14 +207,6 @@ 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:
|
||||
@@ -266,10 +219,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_api
|
||||
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
|
||||
sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.7.0"
|
||||
version: "0.7.2"
|
||||
vector_math:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -282,18 +235,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vm_service
|
||||
sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
|
||||
sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "14.2.1"
|
||||
webdriver:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: webdriver
|
||||
sha256: "003d7da9519e1e5f329422b36c4dcdf18d7d2978d1ba099ea4e45ba490ed845e"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.3"
|
||||
version: "14.2.5"
|
||||
sdks:
|
||||
dart: ">=3.4.4 <4.0.0"
|
||||
flutter: ">=3.18.0-18.0.pre.54"
|
||||
|
||||
@@ -30,8 +30,6 @@ dependencies:
|
||||
cupertino_icons: ^1.0.8
|
||||
pointer_interceptor: ^0.9.3+2
|
||||
dev_dependencies:
|
||||
integration_test:
|
||||
sdk: flutter
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
||||
|
||||
@@ -36,17 +36,10 @@ public func InitCocosIntegrationWithOptions(
|
||||
/***********************************PLUGIN_ENTRY END**************************************/
|
||||
|
||||
// Load cocos framework for fisrt run
|
||||
func CocosFrameworkLoad() -> CocosFramework? {
|
||||
var bundlePath: String? = nil
|
||||
bundlePath = Bundle.main.bundlePath
|
||||
bundlePath = (bundlePath ?? "") + "/Frameworks/CocosFramework.framework"
|
||||
func CocosFrameworkLoad() -> dcocos_bridge? {
|
||||
|
||||
|
||||
let bundle = Bundle(path: bundlePath ?? "")
|
||||
if bundle?.isLoaded == false {
|
||||
bundle?.load()
|
||||
}
|
||||
|
||||
return bundle?.principalClass?.getInstance()
|
||||
return dcocos_bridge.instance()
|
||||
}
|
||||
|
||||
/*********************************** GLOBAL FUNCS & VARS START**************************************/
|
||||
@@ -64,7 +57,7 @@ func GetCocosPlayerUtils() -> CocosPlayerUtils {
|
||||
|
||||
/*********************************** GLOBAL FUNCS & VARS END****************************************/
|
||||
|
||||
var controller: CocosAppController?
|
||||
//var controller: CocosAppController?
|
||||
var sharedApplication: UIApplication?
|
||||
|
||||
@objc protocol CocosEventListener: AnyObject {
|
||||
@@ -73,31 +66,74 @@ var sharedApplication: UIApplication?
|
||||
|
||||
}
|
||||
|
||||
@objc public class CocosPlayerUtils: UIResponder, UIApplicationDelegate, CocosFrameworkListener {
|
||||
var ufw: CocosFramework!
|
||||
@objc public class CocosPlayerUtils: UIResponder, UIApplicationDelegate {
|
||||
var ufw: dcocos_bridge!
|
||||
private var _isCocosPaused = false
|
||||
private var _isCocosReady = false
|
||||
private var _isCocosLoaded = false
|
||||
|
||||
func initCocos() {
|
||||
if (self.cocosIsInitiallized()) {
|
||||
self.ufw?.showCocosWindow()
|
||||
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()
|
||||
return
|
||||
}
|
||||
// 开始生成设备旋转通知
|
||||
//UIDevice.current.beginGeneratingDeviceOrientationNotifications()
|
||||
|
||||
self.ufw = CocosFrameworkLoad()
|
||||
|
||||
self.ufw?.setDataBundleId("com.cocos3d.framework")
|
||||
// 获取当前Pod库的Bundle
|
||||
let bundle = Bundle(for: dcocos_bridge.self)
|
||||
|
||||
// 获取 `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)
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -113,13 +149,18 @@ var sharedApplication: UIApplication?
|
||||
// Create new cocos player
|
||||
func createPlayer(completed: @escaping (_ view: UIView?) -> Void) {
|
||||
if self.cocosIsInitiallized() && self._isCocosReady {
|
||||
completed(controller?.rootView)
|
||||
//todo
|
||||
//completed(controller?.rootView)
|
||||
completed(nil)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
NotificationCenter.default.addObserver(forName: NSNotification.Name("CocosReady"), object: nil, queue: OperationQueue.main, using: { note in
|
||||
self._isCocosReady = true
|
||||
completed(controller?.rootView)
|
||||
//todo
|
||||
//completed(controller?.rootView)
|
||||
completed(nil)
|
||||
})
|
||||
|
||||
DispatchQueue.main.async {
|
||||
@@ -140,20 +181,22 @@ var sharedApplication: UIApplication?
|
||||
|
||||
self.listenAppState()
|
||||
|
||||
completed(controller?.rootView)
|
||||
//todo
|
||||
//completed(controller?.rootView)
|
||||
completed(nil)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,29 +212,30 @@ var sharedApplication: UIApplication?
|
||||
if !self._isCocosReady {
|
||||
return
|
||||
}
|
||||
|
||||
let cocosAppController = self.ufw?.appController() as? CocosAppController
|
||||
//todo
|
||||
//let cocosAppController = self.ufw?.appController() as? CocosAppController
|
||||
// let cocosAppController = nil
|
||||
let application = UIApplication.shared
|
||||
|
||||
if notification?.name == UIApplication.willResignActiveNotification {
|
||||
cocosAppController?.applicationWillResignActive(application)
|
||||
self.ufw?.applicationWillResignActive(application)
|
||||
} else if notification?.name == UIApplication.didEnterBackgroundNotification {
|
||||
cocosAppController?.applicationDidEnterBackground(application)
|
||||
// self.ufw?.applicationDidEnterBackground(application)
|
||||
} else if notification?.name == UIApplication.willEnterForegroundNotification {
|
||||
cocosAppController?.applicationWillEnterForeground(application)
|
||||
// self.ufw?.applicationWillEnterForeground(application)
|
||||
} else if notification?.name == UIApplication.didBecomeActiveNotification {
|
||||
cocosAppController?.applicationDidBecomeActive(application)
|
||||
self.ufw?.applicationDidBecomeActive(application)
|
||||
} else if notification?.name == UIApplication.willTerminateNotification {
|
||||
cocosAppController?.applicationWillTerminate(application)
|
||||
self.ufw?.applicationWillTerminate(application)
|
||||
} else if notification?.name == UIApplication.didReceiveMemoryWarningNotification {
|
||||
cocosAppController?.applicationDidReceiveMemoryWarning(application)
|
||||
}
|
||||
// self.ufw?.applicationDidReceiveMemoryWarning(application)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Listener for app lifecycle eventa
|
||||
func listenAppState() {
|
||||
for name in [
|
||||
|
||||
UIApplication.didBecomeActiveNotification,
|
||||
UIApplication.didEnterBackgroundNotification,
|
||||
UIApplication.willTerminateNotification,
|
||||
@@ -208,19 +252,22 @@ var sharedApplication: UIApplication?
|
||||
}
|
||||
// Pause cocos player
|
||||
func pause() {
|
||||
self.ufw?.pause(true)
|
||||
//todo
|
||||
// self.ufw?.pause(true)
|
||||
self._isCocosPaused = true
|
||||
}
|
||||
|
||||
// Resume cocos player
|
||||
func resume() {
|
||||
self.ufw?.pause(false)
|
||||
//todo
|
||||
//self.ufw?.pause(false)
|
||||
self._isCocosPaused = false
|
||||
}
|
||||
|
||||
// Unoad cocos player
|
||||
func unload() {
|
||||
self.ufw?.unloadApplication()
|
||||
//todo
|
||||
//self.ufw?.unloadApplication()
|
||||
}
|
||||
|
||||
func isCocosLoaded() -> Bool {
|
||||
@@ -233,14 +280,16 @@ var sharedApplication: UIApplication?
|
||||
|
||||
// Quit cocos player application
|
||||
func quit() {
|
||||
self.ufw?.quitApplication(0)
|
||||
//todo
|
||||
//self.ufw?.quitApplication(0)
|
||||
self._isCocosLoaded = false
|
||||
}
|
||||
|
||||
// Post message to cocos
|
||||
func postMessageToCocos(gameObject: String?, cocosMethodName: String?, cocosMessage: String?) {
|
||||
if self.cocosIsInitiallized() {
|
||||
self.ufw?.sendMessageToGO(withName: gameObject, functionName: cocosMethodName, message: cocosMessage)
|
||||
//todo
|
||||
//self.ufw?.sendMessageToGO(withName: gameObject, functionName: cocosMethodName, message: cocosMessage)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,8 @@ class FLTCocosView: UIView {
|
||||
override func layoutSubviews() {
|
||||
super.layoutSubviews()
|
||||
if (!self.bounds.isEmpty) {
|
||||
GetCocosPlayerUtils().ufw?.appController()?.rootView.frame = self.bounds
|
||||
//todo
|
||||
GetCocosPlayerUtils().ufw?.getCocosView()?.frame = self.bounds
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import CocosFramework
|
||||
|
||||
|
||||
// Defines cocos controllable from Flutter.
|
||||
public class FLTCocosWidgetController: NSObject, FLTCocosOptionsSink, FlutterPlatformView {
|
||||
@@ -23,14 +23,16 @@ 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
|
||||
|
||||
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?.setMethodCallHandler(self.methodHandler)
|
||||
@@ -38,6 +40,8 @@ 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)
|
||||
@@ -87,33 +91,35 @@ 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()
|
||||
}
|
||||
|
||||
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: "")
|
||||
}
|
||||
if let cocosView = cocosView {
|
||||
_rootView.addSubview(cocosView)
|
||||
_rootView.layoutIfNeeded()
|
||||
self.channel?.invokeMethod("events#onViewReattached", arguments: "")
|
||||
}
|
||||
GetCocosPlayerUtils().resume()
|
||||
}
|
||||
|
||||
func reattachView() {
|
||||
let cocosView = GetCocosPlayerUtils().ufw?.appController()?.rootView
|
||||
//todo
|
||||
let cocosView = GetCocosPlayerUtils().ufw?.getCocosView()
|
||||
let superview = cocosView?.superview
|
||||
if superview != _rootView {
|
||||
attachView()
|
||||
}
|
||||
}
|
||||
|
||||
GetCocosPlayerUtils().resume()
|
||||
}
|
||||
@@ -123,7 +129,7 @@ public class FLTCocosWidgetController: NSObject, FLTCocosOptionsSink, FlutterPla
|
||||
return
|
||||
}
|
||||
|
||||
let cocosView = GetCocosPlayerUtils().ufw?.appController()?.rootView
|
||||
let cocosView = GetCocosPlayerUtils().ufw?.getCocosView()
|
||||
if _rootView == cocosView?.superview {
|
||||
if globalControllers.isEmpty {
|
||||
cocosView?.removeFromSuperview()
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import Flutter
|
||||
import UIKit
|
||||
|
||||
public class FlutterCocosViewPlugin: NSObject, FlutterPlugin {
|
||||
public class SwiftFlutterCocosViewPlugin: NSObject, FlutterPlugin {
|
||||
public static func register(with registrar: FlutterPluginRegistrar) {
|
||||
let channel = FlutterMethodChannel(name: "flutter_cocos_view", binaryMessenger: registrar.messenger())
|
||||
let instance = FlutterCocosViewPlugin()
|
||||
registrar.addMethodCallDelegate(instance, channel: channel)
|
||||
print("FlutterCocosViewPlugin registered~~~~~~~~~~~~~~") // 添加调试日志
|
||||
|
||||
|
||||
let fuwFactory = FLTCocosWidgetFactory(registrar: registrar)
|
||||
registrar.register(fuwFactory, withId: "plugin.gem.com/cocos_view", gestureRecognizersBlockingPolicy: FlutterPlatformViewGestureRecognizersBlockingPolicyWaitUntilTouchesEnded)
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
#import FlutterCocosWidgetPlugin.h
|
||||
#import "FlutterCocosWidgetPlugin.h"
|
||||
#import <Foundation/Foundation.h>
|
||||
#if __has_include(<flutter_unity_widget/flutter_unity_widget-Swift.h>)
|
||||
#import <flutter_unity_widget/flutter_unity_widget-Swift.h>
|
||||
#if __has_include(<flutter_cocos_view/flutter_cocos_-Swift.h>)
|
||||
#import <flutter_cocos_view/flutter_cocos_view-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_unity_widget-Swift.h"
|
||||
#import <flutter_cocos_view/flutter_cocos_view-Swift.h>
|
||||
#endif
|
||||
|
||||
@implementation FlutterCocosWidgetPlugin {
|
||||
NSObject<FlutterPluginRegistrar>* _registrar;
|
||||
FlutterMethodChannel* _channel;
|
||||
NSMutableDictionary* _unityControllers;
|
||||
NSMutableDictionary* _cocosControllers;
|
||||
}
|
||||
|
||||
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
|
||||
[SwiftFlutterCocosWidgetPlugin registerWithRegistrar:registrar];
|
||||
[SwiftFlutterCocosViewPlugin registerWithRegistrar:registrar];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
8
ios/Classes/flutter_cocos_view-Bridging-Header.h
Normal file
8
ios/Classes/flutter_cocos_view-Bridging-Header.h
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
|
||||
#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,11 +15,17 @@ 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.dependency 'cocos_view_pod','0.1.7'
|
||||
|
||||
#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
|
||||
# Flutter.framework does not contain a i386 slice.
|
||||
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
|
||||
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES'}
|
||||
s.user_target_xcconfig = { 'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES' }
|
||||
s.swift_version = '5.0'
|
||||
|
||||
# If your plugin requires a privacy manifest, for example if it uses any
|
||||
|
||||
@@ -12,7 +12,7 @@ abstract class CocosWidgetController {
|
||||
/// Mainly for internal use when instantiating a [CocosWidgetController] passed
|
||||
/// in [CocosWidget.onCocosCreated] callback.
|
||||
static Future<CocosWidgetController> init(
|
||||
int id, dynamic CocosWidgetState) async {
|
||||
int id, dynamic cocosWidgetState) async {
|
||||
throw UnimplementedError('init() has not been implemented.');
|
||||
}
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ class CocosWidget extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _CocosWidgetState extends State<CocosWidget> {
|
||||
late int _CocosId;
|
||||
late int _cocosId;
|
||||
|
||||
CocosWidgetController? _controller;
|
||||
|
||||
@@ -139,9 +139,9 @@ class _CocosWidgetState extends State<CocosWidget> {
|
||||
super.initState();
|
||||
|
||||
if (!kIsWeb) {
|
||||
_CocosId = _nextCocosCreationId++;
|
||||
_cocosId = _nextCocosCreationId++;
|
||||
} else {
|
||||
_CocosId = 0;
|
||||
_cocosId = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ class _CocosWidgetState extends State<CocosWidget> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final Map<String, dynamic> CocosOptions = <String, dynamic>{
|
||||
final Map<String, dynamic> cocosOptions = <String, dynamic>{
|
||||
'fullscreen': widget.fullscreen,
|
||||
'uiLevel': widget.uiLevel,
|
||||
'hideStatus': widget.hideStatus,
|
||||
@@ -175,9 +175,9 @@ class _CocosWidgetState extends State<CocosWidget> {
|
||||
}
|
||||
|
||||
return CocosWidgetPlatform.instance.buildViewWithTextDirection(
|
||||
_CocosId,
|
||||
_cocosId,
|
||||
_onPlatformViewCreated,
|
||||
cocosOptions: CocosOptions,
|
||||
cocosOptions: cocosOptions,
|
||||
textDirection: widget.layoutDirection ??
|
||||
Directionality.maybeOf(context) ??
|
||||
TextDirection.ltr,
|
||||
|
||||
@@ -40,7 +40,7 @@ class MethodChannelCocosWidget extends CocosWidgetPlatform {
|
||||
MethodChannel ensureChannelInitialized(int cocosId) {
|
||||
MethodChannel? channel = _channels[cocosId];
|
||||
if (channel == null) {
|
||||
channel = MethodChannel('plugin.xraph.com/cocos_view_$cocosId');
|
||||
channel = MethodChannel('plugin.gem.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.xraph.com/cocos_view';
|
||||
final String _viewType = 'plugin.gem.com/cocos_view';
|
||||
|
||||
if (useAndroidViewSurf != null) useAndroidViewSurface = useAndroidViewSurf;
|
||||
|
||||
|
||||
14
pubspec.yaml
14
pubspec.yaml
@@ -1,11 +1,12 @@
|
||||
name: flutter_cocos_view
|
||||
description: "A new Flutter plugin project."
|
||||
version: 0.0.1
|
||||
homepage:
|
||||
homepage: https://www.openim.io
|
||||
|
||||
|
||||
environment:
|
||||
sdk: ^3.4.4
|
||||
flutter: '>=3.3.0'
|
||||
sdk: ">=3.0.0 <4.0.0"
|
||||
flutter: ">=1.20.0"
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
@@ -34,14 +35,15 @@ 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
|
||||
# -------------------
|
||||
some_platform:
|
||||
pluginClass: somePluginClass
|
||||
platforms:
|
||||
ios:
|
||||
pluginClass: FlutterCocosWidgetPlugin
|
||||
|
||||
# -------------------
|
||||
|
||||
# To add assets to your plugin package, add an assets section, like this:
|
||||
|
||||
Reference in New Issue
Block a user