fix:1、添加跳链接的webview的插件。2、修复bug
This commit is contained in:
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,58 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 60e7bf38137eb4950b2f02b7d57c1ad3
|
||||
folderAsset: yes
|
||||
PluginImporter:
|
||||
serializedVersion: 1
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
isPreloaded: 0
|
||||
platformData:
|
||||
Android:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
Any:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
Editor:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
DefaultValueInitialized: true
|
||||
OS: OSX
|
||||
Linux:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: x86
|
||||
Linux64:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: x86_64
|
||||
OSXIntel:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
OSXIntel64:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
OSXUniversal:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
Win:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
Win64:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
iOS:
|
||||
enabled: 0
|
||||
settings:
|
||||
CompileFlags:
|
||||
FrameworkDependencies:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>BuildMachineOSBuild</key>
|
||||
<string>25F80</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>WebView</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>net.gree.unitywebview.WebView</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>WebView</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleSupportedPlatforms</key>
|
||||
<array>
|
||||
<string>MacOSX</string>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>DTCompiler</key>
|
||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||
<key>DTPlatformBuild</key>
|
||||
<string>25F70</string>
|
||||
<key>DTPlatformName</key>
|
||||
<string>macosx</string>
|
||||
<key>DTPlatformVersion</key>
|
||||
<string>26.5</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>25F70</string>
|
||||
<key>DTSDKName</key>
|
||||
<string>macosx26.5</string>
|
||||
<key>DTXcode</key>
|
||||
<string>2650</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>17F42</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.13</string>
|
||||
</dict>
|
||||
</plist>
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,128 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>files</key>
|
||||
<dict>
|
||||
<key>Resources/InfoPlist.strings</key>
|
||||
<data>
|
||||
MiLKDDnrUKr4EmuvhS5VQwxHGK8=
|
||||
</data>
|
||||
</dict>
|
||||
<key>files2</key>
|
||||
<dict>
|
||||
<key>Resources/InfoPlist.strings</key>
|
||||
<dict>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
Oc8u4Ht7Mz58F50L9NeYpbcq9qTlhPUeZCcDu/pPyCg=
|
||||
</data>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>rules</key>
|
||||
<dict>
|
||||
<key>^Resources/</key>
|
||||
<true/>
|
||||
<key>^Resources/.*\.lproj/</key>
|
||||
<dict>
|
||||
<key>optional</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1000</real>
|
||||
</dict>
|
||||
<key>^Resources/.*\.lproj/locversion.plist$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1100</real>
|
||||
</dict>
|
||||
<key>^Resources/Base\.lproj/</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>1010</real>
|
||||
</dict>
|
||||
<key>^version.plist$</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>rules2</key>
|
||||
<dict>
|
||||
<key>.*\.dSYM($|/)</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>11</real>
|
||||
</dict>
|
||||
<key>^(.*/)?\.DS_Store$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>2000</real>
|
||||
</dict>
|
||||
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
|
||||
<dict>
|
||||
<key>nested</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>10</real>
|
||||
</dict>
|
||||
<key>^.*</key>
|
||||
<true/>
|
||||
<key>^Info\.plist$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^PkgInfo$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^Resources/</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^Resources/.*\.lproj/</key>
|
||||
<dict>
|
||||
<key>optional</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1000</real>
|
||||
</dict>
|
||||
<key>^Resources/.*\.lproj/locversion.plist$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1100</real>
|
||||
</dict>
|
||||
<key>^Resources/Base\.lproj/</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>1010</real>
|
||||
</dict>
|
||||
<key>^[^/]+$</key>
|
||||
<dict>
|
||||
<key>nested</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>10</real>
|
||||
</dict>
|
||||
<key>^embedded\.provisionprofile$</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^version\.plist$</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9a69d5fe42677e84b8100f858cb66df7
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0763797fead754049b4255cee0993cb7
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,4 @@
|
||||
Place the Windows WebView plugin DLL here:
|
||||
WebView.dll (64-bit, built from plugins/Windows)
|
||||
|
||||
Build instructions: see plugins/Windows/README.md
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f62969be983297d4aa100a72a1ef672d
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,70 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8c2ac249de280af4ca5514719b5a934a
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
: Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 1
|
||||
Exclude Editor: 0
|
||||
Exclude Linux64: 0
|
||||
Exclude OSXUniversal: 0
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 0
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: ARMv7
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: x86_64
|
||||
DefaultValueInitialized: true
|
||||
OS: Windows
|
||||
- first:
|
||||
Standalone: Linux64
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: OSXUniversal
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: x86_64
|
||||
- first:
|
||||
Standalone: Win
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: Win64
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: x86_64
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 796e71d62d97fe14fa9d58010d2976fb
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,4 @@
|
||||
Place the Windows WebView plugin DLL here:
|
||||
WebView.dll (32-bit, built from plugins/Windows)
|
||||
|
||||
Build instructions: see plugins/Windows/README.md
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea032e1e67ffb2845b15ed2d0ca48d7a
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,70 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ed66942567a0baa4e99daba51749d1c5
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
: Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 1
|
||||
Exclude Editor: 0
|
||||
Exclude Linux64: 0
|
||||
Exclude OSXUniversal: 0
|
||||
Exclude Win: 0
|
||||
Exclude Win64: 1
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: ARMv7
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: x86
|
||||
DefaultValueInitialized: true
|
||||
OS: Windows
|
||||
- first:
|
||||
Standalone: Linux64
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: OSXUniversal
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: x86_64
|
||||
- first:
|
||||
Standalone: Win
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: x86
|
||||
- first:
|
||||
Standalone: Win64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+101
-10
@@ -129,6 +129,7 @@ extern "C" void UnitySendMessage(const char *, const char *, const char *);
|
||||
UIView <WebViewProtocol> *webView;
|
||||
NSString *gameObjectName;
|
||||
NSMutableDictionary *customRequestHeader;
|
||||
BOOL googleAppRedirectionEnabled;
|
||||
BOOL alertDialogEnabled;
|
||||
NSRegularExpression *allowRegex;
|
||||
NSRegularExpression *denyRegex;
|
||||
@@ -154,6 +155,7 @@ static NSMutableArray *_instances = [[NSMutableArray alloc] init];
|
||||
|
||||
gameObjectName = [NSString stringWithUTF8String:gameObjectName_];
|
||||
customRequestHeader = [[NSMutableDictionary alloc] init];
|
||||
googleAppRedirectionEnabled = false;
|
||||
alertDialogEnabled = true;
|
||||
allowRegex = nil;
|
||||
denyRegex = nil;
|
||||
@@ -169,7 +171,8 @@ static NSMutableArray *_instances = [[NSMutableArray alloc] init];
|
||||
WKUserContentController *controller = [[WKUserContentController alloc] init];
|
||||
[controller addScriptMessageHandler:[[WeakScriptMessageDelegate alloc] initWithDelegate:self] name:@"unityControl"];
|
||||
[controller addScriptMessageHandler:[[WeakScriptMessageDelegate alloc] initWithDelegate:self] name:@"saveDataURL"];
|
||||
NSString *str = @"\
|
||||
{
|
||||
NSString *str = @"\
|
||||
window.Unity = { \
|
||||
call: function(msg) { \
|
||||
window.webkit.messageHandlers.unityControl.postMessage(msg); \
|
||||
@@ -179,8 +182,11 @@ window.Unity = { \
|
||||
} \
|
||||
}; \
|
||||
";
|
||||
WKUserScript *script = [[WKUserScript alloc] initWithSource:str injectionTime:WKUserScriptInjectionTimeAtDocumentStart forMainFrameOnly:YES];
|
||||
[controller addUserScript:script];
|
||||
}
|
||||
if (!zoom) {
|
||||
str = [str stringByAppendingString:@"\
|
||||
NSString *str = @"\
|
||||
(function() { \
|
||||
var meta = document.querySelector('meta[name=viewport]'); \
|
||||
if (meta == null) { \
|
||||
@@ -191,12 +197,10 @@ window.Unity = { \
|
||||
var head = document.getElementsByTagName('head')[0]; \
|
||||
head.appendChild(meta); \
|
||||
})(); \
|
||||
"
|
||||
];
|
||||
";
|
||||
WKUserScript *script = [[WKUserScript alloc] initWithSource:str injectionTime:WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:YES];
|
||||
[controller addUserScript:script];
|
||||
}
|
||||
WKUserScript *script
|
||||
= [[WKUserScript alloc] initWithSource:str injectionTime:WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:YES];
|
||||
[controller addUserScript:script];
|
||||
configuration.userContentController = controller;
|
||||
configuration.allowsInlineMediaPlayback = true;
|
||||
if (@available(iOS 10.0, *)) {
|
||||
@@ -267,6 +271,12 @@ window.Unity = { \
|
||||
|
||||
[view addSubview:webView];
|
||||
|
||||
//set webview for Unity 6 accessibility hierarchy
|
||||
NSMutableArray<UIAccessibilityElement *> *accessibilityElements
|
||||
= view.accessibilityElements ? [view.accessibilityElements mutableCopy] : [NSMutableArray array];
|
||||
[accessibilityElements addObject:(UIAccessibilityElement *)webView];
|
||||
view.accessibilityElements = accessibilityElements;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -284,6 +294,13 @@ window.Unity = { \
|
||||
[webView0 stopLoading];
|
||||
[webView0 removeFromSuperview];
|
||||
[webView0 removeObserver:self forKeyPath:@"loading"];
|
||||
|
||||
//remove the WebViewObject from Unity hierarchy tree
|
||||
UIView *view = UnityGetGLViewController().view;
|
||||
NSMutableArray<UIAccessibilityElement *> *accessibilityElements
|
||||
= view.accessibilityElements ? [view.accessibilityElements mutableCopy] : [NSMutableArray array];
|
||||
[accessibilityElements removeObject: (UIAccessibilityElement *)webView0];
|
||||
view.accessibilityElements = accessibilityElements;
|
||||
}
|
||||
basicAuthPassword = nil;
|
||||
basicAuthUserName = nil;
|
||||
@@ -306,6 +323,42 @@ window.Unity = { \
|
||||
}];
|
||||
}
|
||||
|
||||
+ (void)clearCookie:(const char *)name of:(const char *)url
|
||||
{
|
||||
NSURL *nsurl = [NSURL URLWithString:[[NSString alloc] initWithUTF8String:url]];
|
||||
if (nsurl == nil) {
|
||||
return;
|
||||
}
|
||||
NSString *nsname = [NSString stringWithUTF8String:name];
|
||||
if (@available(iOS 9.0, *)) {
|
||||
WKHTTPCookieStore *cookieStore = WKWebsiteDataStore.defaultDataStore.httpCookieStore;
|
||||
[cookieStore
|
||||
getAllCookies:^(NSArray<NSHTTPCookie *> *array) {
|
||||
[array
|
||||
enumerateObjectsUsingBlock:^(NSHTTPCookie *cookie, NSUInteger idx, BOOL *stop) {
|
||||
if ([cookie.name isEqualToString:nsname]
|
||||
&& [cookie.domain isEqualToString:nsurl.host]
|
||||
&& [cookie.path isEqualToString:nsurl.path]) {
|
||||
[cookieStore deleteCookie:cookie completionHandler:^{}];
|
||||
}
|
||||
}];
|
||||
}];
|
||||
} else {
|
||||
NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
|
||||
if (cookieStorage == nil) {
|
||||
// cf. https://stackoverflow.com/questions/33876295/nshttpcookiestorage-sharedhttpcookiestorage-comes-up-empty-in-10-11
|
||||
cookieStorage = [NSHTTPCookieStorage sharedCookieStorageForGroupContainerIdentifier:@"Cookies"];
|
||||
}
|
||||
[[cookieStorage cookies] enumerateObjectsUsingBlock:^(NSHTTPCookie *cookie, NSUInteger idx, BOOL *stop) {
|
||||
if ([cookie.name isEqualToString:nsname]
|
||||
&& [cookie.domain isEqualToString:nsurl.host]
|
||||
&& [cookie.path isEqualToString:nsurl.path]) {
|
||||
[cookieStorage deleteCookie:cookie];
|
||||
}
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
+ (void)clearCookies
|
||||
{
|
||||
[CWebViewPlugin resetSharedProcessPool];
|
||||
@@ -537,7 +590,11 @@ window.Unity = { \
|
||||
return;
|
||||
}
|
||||
if ([url rangeOfString:@"//itunes.apple.com/"].location != NSNotFound) {
|
||||
[[UIApplication sharedApplication] openURL:nsurl];
|
||||
if (@available(iOS 10.0, *)) {
|
||||
[[UIApplication sharedApplication] openURL:nsurl options:@{} completionHandler:nil];
|
||||
} else {
|
||||
[[UIApplication sharedApplication] openURL:nsurl];
|
||||
}
|
||||
decisionHandler(WKNavigationActionPolicyCancel);
|
||||
return;
|
||||
} else if ([url hasPrefix:@"unity:"]) {
|
||||
@@ -554,7 +611,11 @@ window.Unity = { \
|
||||
&& ![url hasPrefix:@"http:"]
|
||||
&& ![url hasPrefix:@"https:"]) {
|
||||
if([[UIApplication sharedApplication] canOpenURL:nsurl]) {
|
||||
[[UIApplication sharedApplication] openURL:nsurl];
|
||||
if (@available(iOS 10.0, *)) {
|
||||
[[UIApplication sharedApplication] openURL:nsurl options:@{} completionHandler:nil];
|
||||
} else {
|
||||
[[UIApplication sharedApplication] openURL:nsurl];
|
||||
}
|
||||
}
|
||||
decisionHandler(WKNavigationActionPolicyCancel);
|
||||
return;
|
||||
@@ -568,7 +629,7 @@ window.Unity = { \
|
||||
if (navigationAction.targetFrame != nil && navigationAction.targetFrame.isMainFrame) {
|
||||
// If the custom header is not attached, give it and make a request again.
|
||||
if (![self isSetupedCustomHeader:[navigationAction request]]) {
|
||||
NSLog(@"navi ... %@", navigationAction);
|
||||
//NSLog(@"navi ... %@", navigationAction);
|
||||
[wkWebView loadRequest:[self constructionCustomHeader:navigationAction.request]];
|
||||
decisionHandler(WKNavigationActionPolicyCancel);
|
||||
return;
|
||||
@@ -576,6 +637,14 @@ window.Unity = { \
|
||||
}
|
||||
}
|
||||
UnitySendMessage([gameObjectName UTF8String], "CallOnStarted", [url UTF8String]);
|
||||
// cf. https://stackoverflow.com/questions/37086605/disable-wkwebview-for-opening-links-to-redirect-to-apps-installed-on-my-iphone/76948270#76948270
|
||||
if (!googleAppRedirectionEnabled
|
||||
&& [url hasPrefix:@"https://www.google.com/"]
|
||||
&& navigationAction.navigationType == WKNavigationTypeLinkActivated) {
|
||||
[webView load:navigationAction.request];
|
||||
decisionHandler(WKNavigationActionPolicyCancel);
|
||||
return;
|
||||
}
|
||||
decisionHandler(WKNavigationActionPolicyAllow);
|
||||
}
|
||||
|
||||
@@ -737,6 +806,13 @@ window.Unity = { \
|
||||
webView.userInteractionEnabled = enabled;
|
||||
}
|
||||
|
||||
- (void)setGoogleAppRedirectionEnabled:(BOOL)enabled
|
||||
{
|
||||
if (webView == nil)
|
||||
return;
|
||||
googleAppRedirectionEnabled = enabled;
|
||||
}
|
||||
|
||||
- (void)setAlertDialogEnabled:(BOOL)enabled
|
||||
{
|
||||
alertDialogEnabled = enabled;
|
||||
@@ -951,6 +1027,7 @@ extern "C" {
|
||||
void *instance, float left, float top, float right, float bottom, BOOL relative);
|
||||
void _CWebViewPlugin_SetVisibility(void *instance, BOOL visibility);
|
||||
void _CWebViewPlugin_SetInteractionEnabled(void *instance, BOOL enabled);
|
||||
void _CWebViewPlugin_SetGoogleAppRedirectionEnabled(void *instance, BOOL enabled);
|
||||
void _CWebViewPlugin_SetAlertDialogEnabled(void *instance, BOOL visibility);
|
||||
void _CWebViewPlugin_SetScrollbarsVisibility(void *instance, BOOL visibility);
|
||||
void _CWebViewPlugin_SetScrollBounceEnabled(void *instance, BOOL enabled);
|
||||
@@ -967,6 +1044,7 @@ extern "C" {
|
||||
void _CWebViewPlugin_AddCustomHeader(void *instance, const char *headerKey, const char *headerValue);
|
||||
void _CWebViewPlugin_RemoveCustomHeader(void *instance, const char *headerKey);
|
||||
void _CWebViewPlugin_ClearCustomHeader(void *instance);
|
||||
void _CWebViewPlugin_ClearCookie(const char *url, const char *name);
|
||||
void _CWebViewPlugin_ClearCookies();
|
||||
void _CWebViewPlugin_SaveCookies();
|
||||
void _CWebViewPlugin_GetCookies(void *instance, const char *url);
|
||||
@@ -1040,6 +1118,14 @@ void _CWebViewPlugin_SetInteractionEnabled(void *instance, BOOL enabled)
|
||||
[webViewPlugin setInteractionEnabled:enabled];
|
||||
}
|
||||
|
||||
void _CWebViewPlugin_SetGoogleAppRedirectionEnabled(void *instance, BOOL enabled)
|
||||
{
|
||||
if (instance == NULL)
|
||||
return;
|
||||
CWebViewPlugin *webViewPlugin = (__bridge CWebViewPlugin *)instance;
|
||||
[webViewPlugin setGoogleAppRedirectionEnabled:enabled];
|
||||
}
|
||||
|
||||
void _CWebViewPlugin_SetAlertDialogEnabled(void *instance, BOOL enabled)
|
||||
{
|
||||
if (instance == NULL)
|
||||
@@ -1168,6 +1254,11 @@ void _CWebViewPlugin_ClearCustomHeader(void *instance)
|
||||
[webViewPlugin clearCustomRequestHeader];
|
||||
}
|
||||
|
||||
void _CWebViewPlugin_ClearCookie(const char *url, const char *name)
|
||||
{
|
||||
[CWebViewPlugin clearCookie:name of:url];
|
||||
}
|
||||
|
||||
void _CWebViewPlugin_ClearCookies()
|
||||
{
|
||||
[CWebViewPlugin clearCookies];
|
||||
|
||||
@@ -182,6 +182,7 @@ extern "C" void UnitySendMessage(const char *, const char *, const char *);
|
||||
UIView <WebViewProtocol> *webView;
|
||||
NSString *gameObjectName;
|
||||
NSMutableDictionary *customRequestHeader;
|
||||
BOOL googleAppRedirectionEnabled;
|
||||
BOOL alertDialogEnabled;
|
||||
NSRegularExpression *allowRegex;
|
||||
NSRegularExpression *denyRegex;
|
||||
@@ -207,6 +208,7 @@ static NSMutableArray *_instances = [[NSMutableArray alloc] init];
|
||||
|
||||
gameObjectName = [NSString stringWithUTF8String:gameObjectName_];
|
||||
customRequestHeader = [[NSMutableDictionary alloc] init];
|
||||
googleAppRedirectionEnabled = false;
|
||||
alertDialogEnabled = true;
|
||||
allowRegex = nil;
|
||||
denyRegex = nil;
|
||||
@@ -222,7 +224,8 @@ static NSMutableArray *_instances = [[NSMutableArray alloc] init];
|
||||
WKUserContentController *controller = [[WKUserContentController alloc] init];
|
||||
[controller addScriptMessageHandler:[[WeakScriptMessageDelegate alloc] initWithDelegate:self] name:@"unityControl"];
|
||||
[controller addScriptMessageHandler:[[WeakScriptMessageDelegate alloc] initWithDelegate:self] name:@"saveDataURL"];
|
||||
NSString *str = @"\
|
||||
{
|
||||
NSString *str = @"\
|
||||
window.Unity = { \
|
||||
call: function(msg) { \
|
||||
window.webkit.messageHandlers.unityControl.postMessage(msg); \
|
||||
@@ -232,8 +235,11 @@ window.Unity = { \
|
||||
} \
|
||||
}; \
|
||||
";
|
||||
WKUserScript *script = [[WKUserScript alloc] initWithSource:str injectionTime:WKUserScriptInjectionTimeAtDocumentStart forMainFrameOnly:YES];
|
||||
[controller addUserScript:script];
|
||||
}
|
||||
if (!zoom) {
|
||||
str = [str stringByAppendingString:@"\
|
||||
NSString *str = @"\
|
||||
(function() { \
|
||||
var meta = document.querySelector('meta[name=viewport]'); \
|
||||
if (meta == null) { \
|
||||
@@ -244,12 +250,10 @@ window.Unity = { \
|
||||
var head = document.getElementsByTagName('head')[0]; \
|
||||
head.appendChild(meta); \
|
||||
})(); \
|
||||
"
|
||||
];
|
||||
";
|
||||
WKUserScript *script = [[WKUserScript alloc] initWithSource:str injectionTime:WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:YES];
|
||||
[controller addUserScript:script];
|
||||
}
|
||||
WKUserScript *script
|
||||
= [[WKUserScript alloc] initWithSource:str injectionTime:WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:YES];
|
||||
[controller addUserScript:script];
|
||||
configuration.userContentController = controller;
|
||||
configuration.allowsInlineMediaPlayback = true;
|
||||
if (@available(iOS 10.0, *)) {
|
||||
@@ -368,6 +372,42 @@ window.Unity = { \
|
||||
}];
|
||||
}
|
||||
|
||||
+ (void)clearCookie:(const char *)name of:(const char *)url
|
||||
{
|
||||
NSURL *nsurl = [NSURL URLWithString:[[NSString alloc] initWithUTF8String:url]];
|
||||
if (nsurl == nil) {
|
||||
return;
|
||||
}
|
||||
NSString *nsname = [NSString stringWithUTF8String:name];
|
||||
if (@available(iOS 9.0, *)) {
|
||||
WKHTTPCookieStore *cookieStore = WKWebsiteDataStore.defaultDataStore.httpCookieStore;
|
||||
[cookieStore
|
||||
getAllCookies:^(NSArray<NSHTTPCookie *> *array) {
|
||||
[array
|
||||
enumerateObjectsUsingBlock:^(NSHTTPCookie *cookie, NSUInteger idx, BOOL *stop) {
|
||||
if ([cookie.name isEqualToString:nsname]
|
||||
&& [cookie.domain isEqualToString:nsurl.host]
|
||||
&& [cookie.path isEqualToString:nsurl.path]) {
|
||||
[cookieStore deleteCookie:cookie completionHandler:^{}];
|
||||
}
|
||||
}];
|
||||
}];
|
||||
} else {
|
||||
NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
|
||||
if (cookieStorage == nil) {
|
||||
// cf. https://stackoverflow.com/questions/33876295/nshttpcookiestorage-sharedhttpcookiestorage-comes-up-empty-in-10-11
|
||||
cookieStorage = [NSHTTPCookieStorage sharedCookieStorageForGroupContainerIdentifier:@"Cookies"];
|
||||
}
|
||||
[[cookieStorage cookies] enumerateObjectsUsingBlock:^(NSHTTPCookie *cookie, NSUInteger idx, BOOL *stop) {
|
||||
if ([cookie.name isEqualToString:nsname]
|
||||
&& [cookie.domain isEqualToString:nsurl.host]
|
||||
&& [cookie.path isEqualToString:nsurl.path]) {
|
||||
[cookieStorage deleteCookie:cookie];
|
||||
}
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
+ (void)clearCookies
|
||||
{
|
||||
[CWebViewPlugin resetSharedProcessPool];
|
||||
@@ -606,7 +646,11 @@ window.Unity = { \
|
||||
return NO;
|
||||
}
|
||||
if ([url rangeOfString:@"//itunes.apple.com/"].location != NSNotFound) {
|
||||
[[UIApplication sharedApplication] openURL:nsurl];
|
||||
if (@available(iOS 10.0, *)) {
|
||||
[[UIApplication sharedApplication] openURL:nsurl options:@{} completionHandler:nil];
|
||||
} else {
|
||||
[[UIApplication sharedApplication] openURL:nsurl];
|
||||
}
|
||||
return NO;
|
||||
} else if ([url hasPrefix:@"unity:"]) {
|
||||
UnitySendMessage([gameObjectName UTF8String], "CallFromJS", [[url substringFromIndex:6] UTF8String]);
|
||||
@@ -652,7 +696,11 @@ window.Unity = { \
|
||||
return;
|
||||
}
|
||||
if ([url rangeOfString:@"//itunes.apple.com/"].location != NSNotFound) {
|
||||
[[UIApplication sharedApplication] openURL:nsurl];
|
||||
if (@available(iOS 10.0, *)) {
|
||||
[[UIApplication sharedApplication] openURL:nsurl options:@{} completionHandler:nil];
|
||||
} else {
|
||||
[[UIApplication sharedApplication] openURL:nsurl];
|
||||
}
|
||||
decisionHandler(WKNavigationActionPolicyCancel);
|
||||
return;
|
||||
} else if ([url hasPrefix:@"unity:"]) {
|
||||
@@ -669,7 +717,11 @@ window.Unity = { \
|
||||
&& ![url hasPrefix:@"http:"]
|
||||
&& ![url hasPrefix:@"https:"]) {
|
||||
if([[UIApplication sharedApplication] canOpenURL:nsurl]) {
|
||||
[[UIApplication sharedApplication] openURL:nsurl];
|
||||
if (@available(iOS 10.0, *)) {
|
||||
[[UIApplication sharedApplication] openURL:nsurl options:@{} completionHandler:nil];
|
||||
} else {
|
||||
[[UIApplication sharedApplication] openURL:nsurl];
|
||||
}
|
||||
}
|
||||
decisionHandler(WKNavigationActionPolicyCancel);
|
||||
return;
|
||||
@@ -683,7 +735,7 @@ window.Unity = { \
|
||||
if (navigationAction.targetFrame != nil && navigationAction.targetFrame.isMainFrame) {
|
||||
// If the custom header is not attached, give it and make a request again.
|
||||
if (![self isSetupedCustomHeader:[navigationAction request]]) {
|
||||
NSLog(@"navi ... %@", navigationAction);
|
||||
//NSLog(@"navi ... %@", navigationAction);
|
||||
[wkWebView loadRequest:[self constructionCustomHeader:navigationAction.request]];
|
||||
decisionHandler(WKNavigationActionPolicyCancel);
|
||||
return;
|
||||
@@ -691,6 +743,14 @@ window.Unity = { \
|
||||
}
|
||||
}
|
||||
UnitySendMessage([gameObjectName UTF8String], "CallOnStarted", [url UTF8String]);
|
||||
// cf. https://stackoverflow.com/questions/37086605/disable-wkwebview-for-opening-links-to-redirect-to-apps-installed-on-my-iphone/76948270#76948270
|
||||
if (!googleAppRedirectionEnabled
|
||||
&& [url hasPrefix:@"https://www.google.com/"]
|
||||
&& navigationAction.navigationType == WKNavigationTypeLinkActivated) {
|
||||
[webView load:navigationAction.request];
|
||||
decisionHandler(WKNavigationActionPolicyCancel);
|
||||
return;
|
||||
}
|
||||
decisionHandler(WKNavigationActionPolicyAllow);
|
||||
}
|
||||
|
||||
@@ -852,6 +912,13 @@ window.Unity = { \
|
||||
webView.userInteractionEnabled = enabled;
|
||||
}
|
||||
|
||||
- (void)setGoogleAppRedirectionEnabled:(BOOL)enabled
|
||||
{
|
||||
if (webView == nil)
|
||||
return;
|
||||
googleAppRedirectionEnabled = enabled;
|
||||
}
|
||||
|
||||
- (void)setAlertDialogEnabled:(BOOL)enabled
|
||||
{
|
||||
alertDialogEnabled = enabled;
|
||||
@@ -1044,6 +1111,7 @@ extern "C" {
|
||||
void *instance, float left, float top, float right, float bottom, BOOL relative);
|
||||
void _CWebViewPlugin_SetVisibility(void *instance, BOOL visibility);
|
||||
void _CWebViewPlugin_SetInteractionEnabled(void *instance, BOOL enabled);
|
||||
void _CWebViewPlugin_SetGoogleAppRedirectionEnabled(void *instance, BOOL enabled);
|
||||
void _CWebViewPlugin_SetAlertDialogEnabled(void *instance, BOOL visibility);
|
||||
void _CWebViewPlugin_SetScrollbarsVisibility(void *instance, BOOL visibility);
|
||||
void _CWebViewPlugin_SetScrollBounceEnabled(void *instance, BOOL enabled);
|
||||
@@ -1060,6 +1128,7 @@ extern "C" {
|
||||
void _CWebViewPlugin_AddCustomHeader(void *instance, const char *headerKey, const char *headerValue);
|
||||
void _CWebViewPlugin_RemoveCustomHeader(void *instance, const char *headerKey);
|
||||
void _CWebViewPlugin_ClearCustomHeader(void *instance);
|
||||
void _CWebViewPlugin_ClearCookie(const char *url, const char *name);
|
||||
void _CWebViewPlugin_ClearCookies();
|
||||
void _CWebViewPlugin_SaveCookies();
|
||||
void _CWebViewPlugin_GetCookies(void *instance, const char *url);
|
||||
@@ -1131,6 +1200,14 @@ void _CWebViewPlugin_SetInteractionEnabled(void *instance, BOOL enabled)
|
||||
[webViewPlugin setInteractionEnabled:enabled];
|
||||
}
|
||||
|
||||
void _CWebViewPlugin_SetGoogleAppRedirectionEnabled(void *instance, BOOL enabled)
|
||||
{
|
||||
if (instance == NULL)
|
||||
return;
|
||||
CWebViewPlugin *webViewPlugin = (__bridge CWebViewPlugin *)instance;
|
||||
[webViewPlugin setGoogleAppRedirectionEnabled:enabled];
|
||||
}
|
||||
|
||||
void _CWebViewPlugin_SetAlertDialogEnabled(void *instance, BOOL enabled)
|
||||
{
|
||||
if (instance == NULL)
|
||||
@@ -1259,6 +1336,11 @@ void _CWebViewPlugin_ClearCustomHeader(void *instance)
|
||||
[webViewPlugin clearCustomRequestHeader];
|
||||
}
|
||||
|
||||
void _CWebViewPlugin_ClearCookie(const char *url, const char *name)
|
||||
{
|
||||
[CWebViewPlugin clearCookie:name of:url];
|
||||
}
|
||||
|
||||
void _CWebViewPlugin_ClearCookies()
|
||||
{
|
||||
[CWebViewPlugin clearCookies];
|
||||
|
||||
@@ -99,6 +99,7 @@ namespace RedHotRoast
|
||||
public int[] BalanceExchange;
|
||||
public int[] PotExchange;
|
||||
public int StatementSwitch;
|
||||
|
||||
public string X_Redeemcode;
|
||||
public string X_ShopURL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,8 +50,10 @@ namespace FGUI.tixian
|
||||
public cash_levelcom com_chlevel;
|
||||
public GGroup group_;
|
||||
public GTextField lab_mn;
|
||||
public GTextField text_rate1;
|
||||
public GList list_kicket;
|
||||
public GTextField lab_mn2;
|
||||
public GTextField text_rate;
|
||||
public GTextField lab_ticket;
|
||||
public GTextField lab_code;
|
||||
public btn_code btn_copy;
|
||||
@@ -116,8 +118,10 @@ namespace FGUI.tixian
|
||||
com_chlevel = (cash_levelcom)GetChildAt(60);
|
||||
group_ = (GGroup)GetChildAt(61);
|
||||
lab_mn = (GTextField)GetChildAt(65);
|
||||
text_rate1 = (GTextField)GetChildAt(68);
|
||||
list_kicket = (GList)GetChildAt(70);
|
||||
lab_mn2 = (GTextField)GetChildAt(75);
|
||||
text_rate = (GTextField)GetChildAt(78);
|
||||
lab_ticket = (GTextField)GetChildAt(83);
|
||||
lab_code = (GTextField)GetChildAt(85);
|
||||
btn_copy = (btn_code)GetChildAt(86);
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace FGUI.tixian
|
||||
public GTextField text_title;
|
||||
public GButton btn_close1;
|
||||
public GTextField lab_mn2;
|
||||
public GTextField text_rate;
|
||||
public GTextField lab_ticket;
|
||||
public GTextField lab_code;
|
||||
public btn_code btn_copy;
|
||||
@@ -29,6 +30,7 @@ namespace FGUI.tixian
|
||||
text_title = (GTextField)GetChildAt(1);
|
||||
btn_close1 = (GButton)GetChildAt(2);
|
||||
lab_mn2 = (GTextField)GetChildAt(6);
|
||||
text_rate = (GTextField)GetChildAt(9);
|
||||
lab_ticket = (GTextField)GetChildAt(14);
|
||||
lab_code = (GTextField)GetChildAt(16);
|
||||
btn_copy = (btn_code)GetChildAt(17);
|
||||
|
||||
@@ -40,8 +40,10 @@ namespace FGUI.tixian
|
||||
public btn_pay btn_watch;
|
||||
public GImage card_;
|
||||
public GTextField lab_mn;
|
||||
public GTextField text_rate1;
|
||||
public GList list_kicket;
|
||||
public GTextField lab_mn2;
|
||||
public GTextField text_rate;
|
||||
public GTextField lab_ticket;
|
||||
public GTextField lab_code;
|
||||
public btn_code btn_copy;
|
||||
@@ -95,8 +97,10 @@ namespace FGUI.tixian
|
||||
btn_watch = (btn_pay)GetChildAt(40);
|
||||
card_ = (GImage)GetChildAt(42);
|
||||
lab_mn = (GTextField)GetChildAt(45);
|
||||
text_rate1 = (GTextField)GetChildAt(47);
|
||||
list_kicket = (GList)GetChildAt(51);
|
||||
lab_mn2 = (GTextField)GetChildAt(55);
|
||||
text_rate = (GTextField)GetChildAt(57);
|
||||
lab_ticket = (GTextField)GetChildAt(62);
|
||||
lab_code = (GTextField)GetChildAt(64);
|
||||
btn_copy = (btn_code)GetChildAt(65);
|
||||
|
||||
@@ -1205,7 +1205,7 @@ namespace RedHotRoast
|
||||
{
|
||||
if (RainPlayUI == null)
|
||||
{
|
||||
RainPlayUI = GameObject.Find("(RainPlayUI)sheep_play");
|
||||
RainPlayUI = GameObject.Find("(ArrowGameUI)com_arrow_game");
|
||||
}
|
||||
if (RainPlayUI != null)
|
||||
{
|
||||
@@ -1906,7 +1906,9 @@ namespace RedHotRoast
|
||||
|
||||
public static string GetPriceInt(decimal ch)
|
||||
{
|
||||
return $"${ch:N0}";
|
||||
var vo = GetExchangeRateVo();
|
||||
ch *= (decimal)vo.Multi;
|
||||
return $"{vo.Payicon}{ch:N0}";
|
||||
}
|
||||
|
||||
public static void InitNewWatchCDList(bool isNew = false)
|
||||
|
||||
@@ -41,6 +41,7 @@ namespace RedHotRoast
|
||||
EnterHall();
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.MainUI_Open);
|
||||
});
|
||||
CtrlDispatcher.Instance.AddListener(CtrlMsg.open_wb, OpenWb);
|
||||
|
||||
AppDispatcher.Instance.AddListener(MainThreadMsg.App_Focus_True, BackToGame);
|
||||
InitSystem();
|
||||
@@ -183,6 +184,43 @@ namespace RedHotRoast
|
||||
}
|
||||
}
|
||||
|
||||
private void OpenWb(object obj) {
|
||||
|
||||
if (obj is not SDKOpenConfig openConfig) return;
|
||||
|
||||
// SdkConfigMgr.Instance.Open(openConfig.normal, openConfig.url);
|
||||
SetCameraVisible(false);
|
||||
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.H5UI_Open, openConfig);
|
||||
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.hideBroadCast);
|
||||
}
|
||||
|
||||
private Camera _gameCamera;
|
||||
|
||||
public void SetCameraVisible(bool visible)
|
||||
{
|
||||
// 只在首次调用时查找
|
||||
if (_gameCamera == null)
|
||||
{
|
||||
// 使用 FindWithTag 确保能找到非激活对象
|
||||
|
||||
_gameCamera = GameObject.Find("GameCamera").GetComponent<Camera>();
|
||||
|
||||
}
|
||||
if (_gameCamera != null)
|
||||
{
|
||||
_gameCamera.enabled = visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("GameCamera reference not found!");
|
||||
}
|
||||
|
||||
GameHelper.ShowSheepPlayUI(visible);
|
||||
}
|
||||
|
||||
|
||||
#region 缓存资源
|
||||
|
||||
public void GetGalleryNet(int imageID, Action<bool> action = null)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 6.4 MiB After Width: | Height: | Size: 9.3 MiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -2255,6 +2255,50 @@ SpriteRenderer:
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!1 &1944924004
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1944924006}
|
||||
- component: {fileID: 1944924005}
|
||||
m_Layer: 0
|
||||
m_Name: FreeWebViewManager
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &1944924005
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1944924004}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 04c76fa88d6e411bbe47d0cfa321fc13, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!4 &1944924006
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1944924004}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 10004.443, y: 9995.665, z: 0.34530076}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1969760103
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -2491,3 +2535,4 @@ SceneRoots:
|
||||
- {fileID: 292594112}
|
||||
- {fileID: 1659410219}
|
||||
- {fileID: 1969760105}
|
||||
- {fileID: 1944924006}
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
using Gree.UnityWebView;
|
||||
using UnityEngine;
|
||||
|
||||
public class FreeWebViewManager : MonoBehaviour
|
||||
{
|
||||
public static FreeWebViewManager Instance;
|
||||
private GameObject _webObj;
|
||||
private WebViewObject1 _webView;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (Instance != null) Destroy(gameObject);
|
||||
else
|
||||
{
|
||||
Instance = this;
|
||||
DontDestroyOnLoad(gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
initView();
|
||||
}
|
||||
|
||||
public void initView()
|
||||
{
|
||||
if (_webObj != null) return;
|
||||
|
||||
// 创建WebView对象
|
||||
_webObj = new GameObject("WebViewObject1");
|
||||
_webView = _webObj.AddComponent<WebViewObject1>();
|
||||
|
||||
// 关键:开启WKWebView,规避苹果审核拒绝
|
||||
_webView.Init(
|
||||
enableWKWebView: true,
|
||||
cb: OnWebMessage // JS调用Unity回调
|
||||
);
|
||||
|
||||
float top_offset = 0;//fgui中的顶部信息的高度
|
||||
float buttom_offset = 155;
|
||||
if (Screen.safeArea.y != 0)
|
||||
{//刘海屏
|
||||
top_offset += Screen.safeArea.y;
|
||||
}
|
||||
|
||||
// 铺满屏幕,适配刘海安全区
|
||||
_webView.SetMargins(0, (int)top_offset, 0, (int)buttom_offset);
|
||||
// 禁止下拉回弹(可选)
|
||||
_webView.SetScrollBounceEnabled(false);
|
||||
|
||||
_webView.LoadURL("about:blank");
|
||||
_webView.SetVisibility(false);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 打开网页
|
||||
/// </summary>
|
||||
public void OpenWeb(string url)
|
||||
{
|
||||
// if (_webObj != null) return;
|
||||
//
|
||||
// // 创建WebView对象
|
||||
// _webObj = new GameObject("WebViewObject1");
|
||||
// _webView = _webObj.AddComponent<WebViewObject1>();
|
||||
//
|
||||
// // 关键:开启WKWebView,规避苹果审核拒绝
|
||||
// _webView.Init(
|
||||
// enableWKWebView: true,
|
||||
// cb: OnWebMessage // JS调用Unity回调
|
||||
// );
|
||||
//
|
||||
// float top_offset = 0;//fgui中的顶部信息的高度
|
||||
// float buttom_offset = 155;
|
||||
// if (Screen.safeArea.y != 0)
|
||||
// {//刘海屏
|
||||
// top_offset += Screen.safeArea.y;
|
||||
// }
|
||||
//
|
||||
// // 铺满屏幕,适配刘海安全区
|
||||
// _webView.SetMargins(0, (int)top_offset, 0, (int)buttom_offset);
|
||||
// // 禁止下拉回弹(可选)
|
||||
// _webView.SetScrollBounceEnabled(false);
|
||||
//
|
||||
// 加载网页并显示
|
||||
_webView.LoadURL(url);
|
||||
_webView.SetVisibility(true);
|
||||
}
|
||||
|
||||
// JS向Unity发消息:window.unity.call("func","参数")
|
||||
void OnWebMessage(string msg)
|
||||
{
|
||||
Debug.Log("收到网页消息:" + msg);
|
||||
}
|
||||
|
||||
// C#调用网页JS
|
||||
public void CallJs(string jsCode)
|
||||
{
|
||||
if (_webView != null)
|
||||
_webView.EvaluateJS(jsCode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 关闭网页(必调用,释放原生资源)
|
||||
/// </summary>
|
||||
public void CloseWeb()
|
||||
{
|
||||
if (_webObj != null)
|
||||
{
|
||||
_webView.SetVisibility(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
if (_webObj != null)
|
||||
{
|
||||
_webView.SetVisibility(false);
|
||||
Destroy(_webObj);
|
||||
_webObj = null;
|
||||
_webView = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 04c76fa88d6e411bbe47d0cfa321fc13
|
||||
timeCreated: 1784015216
|
||||
@@ -85,5 +85,6 @@ namespace RedHotRoast
|
||||
public const string GameAgainCtrl = "GameAgainCtrl";
|
||||
public const string ArrowSettingCtrl = "ArrowSettingCtrl";
|
||||
public const string ArrowGameResultCtrl = "ArrowGameResultCtrl";
|
||||
public const string RedeemCodeCtrl = "RedeemCodeCtrl";
|
||||
}
|
||||
}
|
||||
@@ -83,5 +83,6 @@ namespace RedHotRoast
|
||||
public const string GameAgainModel = "GameAgainModel";
|
||||
public const string ArrowSettingModel = "ArrowSettingModel";
|
||||
public const string ArrowGameResultModel = "ArrowGameResultModel";
|
||||
public const string RedeemCodeModel = "RedeemCodeModel";
|
||||
}
|
||||
}
|
||||
@@ -77,6 +77,7 @@ namespace RedHotRoast
|
||||
moduleManager.AddModel(ModelConst.GameAgainModel, new GameAgainModel());
|
||||
moduleManager.AddModel(ModelConst.ArrowSettingModel, new ArrowSettingModel());
|
||||
moduleManager.AddModel(ModelConst.ArrowGameResultModel, new ArrowGameResultModel());
|
||||
moduleManager.AddModel(ModelConst.RedeemCodeModel, new RedeemCodeModel());
|
||||
}
|
||||
public static void AutoRegisterUICtrl()
|
||||
{
|
||||
@@ -154,6 +155,7 @@ namespace RedHotRoast
|
||||
moduleManager.AddUICtrl(UICtrlConst.GameAgainUICtrl, new GameAgainUICtrl());
|
||||
moduleManager.AddUICtrl(UICtrlConst.ArrowSettingUICtrl, new ArrowSettingUICtrl());
|
||||
moduleManager.AddUICtrl(UICtrlConst.ArrowGameResultUICtrl, new ArrowGameResultUICtrl());
|
||||
moduleManager.AddUICtrl(UICtrlConst.RedeemCodeUICtrl, new RedeemCodeUICtrl());
|
||||
}
|
||||
|
||||
public static void AutoRegisterCtrl()
|
||||
@@ -238,6 +240,7 @@ namespace RedHotRoast
|
||||
moduleManager.AddCtrl(CtrlConst.GameAgainCtrl, new GameAgainCtrl());
|
||||
moduleManager.AddCtrl(CtrlConst.ArrowSettingCtrl, new ArrowSettingCtrl());
|
||||
moduleManager.AddCtrl(CtrlConst.ArrowGameResultCtrl, new ArrowGameResultCtrl());
|
||||
moduleManager.AddCtrl(CtrlConst.RedeemCodeCtrl, new RedeemCodeCtrl());
|
||||
}
|
||||
|
||||
public static void AutoRegisterUIType()
|
||||
@@ -319,6 +322,7 @@ namespace RedHotRoast
|
||||
moduleManager.AddUIType(UIConst.GameAgainUI, typeof(GameAgainUI));
|
||||
moduleManager.AddUIType(UIConst.ArrowSettingUI, typeof(ArrowSettingUI));
|
||||
moduleManager.AddUIType(UIConst.ArrowGameResultUI, typeof(ArrowGameResultUI));
|
||||
moduleManager.AddUIType(UIConst.RedeemCodeUI, typeof(RedeemCodeUI));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -82,6 +82,7 @@ namespace RedHotRoast
|
||||
public const string GameAgainUI = "GameAgainUI";
|
||||
public const string ArrowSettingUI = "ArrowSettingUI";
|
||||
public const string ArrowGameResultUI = "ArrowGameResultUI";
|
||||
public const string RedeemCodeUI = "RedeemCodeUI";
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -83,5 +83,6 @@ namespace RedHotRoast
|
||||
public const string GameAgainUICtrl = "GameAgainUICtrl";
|
||||
public const string ArrowSettingUICtrl = "ArrowSettingUICtrl";
|
||||
public const string ArrowGameResultUICtrl = "ArrowGameResultUICtrl";
|
||||
public const string RedeemCodeUICtrl = "RedeemCodeUICtrl";
|
||||
}
|
||||
}
|
||||
@@ -2028,7 +2028,7 @@ namespace RedHotRoast
|
||||
var start = fguiPosition;
|
||||
var end = GameHelper.GetUICenterPosition(ui.com_money.GetChild("text_gold"));
|
||||
float[] cash_array = GameHelper.GetRewardValue(0);
|
||||
var littleReward = GameHelper.GetExchangeRateVo().Multi * cash_array[0];
|
||||
var littleReward = Math.Round(GameHelper.GetExchangeRateVo().Multi * cash_array[0],2);
|
||||
Debug.Log($"小额奖励:{cash_array[0]} {littleReward}");
|
||||
|
||||
var rewardSingleData = new RewardSingleData(102, (decimal)littleReward, RewardOrigin.AdTask)
|
||||
|
||||
@@ -344,7 +344,7 @@ namespace RedHotRoast
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.GetReward, rewardData);
|
||||
DOVirtual.DelayedCall(1, () =>
|
||||
{
|
||||
DOVirtual.Float(0, (float)DataMgr.Ticket.Value, 1,
|
||||
DOVirtual.Float(0, (float)DataMgr.Ticket.Value * GameHelper.GetExchangeRateVo().Multi, 1,
|
||||
value => { ui.top_money.GetChild("text_gold").text = ((decimal)value).ToString("0.00"); });
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
|
||||
using DG.Tweening;
|
||||
using DontConfuse;
|
||||
using FGUI.ZM_H5_15;
|
||||
using RedHotRoast;
|
||||
@@ -36,11 +37,25 @@ namespace RedHotRoast
|
||||
|
||||
protected override void OnClose()
|
||||
{
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.StopArrowTouch, true);
|
||||
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.showBroadCast);
|
||||
WebviewManager.Instance.setInH5View(false);
|
||||
WebviewManager.Instance.ShowH5View(false);
|
||||
|
||||
HallManager.Instance.SetCameraVisible(true);
|
||||
|
||||
if (_config.normal)
|
||||
{
|
||||
WebviewManager.Instance.setInH5View(false);
|
||||
WebviewManager.Instance.ShowH5View(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
FreeWebViewManager.Instance.CloseWeb();
|
||||
}
|
||||
}
|
||||
|
||||
private SDKOpenConfig _config;
|
||||
|
||||
protected override void OnBind()
|
||||
{
|
||||
ui = baseUI as FGUI.ZM_H5_15.com_webview;
|
||||
@@ -48,12 +63,26 @@ namespace RedHotRoast
|
||||
|
||||
protected override void OnOpenBefore(object args)
|
||||
{
|
||||
if (args is not SDKOpenConfig openConfig) return;
|
||||
|
||||
_config = openConfig;
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.StopArrowTouch, false);
|
||||
|
||||
WebviewManager.Instance.setInH5View(true);
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.hideBroadCast);
|
||||
// delayedCall = DOVirtual.DelayedCall(0.3f, () =>
|
||||
// {
|
||||
WebviewManager.Instance.ShowH5View(true);
|
||||
if (_config.normal)
|
||||
{
|
||||
WebviewManager.Instance.setInH5View(true);
|
||||
WebviewManager.Instance.ShowH5View(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
DOVirtual.DelayedCall(0.2f, () =>
|
||||
{
|
||||
FreeWebViewManager.Instance.OpenWeb(_config.url);
|
||||
});
|
||||
}
|
||||
|
||||
ui.btn_close.SetClick(() =>
|
||||
{
|
||||
|
||||
@@ -491,7 +491,7 @@ namespace RedHotRoast
|
||||
ui.btn_wv.visible = GameHelper.IsGiftSwitch();
|
||||
ui.btn_wv.SetClick(() =>
|
||||
{
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.H5UI_Open);
|
||||
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.H5UI_Open);
|
||||
});
|
||||
|
||||
ui.btn_egg.SetClick(OnClickEgg);
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace RedHotRoast
|
||||
_mLastState = DataMgr.PettyState.Value;
|
||||
// Debug.Log($"PettyState============: {DataMgr.PettyState.Value}");
|
||||
var num = GameHelper.GetCommonModel().SmallReward;
|
||||
ui.com_get_panel.text_reward.text = $"{GameHelper.GetExchangeRateVo().Payicon}{GameHelper.Get102Str(num)}";
|
||||
ui.com_get_panel.text_reward.text = $"{GameHelper.Get102Str(num)}";
|
||||
|
||||
|
||||
ui.com_get_panel.btn_get.SetClick(GotoEnterAccount);
|
||||
@@ -252,12 +252,12 @@ namespace RedHotRoast
|
||||
var pettyAmount = DataMgr.PettyAmount.Value;
|
||||
if (pettyAmount != 0)
|
||||
{
|
||||
ui.com_detail.text_amount.SetVar("num", $" {GameHelper.GetExchangeRateVo().Payicon}{GameHelper.Get102Str(pettyAmount)}").FlushVars();
|
||||
ui.com_detail.text_amount.SetVar("num", $" {GameHelper.Get102Str(pettyAmount)}").FlushVars();
|
||||
}
|
||||
else
|
||||
{
|
||||
var num = GameHelper.GetCommonModel().SmallReward;
|
||||
ui.com_detail.text_amount.SetVar("num", $" {GameHelper.GetExchangeRateVo().Payicon}{GameHelper.Get102Str(num)}").FlushVars();
|
||||
ui.com_detail.text_amount.SetVar("num", $" {GameHelper.Get102Str(num)}").FlushVars();
|
||||
DataMgr.PettyAmount.Value = num;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d727ad32d6e44862ba3e6eff7fe909aa
|
||||
timeCreated: 1784016283
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace RedHotRoast
|
||||
{
|
||||
public class RedeemCodeCtrl : BaseCtrl
|
||||
{
|
||||
public static RedeemCodeCtrl Instance { get; private set; }
|
||||
|
||||
private RedeemCodeModel model;
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a93167d1dab140d2917cf72e64e89770
|
||||
timeCreated: 1782269723
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace RedHotRoast
|
||||
{
|
||||
public class RedeemCodeModel : BaseModel
|
||||
{
|
||||
protected override void OnInit()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 20b6c254390a48eabb165d883f54bf67
|
||||
timeCreated: 1782269723
|
||||
@@ -0,0 +1,103 @@
|
||||
|
||||
using FGUI.tixian;
|
||||
using IgnoreOPS;
|
||||
|
||||
namespace RedHotRoast
|
||||
{
|
||||
public class RedeemCodeUI : BaseUI
|
||||
{
|
||||
private RedeemCodeUICtrl ctrl;
|
||||
private RedeemCodeModel model;
|
||||
private com_redeem_code ui;
|
||||
|
||||
public RedeemCodeUI(RedeemCodeUICtrl ctrl) : base(ctrl)
|
||||
{
|
||||
uiName = UIConst.RedeemCodeUI;
|
||||
this.ctrl = ctrl;
|
||||
}
|
||||
|
||||
protected override void SetUIInfo(UIInfo uiInfo)
|
||||
{
|
||||
uiInfo.packageName = "tixian";
|
||||
uiInfo.assetName = "com_redeem_code";
|
||||
uiInfo.layerType = UILayerType.Popup;
|
||||
uiInfo.isNeedOpenAnim = true;
|
||||
uiInfo.isNeedCloseAnim = true;
|
||||
uiInfo.isNeedUIMask = true;
|
||||
}
|
||||
|
||||
#region 生命周期
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnClose()
|
||||
{
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.StopArrowTouch, true);
|
||||
}
|
||||
|
||||
protected override void OnBind()
|
||||
{
|
||||
ui = baseUI as com_redeem_code;
|
||||
}
|
||||
|
||||
protected override void OnOpenBefore(object args)
|
||||
{
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.StopArrowTouch, false);
|
||||
|
||||
InitView();
|
||||
}
|
||||
|
||||
protected override void OnOpen(object args)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
private void InitView()
|
||||
{
|
||||
ui.lab_mn2.text = GameHelper.Get101Str(0);
|
||||
|
||||
ui.lab_ticket.text = GameHelper.GetPriceInt(DataMgr.PettyAmount.Value);
|
||||
|
||||
var strings = ConfigSystem.GetCommonConf().X_Redeemcode;
|
||||
ui.lab_code.text = strings;
|
||||
ui.text_rate.text = GameHelper.GetExchangeRateVo().Payicon + " 1";
|
||||
ui.btn_copy.SetClick(() =>
|
||||
{
|
||||
GameHelper.CopyText(ui.lab_code.text);
|
||||
});
|
||||
|
||||
ui.btn_contact_us.SetClick(() =>
|
||||
{
|
||||
SDKOpenConfig openConfig = new SDKOpenConfig
|
||||
{
|
||||
normal = false,
|
||||
url = ConfigSystem.GetCommonConf().X_ShopURL
|
||||
};
|
||||
|
||||
CtrlDispatcher.Instance.Dispatch(CtrlMsg.open_wb, openConfig);
|
||||
CtrlCloseUI();
|
||||
});
|
||||
|
||||
ui.btn_close1.SetClick(CtrlCloseUI);
|
||||
|
||||
|
||||
}
|
||||
#region 消息
|
||||
|
||||
protected override void AddListener()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 02aaefad43c146b18cb726f31814007e
|
||||
timeCreated: 1782269723
|
||||
@@ -0,0 +1,71 @@
|
||||
namespace RedHotRoast
|
||||
{
|
||||
public class RedeemCodeUICtrl : BaseUICtrl
|
||||
{
|
||||
private RedeemCodeUI ui;
|
||||
private RedeemCodeModel model;
|
||||
|
||||
private uint openUIMsg = UICtrlMsg.RedeemCodeUI_Open;
|
||||
private uint closeUIMsg = UICtrlMsg.RedeemCodeUI_Close;
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
//model = ModuleManager.Instance.GetModel(ModelConst.PettyAwardModel) as PettyAwardModel;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
public override void OpenUI(object args = null)
|
||||
{
|
||||
if (ui == null)
|
||||
{
|
||||
ui = new RedeemCodeUI(this);
|
||||
ui.Open(args);
|
||||
}
|
||||
}
|
||||
|
||||
public override void CloseUI(object args = null)
|
||||
{
|
||||
if (ui != null && !ui.isClose)
|
||||
{
|
||||
ui.Close();
|
||||
}
|
||||
ui = null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
public override uint GetOpenUIMsg(string uiName)
|
||||
{
|
||||
return openUIMsg;
|
||||
}
|
||||
public override uint GetCloseUIMsg(string uiName)
|
||||
{
|
||||
return closeUIMsg;
|
||||
}
|
||||
|
||||
protected override void AddListener()
|
||||
{
|
||||
uiCtrlDispatcher.AddListener(openUIMsg, OpenUI);
|
||||
uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI);
|
||||
}
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI);
|
||||
uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI);
|
||||
}
|
||||
|
||||
protected override void AddServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
protected override void RemoveServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: db2d94c85bfc42988faab968658f117e
|
||||
timeCreated: 1782269723
|
||||
@@ -110,6 +110,9 @@ namespace RedHotRoast
|
||||
AdExchangeManager.Instance.SetWatchAd(AdExchangeManager.SavingPotMakeupAd, ui.btn_task_watch as btn_watchAd, () => { });
|
||||
AdExchangeManager.Instance.Start();
|
||||
|
||||
ui.text_rate1.text = GameHelper.GetExchangeRateVo().Payicon + " 1";
|
||||
ui.text_rate.text = GameHelper.GetExchangeRateVo().Payicon + " 1";
|
||||
|
||||
ad_cool_down = ConfigSystem.GetCommonConf().WwalaccelerationCD;
|
||||
HallManager.Instance.UpdateSecondEvent += updateSpeedCD;
|
||||
HallManager.Instance.UpdateSecondEvent += Update;
|
||||
@@ -156,7 +159,8 @@ namespace RedHotRoast
|
||||
private void InitView()
|
||||
{
|
||||
Makeup_2 makeupVo = MakeupModel_2.GetData(makeupTaskData.tableId);
|
||||
ui.text_ad.text = string.Format(GameHelper.getDesByKey("saving_pot_5"), makeupVo.ADIncrease);
|
||||
ui.text_ad.text = string.Format(GameHelper.getDesByKey("saving_pot_5"),
|
||||
SaveingPotHelper.getChNumber(makeupVo.ADIncrease));
|
||||
string str = string.Format(GameHelper.getDesByKey("saving_pot_2"), makeupVo.PayIncrease);
|
||||
ui.text_pay.text = str;
|
||||
initTop();
|
||||
@@ -213,7 +217,7 @@ namespace RedHotRoast
|
||||
});
|
||||
|
||||
HallManager.Instance.UpdateSecondEvent -= upLvWatchAdsBtn;
|
||||
InitView();
|
||||
DOVirtual.DelayedCall(0.1f, InitView);
|
||||
}
|
||||
if (SaveData.GetSaveObject().saveingpot_ch > SaveData.GetSaveObject().last_saveingpot_ch)
|
||||
{
|
||||
@@ -344,7 +348,6 @@ namespace RedHotRoast
|
||||
btn_watchad.enabled = true;
|
||||
btn_watchad.can_buy.selectedIndex = 0;
|
||||
if (GameHelper.IsGiftSwitch() && ConfigSystem.GetCommonConf().PiggyBankSwitch == 1) btn_watchad.img_saveingpot.visible = true;
|
||||
|
||||
InitView();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ namespace RedHotRoast
|
||||
btnSign.title = signList[index].id + "";
|
||||
|
||||
btnSign.touchable = false;
|
||||
btnSign.reward_num.text = GameHelper.Get101Str(signList[index].quantity[0]);
|
||||
btnSign.reward_num.text = GameHelper.IsGiftSwitch()?GameHelper.getChString(signList[index].quantity[0]):GameHelper.Get101Str(signList[index].quantity[0]);
|
||||
|
||||
var animName = "appear2";
|
||||
if (index % 5 == 4)
|
||||
|
||||
@@ -63,7 +63,9 @@ public class SaveingPotClass
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
return $"{amount:N}";
|
||||
var exchangeRateVo = GameHelper.GetExchangeRateVo();
|
||||
var cash = exchangeRateVo.Multi * amount;
|
||||
return $"{cash:N}";
|
||||
//}
|
||||
}
|
||||
|
||||
@@ -172,6 +174,8 @@ public class SaveingPotHelper
|
||||
}
|
||||
public static string getChNumber(float cash)
|
||||
{
|
||||
var exchangeRateVo = GameHelper.GetExchangeRateVo();
|
||||
cash = exchangeRateVo.Multi * cash;
|
||||
return $"{cash:N}";
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6f866181e8964a5db5ca2b5389ace632
|
||||
timeCreated: 1784015330
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 396d2c966866e4a8ca47369a69d03109
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d9e103622e8c14154a1cd918fb92795e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,108 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en-us">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>Unity WebGL Player | {{{ PRODUCT_NAME }}}</title>
|
||||
<link rel="shortcut icon" href="TemplateData/favicon.ico">
|
||||
<link rel="stylesheet" href="TemplateData/style.css">
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
|
||||
<script src="unity-webview.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="unity-container" class="unity-desktop">
|
||||
<canvas id="unity-canvas"></canvas>
|
||||
<div id="unity-loading-bar">
|
||||
<div id="unity-logo"></div>
|
||||
<div id="unity-progress-bar-empty">
|
||||
<div id="unity-progress-bar-full"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="unity-footer">
|
||||
<div id="unity-webgl-logo"></div>
|
||||
<div id="unity-fullscreen-button"></div>
|
||||
<div id="unity-build-title">{{{ PRODUCT_NAME }}}</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var buildUrl = "Build";
|
||||
var loaderUrl = buildUrl + "/{{{ LOADER_FILENAME }}}";
|
||||
var config = {
|
||||
dataUrl: buildUrl + "/{{{ DATA_FILENAME }}}",
|
||||
frameworkUrl: buildUrl + "/{{{ FRAMEWORK_FILENAME }}}",
|
||||
codeUrl: buildUrl + "/{{{ CODE_FILENAME }}}",
|
||||
#if MEMORY_FILENAME
|
||||
memoryUrl: buildUrl + "/{{{ MEMORY_FILENAME }}}",
|
||||
#endif
|
||||
#if SYMBOLS_FILENAME
|
||||
symbolsUrl: buildUrl + "/{{{ SYMBOLS_FILENAME }}}",
|
||||
#endif
|
||||
streamingAssetsUrl: "StreamingAssets",
|
||||
companyName: "{{{ COMPANY_NAME }}}",
|
||||
productName: "{{{ PRODUCT_NAME }}}",
|
||||
productVersion: "{{{ PRODUCT_VERSION }}}",
|
||||
};
|
||||
|
||||
var container = document.querySelector("#unity-container");
|
||||
var canvas = document.querySelector("#unity-canvas");
|
||||
var loadingBar = document.querySelector("#unity-loading-bar");
|
||||
var progressBarFull = document.querySelector("#unity-progress-bar-full");
|
||||
var fullscreenButton = document.querySelector("#unity-fullscreen-button");
|
||||
var width0 = "{{{ WIDTH }}}px";
|
||||
var height0 = "{{{ HEIGHT }}}px";
|
||||
|
||||
if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
|
||||
container.className = "unity-mobile";
|
||||
config.devicePixelRatio = 1;
|
||||
} else {
|
||||
canvas.style.width = "{{{ WIDTH }}}px";
|
||||
canvas.style.height = "{{{ HEIGHT }}}px";
|
||||
}
|
||||
#if BACKGROUND_FILENAME
|
||||
canvas.style.background = "url('" + buildUrl + "/{{{ BACKGROUND_FILENAME.replace(/'/g, '%27') }}}') center / cover";
|
||||
#endif
|
||||
loadingBar.style.display = "block";
|
||||
|
||||
document.addEventListener(
|
||||
'fullscreenchange',
|
||||
function() {
|
||||
var p = document.getElementById('unity-container');
|
||||
var c = document.getElementById('unity-canvas');
|
||||
if (document.fullscreenElement) {
|
||||
width0 = c.style.width;
|
||||
height0 = c.style.height;
|
||||
setTimeout(
|
||||
function() {
|
||||
c.style.width = getComputedStyle(p).width;
|
||||
c.style.height = getComputedStyle(p).height;
|
||||
},
|
||||
250);
|
||||
} else {
|
||||
c.style.width = width0;
|
||||
c.style.height = height0;
|
||||
}
|
||||
});
|
||||
var script = document.createElement("script");
|
||||
script.src = loaderUrl;
|
||||
script.onload = () => {
|
||||
createUnityInstance(canvas, config, (progress) => {
|
||||
progressBarFull.style.width = 100 * progress + "%";
|
||||
}).then((unityInstance) => {
|
||||
window.unityInstance = unityInstance;
|
||||
loadingBar.style.display = "none";
|
||||
fullscreenButton.onclick = () => {
|
||||
var p = document.getElementById('unity-container');
|
||||
var c = document.getElementById('unity-canvas');
|
||||
c.requestFullscreen = () => {
|
||||
p.requestFullscreen();
|
||||
};
|
||||
unityInstance.SetFullscreen(1);
|
||||
};
|
||||
}).catch((message) => {
|
||||
alert(message);
|
||||
});
|
||||
};
|
||||
document.body.appendChild(script);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7be04fa587d934a5c958c8fc02a10c40
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,103 @@
|
||||
var unityWebView =
|
||||
{
|
||||
loaded: [],
|
||||
|
||||
init : function (name) {
|
||||
$containers = $('.webviewContainer');
|
||||
if ($containers.length === 0) {
|
||||
$('<div style="position: absolute; left: 0px; width: 100%; height: 100%; top: 0px; pointer-events: none;"><div class="webviewContainer" style="overflow: hidden; position: relative; width: 100%; height: 100%; z-index: 1;"></div></div>')
|
||||
.appendTo($('#unity-container'));
|
||||
}
|
||||
var $last = $('.webviewContainer:last');
|
||||
var clonedTop = parseInt($last.css('top')) - 100;
|
||||
var $clone = $last.clone().insertAfter($last).css('top', clonedTop + '%');
|
||||
var $iframe =
|
||||
$('<iframe style="position:relative; width:100%; height100%; border-style:none; display:none; pointer-events:auto;"></iframe>')
|
||||
.attr('id', 'webview_' + name)
|
||||
.appendTo($last)
|
||||
.on('load', function () {
|
||||
$(this).attr('loaded', 'true');
|
||||
var contents = $(this).contents();
|
||||
var w = $(this)[0].contentWindow;
|
||||
contents.find('a').click(function (e) {
|
||||
var href = $.trim($(this).attr('href'));
|
||||
if (href.substr(0, 6) === 'unity:') {
|
||||
unityInstance.SendMessage(name, "CallFromJS", href.substring(6, href.length));
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
contents.find('form').submit(function () {
|
||||
$this = $(this);
|
||||
var action = $.trim($this.attr('action'));
|
||||
if (action.substr(0, 6) === 'unity:') {
|
||||
var message = action.substring(6, action.length);
|
||||
if ($this.attr('method').toLowerCase() == 'get') {
|
||||
message += '?' + $this.serialize();
|
||||
}
|
||||
unityInstance.SendMessage(name, "CallFromJS", message);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
unityInstance.SendMessage(name, "CallOnLoaded", location.href);
|
||||
});
|
||||
},
|
||||
|
||||
sendMessage: function (name, message) {
|
||||
unityInstance.SendMessage(name, "CallFromJS", message);
|
||||
},
|
||||
|
||||
setMargins: function (name, left, top, right, bottom) {
|
||||
var container = $('#unity-container');
|
||||
var r = (container.hasClass('unity-desktop')) ? window.devicePixelRatio : 1;
|
||||
var w0 = container.width() * r;
|
||||
var h0 = container.height() * r;
|
||||
var canvas = $('#unity-canvas');
|
||||
var w1 = canvas.attr('width');
|
||||
var h1 = canvas.attr('height');
|
||||
|
||||
var lp = left / w0 * 100;
|
||||
var tp = top / h0 * 100;
|
||||
var wp = (w1 - left - right) / w0 * 100;
|
||||
var hp = (h1 - top - bottom) / h0 * 100;
|
||||
|
||||
this.iframe(name)
|
||||
.css('left', lp + '%')
|
||||
.css('top', tp + '%')
|
||||
.css('width', wp + '%')
|
||||
.css('height', hp + '%');
|
||||
},
|
||||
|
||||
setVisibility: function (name, visible) {
|
||||
if (visible)
|
||||
this.iframe(name).show();
|
||||
else
|
||||
this.iframe(name).hide();
|
||||
},
|
||||
|
||||
loadURL: function(name, url) {
|
||||
this.iframe(name).attr('loaded', 'false')[0].contentWindow.location.replace(url);
|
||||
},
|
||||
|
||||
evaluateJS: function (name, js) {
|
||||
$iframe = this.iframe(name);
|
||||
if ($iframe.attr('loaded') === 'true') {
|
||||
$iframe[0].contentWindow.eval(js);
|
||||
} else {
|
||||
$iframe.on('load', function(){
|
||||
$(this)[0].contentWindow.eval(js);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
destroy: function (name) {
|
||||
this.iframe(name).parent().parent().remove();
|
||||
},
|
||||
|
||||
iframe: function (name) {
|
||||
return $('#webview_' + name);
|
||||
},
|
||||
|
||||
};
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5b98600d622f440fab913c56685e11bf
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 74f24ca1a6cc14b5c8da7e2a8e5de817
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,32 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>Unity Web Player</title>
|
||||
|
||||
<link rel="shortcut icon" href="TemplateData/favicon.ico">
|
||||
<link rel="stylesheet" href="TemplateData/style.css">
|
||||
<script src="TemplateData/UnityProgress.js"></script>
|
||||
<script src="Build/UnityLoader.js"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
|
||||
|
||||
<script>
|
||||
var unityInstance = UnityLoader.instantiate("gameContainer", "%UNITY_WEBGL_BUILD_URL%", {onProgress: UnityProgress});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="content">
|
||||
<div class="webgl-content" id="unityPlayer">
|
||||
<div id="gameContainer" style="width: 960px; height: 600px"></div>
|
||||
<div class="footer">
|
||||
<div class="webgl-logo"></div>
|
||||
<div class="fullscreen" onclick="document.getElementById('gameContainer').requestFullscreen()"></div>
|
||||
<div class="title">Title</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- unity_webview -->
|
||||
<script type="text/javascript" src="unity-webview.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cd45543727a7e47d88051ca9ab86a6f5
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,100 @@
|
||||
var unityWebView =
|
||||
{
|
||||
loaded: [],
|
||||
|
||||
init : function (name) {
|
||||
$containers = $('.webviewContainer');
|
||||
if ($containers.length === 0) {
|
||||
$('<div style="position: absolute; left: 0px; width: 100%; height: 100%; top: 0px; pointer-events: none;"><div class="webviewContainer" style="overflow: hidden; position: relative; width: 100%; height: 100%; z-index: 1;"></div></div>')
|
||||
.appendTo($('#gameContainer'));
|
||||
}
|
||||
var $last = $('.webviewContainer:last');
|
||||
var clonedTop = parseInt($last.css('top')) - 100;
|
||||
var $clone = $last.clone().insertAfter($last).css('top', clonedTop + '%');
|
||||
var $iframe =
|
||||
$('<iframe style="position:relative; width:100%; height100%; border-style:none; display:none; pointer-events:auto;"></iframe>')
|
||||
.attr('id', 'webview_' + name)
|
||||
.appendTo($last)
|
||||
.on('load', function () {
|
||||
$(this).attr('loaded', 'true');
|
||||
var contents = $(this).contents();
|
||||
var w = $(this)[0].contentWindow;
|
||||
contents.find('a').click(function (e) {
|
||||
var href = $.trim($(this).attr('href'));
|
||||
if (href.substr(0, 6) === 'unity:') {
|
||||
unityInstance.SendMessage(name, "CallFromJS", href.substring(6, href.length));
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
contents.find('form').submit(function () {
|
||||
$this = $(this);
|
||||
var action = $.trim($this.attr('action'));
|
||||
if (action.substr(0, 6) === 'unity:') {
|
||||
var message = action.substring(6, action.length);
|
||||
if ($this.attr('method').toLowerCase() == 'get') {
|
||||
message += '?' + $this.serialize();
|
||||
}
|
||||
unityInstance.SendMessage(name, "CallFromJS", message);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
unityInstance.SendMessage(name, "CallOnLoaded", location.href);
|
||||
});
|
||||
},
|
||||
|
||||
sendMessage: function (name, message) {
|
||||
unityInstance.SendMessage(name, "CallFromJS", message);
|
||||
},
|
||||
|
||||
setMargins: function (name, left, top, right, bottom) {
|
||||
var container = $('#gameContainer');
|
||||
var r = window.devicePixelRatio;
|
||||
var w0 = container.width() * r;
|
||||
var h0 = container.height() * r;
|
||||
|
||||
var lp = left / w0 * 100;
|
||||
var tp = top / h0 * 100;
|
||||
var wp = (w0 - left - right) / w0 * 100;
|
||||
var hp = (h0 - top - bottom) / h0 * 100;
|
||||
|
||||
this.iframe(name)
|
||||
.css('left', lp + '%')
|
||||
.css('top', tp + '%')
|
||||
.css('width', wp + '%')
|
||||
.css('height', hp + '%');
|
||||
},
|
||||
|
||||
setVisibility: function (name, visible) {
|
||||
if (visible)
|
||||
this.iframe(name).show();
|
||||
else
|
||||
this.iframe(name).hide();
|
||||
},
|
||||
|
||||
loadURL: function(name, url) {
|
||||
this.iframe(name).attr('loaded', 'false')[0].contentWindow.location.replace(url);
|
||||
},
|
||||
|
||||
evaluateJS: function (name, js) {
|
||||
$iframe = this.iframe(name);
|
||||
if ($iframe.attr('loaded') === 'true') {
|
||||
$iframe[0].contentWindow.eval(js);
|
||||
} else {
|
||||
$iframe.on('load', function(){
|
||||
$(this)[0].contentWindow.eval(js);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
destroy: function (name) {
|
||||
this.iframe(name).parent().parent().remove();
|
||||
},
|
||||
|
||||
iframe: function (name) {
|
||||
return $('#webview_' + name);
|
||||
},
|
||||
|
||||
};
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8de1ecd3ea5954800b53548d8c2e2d70
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1ec4661d3c10c4d0e8b5e54ce1e46aa5
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e76c9a30b7f6447eca50079ce4d595ed
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,136 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>Unity Web Player | %UNITY_WEB_NAME%</title>
|
||||
%UNITY_UNITYOBJECT_DEPENDENCIES%
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
var unityObjectUrl = "%UNITY_UNITYOBJECT_URL%";
|
||||
if (document.location.protocol == 'https:')
|
||||
unityObjectUrl = unityObjectUrl.replace("http://", "https://ssl-");
|
||||
document.write('<script type="text\/javascript" src="' + unityObjectUrl + '"><\/script>');
|
||||
-->
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
var config = {
|
||||
width: %UNITY_WIDTH%,
|
||||
height: %UNITY_HEIGHT%,
|
||||
params: %UNITY_PLAYER_PARAMS%
|
||||
%UNITY_SET_BASE_DOWNLOAD_URL%
|
||||
};
|
||||
var u = new UnityObject2(config);
|
||||
|
||||
jQuery(function() {
|
||||
|
||||
var $missingScreen = jQuery("#unityPlayer").find(".missing");
|
||||
var $brokenScreen = jQuery("#unityPlayer").find(".broken");
|
||||
$missingScreen.hide();
|
||||
$brokenScreen.hide();
|
||||
|
||||
u.observeProgress(function (progress) {
|
||||
switch(progress.pluginStatus) {
|
||||
case "broken":
|
||||
$brokenScreen.find("a").click(function (e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
u.installPlugin();
|
||||
return false;
|
||||
});
|
||||
$brokenScreen.show();
|
||||
break;
|
||||
case "missing":
|
||||
$missingScreen.find("a").click(function (e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
u.installPlugin();
|
||||
return false;
|
||||
});
|
||||
$missingScreen.show();
|
||||
break;
|
||||
case "installed":
|
||||
$missingScreen.remove();
|
||||
break;
|
||||
case "first":
|
||||
break;
|
||||
}
|
||||
});
|
||||
u.initPlugin(jQuery("#unityPlayer")[0], "%UNITY_WEB_PATH%");
|
||||
});
|
||||
-->
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
<!--
|
||||
body {
|
||||
font-family: Helvetica, Verdana, Arial, sans-serif;
|
||||
background-color: black;
|
||||
color: white;
|
||||
text-align: center;
|
||||
}
|
||||
a:link, a:visited {
|
||||
color: #bfbfbf;
|
||||
}
|
||||
a:active, a:hover {
|
||||
color: #bfbfbf;
|
||||
}
|
||||
p.header {
|
||||
font-size: small;
|
||||
}
|
||||
p.header span {
|
||||
font-weight: bold;
|
||||
}
|
||||
p.footer {
|
||||
font-size: x-small;
|
||||
}
|
||||
div.content {
|
||||
margin: auto;
|
||||
width: %UNITY_WIDTH%px;
|
||||
}
|
||||
div.broken,
|
||||
div.missing {
|
||||
margin: auto;
|
||||
position: relative;
|
||||
top: 50%;
|
||||
width: 193px;
|
||||
}
|
||||
div.broken a,
|
||||
div.missing a {
|
||||
height: 63px;
|
||||
position: relative;
|
||||
top: -31px;
|
||||
}
|
||||
div.broken img,
|
||||
div.missing img {
|
||||
border-width: 0px;
|
||||
}
|
||||
div.broken {
|
||||
display: none;
|
||||
}
|
||||
div#unityPlayer {
|
||||
cursor: default;
|
||||
height: %UNITY_HEIGHT%px;
|
||||
width: %UNITY_WIDTH%px;
|
||||
}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<p class="header"><span>Unity Web Player | </span>%UNITY_WEB_NAME%</p>%UNITY_BETA_WARNING%
|
||||
<div class="content">
|
||||
<div id="unityPlayer">
|
||||
<div class="missing">
|
||||
<a href="http://unity3d.com/webplayer/" title="Unity Web Player. Install now!">
|
||||
<img alt="Unity Web Player. Install now!" src="http://webplayer.unity3d.com/installation/getunity.png" width="193" height="63" />
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p class="footer">« created with <a href="http://unity3d.com/unity/" title="Go to unity3d.com">Unity</a> »</p>
|
||||
|
||||
<!-- unity_webview -->
|
||||
<script type="text/javascript" src="unity-webview.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f6333062aa8e346f2abc78ef7a457580
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 018355354713f41b2bed252c88e082c7
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,99 @@
|
||||
var unityWebView =
|
||||
{
|
||||
loaded: [],
|
||||
|
||||
init : function (name) {
|
||||
$containers = $('.webviewContainer');
|
||||
if ($containers.length === 0) {
|
||||
$('<div style="position: absolute; left: 0px; width: 100%; height: 100%;"><div class="webviewContainer" style="overflow:hidden; position:relative; width:100%; height:100%; top:-100%; pointer-events:none; z-index: 1;"></div></div')
|
||||
.appendTo($('#unityPlayer'));
|
||||
}
|
||||
var $last = $('.webviewContainer:last');
|
||||
var clonedTop = parseInt($last.css('top')) - 100;
|
||||
var $clone = $last.clone().insertAfter($last).css('top', clonedTop + '%');
|
||||
var $iframe =
|
||||
$('<iframe style="position:relative; width:100%; height100%; border-style:none; display:none; pointer-events:auto;"></iframe>')
|
||||
.attr('id', 'webview_' + name)
|
||||
.appendTo($last)
|
||||
.on('load', function () {
|
||||
$(this).attr('loaded', 'true');
|
||||
var contents = $(this).contents();
|
||||
var w = $(this)[0].contentWindow;
|
||||
contents.find('a').click(function (e) {
|
||||
var href = $.trim($(this).attr('href'));
|
||||
if (href.substr(0, 6) === 'unity:') {
|
||||
u.getUnity().SendMessage(name, "CallFromJS", href.substring(6, href.length));
|
||||
e.preventDefault();
|
||||
} else {
|
||||
w.location.replace(href);
|
||||
}
|
||||
});
|
||||
|
||||
contents.find('form').submit(function () {
|
||||
$this = $(this);
|
||||
var action = $.trim($this.attr('action'));
|
||||
if (action.substr(0, 6) === 'unity:') {
|
||||
var message = action.substring(6, action.length);
|
||||
if ($this.attr('method').toLowerCase() == 'get') {
|
||||
message += '?' + $this.serialize();
|
||||
}
|
||||
u.getUnity().SendMessage(name, "CallFromJS", message);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
sendMessage: function (name, message) {
|
||||
u.getUnity().SendMessage(name, "CallFromJS", message);
|
||||
},
|
||||
|
||||
setMargins: function (name, left, top, right, bottom) {
|
||||
var $player = $('#unityPlayer');
|
||||
var width = $player.width();
|
||||
var height = $player.height();
|
||||
|
||||
var lp = left / width * 100;
|
||||
var tp = top / height * 100;
|
||||
var wp = (width - left - right) / width * 100;
|
||||
var hp = (height - top - bottom) / height * 100;
|
||||
|
||||
this.iframe(name)
|
||||
.css('left', lp + '%')
|
||||
.css('top', tp + '%')
|
||||
.css('width', wp + '%')
|
||||
.css('height', hp + '%');
|
||||
},
|
||||
|
||||
setVisibility: function (name, visible) {
|
||||
if (visible)
|
||||
this.iframe(name).show();
|
||||
else
|
||||
this.iframe(name).hide();
|
||||
},
|
||||
|
||||
loadURL: function(name, url) {
|
||||
this.iframe(name).attr('loaded', 'false')[0].contentWindow.location.replace(url);
|
||||
},
|
||||
|
||||
evaluateJS: function (name, js) {
|
||||
$iframe = this.iframe(name);
|
||||
if ($iframe.attr('loaded') === 'true') {
|
||||
$iframe[0].contentWindow.eval(js);
|
||||
} else {
|
||||
$iframe.on('load', function(){
|
||||
$(this)[0].contentWindow.eval(js);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
destroy: function (name) {
|
||||
this.iframe(name).parent().parent().remove();
|
||||
},
|
||||
|
||||
iframe: function (name) {
|
||||
return $('#webview_' + name);
|
||||
},
|
||||
|
||||
};
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7bf88e2aa1e624d64b530ad0c2383b9e
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user