Commit af3954a27f2f6d4d48194f6d2d452437345823b9
1 parent
2d33a4ba
Exists in
master
and in
1 other branch
Adiciona scripts de dicionario remoto e build web
Showing
4 changed files
with
611 additions
and
0 deletions
Show diff stats
| ... | ... | @@ -0,0 +1,350 @@ |
| 1 | +//Log Dir http://docs.unity3d.com/Manual/LogFiles.html | |
| 2 | +using UnityEngine; | |
| 3 | +using System.Collections; | |
| 4 | +using System.Collections.Generic; | |
| 5 | +using System; | |
| 6 | +using System.Runtime.InteropServices; | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | +public class RemoteScript : MonoBehaviour { | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + public Animator ANIMATOR; | |
| 15 | + | |
| 16 | + public Texture | |
| 17 | + play, stop, | |
| 18 | + fast, slow, | |
| 19 | + box, menu, | |
| 20 | + captions, captionsActive, captionsInactive, | |
| 21 | + resize, resolucao, | |
| 22 | + settings, settingsActive, settingsInactive; | |
| 23 | + | |
| 24 | + public float initVarX, initVarY; | |
| 25 | + public float hSliderValue; | |
| 26 | + | |
| 27 | + Boolean isSettingsActive = false; | |
| 28 | + Boolean isCaptionsActive = true; | |
| 29 | + | |
| 30 | + string alfabeto = "0123456789,ABCDEFGHIJKLMNOPQRSTUVWXYZ"; | |
| 31 | + string stringPre; string[] stringPos; | |
| 32 | + string aniName = ""; AnimationClip aniClip; | |
| 33 | + | |
| 34 | + | |
| 35 | + string GetCurrentPlayingAnimationClip( ){ | |
| 36 | + | |
| 37 | + if(isCaptionsActive){ | |
| 38 | + | |
| 39 | + foreach(AnimationState anim in GetComponent<Animation>()){ | |
| 40 | + | |
| 41 | + //Debug.Log(anim.name); | |
| 42 | + | |
| 43 | + | |
| 44 | + if( GetComponent<Animation>().IsPlaying( anim.name ) ){ | |
| 45 | + | |
| 46 | + if(anim.name.Split(' ')[0].Equals("_default")) | |
| 47 | + return null; | |
| 48 | + | |
| 49 | + return anim.name.Split(' ')[0]; | |
| 50 | + // return anim.name.Split(' '); | |
| 51 | + | |
| 52 | + } | |
| 53 | + | |
| 54 | + }//foreach | |
| 55 | + | |
| 56 | + } | |
| 57 | + | |
| 58 | + return null; | |
| 59 | + | |
| 60 | + } | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + void loadIcons(){ | |
| 65 | + | |
| 66 | + captions = (Texture) Resources.Load("buttons/Subtitle", typeof(Texture)); | |
| 67 | + play = (Texture) Resources.Load("buttons/Play", typeof(Texture)); | |
| 68 | + stop = (Texture) Resources.Load("buttons/Stop", typeof(Texture)); | |
| 69 | + fast = (Texture) Resources.Load("buttons/Fast", typeof(Texture)); | |
| 70 | + slow = (Texture) Resources.Load("buttons/Slow", typeof(Texture)); | |
| 71 | + | |
| 72 | + settings = (Texture) Resources.Load("buttons/Settings", typeof(Texture)); | |
| 73 | + settingsActive = (Texture) Resources.Load("buttons/SettingsActive", typeof(Texture)); | |
| 74 | + settingsInactive = (Texture) Resources.Load("buttons/Settings", typeof(Texture)); | |
| 75 | + | |
| 76 | + box = (Texture) Resources.Load("buttons/_Barra", typeof(Texture)); | |
| 77 | + | |
| 78 | + menu = (Texture) Resources.Load("buttons/MenuConfig", typeof(Texture)); | |
| 79 | + captions = (Texture) Resources.Load("buttons/Subtitle", typeof(Texture)); | |
| 80 | + resize = (Texture) Resources.Load("buttons/Resolution", typeof(Texture)); | |
| 81 | + resolucao = (Texture) Resources.Load("buttons/Resolucao", typeof(Texture)); | |
| 82 | + captionsActive = (Texture) Resources.Load("buttons/CaptionsActive", typeof(Texture)); | |
| 83 | + captionsInactive = (Texture) Resources.Load("buttons/CaptionsInactive", typeof(Texture)); | |
| 84 | + | |
| 85 | + initVarX = ((Screen.width/2)-(box.width/2)); | |
| 86 | + initVarY = ((Screen.height)-(box.height)-10); | |
| 87 | + | |
| 88 | + } | |
| 89 | + | |
| 90 | + void Start( ){ | |
| 91 | + | |
| 92 | + Caching.CleanCache(); | |
| 93 | + | |
| 94 | + ANIMATOR = GetComponent<Animator>(); | |
| 95 | + | |
| 96 | + hSliderValue = 1.0f; | |
| 97 | + loadIcons(); | |
| 98 | + addAlpha( ); | |
| 99 | + | |
| 100 | + | |
| 101 | + } | |
| 102 | + | |
| 103 | + void addAlpha( ){ | |
| 104 | + | |
| 105 | + foreach( char letter in alfabeto ){ | |
| 106 | + | |
| 107 | + aniClip = Resources.Load<AnimationClip> ("alpha/"+letter); | |
| 108 | + if( aniClip ) GetComponent<Animation>().AddClip(aniClip, ""+letter); | |
| 109 | + else Debug.Log("Anim "+aniName+" not found"); | |
| 110 | + | |
| 111 | + } | |
| 112 | + }//addAlpha | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + void animStop( ){ | |
| 117 | + | |
| 118 | + GetComponent<Animation>().Stop( ); | |
| 119 | + aniClip = Resources.Load<AnimationClip>("anims/_default"); | |
| 120 | + GetComponent<Animation>().CrossFadeQueued("_default", 0.6F, QueueMode.CompleteOthers, PlayMode.StopAll ); | |
| 121 | + | |
| 122 | + | |
| 123 | + } | |
| 124 | + | |
| 125 | + void Update( ){ | |
| 126 | + | |
| 127 | + foreach(AnimationState anim in GetComponent<Animation>()) anim.speed = hSliderValue; | |
| 128 | + | |
| 129 | + } | |
| 130 | + | |
| 131 | + | |
| 132 | + public string glosa; | |
| 133 | + | |
| 134 | + | |
| 135 | + void playFromFile(){ Debug.Log("ReadFromFile");// ClearConsole(); | |
| 136 | + | |
| 137 | + //while( GetComponent<Queue>() != null) | |
| 138 | + // GetComponent<Queue>().Dequeue(); | |
| 139 | + //GetComponent<Queue>().Clear(); | |
| 140 | + //GetComponent<Animation>().CrossFadeQueued( PlayMode.StopAll ); | |
| 141 | + | |
| 142 | + GetComponent<Animation>().Stop( ); | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + stringPre = | |
| 147 | + " _default " | |
| 148 | + //+"ABRIL ACADEMIA" | |
| 149 | + +glosa | |
| 150 | + +" _default "; | |
| 151 | + | |
| 152 | + stringPos = stringPre.Split(' '); | |
| 153 | + | |
| 154 | + foreach( string aniName in stringPos ){ | |
| 155 | + | |
| 156 | + aniClip = Resources.Load<AnimationClip>("anims/"+aniName); | |
| 157 | + | |
| 158 | + if( aniClip ){ | |
| 159 | + | |
| 160 | + GetComponent<Animation>().AddClip(aniClip, aniName); | |
| 161 | + GetComponent<Animation>().CrossFadeQueued( aniName, 0.6F, QueueMode.CompleteOthers );//0.4 | |
| 162 | + | |
| 163 | + GetComponent<Animation>().RemoveClip( aniName ); | |
| 164 | + | |
| 165 | + }else | |
| 166 | + foreach(char letter in aniName) | |
| 167 | + GetComponent<Animation>().CrossFadeQueued(""+letter, 0.6F, QueueMode.CompleteOthers); | |
| 168 | + | |
| 169 | + }//foreach string aniName | |
| 170 | + | |
| 171 | + aniClip = Resources.Load<AnimationClip>("anims/_default"); | |
| 172 | + GetComponent<Animation>().AddClip(aniClip, "_default"); | |
| 173 | + | |
| 174 | + } | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + void OnGUI() { /* GUI.backgroundColor = Color.clear; */ | |
| 179 | + /* Box onde ficarao os botoes; */ GUI.Box( new Rect ( initVarX, initVarY, box.width, box.height), box, "" ); | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + if( GUI.Button (new Rect(initVarX+(box.height/4)+10 , initVarY+(play.width/2), play.width, play.height), new GUIContent("", play, "play"), "" )) | |
| 186 | + playFromFile(); | |
| 187 | + | |
| 188 | + glosa = GUI.TextArea ( new Rect (120, 10,400, 50), glosa, 400); | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + if( GUI.Button ( new Rect( initVarX+(box.height)+15, initVarY+(stop.width/2), stop.height, stop.height ), stop, "" ) ) | |
| 200 | + animStop( ); | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + { //INIT_SPEED | |
| 205 | + | |
| 206 | + GUI.DrawTexture(new Rect( initVarX+(box.height)*2, initVarY+(slow.width/2), slow.height, slow.height ), slow); | |
| 207 | + | |
| 208 | + hSliderValue = GUI.HorizontalSlider ( new Rect( initVarX+(box.height)*2+(slow.width), initVarY+(slow.width/2)+(slow.width/3), box.height*3, box.height/4 ), hSliderValue, 0.0F, 2.0F ); | |
| 209 | + | |
| 210 | + GUI.DrawTexture(new Rect( initVarX+(box.height)*5+(slow.width), initVarY+(fast.width/2), fast.height, fast.height ), fast); | |
| 211 | + | |
| 212 | + } //FINISH_SPEED | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + /** | |
| 220 | + * | |
| 221 | + * BOTAO DE LEGENDA | |
| 222 | + * | |
| 223 | + **/ | |
| 224 | + if (GUI.Button(new Rect(initVarX+(box.height)*6+15, initVarY+(slow.width/2), settings.width, settings.height), captions, "")){ | |
| 225 | + | |
| 226 | + isCaptionsActive = !isCaptionsActive; | |
| 227 | + | |
| 228 | + } | |
| 229 | + | |
| 230 | + | |
| 231 | + /** | |
| 232 | + * | |
| 233 | + * BOTAO DE CONFIGURAÇOES | |
| 234 | + * | |
| 235 | + **/ | |
| 236 | + if (GUI.Button(new Rect(initVarX+(box.height)*7, initVarY+(slow.width/2), settings.width, settings.height), settings, "")){ | |
| 237 | + | |
| 238 | + isSettingsActive = !isSettingsActive; | |
| 239 | + | |
| 240 | + if(isSettingsActive) settings = settingsActive; | |
| 241 | + else settings = settingsInactive; | |
| 242 | + | |
| 243 | + } | |
| 244 | + | |
| 245 | + if(isSettingsActive){ | |
| 246 | + | |
| 247 | + GUI.Box(new Rect(initVarX+(box.height)*6, initVarY-menu.width, menu.width, menu.height), menu, ""); | |
| 248 | + | |
| 249 | + GUI.Button ( new Rect( initVarX+(box.height)*6+10, initVarY-captions.width-20, captions.width, captions.height ), captions, "" ); | |
| 250 | + | |
| 251 | + if( isCaptionsActive ){ | |
| 252 | + if( GUI.Button ( new Rect( initVarX+(box.height)*6+50, initVarY-captions.width-10, captionsActive.width, captionsActive.height ), captionsActive, "" ) ){ | |
| 253 | + isCaptionsActive = !isCaptionsActive; | |
| 254 | + } | |
| 255 | + }else{ | |
| 256 | + if( GUI.Button ( new Rect( initVarX+(box.height)*6+50, initVarY-captions.width-10, captionsInactive.width, captionsInactive.height ), captionsInactive, "" )){ | |
| 257 | + isCaptionsActive = !isCaptionsActive; | |
| 258 | + } | |
| 259 | + } | |
| 260 | + | |
| 261 | + | |
| 262 | + //if( GUI.Button ( new Rect( 10, 10, resize.width, resize.height ), resize, "" ) ){ | |
| 263 | + GUI.Button ( new Rect( initVarX+(box.height)*6+resize.width+20, (initVarY-captions.width*2-45+(resolucao.height)), resolucao.width, resolucao.height ), resolucao, "" ); | |
| 264 | + if( GUI.Button ( new Rect( initVarX+(box.height)*6+10, (initVarY-captions.width*2-40), resize.width, resize.height ), resize, "" ) ){ | |
| 265 | + | |
| 266 | + switch(Screen.width){ | |
| 267 | + | |
| 268 | + case 640: | |
| 269 | + Screen.SetResolution(800, 600, false); break; | |
| 270 | + case 800: | |
| 271 | + Screen.SetResolution(1024, 768, false); break; | |
| 272 | + case 1024: | |
| 273 | + Screen.SetResolution(640, 480, false); break; | |
| 274 | + default: | |
| 275 | + Screen.SetResolution(640, 480, false); break; | |
| 276 | + | |
| 277 | + } | |
| 278 | + | |
| 279 | + //initVarX = ((Screen.width/2)-(box.width/2)); | |
| 280 | + //initVarY = ((Screen.height)-(box.height)-10); | |
| 281 | + | |
| 282 | + } | |
| 283 | + | |
| 284 | + | |
| 285 | + } | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + { //INIT_CAPTIONS | |
| 293 | + | |
| 294 | + GUIStyle myLabelStyle = new GUIStyle(GUI.skin.label); | |
| 295 | + myLabelStyle.fontSize = 30; | |
| 296 | + myLabelStyle.alignment = TextAnchor.UpperCenter; | |
| 297 | + | |
| 298 | + | |
| 299 | + ShadowAndOutline.DrawOutline( new Rect(0, initVarY-35, Screen.width, Screen.height), GetCurrentPlayingAnimationClip( ), myLabelStyle, Color.black, Color.yellow, 3); | |
| 300 | + | |
| 301 | + } //FINISH_CAPTIONS | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + if( GUI.Button ( new Rect( 10, 10, 100, 50 ), "DEBUGGER" ) ){//BOTAO DE TESTE | |
| 308 | + | |
| 309 | + int version = 1; | |
| 310 | + | |
| 311 | + StartCoroutine( bundleCatch(glosa.ToLower(), version) ); | |
| 312 | + //StartCoroutine( bundleCatch("abacate", version) ); | |
| 313 | + | |
| 314 | + | |
| 315 | + }//BOTAO DE TESTE | |
| 316 | + | |
| 317 | + }//onGui | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + IEnumerator bundleCatch( String token, int version ){ string BaseURL = "http://192.168.0.108:8000/"; | |
| 323 | + | |
| 324 | + WWW www = WWW.LoadFromCacheOrDownload(BaseURL+token, version); | |
| 325 | + yield return www; | |
| 326 | + if (www.error != null) throw new Exception("Erro no WWW! Se liga nego: " + www.error); | |
| 327 | + | |
| 328 | + UnityEngine.Object[] bundleBaixado = www.assetBundle.LoadAllAssets(); | |
| 329 | + | |
| 330 | + foreach(UnityEngine.Object animacao in bundleBaixado){ | |
| 331 | + | |
| 332 | + GetComponent<Animation>().AddClip(animacao as AnimationClip, animacao.name); | |
| 333 | + | |
| 334 | + Debug.Log(animacao.name+" - "+animacao.GetType()); | |
| 335 | + | |
| 336 | + GetComponent<Animation>().CrossFadeQueued(animacao.name, 0.6f, QueueMode.CompleteOthers); | |
| 337 | + | |
| 338 | + } | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + //playFromFile(); | |
| 343 | +// AssetBundle bundle = www.assetBundle.LoadAsset(bundleBaixado[0].name); | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + } | |
| 348 | + | |
| 349 | + | |
| 350 | +} | |
| 0 | 351 | \ No newline at end of file | ... | ... |
| ... | ... | @@ -0,0 +1,12 @@ |
| 1 | +fileFormatVersion: 2 | |
| 2 | +guid: 413fd4185617d03479da29306f1017ea | |
| 3 | +timeCreated: 1435591608 | |
| 4 | +licenseType: Pro | |
| 5 | +MonoImporter: | |
| 6 | + serializedVersion: 2 | |
| 7 | + defaultReferences: [] | |
| 8 | + executionOrder: 0 | |
| 9 | + icon: {instanceID: 0} | |
| 10 | + userData: | |
| 11 | + assetBundleName: | |
| 12 | + assetBundleVariant: | ... | ... |
| ... | ... | @@ -0,0 +1,237 @@ |
| 1 | +//Log Dir http://docs.unity3d.com/Manual/LogFiles.html | |
| 2 | +using UnityEngine; | |
| 3 | +using System.Collections; | |
| 4 | +using System.Collections.Generic; | |
| 5 | +using System; | |
| 6 | +using System.Runtime.InteropServices; | |
| 7 | + | |
| 8 | + | |
| 9 | +public class WebScript : MonoBehaviour { | |
| 10 | + | |
| 11 | +public string hover; | |
| 12 | + | |
| 13 | + public Texture | |
| 14 | + play, stop, repeat, | |
| 15 | + fast, slow, | |
| 16 | + box, menu, | |
| 17 | + captions, captionsActive, captionsInactive, | |
| 18 | + resize, resolucao; | |
| 19 | + | |
| 20 | + | |
| 21 | + public float initVarX, initVarY; | |
| 22 | + public float hSliderValue; | |
| 23 | + | |
| 24 | + Boolean isCaptionsActive = false; | |
| 25 | + | |
| 26 | + string alfabeto = "0123456789,ABCDEFGHIJKLMNOPQRSTUVWXYZ"; | |
| 27 | + string stringPre; string[] stringPos; | |
| 28 | + string aniName = ""; AnimationClip aniClip; | |
| 29 | + | |
| 30 | + | |
| 31 | + string GetCurrentPlayingAnimationClip( ){ | |
| 32 | + | |
| 33 | + if(isCaptionsActive){ | |
| 34 | + | |
| 35 | + foreach(AnimationState anim in GetComponent<Animation>()){ | |
| 36 | + | |
| 37 | + //Debug.Log(anim.name); | |
| 38 | + | |
| 39 | + | |
| 40 | + if( GetComponent<Animation>().IsPlaying( anim.name ) ){ | |
| 41 | + | |
| 42 | + if(anim.name.Split(' ')[0].Equals("_default")) | |
| 43 | + return null; | |
| 44 | + | |
| 45 | + return anim.name.Split(' ')[0]; | |
| 46 | + // return anim.name.Split(' '); | |
| 47 | + | |
| 48 | + } | |
| 49 | + | |
| 50 | + }//foreach | |
| 51 | + | |
| 52 | + } | |
| 53 | + | |
| 54 | + return null; | |
| 55 | + | |
| 56 | + } | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + void loadIcons(){ | |
| 61 | + | |
| 62 | + captions = (Texture) Resources.Load("buttons/Subtitle", typeof(Texture)); | |
| 63 | + //play = (Texture) Resources.Load("buttons/Play", typeof(Texture)); | |
| 64 | + repeat = (Texture) Resources.Load("buttons/Repeat", typeof(Texture)); | |
| 65 | + stop = (Texture) Resources.Load("buttons/Stop", typeof(Texture)); | |
| 66 | + fast = (Texture) Resources.Load("buttons/Fast", typeof(Texture)); | |
| 67 | + slow = (Texture) Resources.Load("buttons/Slow", typeof(Texture)); | |
| 68 | + | |
| 69 | + box = (Texture) Resources.Load("buttons/_Barra", typeof(Texture)); | |
| 70 | + | |
| 71 | + menu = (Texture) Resources.Load("buttons/MenuConfig", typeof(Texture)); | |
| 72 | + captions = (Texture) Resources.Load("buttons/Subtitle", typeof(Texture)); | |
| 73 | + resize = (Texture) Resources.Load("buttons/Resolution", typeof(Texture)); | |
| 74 | + resolucao = (Texture) Resources.Load("buttons/Resolucao", typeof(Texture)); | |
| 75 | + captionsActive = (Texture) Resources.Load("buttons/CaptionsActive", typeof(Texture)); | |
| 76 | + captionsInactive = (Texture) Resources.Load("buttons/CaptionsInactive", typeof(Texture)); | |
| 77 | + | |
| 78 | + initVarX = ((Screen.width/2)-(box.width/2)); | |
| 79 | + initVarY = ((Screen.height)-(box.height)-10); | |
| 80 | + | |
| 81 | + } | |
| 82 | + | |
| 83 | + void Start( ){ | |
| 84 | + | |
| 85 | + hSliderValue = 1.7f; | |
| 86 | + loadIcons(); | |
| 87 | + addAlpha( ); | |
| 88 | + Application.ExternalCall("onLoadPlayer"); | |
| 89 | + | |
| 90 | + } | |
| 91 | + | |
| 92 | + | |
| 93 | + void addAlpha( ){ | |
| 94 | + | |
| 95 | + foreach( char letter in alfabeto ){ | |
| 96 | + | |
| 97 | + aniClip = Resources.Load<AnimationClip> ("alpha/"+letter); | |
| 98 | + if( aniClip ) GetComponent<Animation>().AddClip(aniClip, ""+letter); | |
| 99 | + else Debug.Log("Anim "+aniName+" not found"); | |
| 100 | + | |
| 101 | + } | |
| 102 | + }//addAlpha | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + void animStop( ){ | |
| 107 | + | |
| 108 | + GetComponent<Animation>().Stop( ); | |
| 109 | + aniClip = Resources.Load<AnimationClip>("anims/_default"); | |
| 110 | + GetComponent<Animation>().CrossFadeQueued("_default", 0.6F, QueueMode.CompleteOthers, PlayMode.StopAll ); | |
| 111 | + | |
| 112 | + | |
| 113 | + } | |
| 114 | + | |
| 115 | + | |
| 116 | + void updateGuiElements(){ | |
| 117 | + | |
| 118 | + initVarX = ((Screen.width/2)-(box.width/2)); | |
| 119 | + initVarY = ((Screen.height)-(box.height)-10); | |
| 120 | + | |
| 121 | + } | |
| 122 | + | |
| 123 | + void Update( ){ | |
| 124 | + | |
| 125 | +// if( hover == "play" ) | |
| 126 | +// Debug.Log( hover ); | |
| 127 | + | |
| 128 | + updateGuiElements(); | |
| 129 | + foreach(AnimationState anim in GetComponent<Animation>()) anim.speed = hSliderValue; | |
| 130 | + | |
| 131 | + } | |
| 132 | + | |
| 133 | + | |
| 134 | + public string glosa; | |
| 135 | + | |
| 136 | + public void catchGlosa( String glosa ){ | |
| 137 | + | |
| 138 | + animStop( ); | |
| 139 | + this.glosa = " _default "+glosa+" _default "; | |
| 140 | + playFromWEB(); | |
| 141 | + | |
| 142 | + } | |
| 143 | + | |
| 144 | + void playFromWEB(){ | |
| 145 | + | |
| 146 | + Debug.Log( "Running on "+Application.platform ); //if( Application.platform == RuntimePlatform.OS ) | |
| 147 | + | |
| 148 | + GetComponent<Animation>().Stop( ); | |
| 149 | + | |
| 150 | + stringPos = glosa.Split(' '); | |
| 151 | + | |
| 152 | + foreach( string aniName in stringPos ){ | |
| 153 | + aniClip = Resources.Load<AnimationClip>("anims/"+aniName); | |
| 154 | + | |
| 155 | + if( aniClip ){ | |
| 156 | + | |
| 157 | + GetComponent<Animation>().AddClip(aniClip, aniName); | |
| 158 | + GetComponent<Animation>().CrossFadeQueued( aniName, 0.6F, QueueMode.CompleteOthers );//0.4 | |
| 159 | + GetComponent<Animation>().RemoveClip( aniName ); | |
| 160 | + | |
| 161 | + }else | |
| 162 | + foreach(char letter in aniName) | |
| 163 | + GetComponent<Animation>().CrossFadeQueued(""+letter, 0.6F, QueueMode.CompleteOthers); | |
| 164 | + | |
| 165 | + }//foreach string aniName | |
| 166 | + | |
| 167 | + aniClip = Resources.Load<AnimationClip>("anims/_default"); | |
| 168 | + GetComponent<Animation>().AddClip(aniClip, "_default"); | |
| 169 | + | |
| 170 | + } | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + void OnGUI() { /* GUI.backgroundColor = Color.clear; */ | |
| 175 | + /* Box onde ficarao os botoes; */ GUI.Box( new Rect ( initVarX, initVarY, box.width, box.height), box, "" ); | |
| 176 | + | |
| 177 | + | |
| 178 | + if( GUI.Button (new Rect(initVarX+(box.height/4)+10 , initVarY+(repeat.width/2), repeat.width, repeat.height), new GUIContent("", repeat, "repeat"), "" )){ | |
| 179 | + | |
| 180 | + playFromWEB(); | |
| 181 | + } | |
| 182 | + | |
| 183 | + | |
| 184 | + //hover = GUI.tooltip; | |
| 185 | + | |
| 186 | + | |
| 187 | + if( GUI.Button ( new Rect( initVarX+(box.height)+15, initVarY+(stop.width/2), stop.height, stop.height ), stop, "" ) ) | |
| 188 | + animStop( ); | |
| 189 | + | |
| 190 | + | |
| 191 | + { //INIT_SPEED | |
| 192 | + | |
| 193 | + GUI.DrawTexture(new Rect( initVarX+(box.height)*2, initVarY+(slow.width/2), slow.height, slow.height ), slow); | |
| 194 | + | |
| 195 | + hSliderValue = GUI.HorizontalSlider ( new Rect( initVarX+(box.height)*2+(slow.width)+5, initVarY+(slow.width/2)+(slow.width/3), box.height*3.5f, box.height/4 ), hSliderValue, 0.0F, 2.0F ); | |
| 196 | + | |
| 197 | + GUI.DrawTexture(new Rect( initVarX+(box.height)*6+15, initVarY+(fast.width/2), fast.height, fast.height ), fast); | |
| 198 | + | |
| 199 | + } //FINISH_SPEED | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + /** | |
| 204 | + * | |
| 205 | + * BOTAO DE LEGENDA | |
| 206 | + * | |
| 207 | + **/ | |
| 208 | + if (GUI.Button(new Rect(initVarX+(box.height)*7, initVarY+(slow.width/2), captions.width, captions.height), captions, "")){ | |
| 209 | + | |
| 210 | + isCaptionsActive = !isCaptionsActive; | |
| 211 | + | |
| 212 | + } | |
| 213 | + | |
| 214 | + | |
| 215 | + { //INIT_CAPTIONS | |
| 216 | + | |
| 217 | + GUIStyle myLabelStyle = new GUIStyle(GUI.skin.label); | |
| 218 | + myLabelStyle.fontSize = 30; | |
| 219 | + myLabelStyle.alignment = TextAnchor.UpperCenter; | |
| 220 | + | |
| 221 | + | |
| 222 | + ShadowAndOutline.DrawOutline( new Rect(0, initVarY-35, Screen.width, Screen.height), GetCurrentPlayingAnimationClip( ), myLabelStyle, Color.black, Color.yellow, 3); | |
| 223 | + | |
| 224 | + } //FINISH_CAPTIONS | |
| 225 | + | |
| 226 | + | |
| 227 | + //if( GUI.Button ( new Rect( 10, 10, 100, 100 ), "DEBUGGER" ) ){//BOTAO DE TESTE }//BOTAO DE TESTE | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + }//onGui | |
| 232 | + | |
| 233 | + void OnApplicationQuit() { | |
| 234 | + | |
| 235 | + } | |
| 236 | + | |
| 237 | +} | |
| 0 | 238 | \ No newline at end of file | ... | ... |
| ... | ... | @@ -0,0 +1,12 @@ |
| 1 | +fileFormatVersion: 2 | |
| 2 | +guid: 1028c034d96246149ad30dbf7eed6258 | |
| 3 | +timeCreated: 1435591608 | |
| 4 | +licenseType: Pro | |
| 5 | +MonoImporter: | |
| 6 | + serializedVersion: 2 | |
| 7 | + defaultReferences: [] | |
| 8 | + executionOrder: 0 | |
| 9 | + icon: {instanceID: 0} | |
| 10 | + userData: | |
| 11 | + assetBundleName: | |
| 12 | + assetBundleVariant: | ... | ... |