Ejemplo n.º 1
0
    public void DeleteNote()
    {
        if (isEdit == true)
        {
            ScrollContentCreate sc = scrollcontentview.GetComponent <ScrollContentCreate> ();
            NoteNode            _node;
            _node = new NoteNode();
            sc.noteList.RemoveAt(NoteNodeIndex);
            sc.GetComponentsInChildren <Button> () [NoteNodeIndex].onClick.RemoveAllListeners();
//			sc.GetComponentsInChildren<Button> () [NoteNodeIndex]
            Destroy(sc.GetComponentsInChildren <Button> () [NoteNodeIndex].gameObject);

            sc.gameObject.GetComponent <RectTransform> ().sizeDelta = new Vector2(
                sc.gameObject.GetComponent <RectTransform> ().sizeDelta.x,
                sc.gameObject.GetComponent <RectTransform> ().sizeDelta.y -
                sc.noteButton.GetComponent <LayoutElement> ().minHeight
                );


            if (NoteNow)
            {
                Destroy(NoteNow);                    //DESTROY IT
            }
            isEdit = false;
        }
    }
Ejemplo n.º 2
0
 // Update is called once per frame
 void Update()
 {
     if (autoplay == true)
     {
         if (!AS.isPlaying && AS.clip.loadState == AudioDataLoadState.Loaded)
         {
             AS.Play();
             AS.loop  = false;
             autoplay = false;
             ScrollContentCreate temp = scc.GetComponent <ScrollContentCreate> ();
             temp.CreateList();
             //			GameObject timelineCanvas = Instantiate (TimelineCanvasPrefab) as GameObject;
             //			timelineCanvas.transform.SetParent (transform);
         }
     }
 }
Ejemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        if (audioSource.GetComponent <AudioSource> ().time - _time > 1.0f)
        {
            ScrollContentCreate sc = scrollcontentcreate.GetComponent <ScrollContentCreate> ();
            sc.noteList [_index]._alive = false;
            Destroy(gameObject);
        }
        else if (audioSource.GetComponent <AudioSource> ().time - _time > 0.5f)
        {
            //gameObject.GetComponent<Material>().
//			gameObject.GetComponent<MeshRenderer>().material=_material;
            //Debug.Log(gameObject.GetComponentsInChildren<MeshRenderer>().Length);
            if (gameObject.GetComponentsInChildren <MeshRenderer> ().Length == 2)
            {
                gameObject.GetComponentsInChildren <MeshRenderer> () [0].material = _material;
                gameObject.GetComponentsInChildren <MeshRenderer> () [1].material = _material;
            }
        }
    }
Ejemplo n.º 4
0
    public void StartEdit(string mapPath)
    {
        Debug.Log(mapPath);



        ScrollContentCreate sc = contentCreate.GetComponent <ScrollContentCreate> ();

        sc.Prepare(mapPath);
        SelectCanvas.SetActive(false);
        mainCanvas.SetActive(true);



        /*
         * menuCanvas.GetComponent<MenuManager> ().HideMenu ();
         *
         * stageController = Instantiate (stageControllerPrefab) as GameObject;
         * stageController.GetComponent<NoteGenerator> ().SelectBeatmap(mapPath);
         * stageController.GetComponent<NoteGenerator> ().Prepare ();
         *
         * gameStarted = true;
         */
    }
Ejemplo n.º 5
0
    public void saveNote()
    {
        ScrollContentCreate sc = scrollcontentview.GetComponent <ScrollContentCreate> ();
        NoteNode            _node;

        _node = new NoteNode();
        if (isEdit == false)
        {
            _node.pos    = NoteNow.transform.position;
            _node.time   = gameObject.GetComponent <AudioSource> ().time;
            _node.type   = 2;
            _node._alive = false;
            sc.noteList.Add(_node);
            sc.noteList.Sort((x, y) => {
                return(x.time.CompareTo(y.time));
            });
            GameObject newButton = Instantiate(sc.noteButton) as GameObject;
            newButton.transform.SetParent(sc.gameObject.transform, false);
            newButton.transform.SetSiblingIndex(sc.noteList.IndexOf(_node));
            newButton.GetComponent <RectTransform> ().position = Vector3.zero;
            newButton.GetComponentInChildren <Text> ().text    = _node.time + "," + _node.type;
            newButton.GetComponent <Button> ().onClick.AddListener(delegate {
                // menuCanvas.GetComponent<MenuManager> ().ToggleMenu(); move the GameController.StartGame()
                gameObject.GetComponent <MusicControl> ().JumpAndPause(
                    float.Parse(newButton.GetComponentInChildren <Text> ().text.Substring(0,
                                                                                          newButton.GetComponentInChildren <Text> ().text.IndexOf(','))),
                    newButton.transform.GetSiblingIndex(),
                    _node.pos
                    );
            });
            sc.gameObject.GetComponent <RectTransform> ().sizeDelta = new Vector2(
                sc.gameObject.GetComponent <RectTransform> ().sizeDelta.x,
                sc.gameObject.GetComponent <RectTransform> ().sizeDelta.y +
                sc.noteButton.GetComponent <LayoutElement> ().minHeight
                );

            for (int i = 0; i < sc.noteList.Count; i++)
            {
                Debug.Log(sc.noteList [i].time);
            }
        }
        else
        {
            _node.pos    = NoteNow.transform.position;
            _node.type   = 2;
            _node.time   = gameObject.GetComponent <AudioSource> ().time;
            _node._alive = false;
            sc.noteList [NoteNodeIndex] = _node;
            sc.noteList.Sort((x, y) => {
                return(x.time.CompareTo(y.time));
            });
            sc.GetComponentsInChildren <Button> () [NoteNodeIndex].GetComponentInChildren <Text> ().text = _node.time + "," + _node.type;
            sc.GetComponentsInChildren <Button> () [NoteNodeIndex].onClick.RemoveAllListeners();
            sc.GetComponentsInChildren <Button> () [NoteNodeIndex].onClick.AddListener(delegate {
                // menuCanvas.GetComponent<MenuManager> ().ToggleMenu(); move the GameController.StartGame()
                gameObject.GetComponent <MusicControl> ().JumpAndPause(
                    float.Parse(sc.GetComponentsInChildren <Button> () [NoteNodeIndex].GetComponentInChildren <Text> ().text.Substring(0,
                                                                                                                                       sc.GetComponentsInChildren <Button> () [NoteNodeIndex].GetComponentInChildren <Text> ().text.IndexOf(','))),
                    sc.GetComponentsInChildren <Button> () [NoteNodeIndex].transform.GetSiblingIndex(),
                    _node.pos
                    );
            });

            sc.GetComponentsInChildren <Button> () [NoteNodeIndex].transform.SetSiblingIndex(sc.noteList.IndexOf(_node));
        }

        if (NoteNow)
        {
            Destroy(NoteNow);                //DESTROY IT
        }
        isEdit = false;
    }