45 lines
1.2 KiB
C#
45 lines
1.2 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class WebViewInfo : MonoBehaviourSingletonTemplate<WebViewInfo>
|
|
{
|
|
public GameObject go_closeBtn;
|
|
|
|
WebViewObject webViewObject;
|
|
|
|
protected override void Awake()
|
|
{
|
|
base.Awake();
|
|
//DontDestroy(); // 다른 곳에서 부모로 설정함
|
|
webViewObject = new GameObject("gree").AddComponent<WebViewObject>();
|
|
webViewObject.transform.parent = transform;
|
|
webViewObject.transform.localPosition = Vector3.zero;
|
|
#if !UNITY_EDITOR
|
|
webViewObject.Init(separated: true, enableWKWebView: true);
|
|
#endif
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
OnClick_Close();
|
|
}
|
|
|
|
public void Show_WebView(string _url)
|
|
{
|
|
webViewObject.gameObject.SetActive(true);
|
|
go_closeBtn.SetActive(true);
|
|
#if !UNITY_EDITOR
|
|
webViewObject.LoadURL(_url);
|
|
webViewObject.SetVisibility(true);
|
|
//var margin = Mathf.Max(50, 50 * Screen.height / 1280);
|
|
webViewObject.SetMargins(0, 0, 100, 0);
|
|
#endif
|
|
}
|
|
|
|
public void OnClick_Close()
|
|
{
|
|
if (webViewObject != null) webViewObject.SetVisibility(false);
|
|
go_closeBtn.SetActive(false);
|
|
}
|
|
} |