diff --git a/Runtime/Plugins/platform/osx.meta b/Runtime/Plugins/platform/osx.meta new file mode 100644 index 00000000..04943a79 --- /dev/null +++ b/Runtime/Plugins/platform/osx.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b500c0b9b52b448c1a6de52cc372d600 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.meta b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.meta new file mode 100644 index 00000000..bf9022e0 --- /dev/null +++ b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f7b51ed4cf0f74abc970789f8eac5788 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj.meta b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj.meta new file mode 100644 index 00000000..733305c2 --- /dev/null +++ b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 37f7b3d7fe8874417871ad060ce5903a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/project.pbxproj b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/project.pbxproj new file mode 100644 index 00000000..c4495b82 --- /dev/null +++ b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/project.pbxproj @@ -0,0 +1,329 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 0DB63CA222978E91007AFA02 /* UIWidgetsMessageManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0DB63CA022978E91007AFA02 /* UIWidgetsMessageManager.m */; }; + 0DB63CB32297A761007AFA02 /* NSWindow+NSScreenUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 0DB63CB22297A761007AFA02 /* NSWindow+NSScreenUtils.m */; }; + 0DCC9CC92293F026000AA521 /* NSScreenUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 0DCC9CC82293F026000AA521 /* NSScreenUtils.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 0DB63CA022978E91007AFA02 /* UIWidgetsMessageManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIWidgetsMessageManager.m; sourceTree = ""; }; + 0DB63CA122978E91007AFA02 /* UIWidgetsMessageManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIWidgetsMessageManager.h; sourceTree = ""; }; + 0DB63CAE22979CA3007AFA02 /* PrefixHeader.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PrefixHeader.pch; sourceTree = ""; }; + 0DB63CAF22979D4C007AFA02 /* NSScreenUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSScreenUtils.h; sourceTree = ""; }; + 0DB63CB12297A761007AFA02 /* NSWindow+NSScreenUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSWindow+NSScreenUtils.h"; sourceTree = ""; }; + 0DB63CB22297A761007AFA02 /* NSWindow+NSScreenUtils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSWindow+NSScreenUtils.m"; sourceTree = ""; }; + 0DCC9CBF2293F015000AA521 /* NSScreenUtils.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NSScreenUtils.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; + 0DCC9CC22293F015000AA521 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 0DCC9CC82293F026000AA521 /* NSScreenUtils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NSScreenUtils.m; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 0DCC9CBC2293F015000AA521 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 0DB63CA322979543007AFA02 /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = ""; + }; + 0DCC9CB62293F015000AA521 = { + isa = PBXGroup; + children = ( + 0DCC9CC12293F015000AA521 /* NSScreenUtils */, + 0DCC9CC02293F015000AA521 /* Products */, + 0DB63CA322979543007AFA02 /* Frameworks */, + ); + sourceTree = ""; + }; + 0DCC9CC02293F015000AA521 /* Products */ = { + isa = PBXGroup; + children = ( + 0DCC9CBF2293F015000AA521 /* NSScreenUtils.bundle */, + ); + name = Products; + sourceTree = ""; + }; + 0DCC9CC12293F015000AA521 /* NSScreenUtils */ = { + isa = PBXGroup; + children = ( + 0DCC9CC22293F015000AA521 /* Info.plist */, + 0DB63CAE22979CA3007AFA02 /* PrefixHeader.pch */, + 0DB63CA122978E91007AFA02 /* UIWidgetsMessageManager.h */, + 0DB63CA022978E91007AFA02 /* UIWidgetsMessageManager.m */, + 0DB63CAF22979D4C007AFA02 /* NSScreenUtils.h */, + 0DCC9CC82293F026000AA521 /* NSScreenUtils.m */, + 0DB63CB12297A761007AFA02 /* NSWindow+NSScreenUtils.h */, + 0DB63CB22297A761007AFA02 /* NSWindow+NSScreenUtils.m */, + ); + path = NSScreenUtils; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 0DCC9CBE2293F015000AA521 /* NSScreenUtils */ = { + isa = PBXNativeTarget; + buildConfigurationList = 0DCC9CC52293F015000AA521 /* Build configuration list for PBXNativeTarget "NSScreenUtils" */; + buildPhases = ( + 0DCC9CBB2293F015000AA521 /* Sources */, + 0DCC9CBC2293F015000AA521 /* Frameworks */, + 0DCC9CBD2293F015000AA521 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = NSScreenUtils; + productName = NSScreenUtils; + productReference = 0DCC9CBF2293F015000AA521 /* NSScreenUtils.bundle */; + productType = "com.apple.product-type.bundle"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 0DCC9CB72293F015000AA521 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1020; + ORGANIZATIONNAME = "Justin Fincher"; + TargetAttributes = { + 0DCC9CBE2293F015000AA521 = { + CreatedOnToolsVersion = 10.2.1; + }; + }; + }; + buildConfigurationList = 0DCC9CBA2293F015000AA521 /* Build configuration list for PBXProject "NSScreenUtils" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 0DCC9CB62293F015000AA521; + productRefGroup = 0DCC9CC02293F015000AA521 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 0DCC9CBE2293F015000AA521 /* NSScreenUtils */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 0DCC9CBD2293F015000AA521 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 0DCC9CBB2293F015000AA521 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 0DCC9CC92293F026000AA521 /* NSScreenUtils.m in Sources */, + 0DB63CB32297A761007AFA02 /* NSWindow+NSScreenUtils.m in Sources */, + 0DB63CA222978E91007AFA02 /* UIWidgetsMessageManager.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 0DCC9CC32293F015000AA521 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "Mac Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + 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; + MACOSX_DEPLOYMENT_TARGET = 10.14; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 0DCC9CC42293F015000AA521 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "Mac Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + 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; + MACOSX_DEPLOYMENT_TARGET = 10.14; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = macosx; + }; + name = Release; + }; + 0DCC9CC62293F015000AA521 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = 9QJ8M25J77; + GCC_PREFIX_HEADER = NSScreenUtils/PrefixHeader.pch; + INFOPLIST_FILE = NSScreenUtils/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)", + ); + MACOSX_DEPLOYMENT_TARGET = 10.12; + PRODUCT_BUNDLE_IDENTIFIER = com.JustZht.Unity.Cocoa.NSScreenUtils; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + WRAPPER_EXTENSION = bundle; + }; + name = Debug; + }; + 0DCC9CC72293F015000AA521 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = 9QJ8M25J77; + GCC_PREFIX_HEADER = NSScreenUtils/PrefixHeader.pch; + INFOPLIST_FILE = NSScreenUtils/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)", + ); + MACOSX_DEPLOYMENT_TARGET = 10.12; + PRODUCT_BUNDLE_IDENTIFIER = com.JustZht.Unity.Cocoa.NSScreenUtils; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + WRAPPER_EXTENSION = bundle; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 0DCC9CBA2293F015000AA521 /* Build configuration list for PBXProject "NSScreenUtils" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 0DCC9CC32293F015000AA521 /* Debug */, + 0DCC9CC42293F015000AA521 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 0DCC9CC52293F015000AA521 /* Build configuration list for PBXNativeTarget "NSScreenUtils" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 0DCC9CC62293F015000AA521 /* Debug */, + 0DCC9CC72293F015000AA521 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 0DCC9CB72293F015000AA521 /* Project object */; +} diff --git a/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/project.pbxproj.meta b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/project.pbxproj.meta new file mode 100644 index 00000000..4c9b8135 --- /dev/null +++ b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/project.pbxproj.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 1e5036e0db0244eefa916cce9b72e3d2 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/project.xcworkspace.meta b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/project.xcworkspace.meta new file mode 100644 index 00000000..0dcc1f18 --- /dev/null +++ b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/project.xcworkspace.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 35daa91b0e18d462fbd13f835b3fa260 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..e77081c0 --- /dev/null +++ b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/project.xcworkspace/contents.xcworkspacedata.meta b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/project.xcworkspace/contents.xcworkspacedata.meta new file mode 100644 index 00000000..25a16191 --- /dev/null +++ b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/project.xcworkspace/contents.xcworkspacedata.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: b0d6ad5043b124862b852124195ef1aa +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/project.xcworkspace/xcshareddata.meta b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/project.xcworkspace/xcshareddata.meta new file mode 100644 index 00000000..5b1e7db7 --- /dev/null +++ b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/project.xcworkspace/xcshareddata.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d5e7b5890f89c402bb8a283a126e7997 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist.meta b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist.meta new file mode 100644 index 00000000..eb555265 --- /dev/null +++ b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 8618229f3a68a49ae8bc7fd561751fdd +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/project.xcworkspace/xcuserdata.meta b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/project.xcworkspace/xcuserdata.meta new file mode 100644 index 00000000..cc08b526 --- /dev/null +++ b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/project.xcworkspace/xcuserdata.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 702d41e0512454162952a526f02a5bc9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/project.xcworkspace/xcuserdata/fincher.xcuserdatad.meta b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/project.xcworkspace/xcuserdata/fincher.xcuserdatad.meta new file mode 100644 index 00000000..76ef9a19 --- /dev/null +++ b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/project.xcworkspace/xcuserdata/fincher.xcuserdatad.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ee7fbc115e4f34a2193cfffd8f856eec +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/project.xcworkspace/xcuserdata/fincher.xcuserdatad/UserInterfaceState.xcuserstate b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/project.xcworkspace/xcuserdata/fincher.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 00000000..26fd0315 Binary files /dev/null and b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/project.xcworkspace/xcuserdata/fincher.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/project.xcworkspace/xcuserdata/fincher.xcuserdatad/UserInterfaceState.xcuserstate.meta b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/project.xcworkspace/xcuserdata/fincher.xcuserdatad/UserInterfaceState.xcuserstate.meta new file mode 100644 index 00000000..91a0142a --- /dev/null +++ b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/project.xcworkspace/xcuserdata/fincher.xcuserdatad/UserInterfaceState.xcuserstate.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 1fbb6dc5384a94ee0b341ce9b10f4604 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/xcuserdata.meta b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/xcuserdata.meta new file mode 100644 index 00000000..10a7f3cd --- /dev/null +++ b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/xcuserdata.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b2aa9101905314d2593331b170d5613c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/xcuserdata/fincher.xcuserdatad.meta b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/xcuserdata/fincher.xcuserdatad.meta new file mode 100644 index 00000000..ee85bc86 --- /dev/null +++ b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/xcuserdata/fincher.xcuserdatad.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d65a0a84ac1dd434e907fb437e166daf +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/xcuserdata/fincher.xcuserdatad/xcschemes.meta b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/xcuserdata/fincher.xcuserdatad/xcschemes.meta new file mode 100644 index 00000000..38d76822 --- /dev/null +++ b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/xcuserdata/fincher.xcuserdatad/xcschemes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 871009a9902b04c13ae41c4f44fd644b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/xcuserdata/fincher.xcuserdatad/xcschemes/xcschememanagement.plist b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/xcuserdata/fincher.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 00000000..bcf83a2f --- /dev/null +++ b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/xcuserdata/fincher.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + NSScreenUtils.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/xcuserdata/fincher.xcuserdatad/xcschemes/xcschememanagement.plist.meta b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/xcuserdata/fincher.xcuserdatad/xcschemes/xcschememanagement.plist.meta new file mode 100644 index 00000000..a328b059 --- /dev/null +++ b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils.xcodeproj/xcuserdata/fincher.xcuserdatad/xcschemes/xcschememanagement.plist.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: b9dd7c706e01a45b5bb46c20adc3a31c +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/Info.plist b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/Info.plist new file mode 100644 index 00000000..4186e91e --- /dev/null +++ b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + NSHumanReadableCopyright + Copyright © 2019 Justin Fincher. All rights reserved. + NSPrincipalClass + + + diff --git a/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/Info.plist.meta b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/Info.plist.meta new file mode 100644 index 00000000..4e2e3080 --- /dev/null +++ b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/Info.plist.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 074212a30c39e4aac9b138699431bece +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/NSScreenUtils.h b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/NSScreenUtils.h new file mode 100644 index 00000000..b188408f --- /dev/null +++ b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/NSScreenUtils.h @@ -0,0 +1,39 @@ +// +// NSScreenUtils.h +// NSScreenUtils +// +// Created by Justin Fincher on 24/5/2019. +// Copyright © 2019 Justin Fincher. All rights reserved. +// + +#ifndef NSScreenUtils_h +#define NSScreenUtils_h + +typedef void (* UnityOSXCallback)(const char *name,const char *method,const char *arg); + +#ifdef __cplusplus +extern "C" { +#endif + + /** + Set Custom Objective-C to C# Callback + + @param callback callback block + */ + void LinkUnityOSXCallback(UnityOSXCallback callback); + + + /** + A UnitySendMessage clone method for OSX, if there is an offical implementation of UnitySendMessage in Unity standalone player you can replace this with the offical method. + + @param name GameObject name + @param method Method name + @param arg Argument + */ + void UnityOSXSendMessage(const char *name,const char *method,const char *arg); +#ifdef __cplusplus +} +#endif + + +#endif /* NSScreenUtils_h */ diff --git a/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/NSScreenUtils.h.meta b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/NSScreenUtils.h.meta new file mode 100644 index 00000000..c8ebbb6f --- /dev/null +++ b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/NSScreenUtils.h.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: e9ef1660ddc204da9b9555665bd2a892 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 1 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/NSScreenUtils.m b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/NSScreenUtils.m new file mode 100644 index 00000000..f8b3c5f8 --- /dev/null +++ b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/NSScreenUtils.m @@ -0,0 +1,47 @@ +// +// NSScreenUtils.m +// NSScreenUtils +// +// Created by Justin Fincher on 21/5/2019. +// Copyright © 2019 Justin Fincher. All rights reserved. +// + +#import +#import +#import "NSScreenUtils.h" + + +static UnityOSXCallback callback = NULL; + +void LinkUnityOSXCallback(UnityOSXCallback externalCallback) +{ + callback = externalCallback; +} + +void UnityOSXSendMessage(const char *name,const char *method,const char *arg) +{ + if (callback) { + callback(name,method,arg); + } +} + + +/** + Get Screen Scale Factor using NSScreen.backingScaleFactor + + @return scale + */ +float OSXDeviceScaleFactor() +{ + NSArray *ar = [NSApp orderedWindows]; + NSWindow *window = [ar objectAtIndex:0]; + NSScreen *screen = window.screen; + if (!screen) { + screen = [NSScreen mainScreen]; + } + if (screen) + { + return screen.backingScaleFactor; + } + return 1; +} diff --git a/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/NSScreenUtils.m.meta b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/NSScreenUtils.m.meta new file mode 100644 index 00000000..1d199c9d --- /dev/null +++ b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/NSScreenUtils.m.meta @@ -0,0 +1,37 @@ +fileFormatVersion: 2 +guid: 3ee51eff1426a4915902e82cd080ca2c +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 1 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + iPhone: iOS + second: + enabled: 1 + settings: {} + - first: + tvOS: tvOS + second: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/NSWindow+NSScreenUtils.h b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/NSWindow+NSScreenUtils.h new file mode 100644 index 00000000..2e2d1911 --- /dev/null +++ b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/NSWindow+NSScreenUtils.h @@ -0,0 +1,21 @@ +// +// NSWindow+NSScreenUtils.h +// NSScreenUtils +// +// Created by Justin Fincher on 24/5/2019. +// Copyright © 2019 Justin Fincher. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + + +/** + A NSWindow category class for injecting NSScreen notification + */ +@interface NSWindow (NSScreenUtils) + +@end + +NS_ASSUME_NONNULL_END diff --git a/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/NSWindow+NSScreenUtils.h.meta b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/NSWindow+NSScreenUtils.h.meta new file mode 100644 index 00000000..4feedc1d --- /dev/null +++ b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/NSWindow+NSScreenUtils.h.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: efacb2d7d645146a7b93b71bc30f7526 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 1 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/NSWindow+NSScreenUtils.m b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/NSWindow+NSScreenUtils.m new file mode 100644 index 00000000..1352e46b --- /dev/null +++ b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/NSWindow+NSScreenUtils.m @@ -0,0 +1,93 @@ +// +// NSWindow+NSScreenUtils.m +// NSScreenUtils +// +// Created by Justin Fincher on 24/5/2019. +// Copyright © 2019 Justin Fincher. All rights reserved. +// + +#import "NSWindow+NSScreenUtils.h" +#import +#import "UIWidgetsMessageManager.h" + +@implementation NSWindow (NSScreenUtils) + + +/** + Using method swizzling to inject notification on library load. Notice this bundle should be marked as 'Load on Start' in Unity inspector panel + */ ++ (void)load { + NSLog(@"NSWindow + NSScreenUtils Load"); + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^ + { + NSString *bundleIdentifier = [[NSBundle mainBundle] bundleIdentifier]; + if ([bundleIdentifier isEqualToString:@"com.unity3d.UnityEditor5.x"]) { + } + else + { + [UIWidgetsMessageManager getInstance]; + NSLog(@"NSWindow + NSScreenUtils Enabled for %@",bundleIdentifier); + [self exchangeClassMethodMethod:@selector(initWithContentRect:styleMask:backing:defer:) with:@selector(utils_initWithContentRect:styleMask:backing:defer:)]; + [self exchangeClassMethodMethod:@selector(initWithContentRect:styleMask:backing:defer:screen:) with:@selector(utils_initWithContentRect:styleMask:backing:defer:screen:)]; + } + }); +} + + +/** + Swizzling Helper + + @param originalSelector original method + @param swizzledSelector replace method + */ ++ (void)exchangeClassMethodMethod:(SEL)originalSelector with:(SEL)swizzledSelector +{ + Class class = object_getClass((id)self); + Method originalMethod = class_getClassMethod(class, originalSelector); + Method swizzledMethod = class_getClassMethod(class, swizzledSelector); + BOOL didAddMethod = class_addMethod(class, + originalSelector, + method_getImplementation(swizzledMethod), + method_getTypeEncoding(swizzledMethod)); + + if (didAddMethod) { + class_replaceMethod(class, + swizzledSelector, + method_getImplementation(originalMethod), + method_getTypeEncoding(originalMethod)); + } else { + method_exchangeImplementations(originalMethod, swizzledMethod); + } +} + +#pragma mark - Method Swizzling + +- (instancetype)utils_initWithContentRect:(NSRect)contentRect styleMask:(NSWindowStyleMask)style backing:(NSBackingStoreType)backingStoreType defer:(BOOL)flag screen:(NSScreen *)screen +{ + NSWindow * instance = [self utils_initWithContentRect:contentRect styleMask:style backing:backingStoreType defer:flag screen:screen]; + if (instance) { + NSLog(@"utils_initWithContentRect:styleMask:backing:defer:screen:"); + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onWindowDidChangeBackingProperties:) name:NSWindowDidChangeBackingPropertiesNotification object:nil]; + } + return instance; +} +- (instancetype)utils_initWithContentRect:(NSRect)contentRect styleMask:(NSWindowStyleMask)style backing:(NSBackingStoreType)backingStoreType defer:(BOOL)flag +{ + NSWindow * instance = [self utils_initWithContentRect:contentRect styleMask:style backing:backingStoreType defer:flag]; + if (instance) { + NSLog(@"utils_initWithContentRect:styleMask:backing:defer:"); + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onWindowDidChangeBackingProperties:) name:NSWindowDidChangeBackingPropertiesNotification object:nil]; + } + return instance; +} + +#pragma mark - Callback + + +- (void)onWindowDidChangeBackingProperties:(NSNotification *)notification +{ + NSLog(@"onWindowDidChangeBackingProperties"); + [[UIWidgetsMessageManager getInstance] UIWidgetsMethodMessage:@"ViewportMatricsChanged" :@"UIWidgetViewController.keyboardChanged" :[NSArray array]]; +} +@end diff --git a/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/NSWindow+NSScreenUtils.m.meta b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/NSWindow+NSScreenUtils.m.meta new file mode 100644 index 00000000..8d9884d9 --- /dev/null +++ b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/NSWindow+NSScreenUtils.m.meta @@ -0,0 +1,37 @@ +fileFormatVersion: 2 +guid: ab049ac2dac6f45e8b91a121cdc93f7a +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 1 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + iPhone: iOS + second: + enabled: 1 + settings: {} + - first: + tvOS: tvOS + second: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/PrefixHeader.pch b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/PrefixHeader.pch new file mode 100644 index 00000000..a6ea9b7e --- /dev/null +++ b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/PrefixHeader.pch @@ -0,0 +1,17 @@ +// +// PrefixHeader.pch +// NSScreenUtils +// +// Created by Justin Fincher on 24/5/2019. +// Copyright © 2019 Justin Fincher. All rights reserved. +// + +#ifndef PrefixHeader_pch +#define PrefixHeader_pch + +// Include any system framework and library headers here that should be included in all compilation units. +// You will also need to set the Prefix Header build setting of one or more of your targets to reference this file. + + + +#endif /* PrefixHeader_pch */ diff --git a/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/PrefixHeader.pch.meta b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/PrefixHeader.pch.meta new file mode 100644 index 00000000..ff80e479 --- /dev/null +++ b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/PrefixHeader.pch.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 5790e4027ed5b4a9684a1726e55fd796 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/UIWidgetsMessageManager.h b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/UIWidgetsMessageManager.h new file mode 100644 index 00000000..034d606b --- /dev/null +++ b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/UIWidgetsMessageManager.h @@ -0,0 +1,38 @@ +#import + +@interface UIWidgetsMessageManager : NSObject + +@property (nonatomic, retain) NSString *someProperty; + +/** + Get Instance of UIWidgetsMessageManager Singleton + + @return instance + */ ++ (id) getInstance; + + +/** + Send Message From Objective-C to C# & UIWidgets + + @param channel Channel Name + @param method Method Name + @param args Arg Array + */ +- (void) UIWidgetsMethodMessage:(NSString *)channel :(NSString*) method :(NSArray *)args; + +#ifdef __cplusplus +extern "C" { +#endif + + /** + Set Object Name From C# to Objective-C, the value will be stored within UIWidgetsMessageManager + + @param name Object name + */ + void UIWidgetsMessageSetObjectName(const char *name); +#ifdef __cplusplus +} +#endif + +@end diff --git a/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/UIWidgetsMessageManager.h.meta b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/UIWidgetsMessageManager.h.meta new file mode 100644 index 00000000..a2956b77 --- /dev/null +++ b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/UIWidgetsMessageManager.h.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: 678202a350b04494d9d2da7cb36646f0 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 1 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/UIWidgetsMessageManager.m b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/UIWidgetsMessageManager.m new file mode 100644 index 00000000..a8441a37 --- /dev/null +++ b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/UIWidgetsMessageManager.m @@ -0,0 +1,55 @@ +#include "UIWidgetsMessageManager.h" + +static NSString *unityObjectName = NULL; + +@interface UIWidgetsMessageManager() + +@end + +void UnityOSXSendMessage(const char *name,const char *method,const char *arg); + +@implementation UIWidgetsMessageManager + +#pragma mark Singleton Methods + ++ (id)getInstance { + static UIWidgetsMessageManager *sharedMyManager = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + sharedMyManager = [[self alloc] init]; + }); + return sharedMyManager; +} + +- (id)init { + if (self = [super init]) + { + + } + return self; +} + +#pragma mark Message + +void UIWidgetsMessageSetObjectName(const char *name) +{ + NSLog(@"UIWidgetsMessageSetObjectName %@",[NSString stringWithUTF8String:name]); + unityObjectName = [NSString stringWithUTF8String:name]; +} + +- (void)UIWidgetsMethodMessage:(NSString *)channel :(NSString *)method :(NSArray *)args +{ + NSError *error; + NSDictionary* dict = @{ + @"channel": channel, + @"method": method, + @"args": args + }; + + NSData* data = [NSJSONSerialization dataWithJSONObject:dict options:0 error:&error]; + NSString* text = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; + UnityOSXSendMessage([unityObjectName UTF8String], "OnUIWidgetsMethodMessage", [text UTF8String]); +} + +@end + diff --git a/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/UIWidgetsMessageManager.m.meta b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/UIWidgetsMessageManager.m.meta new file mode 100644 index 00000000..c0439fca --- /dev/null +++ b/Runtime/Plugins/platform/osx/.NSScreenUtils/NSScreenUtils/UIWidgetsMessageManager.m.meta @@ -0,0 +1,37 @@ +fileFormatVersion: 2 +guid: a412088e1a3814b2691385ca5029ae84 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 1 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + iPhone: iOS + second: + enabled: 1 + settings: {} + - first: + tvOS: tvOS + second: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Plugins/platform/osx/NSScreenUtils.bundle.meta b/Runtime/Plugins/platform/osx/NSScreenUtils.bundle.meta new file mode 100644 index 00000000..4071bf7b --- /dev/null +++ b/Runtime/Plugins/platform/osx/NSScreenUtils.bundle.meta @@ -0,0 +1,98 @@ +fileFormatVersion: 2 +guid: 649603fe670c342cda3430292a760c41 +folderAsset: yes +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 1 + isOverridable: 1 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + '': Any + second: + enabled: 0 + settings: + Exclude Android: 1 + Exclude Editor: 1 + Exclude Linux: 0 + Exclude Linux64: 0 + Exclude LinuxUniversal: 0 + Exclude OSXUniversal: 0 + Exclude WebGL: 1 + Exclude Win: 0 + Exclude Win64: 0 + - first: + Android: Android + second: + enabled: 0 + settings: + CPU: ARMv7 + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + - first: + Facebook: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Facebook: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Linux + second: + enabled: 1 + settings: + CPU: x86 + - first: + Standalone: Linux64 + second: + enabled: 1 + settings: + CPU: x86_64 + - first: + Standalone: LinuxUniversal + second: + enabled: 1 + settings: + CPU: AnyCPU + - first: + Standalone: OSXUniversal + second: + enabled: 1 + settings: + CPU: AnyCPU + - first: + Standalone: Win + second: + enabled: 1 + settings: + CPU: AnyCPU + - first: + Standalone: Win64 + second: + enabled: 1 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Plugins/platform/osx/NSScreenUtils.bundle/Contents/Info.plist b/Runtime/Plugins/platform/osx/NSScreenUtils.bundle/Contents/Info.plist new file mode 100644 index 00000000..d9bd6bb3 --- /dev/null +++ b/Runtime/Plugins/platform/osx/NSScreenUtils.bundle/Contents/Info.plist @@ -0,0 +1,44 @@ + + + + + BuildMachineOSBuild + 18F132 + CFBundleDevelopmentRegion + en + CFBundleExecutable + NSScreenUtils + CFBundleIdentifier + com.JustZht.Unity.Cocoa.NSScreenUtils + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + NSScreenUtils + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSupportedPlatforms + + MacOSX + + CFBundleVersion + 1 + DTCompiler + com.apple.compilers.llvm.clang.1_0 + DTPlatformBuild + 10E1001 + DTPlatformVersion + GM + DTSDKBuild + 18E219 + DTSDKName + macosx10.14 + DTXcode + 1020 + DTXcodeBuild + 10E1001 + NSHumanReadableCopyright + Copyright © 2019 Justin Fincher. All rights reserved. + + diff --git a/Runtime/Plugins/platform/osx/NSScreenUtils.bundle/Contents/MacOS/NSScreenUtils b/Runtime/Plugins/platform/osx/NSScreenUtils.bundle/Contents/MacOS/NSScreenUtils new file mode 100755 index 00000000..cedc70fb Binary files /dev/null and b/Runtime/Plugins/platform/osx/NSScreenUtils.bundle/Contents/MacOS/NSScreenUtils differ diff --git a/Runtime/Plugins/platform/osx/NSScreenUtils.bundle/Contents/_CodeSignature/CodeResources b/Runtime/Plugins/platform/osx/NSScreenUtils.bundle/Contents/_CodeSignature/CodeResources new file mode 100644 index 00000000..d5d0fd74 --- /dev/null +++ b/Runtime/Plugins/platform/osx/NSScreenUtils.bundle/Contents/_CodeSignature/CodeResources @@ -0,0 +1,115 @@ + + + + + files + + files2 + + rules + + ^Resources/ + + ^Resources/.*\.lproj/ + + optional + + weight + 1000 + + ^Resources/.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Resources/Base\.lproj/ + + weight + 1010 + + ^version.plist$ + + + rules2 + + .*\.dSYM($|/) + + weight + 11 + + ^(.*/)?\.DS_Store$ + + omit + + weight + 2000 + + ^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/ + + nested + + weight + 10 + + ^.* + + ^Info\.plist$ + + omit + + weight + 20 + + ^PkgInfo$ + + omit + + weight + 20 + + ^Resources/ + + weight + 20 + + ^Resources/.*\.lproj/ + + optional + + weight + 1000 + + ^Resources/.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Resources/Base\.lproj/ + + weight + 1010 + + ^[^/]+$ + + nested + + weight + 10 + + ^embedded\.provisionprofile$ + + weight + 20 + + ^version\.plist$ + + weight + 20 + + + + diff --git a/Runtime/engine/DisplayMetrics.cs b/Runtime/engine/DisplayMetrics.cs index dc845237..ab0e71cc 100644 --- a/Runtime/engine/DisplayMetrics.cs +++ b/Runtime/engine/DisplayMetrics.cs @@ -48,6 +48,8 @@ public void OnGUI() { public void Update() { //view metrics marks dirty this._viewMetrics = null; + //mark devicePixelRatio dirty + this._devicePixelRatio = -1; } @@ -68,6 +70,10 @@ public float devicePixelRatio { #if UNITY_IOS this._devicePixelRatio = IOSDeviceScaleFactor(); #endif + +#if UNITY_STANDALONE_OSX + this._devicePixelRatio = OSXDeviceScaleFactor(); +#endif if (this._devicePixelRatio <= 0) { this._devicePixelRatio = 1; @@ -188,5 +194,11 @@ static float AndroidDevicePixelRatio() { [DllImport("__Internal")] static extern viewMetrics IOSGetViewportPadding(); #endif + +#if UNITY_STANDALONE_OSX + [DllImport("NSScreenUtils")] + static extern float OSXDeviceScaleFactor(); +#endif + } } \ No newline at end of file diff --git a/Runtime/engine/UIWidgetsMessageManager.cs b/Runtime/engine/UIWidgetsMessageManager.cs index 90756b90..ed1e7411 100644 --- a/Runtime/engine/UIWidgetsMessageManager.cs +++ b/Runtime/engine/UIWidgetsMessageManager.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.Runtime.InteropServices; using Unity.UIWidgets.external.simplejson; @@ -28,10 +29,30 @@ internal static void ensureUIWidgetsMessageManagerIfNeeded() { managerObj.AddComponent(); } -#if UNITY_IOS || UNITY_ANDROID || UNITY_WEBGL +#if UNITY_IOS || UNITY_ANDROID || UNITY_WEBGL || UNITY_STANDALONE_OSX string _lastObjectName; #endif +#if UNITY_STANDALONE_OSX + public delegate void UnityOSXCallbackDelegate(IntPtr name, IntPtr method, IntPtr arg); +#endif + + void Awake() { +#if UNITY_STANDALONE_OSX + // Call native code to construct a UnitySendMessage clone for macOS player. If there is an official way to call UnitySendMessage in macOS plugin please replace this. + LinkUnityOSXCallback((namePtr, methodPtr, argPtr) => { + string name = Marshal.PtrToStringAuto(namePtr); + string method = Marshal.PtrToStringAuto(methodPtr); + string arg = Marshal.PtrToStringAuto(argPtr); + + GameObject foundGameObject = GameObject.Find(name); + if (foundGameObject != null) { + foundGameObject.SendMessage(method,arg); + } + }); +#endif + } + void OnEnable() { D.assert(_instance == null, () => "Only one instance of UIWidgetsMessageManager should exists"); _instance = this; @@ -48,7 +69,7 @@ void Update() { } void UpdateNameIfNeed() { -#if UNITY_IOS || UNITY_ANDROID || UNITY_WEBGL +#if UNITY_IOS || UNITY_ANDROID || UNITY_WEBGL || UNITY_STANDALONE_OSX var name = this.gameObject.name; if (name != this._lastObjectName) { @@ -93,7 +114,6 @@ void OnUIWidgetsMethodMessage(string message) { [DllImport("__Internal")] static extern void UIWidgetsMessageSetObjectName(string objectName); #elif UNITY_ANDROID - static void UIWidgetsMessageSetObjectName(string objectName) { using ( AndroidJavaClass managerClass = new AndroidJavaClass("com.unity.uiwidgets.plugin.UIWidgetsMessageManager") @@ -105,7 +125,18 @@ static void UIWidgetsMessageSetObjectName(string objectName) { } } } +#elif UNITY_STANDALONE_OSX + [DllImport("NSScreenUtils")] + static extern void UIWidgetsMessageSetObjectName(string objectName); + + /// + /// Call this method to connect native SendMessage function to the osxCallbackDelegate delegate + /// + /// Native message handler + [DllImport("NSScreenUtils")] + static extern void LinkUnityOSXCallback( + [MarshalAs(UnmanagedType.FunctionPtr)] UnityOSXCallbackDelegate osxCallbackDelegate); #endif - + } } \ No newline at end of file