Esempio n. 1
0
    public Task BindModelAsync(ModelBindingContext bindingContext)
    {
        if (bindingContext == null)
        {
            throw new ArgumentNullException(nameof(bindingContext));
        }
        var values = bindingContext.ValueProvider.GetValue("city");

        if (values.Length == 0)
        {
            return(Task.CompletedTask);
        }
        var result = new RNote
        {
            city = values.ToString()
        };

        bindingContext.Result = ModelBindingResult.Success(result);

        return(Task.CompletedTask);
    }
Esempio n. 2
0
    public void Init(NoteType t, RNote r, int n, int l)
    {
        type  = t;
        rnote = r;
        node  = n;
        line  = l;

        if (type == NoteType.LONG)
        {
            GetComponent <SpriteRenderer>().color = Color.blue;
        }
        else if (type == NoteType.LONG_END)
        {
            GetComponent <SpriteRenderer>().color = Color.cyan;
            rnote.rnote = this;
        }
        else if (type == NoteType.SLIDER)
        {
            GetComponent <SpriteRenderer>().color = Color.yellow;
        }
    }
    private void Update()
    {
        if (type == NoteType.NORMAL)
        {
            NormalRnote();
        }
        if (type == NoteType.LONG || type == NoteType.LONG_END)
        {
            LongRnote();
        }
        if (type == NoteType.SLIDER)
        {
            SliderRnote();
        }

        if (type != NoteType.LONG_END && Input.GetKeyDown(KeyCode.Alpha1))
        {
            type      = NoteType.NORMAL;
            text.text = type.ToString();
        }
        if (type != NoteType.LONG_END && Input.GetKeyDown(KeyCode.Alpha2))
        {
            type      = NoteType.LONG;
            text.text = type.ToString();
        }
        if (type != NoteType.LONG_END && Input.GetKeyDown(KeyCode.Alpha3))
        {
            type      = NoteType.SLIDER;
            text.text = type.ToString();
        }

        if ((type == NoteType.NORMAL || type == NoteType.SLIDER) && Input.GetKeyDown(KeyCode.Alpha7))
        {
            CreateRNoteWithKeyboard(1);
        }
        if ((type == NoteType.NORMAL || type == NoteType.SLIDER) && Input.GetKeyDown(KeyCode.Alpha8))
        {
            CreateRNoteWithKeyboard(2);
        }
        if ((type == NoteType.NORMAL || type == NoteType.SLIDER) && Input.GetKeyDown(KeyCode.Alpha9))
        {
            CreateRNoteWithKeyboard(3);
        }
        if ((type == NoteType.NORMAL || type == NoteType.SLIDER) && Input.GetKeyDown(KeyCode.Alpha0))
        {
            CreateRNoteWithKeyboard(4);
        }

        if (Input.GetMouseButtonDown(1))
        {
            Vector2 point = Camera.main.ScreenToWorldPoint(Input.mousePosition);

            for (int i = 0; i < rnotes.Count; i++)
            {
                if (Vector2.Distance((Vector2)rnotes[i].transform.position, point) < 0.695f)
                {
                    RNote temp = rnotes[i];
                    rnotes.Remove(temp);
                    if (temp.rnote != null)
                    {
                        rnotes.Remove(temp.rnote);
                        Destroy(temp.rnote.gameObject);
                    }
                    Destroy(temp.gameObject);
                }
            }
        }

        if (Input.GetKeyDown(KeyCode.P))
        {
            if (play != null)
            {
                StopCoroutine(play);
            }
            play = StartCoroutine(PlayMusic());
        }

        if (Input.GetKeyDown(KeyCode.S))
        {
            SaveMusic();
        }

        if (Input.GetKeyDown(KeyCode.Space))
        {
            if (play != null)
            {
                StopCoroutine(play);
                music.Stop();
            }
        }

        //music.pitch = speed;
    }