블로그 이미지
Every unexpected event is a path to learning for you. blueasa

카테고리

분류 전체보기 (2797)
Unity3D (853)
Programming (479)
Server (33)
Unreal (4)
Gamebryo (56)
Tip & Tech (185)
협업 (61)
3DS Max (3)
Game (12)
Utility (68)
Etc (98)
Link (32)
Portfolio (19)
Subject (90)
iOS,OSX (55)
Android (14)
Linux (5)
잉여 프로젝트 (2)
게임이야기 (3)
Memories (20)
Interest (38)
Thinking (38)
한글 (30)
PaperCraft (5)
Animation (408)
Wallpaper (2)
재테크 (18)
Exercise (3)
나만의 맛집 (3)
냥이 (10)
육아 (16)
Total
Today
Yesterday

'WebView'에 해당되는 글 4건

  1. 2017.10.23 [Link] unity-webview
  2. 2015.08.05 WebView 플러그인 Awesomium(HTML UI Engine) 3
  3. 2015.01.21 Unity3D WebView
  4. 2015.01.20 유니티 3D상에서 WebView 띄우기

[Link] unity-webview

Unity3D/Plugins / 2017. 10. 23. 19:11


[Link] https://github.com/gree/unity-webview

반응형
Posted by blueasa
, |

유니티에서 쓸 WebView를 찾아보다가 유료지만 괜찮아 보이길래 남겨 놓음.


수익이 $100k(대략 1억원) 이하면 Free 버전 써도 된다고 하니 나중에 한 번 건드려 봐야지..


[링크] http://www.awesomium.com/


[참조]

http://www.devkorea.co.kr/bbs/board.php?bo_table=m03_qna&wr_id=29578

http://labs.awesomium.com/unity3d-integration-tutorial-part-1/


반응형
Posted by blueasa
, |

Unity3D WebView

Unity3D/Plugins / 2015. 1. 21. 17:46

Unity 3D에서 WebView를 쓸 때 유용한 소스 입니다. 

일본 개발자분이 오픈소스로 라이센스로 공개한 것 같더군요...


[소스]

https://github.com/gree/unity-webview


- Java로 작성된 Android 용 Native Plugin

- Objective-C로 작성된 iOS 용 Native Plugin

- Objective-C로 작성된 OS X 용 Native Plugin

- Native Plugin을 사용하기위한 C # Plugin


[예제 프로젝트]

https://github.com/keijiro/unity-webview-integration


unity-webview-integration 소스는 웹 페이지를 WebView로 호출에서 아래와 같이 unity와 기능을 연동한 예제 입니다.

javascript 예제여서 좀 아쉽네요. C#으로 수정해봐야 겠습니다.


http://keijiro.github.com/unity-webview-integration/index.html#

...

<title>Unity - WebView Integration Test Page</title>

<p><ul>

<li><a href="#" onclick='unity.callback("/spawn")'>Spawn a box</a></li>

<li><a href="#" onclick='unity.callback("/spawn", {color:"red"})'>Spawn a red box</a></li>

<li><a href="#" onclick='unity.callback("/spawn", {color:"blue"})'>Spawn a blue box</a></li>

<li><a href="#" onclick='unity.callback("/spawn", {color:"red", scale:0.5})'>Spawn a small red box</a></li>

<li><a href="#" onclick='unity.callback("/spawn", {color:"blue", scale:0.5})'>Spawn a small blue box</a></li>

<li><a href="#" onclick='unity.callback("/note", {text:"こんにちは"})'>「こんにちは」</a></li>

<li><a href="#" onclick='unity.callback("/note", {text:"ごきげんいかが"})'>「ごきげんいかが」</a></li>

<li><a href="#" onclick='unity.callback("/note", {text:"!@#$%^&*()-+"})'>"!@#$%^&*()-+"</a></li>

<li><a href="#" onclick='unity.callback("/close")'>Close</a></li>

<li><a href="page2.html">Go to page 2.</a></li>

</ul></p>

...


TestInterface.js (unity 3d script)

...

// Process messages coming from the web view.

private function ProcessMessages() {

    while (true) {

        // Poll a message or break.

        var message = WebMediator.PollMessage();

        if (!message) break;


        if (message.path == "/spawn") {

            // "spawn" message.

            if (message.args.ContainsKey("color")) {

                var prefab = (message.args["color"] == "red") ? redBoxPrefab : blueBoxPrefab;

            } else {

                prefab = Random.value < 0.5 ? redBoxPrefab : blueBoxPrefab;

            }

            var box = Instantiate(prefab, redBoxPrefab.transform.position, Random.rotation) as GameObject; 

            if (message.args.ContainsKey("scale")) {

                box.transform.localScale = Vector3.one * float.Parse(message.args["scale"] as String);

            }

        } else if (message.path == "/note") {

            // "note" message.

            note = message.args["text"] as String;

        } else if (message.path == "/print") {

            // "print" message.

            var text = message.args["line1"] as String;

            if (message.args.ContainsKey("line2")) {

                text += "\n" + message.args["line2"] as String;

            }

            Debug.Log(text);

            Debug.Log("(" + text.Length + " chars)");

        } else if (message.path == "/close") {

            // "close" message.

            DeactivateWebView();

        }

    }

}

...



// C#으로 변환한 소스 입니다.  by asuss님(출처 : http://reysion.tistory.com/34 의 댓글)

using UnityEngine;
using System.Collections;

public class TestWebView : MonoBehaviour {

public GUISkin guiSkin;
public GameObject redBoxPrefab;
public GameObject blueBoxPrefab;

private string note;

// Show the web view (with margins) and load the index page.
void ActivateWebView() {
WebMediator.LoadUrl("http://keijiro.github.com/unity-webview-integration/index.html");
WebMediator.SetMargin(12, Screen.height / 2 + 12, 12, 12);
WebMediator.Show();
}

// Hide the web view.
void DeactivateWebView() {
WebMediator.Hide();
// Clear the state of the web view (by loading a blank page).
WebMediator.LoadUrl("about:blank");
}

// Process messages coming from the web view.
void ProcessMessages() {
while (true) {
// Poll a message or break.
WebMediatorMessage message = WebMediator.PollMessage();
if (message == null) 
break;

if (message.path == "/spawn") {
// "spawn" message.
GameObject prefab = null;
if (message.args.ContainsKey("color")) {
prefab = (message.args["color"] == "red") ? redBoxPrefab : blueBoxPrefab;
} else {
prefab = Random.value < 0.5 ? redBoxPrefab : blueBoxPrefab;
}
var box = Instantiate(prefab, redBoxPrefab.transform.position, Random.rotation) as GameObject; 
if (message.args.ContainsKey("scale")) {
box.transform.localScale = Vector3.one * float.Parse(message.args["scale"] as string);
}
} else if (message.path == "/note") {
// "note" message.
note = message.args["text"] as string;
} else if (message.path == "/print") {
// "print" message.
var text = message.args["line1"] as string;
if (message.args.ContainsKey("line2")) {
text += "\n" + message.args["line2"] as string;
}
Debug.Log(text);
Debug.Log("(" + text.Length + " chars)");
} else if (message.path == "/close") {
// "close" message.
DeactivateWebView();
}
}
}

void Start() {
WebMediator.Install();
}

void Update() {
if (WebMediator.IsVisible()) {
ProcessMessages();
} else if (Input.GetButtonDown("Fire1") && Input.mousePosition.y < Screen.height / 2) {
ActivateWebView();
}
}

void OnGUI() {
float sw = Screen.width;
float sh = Screen.height;
GUI.skin = guiSkin;
if(note != null) 
GUI.Label(new Rect(0, 0, sw, sh/2), note);
GUI.Label(new Rect(0, sh/2, sw, sh/2), "TAP HERE", "center");
}
}



출처 : http://reysion.tistory.com/34

반응형
Posted by blueasa
, |


참조1 : http://www.devkorea.co.kr/bbs/board.php?bo_table=m03_qna&wr_id=29578


참조2 : http://wiki.unity3d.com/index.php/HtmlTexturePlugin


참조3 : http://labs.awesomium.com/unity3d-integration-tutorial-part-1/

반응형

'Unity3D > Plugins' 카테고리의 다른 글

UniWebView - Integrating WebView to your mobile games in a simple way  (0) 2015.01.21
Unity3D WebView  (0) 2015.01.21
Loading DDS, BMP, TGA and other textures via WWW class in Unity3d  (0) 2014.04.11
Log Viewer  (0) 2014.01.09
Mobile Movie Texture  (0) 2013.12.03
Posted by blueasa
, |