Ejemplo n.º 1
0
 public void GenerateNoteButtons()
 {
     for (int i = 0; i < s.layers; i++)
     {
         NoteButton nb = Instantiate(buttonPrefab, transform);
         nb.buttonID = columnID + i.ToString("00");
         noteButtons.Add(nb);
     }
 }
Ejemplo n.º 2
0
 public void CalcButton(Graphics graphics)
 {
     NoteButton.CalcViewInfo(graphics, ClientRectangle);
     ButtonsInfo.Clear();
     for (int i = 0; i < Items.Count; i++)
     {
         ButtonViewInfo viewInfo = NoteButton.ButtonViewInfo.Clone();
         ButtonsInfo.Add(viewInfo);
     }
 }
Ejemplo n.º 3
0
    //private IEnumerator SpawnNotes()
    //{
    //    NoteDataHolder temp;
    //    Debug.Log("Started Parsing notes");
    //    while(!loader.IsEmpty())
    //    {
    //        temp = loader.getNextNote();
    //        //we only want to actually do this if it is not a no-note
    //        if(temp.button == NoteButton.WAIT && temp.direction == NoteDirection.NONE) //we encountered a wait
    //        {
    //            yield return new WaitForSeconds(temp.timeToWait);
    //        }
    //        else
    //        {
    //            Note spawnedNote = Instantiate(DetermineNote(temp.button), DetermineSpawnPoint(temp.direction), Quaternion.identity) as Note;
    //            spawnedNote.Initialize(temp.button, temp.direction, DetermineNoteSpeed(temp.direction) + (Vector3.up * 1.5f));
    //            LevelManager.Instance.NoteQueue.Enqueue(spawnedNote);
    //        }
    //        if(!loader.IsEmpty())
    //        {
    //            yield return new WaitForSeconds(loader.GetTimeToWait());
    //        }
    //        else
    //        {
    //            break; //end of the song
    //        }
    //    }
    //}

    private Note DetermineNote(NoteButton button)
    {
        if (button == NoteButton.A)
        {
            return(aNote);
        }
        else if (button == NoteButton.B)
        {
            return(bNote);
        }
        else if (button == NoteButton.X)
        {
            return(xNote);
        }
        else
        {
            return(yNote);
        }
    }
 void ReleaseDesignerOutlets()
 {
     if (LyricNameL != null)
     {
         LyricNameL.Dispose();
         LyricNameL = null;
     }
     if (LyricsTV != null)
     {
         LyricsTV.Dispose();
         LyricsTV = null;
     }
     if (NoteButton != null)
     {
         NoteButton.Dispose();
         NoteButton = null;
     }
     if (RecordingButton != null)
     {
         RecordingButton.Dispose();
         RecordingButton = null;
     }
 }
Ejemplo n.º 5
0
        void SetupKeyboardLayout(KeyMap map)
        {
            keymap = map;

            int top         = 70;
            int labelOffset = -5;

            // offset 4, 10, 18 are not mapped, so skip those numbers
            var hl = new List <Button> ();
            int labelStringIndex = key_labels.Length + labelOffset;

            for (int i = 0; i < keymap.HighKeys.Length; i++)
            {
                var b = new NoteButton();
                b.Text = key_labels [labelStringIndex % key_labels.Length];
                labelStringIndex++;
                if (!IsNotableIndex(i))
                {
                    b.Enabled = false;
                    b.Visible = false;
                }
                b.Location = new Point(btSize / 2 + i * btSize / 2, i % 2 == 0 ? top : top + 5 + btSize);
                hl.Add(b);
                Controls.Add(b);
            }
            high_buttons = hl.ToArray();
            var ll = new List <Button> ();

            labelStringIndex = key_labels.Length + labelOffset;
            for (int i = 0; i < keymap.LowKeys.Length; i++)
            {
                var b = new NoteButton();
                b.Text = key_labels [labelStringIndex % key_labels.Length];
                labelStringIndex++;
                if (!IsNotableIndex(i))
                {
                    b.Enabled = false;
                    b.Visible = false;
                }
                b.Location = new Point(btSize + i * btSize / 2, i % 2 == 0 ? top + 10 + btSize * 2 : top + 15 + btSize * 3);
                ll.Add(b);
                Controls.Add(b);
            }
            low_buttons = ll.ToArray();

            high_button_states = new bool [high_buttons.Length];
            low_button_states  = new bool [low_buttons.Length];

            var tb = new TextBox();

            tb.TabIndex     = 0;
            tb.Location     = new Point(10, 200);
            tb.TextChanged += delegate { tb.Text = String.Empty; };
            Controls.Add(tb);
            tb.KeyDown += delegate(object o, KeyEventArgs e) {
                ProcessKey(true, e);
            };
            tb.KeyUp += delegate(object o, KeyEventArgs e) {
                ProcessKey(false, e);
            };
        }
        void ReleaseDesignerOutlets()
        {
            if (AssignLabelTF != null)
            {
                AssignLabelTF.Dispose();
                AssignLabelTF = null;
            }

            if (DateLabelTF != null)
            {
                DateLabelTF.Dispose();
                DateLabelTF = null;
            }

            if (DelAnnotationBtn != null)
            {
                DelAnnotationBtn.Dispose();
                DelAnnotationBtn = null;
            }

            if (DelNoteButton != null)
            {
                DelNoteButton.Dispose();
                DelNoteButton = null;
            }

            if (EditButton != null)
            {
                EditButton.Dispose();
                EditButton = null;
            }

            if (HSeprator != null)
            {
                HSeprator.Dispose();
                HSeprator = null;
            }

            if (NoteBkgView != null)
            {
                NoteBkgView.Dispose();
                NoteBkgView = null;
            }

            if (NoteButton != null)
            {
                NoteButton.Dispose();
                NoteButton = null;
            }

            if (NoteTextView != null)
            {
                NoteTextView.Dispose();
                NoteTextView = null;
            }

            if (TagsTableView != null)
            {
                TagsTableView.Dispose();
                TagsTableView = null;
            }

            if (TitleLabelTF != null)
            {
                TitleLabelTF.Dispose();
                TitleLabelTF = null;
            }

            if (VSeprator != null)
            {
                VSeprator.Dispose();
                VSeprator = null;
            }
        }
Ejemplo n.º 7
0
 public void Initialize(NoteButton button, NoteDirection direction, Vector3 noteSpeed)
 {
     this.Button    = button;
     this.Direction = direction;
     this.noteSpeed = noteSpeed;
 }
Ejemplo n.º 8
0
    private void HandleInput(NoteButton buttonPressed)
    {
        AccuracyType type = AccuracyType.Distance5;

        if (NoteQueue.Count > 0)
        {
            Note note = NoteQueue.Peek();

            if (NoteQueue.Count > 0 && note != null && (new Vector3(note.transform.position.x, 0.0f, note.transform.position.z) -
                                                        new Vector3(centerPoint.x, 0.0f, centerPoint.z)).magnitude
                <= GameManager.Instance.Distance5)
            {
                //Debug.Log("Current Note: " + note.Button + ", " + note.Direction);
                //Debug.Log("Button Pressed: " + buttonPressed.ToString() + ", Horizontal: " + Input.GetAxis("Horizontal") + ", Vertical: " + Input.GetAxis("Vertical"));

                if (note.Button == buttonPressed)
                {
                    if (note.Direction == NoteDirection.Left || note.Direction == NoteDirection.Right)
                    {
                        if (note.Direction == DetermineHorizontalDirecction())
                        {
                            //Debug.Log( DetermineAccuracy().ToString() + "!" );
                            type = DetermineAccuracy();
                        }
                        else
                        {
                            //Debug.Log("Miss");
                            type = AccuracyType.Distance5;
                        }
                    }
                    else if (note.Direction == NoteDirection.Up || note.Direction == NoteDirection.Down)
                    {
                        if (note.Direction == DetermineVerticalDirection())
                        {
                            //Debug.Log( DetermineAccuracy().ToString() );
                            type = DetermineAccuracy();
                        }
                        else
                        {
                            //Debug.Log( "MISS!" );
                            type = AccuracyType.Distance5;
                        }
                    }
                }
                else
                {
                    type = AccuracyType.Distance5;
                }

                centerPointAnimator.SetTrigger("Bounce");
                Destroy(NoteQueue.Dequeue().gameObject);
            }
            else
            {
                //Debug.Log( "Miss!: No top note." );
                type = AccuracyType.Distance5;
            }
        }
        else
        {
            //Debug.Log( "Miss!: No top note." );
            type = AccuracyType.Distance5;
        }

        AdjustAndRedrawGUI(type);
        //FeedbackManager.Instance.Animate(type);
    }
Ejemplo n.º 9
0
    /// <summary>
    /// 저장해놓은 데이터 다시 불러오기.
    /// </summary>
    /// <param name="filePath"> 파일 경로 </param>
    /// <returns></returns>
    public IEnumerator LoadXml(string filePath)
    {
        xmlFile.Load(filePath);     // 데이터 읽어옴.

        // BGM 읽어옴.
        XmlNodeList bgmList = xmlFile.SelectNodes("/" + LoadData.redefLastDirectory(filePath) + "/BGM");
        // BGM 디렉토리 변수에 저장.
        string bgmDirectory = bgmList[0].ChildNodes[1].InnerText;
        WWW    www_Bgm      = new WWW("file://" + bgmDirectory);

        yield return(www_Bgm);

        // 이름 재정의 후 넣어줌.
        AudioClip audioClip = www_Bgm.GetAudioClip();

        audioClip.name = LoadData.redefName(bgmDirectory);
        Data.name      = audioClip.name;
        Data.length    = audioClip.length;
        EditorManager.editorMgr.SetAudioClip(audioClip);

        // SE 읽어옴.
        XmlNodeList seList = xmlFile.SelectNodes("/" + LoadData.redefLastDirectory(filePath) + "/EffectSound");
        int         count  = int.Parse(seList[0].ChildNodes[0].InnerText);

        if (count != 0)
        {
            for (int i = 0; i < count; i++)
            {
                string esDirectory = seList[0].ChildNodes[i + 1].ChildNodes[1].InnerText;
                WWW    www_es      = new WWW("file://" + esDirectory);
                yield return(www_es);

                // 이름 재정의 후 넣어줌.
                AudioClip esClip = www_es.GetAudioClip();
                esClip.name                  = LoadData.redefName(esDirectory);
                esdMgr.esd[i].audioClip      = esClip;
                esdMgr.esd[i].text_name.text = esClip.name;
            }
        }
        // Note 읽어옴.
        XmlNodeList noteList  = xmlFile.SelectNodes("/" + LoadData.redefLastDirectory(filePath) + "/Note");
        int         noteCount = int.Parse(noteList[0].ChildNodes[0].InnerText);

        for (int i = 0; i < noteCount; i++)
        {
            Note    clone         = Note.Instantiate(note_prefab);
            XmlNode noteDirectory = noteList[0].ChildNodes[i + 1];

            // 포지션 설정
            float posX = float.Parse(noteDirectory.ChildNodes[4].InnerText);
            float posY = float.Parse(noteDirectory.ChildNodes[5].InnerText);
            clone.transform.position = new Vector3(posX, posY, -1);
            clone.transform.parent   = EditorManager.editorMgr.noteMgr.transform;
            clone.Init();

            // 노트 타입 설정
            NoteButton.curType = NoteButton.GetNoteType(noteDirectory.ChildNodes[0].InnerText);
            clone.SetNoteType();

            // 노트 점수 설정
            ScoreButton.curScore = int.Parse(noteDirectory.ChildNodes[2].InnerText);
            clone.SetScoreType();

            // 노트 효과음 설정
            clone.audioClip = esdMgr.GetClip(noteDirectory.ChildNodes[3].InnerText);

            if (esdMgr.esd.Count != 0)
            {
                for (int j = 0; j < esdMgr.esd.Count; j++)
                {
                    if (esdMgr.esd[j].audioClip.name == noteDirectory.ChildNodes[3].InnerText)
                    {
                        clone.SetEffect(esdMgr.esd[j].audioClip);
                        break;
                    }
                }
            }

            clone.name = "Note";
            EditorManager.editorMgr.noteMgr.notes.Add(clone);
        }

        NoteButton.b_touchNoteButton   = false;
        ScoreButton.b_touchScoreButton = false;
        EffectSoundManager.b_TouchESD  = false;

        yield return(null);
    }