thieumao

Check Nen Tang Unity

Jul 8th, 2015
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.21 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3. using UnityEngine.UI;
  4.  
  5. public class Check : MonoBehaviour {
  6.  
  7.     Text TextCheck;
  8.    
  9.     void Start () {
  10.         TextCheck = GameObject.Find ("TextCheck").GetComponent<Text>();
  11.     }
  12.  
  13.     public void ButtonClick(){
  14.         if (Application.platform == RuntimePlatform.Android)
  15.             TextCheck.text = "Android";
  16.         else {
  17.             if (Application.platform == RuntimePlatform.WP8Player)
  18.                 TextCheck.text = "WP8Player";
  19.             else {
  20.                 if (Application.platform == RuntimePlatform.WindowsPlayer)
  21.                     TextCheck.text = "WindowsPlayer";
  22.                 else
  23.                     TextCheck.text = "Khong Biet";
  24.             }
  25.         }
  26.     }
  27.  
  28.     void OnEnable ()
  29.     {
  30.         btnCall.onClick.AddListener (() => tryCall ());
  31.     }
  32.     void Disable ()
  33.     {
  34.         btnCall.onClick.RemoveListener (() => tryCall ());
  35.     }
  36.     private void tryCall ()
  37.     {
  38.         /*
  39.         AndroidJNIHelper.debug = true;
  40.  
  41.         #if UNITY_ANDROID && !UNITY_EDITOR
  42.         AndroidJavaClass jc = new           AndroidJavaClass("com.unity3d.player.UnityPlayer");
  43.         AndroidJavaObject jo =         jc.GetStatic("currentActivity");
  44.         textField.text = jo.Call("getCacheDir").Call("getCanonicalPath");
  45.         #endif
  46.         */
  47.     }
  48.     public Button btnCall;
  49.     public InputField textField;
  50.     private AndroidJavaObject jo;
  51.    
  52.    
  53.    
  54. }
Advertisement
Add Comment
Please, Sign In to add comment