1
1
/*
2
2
* Copyright (C) 2011 Keijiro Takahashi
3
3
* Copyright (C) 2012 GREE, Inc.
4
- *
4
+ *
5
5
* This software is provided 'as-is', without any express or implied
6
6
* warranty. In no event will the authors be held liable for any damages
7
7
* arising from the use of this software.
8
- *
8
+ *
9
9
* Permission is granted to anyone to use this software for any purpose,
10
10
* including commercial applications, and to alter it and redistribute it
11
11
* freely, subject to the following restrictions:
12
- *
12
+ *
13
13
* 1. The origin of this software must not be misrepresented; you must not
14
14
* claim that you wrote the original software. If you use this software
15
15
* in a product, an acknowledgment in the product documentation would be
@@ -398,13 +398,14 @@ public void Init(
398
398
bool zoom = true ,
399
399
string ua = "" ,
400
400
// android
401
- int androidForceDarkMode = 0 , // 0: follow system setting, 1: force dark off, 2: force dark on
401
+ int androidForceDarkMode = 0 , // 0: follow system setting, 1: force dark off, 2: force dark on
402
402
// ios
403
403
bool enableWKWebView = true ,
404
- int wkContentMode = 0 , // 0: recommended, 1: mobile, 2: desktop
404
+ int wkContentMode = 0 , // 0: recommended, 1: mobile, 2: desktop
405
405
bool wkAllowsLinkPreview = true ,
406
406
// editor
407
- bool separated = false )
407
+ bool separated = false
408
+ )
408
409
{
409
410
#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
410
411
_CWebViewPlugin_InitStatic (
@@ -537,7 +538,7 @@ public void Resume()
537
538
{
538
539
#if UNITY_WEBPLAYER || UNITY_WEBGL
539
540
//TODO: UNSUPPORTED
540
- #elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX
541
+ #elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX || UNITY_STANDALONE
541
542
//TODO: UNSUPPORTED
542
543
#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
543
544
//TODO: UNSUPPORTED
@@ -554,9 +555,9 @@ public void Resume()
554
555
// NOTE: for historical reasons, `center` means the lower left corner and positive y values extend up.
555
556
public void SetCenterPositionWithScale ( Vector2 center , Vector2 scale )
556
557
{
557
- #if UNITY_WEBPLAYER || UNITY_WEBGL
558
+ #if UNITY_WEBPLAYER || UNITY_WEBGL || UNITY_SERVER
558
559
//TODO: UNSUPPORTED
559
- #elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX
560
+ #elif UNITY_EDITOR_WIN || UNITY_STANDALONE || UNITY_EDITOR_LINUX
560
561
//TODO: UNSUPPORTED
561
562
#else
562
563
float left = ( Screen . width - scale . x ) / 2.0f + center . x ;
@@ -569,7 +570,7 @@ public void SetCenterPositionWithScale(Vector2 center, Vector2 scale)
569
570
570
571
public void SetMargins ( int left , int top , int right , int bottom , bool relative = false )
571
572
{
572
- #if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX
573
+ #if UNITY_EDITOR_WIN || UNITY_STANDALONE || UNITY_EDITOR_LINUX
573
574
//TODO: UNSUPPORTED
574
575
return ;
575
576
#elif UNITY_WEBPLAYER || UNITY_WEBGL
@@ -589,8 +590,11 @@ public void SetMargins(int left, int top, int right, int bottom, bool relative =
589
590
mMarginRight = right ;
590
591
mMarginBottom = bottom ;
591
592
mMarginRelative = relative ;
592
- float ml , mt , mr , mb ;
593
- #if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX
593
+ float ml ,
594
+ mt ,
595
+ mr ,
596
+ mb ;
597
+ #if UNITY_EDITOR_WIN || UNITY_STANDALONE || UNITY_EDITOR_LINUX
594
598
//TODO: UNSUPPORTED
595
599
#elif UNITY_WEBPLAYER || UNITY_WEBGL
596
600
ml = left ;
@@ -641,11 +645,7 @@ public void SetMargins(int left, int top, int right, int bottom, bool relative =
641
645
#endif
642
646
bool r = relative ;
643
647
644
- if ( ml == mMarginLeftComputed
645
- && mt == mMarginTopComputed
646
- && mr == mMarginRightComputed
647
- && mb == mMarginBottomComputed
648
- && r == mMarginRelativeComputed )
648
+ if ( ml == mMarginLeftComputed && mt == mMarginTopComputed && mr == mMarginRightComputed && mb == mMarginBottomComputed && r == mMarginRelativeComputed )
649
649
{
650
650
return ;
651
651
}
@@ -655,7 +655,7 @@ public void SetMargins(int left, int top, int right, int bottom, bool relative =
655
655
mMarginBottomComputed = mb ;
656
656
mMarginRelativeComputed = r ;
657
657
658
- #if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX
658
+ #if UNITY_EDITOR_WIN || UNITY_STANDALONE || UNITY_EDITOR_LINUX
659
659
//TODO: UNSUPPORTED
660
660
#elif UNITY_WEBPLAYER
661
661
Application . ExternalCall ( "unityWebView.setMargins" , name , ( int ) ml , ( int ) mt , ( int ) mr , ( int ) mb ) ;
@@ -681,7 +681,7 @@ public void SetVisibility(bool v)
681
681
#endif
682
682
#elif UNITY_WEBPLAYER
683
683
Application . ExternalCall ( "unityWebView.setVisibility" , name , v ) ;
684
- #elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX
684
+ #elif UNITY_EDITOR_WIN || UNITY_STANDALONE || UNITY_EDITOR_LINUX
685
685
//TODO: UNSUPPORTED
686
686
#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
687
687
if ( webView == IntPtr . Zero )
@@ -818,7 +818,7 @@ public bool SetURLPattern(string allowPattern, string denyPattern, string hookPa
818
818
#if UNITY_WEBPLAYER || UNITY_WEBGL
819
819
//TODO: UNSUPPORTED
820
820
return false ;
821
- #elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX
821
+ #elif UNITY_EDITOR_WIN || UNITY_STANDALONE || UNITY_EDITOR_LINUX
822
822
//TODO: UNSUPPORTED
823
823
return false ;
824
824
#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE
@@ -842,7 +842,7 @@ public void LoadURL(string url)
842
842
#endif
843
843
#elif UNITY_WEBPLAYER
844
844
Application . ExternalCall ( "unityWebView.loadURL" , name , url ) ;
845
- #elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX
845
+ #elif UNITY_EDITOR_WIN || UNITY_STANDALONE || UNITY_EDITOR_LINUX
846
846
//TODO: UNSUPPORTED
847
847
#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE
848
848
if ( webView == IntPtr . Zero )
@@ -863,7 +863,7 @@ public void LoadHTML(string html, string baseUrl)
863
863
baseUrl = "" ;
864
864
#if UNITY_WEBPLAYER || UNITY_WEBGL
865
865
//TODO: UNSUPPORTED
866
- #elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX
866
+ #elif UNITY_EDITOR_WIN || UNITY_STANDALONE || UNITY_EDITOR_LINUX
867
867
//TODO: UNSUPPORTED
868
868
#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE
869
869
if ( webView == IntPtr . Zero )
@@ -884,7 +884,7 @@ public void EvaluateJS(string js)
884
884
#endif
885
885
#elif UNITY_WEBPLAYER
886
886
Application . ExternalCall ( "unityWebView.evaluateJS" , name , js ) ;
887
- #elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX
887
+ #elif UNITY_EDITOR_WIN || UNITY_STANDALONE || UNITY_EDITOR_LINUX
888
888
//TODO: UNSUPPORTED
889
889
#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE
890
890
if ( webView == IntPtr . Zero )
@@ -902,7 +902,7 @@ public int Progress()
902
902
#if UNITY_WEBPLAYER || UNITY_WEBGL
903
903
//TODO: UNSUPPORTED
904
904
return 0 ;
905
- #elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX
905
+ #elif UNITY_EDITOR_WIN || UNITY_STANDALONE || UNITY_EDITOR_LINUX
906
906
//TODO: UNSUPPORTED
907
907
return 0 ;
908
908
#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE
@@ -921,7 +921,7 @@ public bool CanGoBack()
921
921
#if UNITY_WEBPLAYER || UNITY_WEBGL
922
922
//TODO: UNSUPPORTED
923
923
return false ;
924
- #elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX
924
+ #elif UNITY_EDITOR_WIN || UNITY_STANDALONE || UNITY_EDITOR_LINUX
925
925
//TODO: UNSUPPORTED
926
926
return false ;
927
927
#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE
@@ -940,7 +940,7 @@ public bool CanGoForward()
940
940
#if UNITY_WEBPLAYER || UNITY_WEBGL
941
941
//TODO: UNSUPPORTED
942
942
return false ;
943
- #elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX
943
+ #elif UNITY_EDITOR_WIN || UNITY_STANDALONE || UNITY_EDITOR_LINUX
944
944
//TODO: UNSUPPORTED
945
945
return false ;
946
946
#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE
@@ -958,7 +958,7 @@ public void GoBack()
958
958
{
959
959
#if UNITY_WEBPLAYER || UNITY_WEBGL
960
960
//TODO: UNSUPPORTED
961
- #elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX
961
+ #elif UNITY_EDITOR_WIN || UNITY_STANDALONE || UNITY_EDITOR_LINUX
962
962
//TODO: UNSUPPORTED
963
963
#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE
964
964
if ( webView == IntPtr . Zero )
@@ -975,7 +975,7 @@ public void GoForward()
975
975
{
976
976
#if UNITY_WEBPLAYER || UNITY_WEBGL
977
977
//TODO: UNSUPPORTED
978
- #elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX
978
+ #elif UNITY_EDITOR_WIN || UNITY_STANDALONE || UNITY_EDITOR_LINUX
979
979
//TODO: UNSUPPORTED
980
980
#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE
981
981
if ( webView == IntPtr . Zero )
@@ -992,7 +992,7 @@ public void Reload()
992
992
{
993
993
#if UNITY_WEBPLAYER || UNITY_WEBGL
994
994
//TODO: UNSUPPORTED
995
- #elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX
995
+ #elif UNITY_EDITOR_WIN || UNITY_STANDALONE || UNITY_EDITOR_LINUX
996
996
//TODO: UNSUPPORTED
997
997
#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE
998
998
if ( webView == IntPtr . Zero )
@@ -1067,7 +1067,6 @@ public void CallOnHooked(string message)
1067
1067
}
1068
1068
}
1069
1069
1070
-
1071
1070
public void AddCustomHeader ( string headerKey , string headerValue )
1072
1071
{
1073
1072
#if UNITY_WEBPLAYER || UNITY_WEBGL
@@ -1090,7 +1089,7 @@ public string GetCustomHeaderValue(string headerKey)
1090
1089
#if UNITY_WEBPLAYER || UNITY_WEBGL
1091
1090
//TODO: UNSUPPORTED
1092
1091
return null ;
1093
- #elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX
1092
+ #elif UNITY_EDITOR_WIN || UNITY_STANDALONE || UNITY_EDITOR_LINUX
1094
1093
//TODO: UNSUPPORTED
1095
1094
return null ;
1096
1095
#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE
@@ -1153,7 +1152,6 @@ public void ClearCookies()
1153
1152
#endif
1154
1153
}
1155
1154
1156
-
1157
1155
public void SaveCookies ( )
1158
1156
{
1159
1157
#if UNITY_WEBPLAYER || UNITY_WEBGL
@@ -1171,7 +1169,6 @@ public void SaveCookies()
1171
1169
#endif
1172
1170
}
1173
1171
1174
-
1175
1172
public string GetCookies ( string url )
1176
1173
{
1177
1174
#if UNITY_WEBPLAYER || UNITY_WEBGL
@@ -1230,7 +1227,6 @@ public void ClearCache(bool includeDiskFiles)
1230
1227
#endif
1231
1228
}
1232
1229
1233
-
1234
1230
public void SetTextZoom ( int textZoom )
1235
1231
{
1236
1232
#if UNITY_WEBPLAYER || UNITY_WEBGL
0 commit comments