void Awake() { if (instance != null) { Destroy(instance.gameObject); } instance = this; }
//public GameObject btn; // Use this for initialization void Start() { isReady = false; isConnected = false; opSelectedGeis = new ArrayList(); l = GameObject.Find("HUD").GetComponent <VersusUI>(); gen = GameObject.Find("Reader").GetComponent <NoteGenMan>(); audio = GameObject.Find("Audio Source").GetComponent <AudioSource>(); if (l.myDataSync == null || l.opDataSync == null) { ns = GameObject.FindGameObjectsWithTag("Syncs"); foreach (GameObject n in ns) { NetSync nv = n.GetComponent <NetSync>(); if (nv.isLocalPlayer) { l.myDataSync = nv; gen.myDataSync = nv; } else { l.opDataSync = nv; gen.opDataSync = nv; } } if (ns.Length == 2) { isConnected = true; l.DeactivitateInitPanel(); //l.ActivitateGeiPanel(); Time.timeScale = 1; l.ActivitateMe(); l.ActivitateOp(); audio.Play(); } } //btn.GetComponent<Button>().onClick.RemoveAllListeners(); score = 0; }
// Use this for initialization void Start() { factor = 1.3f; isFactor = false; beatsOfCountdown = 2; l = GameObject.Find("HUD").GetComponent <myUGUI>(); pt = Time.time; pn = 0; pg = 0; bn = 4; beatCount = 0; sceneName = SceneManager.GetActiveScene().name; if (sceneName == "Versus") { lv = GameObject.Find("HUD").GetComponent <VersusUI>(); } avatar = GameObject.Find("t2").GetComponent <Animator>(); isChanging = false; isSelected = false; // #if UNITY_EDITOR // string filepath = Application.dataPath +"/StreamingAssets"; // // #elif UNITY_IPHONE // string filepath = Application.dataPath +"/Raw"; // // #elif UNITY_ANDROID // string filepath = "jar:file://" + Application.dataPath + "!/assets/"; // // #endif // path=filepath; gens = new ArrayList(); for (int i = 0; i < GEN_COUNT; i++) { NoteGen s = GameObject.Find("Stream" + i).GetComponentInChildren <NoteGen>(); s.speed = this.speed; gens.Add(s); } // foreach(NoteGen g in gens) // { // g.hello(); // } bool isStart = true; //TODO:xiugai ArrayList info = LoadFile("gei"); gei = new ArrayList(); Gei_data t_gei = new Gei_data(); foreach (string str in info) { //Debug.Log(str); if (str.Length > 0 && str[0] == '/') { } else if (isStart) { if (str.Length > 0) { //Debug.Log(str); t_gei = new Gei_data(); isStart = false; t_gei.name = str; } } else { if (str.Length < 1) { gei.Add(t_gei); isStart = true; } else { string t = str; string[] temp = t.Split(new char[] { ' ' }); if (temp.Length == 4) { Note_data nd = new Note_data(); nd.flag = int.Parse(temp[0]); nd.type = int.Parse(temp[1]); nd.pos = int.Parse(temp[2]); nd.len = int.Parse(temp[3]); t_gei.note.Add(nd); } else if (temp.Length == 3) { Note_data nd = new Note_data(); nd.flag = int.Parse(temp[0]); nd.type = int.Parse(temp[1]); nd.pos = int.Parse(temp[2]); t_gei.note.Add(nd); } else if (temp.Length == 2) { t_gei.len = int.Parse(temp[0]); t_gei.type = int.Parse(temp[1]); } } } } CatGeis(); // foreach(Gei_data g in gei) // { // Debug.Log(g.name); // Debug.Log(g.len); // Debug.Log(g.note.Count); // foreach(Note_data n in g.note) // { // Debug.Log(n.flag); // Debug.Log(n.type); // Debug.Log(n.pos); // if(n.type==1) // Debug.Log(n.len); // Debug.Log('\n'); // } // Debug.Log('\n'); // Debug.Log('\n'); // } // //map loading //TODO:xiugai info = LoadFile("map"); bool isFirst = true; map = new ArrayList(); foreach (string str in info) { // Debug.Log(str); if (str.Length > 0 && str[0] == '/') { } else { if (isFirst) { bpm = int.Parse(str); isFirst = false; } else { map.Add(int.Parse(str)); } } } // Debug.Log(bpm); // foreach(int num in map) // { // Debug.Log(num); // } dt = 60f / bpm; tmp = (Gei_data)(gei[(int)(map[pg])]); InvokeRepeating("UpdateNote", 0, dt); }