Example #1
0
    /// <summary>
    /// Implements MonoBehaviour
    /// </summary>
    private void OnGUI()
    {
        GUILayout.Label(string.Empty);
        GUILayout.Label(string.Empty);
        GUILayout.Label(string.Empty);
        GUILayout.Label(string.Empty);

        switch (Application.platform)
        {
        case RuntimePlatform.Android:
            //case RuntimePlatform.OSXEditor:
            //case RuntimePlatform.WindowsEditor:
            GUILayout.BeginHorizontal();
            GUILayout.Space(400);
            if (GUILayout.Button("Clear Results", GUILayout.MinHeight(40)))
            {
                m_c          = -1;
                m_helloWorld = string.Empty;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Space(400);
            if (GUILayout.Button("Invoke Android Hello World", GUILayout.MinHeight(40)))
            {
                m_helloWorld = AndroidPlugin.InvokeAndroidGetHelloWorld();
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Space(400);
            GUILayout.Label(string.Format("Hello World result: {0}", m_helloWorld));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Space(400);
            if (GUILayout.Button("Invoke Android ExampleFunction1", GUILayout.MinHeight(40)))
            {
                byte[] a = ASCIIEncoding.ASCII.GetBytes("Hello some string in bytes");
                AndroidPlugin.InvokeAndroidExampleFunction1(a, 2, out m_c);
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Space(400);
            GUILayout.Label(string.Format("ExampleFunction1 result: {0}", m_c));
            GUILayout.EndHorizontal();
            break;
        }
    }