Commit d78bb39b authored by KimLakYoung's avatar KimLakYoung
Browse files

웹뷰삭제

parent cdcdc0cd
File deleted
fileFormatVersion: 2
guid: 8159b26dba4304c5cad304bd66ec10ba
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: d905d179774205b48af068bc22ac3f6b
folderAsset: yes
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
DefaultValueInitialized: true
- first:
Standalone: OSXUniversal
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 73cbdf950fe6c3344ba9bb3849d75cda
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
<?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>11G63</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>CFBundleVersion</key>
<string>1</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>4G182</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>12C37</string>
<key>DTSDKName</key>
<string>macosx10.8</string>
<key>DTXcode</key>
<string>0450</string>
<key>DTXcodeBuild</key>
<string>4G182</string>
</dict>
</plist>
fileFormatVersion: 2
guid: af34f0bfb341f4c7c96d154b0b832e2a
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 5dae93cd0f9890f4fa10d2351a2c2b9f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
File deleted
fileFormatVersion: 2
guid: 570b6d1d522874a4dbd65e29ac4e743b
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 489a4650c31a3af41b8d441d87d17bcf
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Binary files a/GetEyes/Assets/Plugins/WebView.bundle/Contents/Resources/InfoPlist.strings and /dev/null differ Binary files a/GetEyes/Assets/Plugins/WebView.bundle/Contents/Resources/InfoPlist.strings and /dev/null differ
fileFormatVersion: 2
guid: 9a88f01b59cb349eb8984fbf5cc62fef
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
/*
* Copyright (C) 2011 Keijiro Takahashi
* Copyright (C) 2012 GREE, Inc.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*/
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using Callback = System.Action<string>;
#if UNITY_EDITOR || UNITY_STANDALONE_OSX
public class UnitySendMessageDispatcher
{
public static void Dispatch(string name, string method, string message)
{
GameObject obj = GameObject.Find(name);
if (obj != null)
obj.SendMessage(method, message);
}
}
#endif
public class WebViewObject : MonoBehaviour
{
Callback callback;
#if UNITY_EDITOR || UNITY_STANDALONE_OSX
IntPtr webView;
bool visibility;
Rect rect;
Texture2D texture;
string inputString;
#elif UNITY_IPHONE
IntPtr webView;
#elif UNITY_ANDROID
AndroidJavaObject webView;
Vector2 offset;
#endif
#if UNITY_EDITOR || UNITY_STANDALONE_OSX
[DllImport("WebView")]
private static extern IntPtr _WebViewPlugin_Init(
string gameObject, int width, int height, bool ineditor);
[DllImport("WebView")]
private static extern int _WebViewPlugin_Destroy(IntPtr instance);
[DllImport("WebView")]
private static extern void _WebViewPlugin_SetRect(
IntPtr instance, int width, int height);
[DllImport("WebView")]
private static extern void _WebViewPlugin_SetVisibility(
IntPtr instance, bool visibility);
[DllImport("WebView")]
private static extern void _WebViewPlugin_LoadURL(
IntPtr instance, string url);
[DllImport("WebView")]
private static extern void _WebViewPlugin_EvaluateJS(
IntPtr instance, string url);
[DllImport("WebView")]
private static extern void _WebViewPlugin_Update(IntPtr instance,
int x, int y, float deltaY, bool down, bool press, bool release,
bool keyPress, short keyCode, string keyChars, int textureId);
#elif UNITY_IPHONE
[DllImport("__Internal")]
private static extern IntPtr _WebViewPlugin_Init(string gameObject);
[DllImport("__Internal")]
private static extern int _WebViewPlugin_Destroy(IntPtr instance);
[DllImport("__Internal")]
private static extern void _WebViewPlugin_SetMargins(
IntPtr instance, int left, int top, int right, int bottom);
[DllImport("__Internal")]
private static extern void _WebViewPlugin_SetVisibility(
IntPtr instance, bool visibility);
[DllImport("__Internal")]
private static extern void _WebViewPlugin_LoadURL(
IntPtr instance, string url);
[DllImport("__Internal")]
private static extern void _WebViewPlugin_EvaluateJS(
IntPtr instance, string url);
#endif
#if UNITY_EDITOR || UNITY_STANDALONE_OSX
private void CreateTexture(int x, int y, int width, int height)
{
int w = 1;
int h = 1;
while (w < width)
w <<= 1;
while (h < height)
h <<= 1;
rect = new Rect(x, y, width, height);
texture = new Texture2D(w, h, TextureFormat.ARGB32, false);
}
#endif
public void Init(Callback cb = null)
{
callback = cb;
#if UNITY_EDITOR || UNITY_STANDALONE_OSX
CreateTexture(0, 0, Screen.width, Screen.height);
webView = _WebViewPlugin_Init(name, Screen.width, Screen.height,
Application.platform == RuntimePlatform.OSXEditor);
#elif UNITY_IPHONE
webView = _WebViewPlugin_Init(name);
#elif UNITY_ANDROID
offset = new Vector2(0, 0);
webView = new AndroidJavaObject("net.gree.unitywebview.WebViewPlugin");
webView.Call("Init", name);
#endif
}
void OnDestroy()
{
#if UNITY_EDITOR || UNITY_STANDALONE_OSX
if (webView == IntPtr.Zero)
return;
_WebViewPlugin_Destroy(webView);
#elif UNITY_IPHONE
if (webView == IntPtr.Zero)
return;
_WebViewPlugin_Destroy(webView);
#elif UNITY_ANDROID
if (webView == null)
return;
webView.Call("Destroy");
#endif
}
public void SetMargins(int left, int top, int right, int bottom)
{
#if UNITY_EDITOR || UNITY_STANDALONE_OSX
if (webView == IntPtr.Zero)
return;
int width = Screen.width - (left + right);
int height = Screen.height - (bottom + top);
CreateTexture(left, bottom, width, height);
_WebViewPlugin_SetRect(webView, width, height);
#elif UNITY_IPHONE
if (webView == IntPtr.Zero)
return;
_WebViewPlugin_SetMargins(webView, left, top, right, bottom);
#elif UNITY_ANDROID
if (webView == null)
return;
offset = new Vector2(left, top);
webView.Call("SetMargins", left, top, right, bottom);
#endif
}
public void SetVisibility(bool v)
{
#if UNITY_EDITOR || UNITY_STANDALONE_OSX
if (webView == IntPtr.Zero)
return;
visibility = v;
_WebViewPlugin_SetVisibility(webView, v);
#elif UNITY_IPHONE
if (webView == IntPtr.Zero)
return;
_WebViewPlugin_SetVisibility(webView, v);
#elif UNITY_ANDROID
if (webView == null)
return;
webView.Call("SetVisibility", v);
#endif
}
public void LoadURL(string url)
{
#if UNITY_EDITOR || UNITY_STANDALONE_OSX || UNITY_IPHONE
if (webView == IntPtr.Zero)
return;
_WebViewPlugin_LoadURL(webView, url);
#elif UNITY_ANDROID
if (webView == null)
return;
webView.Call("LoadURL", url);
#endif
}
public void EvaluateJS(string js)
{
#if UNITY_EDITOR || UNITY_STANDALONE_OSX || UNITY_IPHONE
if (webView == IntPtr.Zero)
return;
_WebViewPlugin_EvaluateJS(webView, js);
#elif UNITY_ANDROID
if (webView == null)
return;
webView.Call("LoadURL", "javascript:" + js);
#endif
}
public void CallFromJS(string message)
{
if (callback != null)
callback(message);
}
#if UNITY_EDITOR || UNITY_STANDALONE_OSX
void Update()
{
inputString += Input.inputString;
}
void OnGUI()
{
if (webView == IntPtr.Zero || !visibility)
return;
Vector3 pos = Input.mousePosition;
bool down = Input.GetButton("Fire1");
bool press = Input.GetButtonDown("Fire1");
bool release = Input.GetButtonUp("Fire1");
float deltaY = Input.GetAxis("Mouse ScrollWheel");
bool keyPress = false;
string keyChars = "";
short keyCode = 0;
if (inputString.Length > 0) {
keyPress = true;
keyChars = inputString.Substring(0, 1);
keyCode = (short)inputString[0];
inputString = inputString.Substring(1);
}
_WebViewPlugin_Update(webView,
(int)(pos.x - rect.x), (int)(pos.y - rect.y), deltaY,
down, press, release, keyPress, keyCode, keyChars,
texture.GetNativeTextureID());
GL.IssuePluginEvent((int)webView);
Matrix4x4 m = GUI.matrix;
GUI.matrix = Matrix4x4.TRS(new Vector3(0, Screen.height, 0),
Quaternion.identity, new Vector3(1, -1, 1));
GUI.DrawTexture(rect, texture);
GUI.matrix = m;
}
#endif
}
fileFormatVersion: 2
guid: eb2e7ee2a8f32472a950031e188fea23
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
/*
* Copyright (C) 2011 Keijiro Takahashi
* Copyright (C) 2012 GREE, Inc.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*/
#import <UIKit/UIKit.h>
extern UIViewController *UnityGetGLViewController();
extern "C" void UnitySendMessage(const char *, const char *, const char *);
@interface WebViewPlugin : NSObject<UIWebViewDelegate>
{
UIWebView *webView;
NSString *gameObjectName;
}
@end
@implementation WebViewPlugin
- (id)initWithGameObjectName:(const char *)gameObjectName_
{
self = [super init];
UIView *view = UnityGetGLViewController().view;
webView = [[UIWebView alloc] initWithFrame:view.frame];
webView.delegate = self;
webView.hidden = YES;
[view addSubview:webView];
gameObjectName = [[NSString stringWithUTF8String:gameObjectName_] retain];
return self;
}
- (void)dealloc
{
[webView removeFromSuperview];
[webView release];
[gameObjectName release];
[super dealloc];
}
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
NSString *url = [[request URL] absoluteString];
if ([url hasPrefix:@"unity:"]) {
UnitySendMessage([gameObjectName UTF8String],
"CallFromJS", [[url substringFromIndex:6] UTF8String]);
return NO;
} else {
return YES;
}
}
- (void)setMargins:(int)left top:(int)top right:(int)right bottom:(int)bottom
{
UIView *view = UnityGetGLViewController().view;
CGRect frame = view.frame;
CGFloat scale = view.contentScaleFactor;
frame.size.width -= (left + right) / scale;
frame.size.height -= (top + bottom) / scale;
frame.origin.x += left / scale;
frame.origin.y += top / scale;
webView.frame = frame;
}
- (void)setVisibility:(BOOL)visibility
{
webView.hidden = visibility ? NO : YES;
}
- (void)loadURL:(const char *)url
{
NSString *urlStr = [NSString stringWithUTF8String:url];
NSURL *nsurl = [NSURL URLWithString:urlStr];
NSURLRequest *request = [NSURLRequest requestWithURL:nsurl];
[webView loadRequest:request];
}
- (void)evaluateJS:(const char *)js
{
NSString *jsStr = [NSString stringWithUTF8String:js];
[webView stringByEvaluatingJavaScriptFromString:jsStr];
}
@end
extern "C" {
void *_WebViewPlugin_Init(const char *gameObjectName);
void _WebViewPlugin_Destroy(void *instance);
void _WebViewPlugin_SetMargins(
void *instance, int left, int top, int right, int bottom);
void _WebViewPlugin_SetVisibility(void *instance, BOOL visibility);
void _WebViewPlugin_LoadURL(void *instance, const char *url);
void _WebViewPlugin_EvaluateJS(void *instance, const char *url);
}
void *_WebViewPlugin_Init(const char *gameObjectName)
{
id instance = [[WebViewPlugin alloc] initWithGameObjectName:gameObjectName];
return (void *)instance;
}
void _WebViewPlugin_Destroy(void *instance)
{
WebViewPlugin *webViewPlugin = (WebViewPlugin *)instance;
[webViewPlugin release];
}
void _WebViewPlugin_SetMargins(
void *instance, int left, int top, int right, int bottom)
{
WebViewPlugin *webViewPlugin = (WebViewPlugin *)instance;
[webViewPlugin setMargins:left top:top right:right bottom:bottom];
}
void _WebViewPlugin_SetVisibility(void *instance, BOOL visibility)
{
WebViewPlugin *webViewPlugin = (WebViewPlugin *)instance;
[webViewPlugin setVisibility:visibility];
}
void _WebViewPlugin_LoadURL(void *instance, const char *url)
{
WebViewPlugin *webViewPlugin = (WebViewPlugin *)instance;
[webViewPlugin loadURL:url];
}
void _WebViewPlugin_EvaluateJS(void *instance, const char *js)
{
WebViewPlugin *webViewPlugin = (WebViewPlugin *)instance;
[webViewPlugin evaluateJS:js];
}
fileFormatVersion: 2
guid: 504ce2bbdf89148fc8875001ed5c2294
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
...@@ -12,14 +12,13 @@ public class ARBrandInfo : MonoBehaviour ...@@ -12,14 +12,13 @@ public class ARBrandInfo : MonoBehaviour
public UISprite _HeartIcon; public UISprite _HeartIcon;
public UILabel _BrandName; public UILabel _BrandName;
public UILabel _ModelName; public UILabel _ModelName;
public UILabel _ProductName; public UILabel _ProductName;
private WebViewObject _WebviewObject;
public GameObject ShowPopUpButtonObject; public GameObject ShowPopUpButtonObject;
private ArMetaProductData _ArMetaProductData; private ArMetaProductData _ArMetaProductData;
private bool IsFavor; private bool IsFavor;
// Start is called before the first frame update // Start is called before the first frame update
public void SetInfo(ArMetaProductData armetaProductData, WebViewObject webViewObject = null) public void SetInfo(ArMetaProductData armetaProductData)
{ {
var productData = DataManager.Instance.ProductDatas[armetaProductData.ProductId]; var productData = DataManager.Instance.ProductDatas[armetaProductData.ProductId];
var companyData = DataManager.Instance.CompanyDatas[armetaProductData.CompanyId]; var companyData = DataManager.Instance.CompanyDatas[armetaProductData.CompanyId];
...@@ -28,8 +27,7 @@ public class ARBrandInfo : MonoBehaviour ...@@ -28,8 +27,7 @@ public class ARBrandInfo : MonoBehaviour
SetBrandIcon(companyData); SetBrandIcon(companyData);
_BrandName.text = companyData.Name; _BrandName.text = companyData.Name;
_ModelName.text = productData.ModelName; _ModelName.text = productData.ModelName;
_ProductName.text = string.Empty; _ProductName.text = string.Empty;
_WebviewObject = webViewObject;
SetShowPopUpButtonPos(); SetShowPopUpButtonPos();
CheckMyFavoriteCompany(); CheckMyFavoriteCompany();
ShowFovoriteCount(); ShowFovoriteCount();
...@@ -214,10 +212,7 @@ public class ARBrandInfo : MonoBehaviour ...@@ -214,10 +212,7 @@ public class ARBrandInfo : MonoBehaviour
} }
public void CloseButton() public void CloseButton()
{ {
if (_WebviewObject != null)
_WebviewObject.SetVisibility(false);
PopUpManager.Instance.ClosePopUp(); PopUpManager.Instance.ClosePopUp();
} }
......
...@@ -5,7 +5,6 @@ using UnityEngine; ...@@ -5,7 +5,6 @@ using UnityEngine;
public class BrandTargetPopUp : MonoBehaviour public class BrandTargetPopUp : MonoBehaviour
{ {
public WebViewObject _WebViewObject;
public ArMetaProductData _ImageTargetData; public ArMetaProductData _ImageTargetData;
private ARBrandInfo _ARBrandInfo; private ARBrandInfo _ARBrandInfo;
public GameObject ARBrandObject; public GameObject ARBrandObject;
...@@ -62,7 +61,7 @@ public class BrandTargetPopUp : MonoBehaviour ...@@ -62,7 +61,7 @@ public class BrandTargetPopUp : MonoBehaviour
obj.transform.localScale = Vector3.one; obj.transform.localScale = Vector3.one;
_ARBrandInfo = obj.GetComponent<ARBrandInfo>(); _ARBrandInfo = obj.GetComponent<ARBrandInfo>();
} }
_ARBrandInfo.SetInfo(imageTargetData, _WebViewObject); _ARBrandInfo.SetInfo(imageTargetData);
_ImageTargetData = imageTargetData; _ImageTargetData = imageTargetData;
} }
......
...@@ -174,31 +174,6 @@ public class UIManager : MonoBehaviour ...@@ -174,31 +174,6 @@ public class UIManager : MonoBehaviour
_ARTutorial.StartTuttorial(false); _ARTutorial.StartTuttorial(false);
} }
public void OpenWebView(string web, int left, int right, int top, int bottom, WebViewObject webViewObject)
{
string strUrl = string.Format("{0}", web);
Debug.Log(strUrl);
//Application.OpenURL(strUrl);
// 오브젝트를 생성하고 멤버 변수로 등록한다. ( 쉽게 제거하기 위해서 )
// WebViewObject 컴포넌트 등록
//m_webViewObject = (new GameObject("WebViewObject")).AddComponent<WebViewObject>();
//m_webViewObject.gameObject.name = "WebView";
// 반드시 Init 호출 파라미터 : 웹페이지
// Html 형태를 등록 할 경우 페이지에 연결된 다른 페이지로 이동하지 않는 버그 있었음
webViewObject.Init((msg) =>
{
Debug.Log(string.Format("CallFromJS[{0}]", msg));
});
// 마진값 : 화면으로부터 좌상우하 여백 값
webViewObject.SetMargins(left, top, right, bottom);
webViewObject.LoadURL(strUrl);
webViewObject.SetVisibility(true);
}
public void SetUiRootUpdateScale(bool isUpdate) public void SetUiRootUpdateScale(bool isUpdate)
{ {
_UiRoot.IsUpdateScale = isUpdate; _UiRoot.IsUpdateScale = isUpdate;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment