//Debug.Log Dir http://docs.unity3d.com/Manual/Debug.LogFiles.html using UnityEngine; using System.Collections; using System.Collections.Generic; using System; using System.IO; using System.Text; using System.Runtime.InteropServices; using UnityEngine.UI; public class PlayerManager : GenericPlayerManager { //Importacao de metodos de instancia do core via DLLs [DllImport ("CorePlugin")] public static extern int coreInitialize(); [DllImport ("CorePlugin")] private static extern IntPtr coreExecute(); [DllImport ("CorePlugin")] public static extern int coreFinalize(); public ScreenManager screenManager; private string[] randomAnimationNames = new string[] { "[RELAXAR]", "[BOCEJAR]", "[COCHILAR]", "[ESPREGUI_ADA]" }; public override void Start() { Screen.SetResolution(640, 480, false); // Puxa as dlls do core try { Debug.Log("Inicializando: " + coreInitialize()); } catch (Exception e) { Debug.Log (e.ToString()); } base.setRandomAnimations(randomAnimationNames); base.Start(); } public string catchGlosa() { return Marshal.PtrToStringAnsi(coreExecute()); } public void start_local_play() { start_local_play(catchGlosa()); } public void start_local_play(string glosa) { base.gloss = glosa; base.playNow(glosa); } private System.Object LOCKER_STATE = new System.Object(); protected override void onPlayingStateChange() { lock (LOCKER_STATE) { this.screenManager.updateButtons(base.isPlaying(), base.isPaused()); } } protected override WWW loadAssetBundle(string aniName) { string assetPath = Application.dataPath + "/Bundles/" + aniName; if ( ! File.Exists(assetPath)) return null; try { WWW www = new WWW("file://" + assetPath); return www; } catch (Exception e) { Debug.Log(e); } return null; } protected override void onConnectionError(string gloss, string word) { } void OnApplicationQuit() { try { Debug.Log("Finalizando: " + coreFinalize()); } catch (Exception e) { Debug.Log(e.ToString()); } } }