Created
March 23, 2017 01:10
-
-
Save kyechan99/9b2d5e402098f99fdca0cdde324cef4c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.company.product; | |
import android.os.Handler; | |
import android.os.Message; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.widget.Toast; | |
import com.unity3d.player.UnityPlayer; | |
public class MainActivity extends AppCompatActivity { | |
String toastMessage; | |
private static final int SEND_THREAD_TOAST = 0; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
} | |
/** | |
* @brief 유니티에게 초기화가 성공적으로 이루어 졌다는 것을 알림 | |
*/ | |
public void init () { | |
UnityPlayer.UnitySendMessage("_PluginManager", "ReceiveInit", "SUCCESS"); | |
} | |
/** | |
* @brief 핸들러 | |
*/ | |
public Handler handle = new Handler() { | |
public void handleMessage (Message msg) { | |
switch (msg.what) { | |
case SEND_THREAD_TOAST: | |
Toast.makeText(getApplicationContext(), toastMessage, Toast.LENGTH_SHORT).show(); | |
break; | |
default: | |
break; | |
} | |
} | |
}; | |
/** | |
* @brief 토스트 메시지를 화면에 띄워줌 | |
* @param message 메시지 내용 | |
*/ | |
public void ToastMessage (String message) { | |
toastMessage = message; | |
handle.sendEmptyMessage(SEND_THREAD_TOAST); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment