11/*
22 * Copyright (C) 2011 Keijiro Takahashi
33 * Copyright (C) 2012 GREE, Inc.
4- *
4+ *
55 * This software is provided 'as-is', without any express or implied
66 * warranty. In no event will the authors be held liable for any damages
77 * arising from the use of this software.
8- *
8+ *
99 * Permission is granted to anyone to use this software for any purpose,
1010 * including commercial applications, and to alter it and redistribute it
1111 * freely, subject to the following restrictions:
12- *
12+ *
1313 * 1. The origin of this software must not be misrepresented; you must not
1414 * claim that you wrote the original software. If you use this software
1515 * in a product, an acknowledgment in the product documentation would be
@@ -398,13 +398,14 @@ public void Init(
398398 bool zoom = true ,
399399 string ua = "" ,
400400 // 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
402402 // ios
403403 bool enableWKWebView = true ,
404- int wkContentMode = 0 , // 0: recommended, 1: mobile, 2: desktop
404+ int wkContentMode = 0 , // 0: recommended, 1: mobile, 2: desktop
405405 bool wkAllowsLinkPreview = true ,
406406 // editor
407- bool separated = false )
407+ bool separated = false
408+ )
408409 {
409410#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
410411 _CWebViewPlugin_InitStatic (
@@ -537,7 +538,7 @@ public void Resume()
537538 {
538539#if UNITY_WEBPLAYER || UNITY_WEBGL
539540 //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
541542 //TODO: UNSUPPORTED
542543#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
543544 //TODO: UNSUPPORTED
@@ -554,9 +555,9 @@ public void Resume()
554555 // NOTE: for historical reasons, `center` means the lower left corner and positive y values extend up.
555556 public void SetCenterPositionWithScale ( Vector2 center , Vector2 scale )
556557 {
557- #if UNITY_WEBPLAYER || UNITY_WEBGL
558+ #if UNITY_WEBPLAYER || UNITY_WEBGL || UNITY_SERVER
558559 //TODO: UNSUPPORTED
559- #elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX
560+ #elif UNITY_EDITOR_WIN || UNITY_STANDALONE || UNITY_EDITOR_LINUX
560561 //TODO: UNSUPPORTED
561562#else
562563 float left = ( Screen . width - scale . x ) / 2.0f + center . x ;
@@ -569,7 +570,7 @@ public void SetCenterPositionWithScale(Vector2 center, Vector2 scale)
569570
570571 public void SetMargins ( int left , int top , int right , int bottom , bool relative = false )
571572 {
572- #if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX
573+ #if UNITY_EDITOR_WIN || UNITY_STANDALONE || UNITY_EDITOR_LINUX
573574 //TODO: UNSUPPORTED
574575 return ;
575576#elif UNITY_WEBPLAYER || UNITY_WEBGL
@@ -589,8 +590,11 @@ public void SetMargins(int left, int top, int right, int bottom, bool relative =
589590 mMarginRight = right ;
590591 mMarginBottom = bottom ;
591592 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
594598 //TODO: UNSUPPORTED
595599#elif UNITY_WEBPLAYER || UNITY_WEBGL
596600 ml = left ;
@@ -641,11 +645,7 @@ public void SetMargins(int left, int top, int right, int bottom, bool relative =
641645#endif
642646 bool r = relative ;
643647
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 )
649649 {
650650 return ;
651651 }
@@ -655,7 +655,7 @@ public void SetMargins(int left, int top, int right, int bottom, bool relative =
655655 mMarginBottomComputed = mb ;
656656 mMarginRelativeComputed = r ;
657657
658- #if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX
658+ #if UNITY_EDITOR_WIN || UNITY_STANDALONE || UNITY_EDITOR_LINUX
659659 //TODO: UNSUPPORTED
660660#elif UNITY_WEBPLAYER
661661 Application . ExternalCall ( "unityWebView.setMargins" , name , ( int ) ml , ( int ) mt , ( int ) mr , ( int ) mb ) ;
@@ -681,7 +681,7 @@ public void SetVisibility(bool v)
681681#endif
682682#elif UNITY_WEBPLAYER
683683 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
685685 //TODO: UNSUPPORTED
686686#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
687687 if ( webView == IntPtr . Zero )
@@ -818,7 +818,7 @@ public bool SetURLPattern(string allowPattern, string denyPattern, string hookPa
818818#if UNITY_WEBPLAYER || UNITY_WEBGL
819819 //TODO: UNSUPPORTED
820820 return false ;
821- #elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX
821+ #elif UNITY_EDITOR_WIN || UNITY_STANDALONE || UNITY_EDITOR_LINUX
822822 //TODO: UNSUPPORTED
823823 return false ;
824824#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE
@@ -842,7 +842,7 @@ public void LoadURL(string url)
842842#endif
843843#elif UNITY_WEBPLAYER
844844 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
846846 //TODO: UNSUPPORTED
847847#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE
848848 if ( webView == IntPtr . Zero )
@@ -863,7 +863,7 @@ public void LoadHTML(string html, string baseUrl)
863863 baseUrl = "" ;
864864#if UNITY_WEBPLAYER || UNITY_WEBGL
865865 //TODO: UNSUPPORTED
866- #elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX
866+ #elif UNITY_EDITOR_WIN || UNITY_STANDALONE || UNITY_EDITOR_LINUX
867867 //TODO: UNSUPPORTED
868868#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE
869869 if ( webView == IntPtr . Zero )
@@ -884,7 +884,7 @@ public void EvaluateJS(string js)
884884#endif
885885#elif UNITY_WEBPLAYER
886886 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
888888 //TODO: UNSUPPORTED
889889#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE
890890 if ( webView == IntPtr . Zero )
@@ -902,7 +902,7 @@ public int Progress()
902902#if UNITY_WEBPLAYER || UNITY_WEBGL
903903 //TODO: UNSUPPORTED
904904 return 0 ;
905- #elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX
905+ #elif UNITY_EDITOR_WIN || UNITY_STANDALONE || UNITY_EDITOR_LINUX
906906 //TODO: UNSUPPORTED
907907 return 0 ;
908908#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE
@@ -921,7 +921,7 @@ public bool CanGoBack()
921921#if UNITY_WEBPLAYER || UNITY_WEBGL
922922 //TODO: UNSUPPORTED
923923 return false ;
924- #elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX
924+ #elif UNITY_EDITOR_WIN || UNITY_STANDALONE || UNITY_EDITOR_LINUX
925925 //TODO: UNSUPPORTED
926926 return false ;
927927#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE
@@ -940,7 +940,7 @@ public bool CanGoForward()
940940#if UNITY_WEBPLAYER || UNITY_WEBGL
941941 //TODO: UNSUPPORTED
942942 return false ;
943- #elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX
943+ #elif UNITY_EDITOR_WIN || UNITY_STANDALONE || UNITY_EDITOR_LINUX
944944 //TODO: UNSUPPORTED
945945 return false ;
946946#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE
@@ -958,7 +958,7 @@ public void GoBack()
958958 {
959959#if UNITY_WEBPLAYER || UNITY_WEBGL
960960 //TODO: UNSUPPORTED
961- #elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX
961+ #elif UNITY_EDITOR_WIN || UNITY_STANDALONE || UNITY_EDITOR_LINUX
962962 //TODO: UNSUPPORTED
963963#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE
964964 if ( webView == IntPtr . Zero )
@@ -975,7 +975,7 @@ public void GoForward()
975975 {
976976#if UNITY_WEBPLAYER || UNITY_WEBGL
977977 //TODO: UNSUPPORTED
978- #elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX
978+ #elif UNITY_EDITOR_WIN || UNITY_STANDALONE || UNITY_EDITOR_LINUX
979979 //TODO: UNSUPPORTED
980980#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE
981981 if ( webView == IntPtr . Zero )
@@ -992,7 +992,7 @@ public void Reload()
992992 {
993993#if UNITY_WEBPLAYER || UNITY_WEBGL
994994 //TODO: UNSUPPORTED
995- #elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX
995+ #elif UNITY_EDITOR_WIN || UNITY_STANDALONE || UNITY_EDITOR_LINUX
996996 //TODO: UNSUPPORTED
997997#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE
998998 if ( webView == IntPtr . Zero )
@@ -1067,7 +1067,6 @@ public void CallOnHooked(string message)
10671067 }
10681068 }
10691069
1070-
10711070 public void AddCustomHeader ( string headerKey , string headerValue )
10721071 {
10731072#if UNITY_WEBPLAYER || UNITY_WEBGL
@@ -1090,7 +1089,7 @@ public string GetCustomHeaderValue(string headerKey)
10901089#if UNITY_WEBPLAYER || UNITY_WEBGL
10911090 //TODO: UNSUPPORTED
10921091 return null ;
1093- #elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_LINUX
1092+ #elif UNITY_EDITOR_WIN || UNITY_STANDALONE || UNITY_EDITOR_LINUX
10941093 //TODO: UNSUPPORTED
10951094 return null ;
10961095#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE
@@ -1153,7 +1152,6 @@ public void ClearCookies()
11531152#endif
11541153 }
11551154
1156-
11571155 public void SaveCookies ( )
11581156 {
11591157#if UNITY_WEBPLAYER || UNITY_WEBGL
@@ -1171,7 +1169,6 @@ public void SaveCookies()
11711169#endif
11721170 }
11731171
1174-
11751172 public string GetCookies ( string url )
11761173 {
11771174#if UNITY_WEBPLAYER || UNITY_WEBGL
@@ -1230,7 +1227,6 @@ public void ClearCache(bool includeDiskFiles)
12301227#endif
12311228 }
12321229
1233-
12341230 public void SetTextZoom ( int textZoom )
12351231 {
12361232#if UNITY_WEBPLAYER || UNITY_WEBGL
0 commit comments