Exemplo n.º 1
0
        protected virtual void OnPrcessEvaluate(bool missPress, bool released, EffectType effectType, MarkManager.EvaluateEffectHandler effectcallback, Vector2 position)
        {
            if (ChangeMarkEvaluate != null)
            {
                if (ChangeMarkEvaluate(this, effectType, missPress, released, position))
                {
                    return;
                }
            }

            if (effectcallback != null)
            {
                effectcallback.Invoke(effectType, position);
            }
        }
Exemplo n.º 2
0
        public virtual bool Update(float ctime, float bp, ref bool[] button, ref MarkManager.EffectType check, bool auto, ref int soundtype, MarkManager.EvaluateEffectHandler effectcallback)
        {
            bool ret = false;

            if (!auto)
            {
                if (button[(int)ButtonType] && state < State.cool)
                {
                    int a = evaluate(this.time, ctime - adjustgaptime);
                    if (a > 1)
                    {
                        button[(int)ButtonType] = false;
                    }
                    switch (a)
                    {
                    case 5:
                        state = State.cool;
                        effectcallback.Invoke(MarkManager.EffectType.Cool, Position);
                        check = MarkManager.EffectType.Cool;
                        ret   = true;
                        break;

                    case 4:
                        state = State.fine;
                        check = MarkManager.EffectType.Fine;
                        ret   = true;
                        effectcallback.Invoke(MarkManager.EffectType.Fine, Position);
                        break;

                    case 3:
                        state = State.safe;
                        effectcallback.Invoke(MarkManager.EffectType.Safe, Position);
                        check = MarkManager.EffectType.Safe;
                        ret   = true;
                        break;

                    case 2:
                        state = State.sad;
                        effectcallback.Invoke(MarkManager.EffectType.Sad, Position);
                        check = MarkManager.EffectType.Sad;
                        ret   = true;
                        break;

                    case 1:
                        state = State.worst;
                        effectcallback.Invoke(MarkManager.EffectType.Cool, Position);
                        check = MarkManager.EffectType.Worst;
                        ret   = true;
                        break;

                    case 0:
                        break;
                    }
                }
            }
            else
            {
                //when auto
                if (ctime - this.time >= -autowidth && state < State.cool)
                {
                    state = State.cool;
                    effectcallback.Invoke(MarkManager.EffectType.Cool, Position);
                    soundtype = (int)ButtonType;
                    check     = MarkManager.EffectType.Cool;
                    ret       = true;
                    hidden    = false;
                }
            }
            if (ctime - this.time >= eval[3] && state < State.cool)
            {
                check = MarkManager.EffectType.Worst;
                ret   = true;
            }
            if (state < State.cool)
            {
                if (state == State.moving && ctime - this.time >= 0)
                {
                    state = State.disappering;
                }
                if (state == State.disappering)
                {
                    float sx = mark.Scale.X;
                    mark.Scale  = new Vector2((eval[3] + this.time - ctime) / eval[3], (eval[3] + this.time - ctime) / eval[3]);
                    jiku.Scale  = new Vector2((eval[3] + this.time - ctime) / eval[3], (eval[3] + this.time - ctime) / eval[3]);
                    markc.Scale = new Vector2((eval[3] + this.time - ctime) / eval[3], (eval[3] + this.time - ctime) / eval[3]);
                    if (mark.Scale.X <= 0)
                    {
                        mark.Scale  = new Vector2(0, 0);
                        jiku.Scale  = new Vector2(0, 0);
                        markc.Scale = new Vector2(0, 0);
                    }
                }
                float scale = (float)bp / defaultbpm;
                if (hidden)
                {
                    if (this.time - ctime <= 2 / scale)
                    {
                        if (dState == DisplayState.Normal || dState == DisplayState.Hidden)
                        {
                            hidden = false;
                            effectcallback.Invoke(MarkManager.EffectType.Appear, Position);
                        }
                    }
                    if (this.time - ctime <= 0.5f / scale)
                    {
                        if (dState == DisplayState.Sudden)
                        {
                            hidden = false;
                            effectcallback.Invoke(MarkManager.EffectType.Appear, Position);
                            pos1           = new Vector2[40];
                            pos2           = new Vector2[40];
                            iVerticesCount = 0;
                        }
                    }
                    if (this.time - ctime <= 0.25f / scale)
                    {
                        if (dState == DisplayState.Hidden)
                        {
                            hidden = true;
                        }
                    }
                }
                if (state == State.appearing && !hidden)
                {
                    float sx = mark.Scale.X + 0.05f;
                    mark.Scale = new Vector2(sx, sx);
                    //uzu.Scale = new Vector2(sx / 4f, sx / 4f);
                    if (mark.Scale.X > 1.2f)
                    {
                        mark.Scale = new Vector2(1, 1);
                        state      = State.moving;
                    }
                }
                CaliculateColorPosition(ctime, bp);
                jiku.Rotation = -1 * (float)Math.PI * (this.time - ctime) * scale;
                if (jiku.Rotation >= 0)
                {
                    jiku.Rotation = 0;
                }
            }
            mark.Update();
            markc.Update();
            jiku.Update();
            return(ret);
        }
Exemplo n.º 3
0
        public bool ExUpdate(float ctime, float bp, ref bool[] button, ref bool[] released, ref MarkManager.EffectType check, bool auto, ref int soundtype, MarkManager.EvaluateEffectHandler effectcallback)
        {
            bool ret = false;

            lasttime = ctime;
            //base.Update(ctime, bp, ref button, ref check, auto, ref soundtype);
            if (!auto)
            {
                if (exstate == ExState.waitingpress)
                {
                    if (button[(int)ButtonType])
                    {
                        int a = evaluate(this.time, ctime - adjustgaptime);
                        if (a > 1)
                        {
                            button[(int)ButtonType] = false;
                        }
                        switch (a)
                        {
                        // if more than safe,ok
                        case 5:
                            check   = MarkManager.EffectType.Cool;
                            exstate = ExState.pressok;
                            break;

                        case 4:
                            check   = MarkManager.EffectType.Fine;
                            exstate = ExState.pressok;
                            break;

                        case 3:
                            check   = MarkManager.EffectType.Safe;
                            state   = State.safe;
                            exstate = ExState.released;
                            ret     = true;
                            break;

                        case 2:
                            check   = MarkManager.EffectType.Sad;
                            state   = State.sad;
                            exstate = ExState.released;
                            ret     = true;
                            break;

                        case 1:
                            check   = MarkManager.EffectType.Worst;
                            state   = State.worst;
                            exstate = ExState.released;
                            ret     = true;
                            break;

                        case 0:
                            break;
                        }
                        if (a != 0)
                        {
                            hidden         = false;
                            pos1           = new Vector2[40];
                            pos2           = new Vector2[40];
                            iVerticesCount = 0;
                        }
                        if (AC && (check == MarkManager.EffectType.Cool || check == MarkManager.EffectType.Fine))
                        {
                            state = State.cool;
                            effectcallback.Invoke(MarkManager.EffectType.Cool, Position);
                            hidden = true;
                        }
                    }
                }
                else if (exstate == ExState.pressok)
                {
                    if (AC)
                    {
                        if (released[(int)ButtonType])
                        {
                            check = MarkManager.EffectType.PressReleased;
                            ret   = true;
                        }
                        else
                        {
                            check = MarkManager.EffectType.Pressing;
                        }
                    }
                    else
                    {
                        if (released[(int)ButtonType])
                        {
                            released[(int)ButtonType] = false;
                            int a = evaluate(this.endtime, ctime - adjustgaptime);
                            switch (a)
                            {
                            // final evaluate
                            case 5:
                                check = MarkManager.EffectType.Cool;
                                state = State.cool;
                                effectcallback.Invoke(MarkManager.EffectType.Cool, Position);
                                exstate = ExState.released;
                                ret     = true;
                                break;

                            case 4:
                                check = MarkManager.EffectType.Fine;
                                state = State.fine;
                                effectcallback.Invoke(MarkManager.EffectType.Fine, Position);
                                exstate = ExState.released;
                                ret     = true;
                                break;

                            case 3:
                                check = MarkManager.EffectType.Safe;
                                state = State.safe;
                                effectcallback.Invoke(MarkManager.EffectType.Safe, Position);
                                exstate = ExState.released;
                                ret     = true;
                                break;

                            case 2:
                                check = MarkManager.EffectType.Sad;
                                state = State.sad;
                                effectcallback.Invoke(MarkManager.EffectType.Sad, Position);
                                exstate = ExState.released;
                                ret     = true;
                                break;

                            case 1:
                                check   = MarkManager.EffectType.Worst;
                                state   = State.worst;
                                exstate = ExState.released;
                                ret     = true;
                                break;

                            case 0:
                                check   = MarkManager.EffectType.Worst;
                                state   = State.worst;
                                exstate = ExState.released;
                                ret     = true;
                                break;
                            }
                            if (state >= State.cool && state <= State.sad)
                            {
                                //離したとき用の音
                                soundtype = (int)ButtonType;
                            }
                        }
                    }
                }
                if (exstate == ExState.waitingpress)
                {
                    if (ctime - this.time >= eval[3])
                    {
                        check = MarkManager.EffectType.Worst;
                        ret   = true;
                    }
                }
                else if (exstate == ExState.pressok)
                {
                    if (!AC)
                    {
                        if (ctime - this.endtime >= eval[3])
                        {
                            check = MarkManager.EffectType.Worst;
                            ret   = true;
                        }
                    }
                }
            }
            else
            {
                //when auto
                if (exstate == ExState.waitingpress)
                {
                    if (ctime - this.time >= -autowidth)
                    {
                        check     = MarkManager.EffectType.Cool;
                        exstate   = ExState.pressok;
                        soundtype = (int)ButtonType;
                        if (AC)
                        {
                            state = State.cool;
                            effectcallback.Invoke(MarkManager.EffectType.Cool, Position);
                            hidden = true;
                        }
                        else
                        {
                            hidden = false;
                        }
                        pos1           = new Vector2[40];
                        pos2           = new Vector2[40];
                        iVerticesCount = 0;
                    }
                }
                else if (exstate == ExState.pressok)
                {
                    if (AC)
                    {
                        check = MarkManager.EffectType.Pressing;
                    }
                    else
                    {
                        if (ctime - this.endtime >= -autowidth)
                        {
                            check     = MarkManager.EffectType.Cool;
                            exstate   = ExState.released;
                            soundtype = (int)ButtonType + 10;
                            state     = State.cool;
                            effectcallback.Invoke(MarkManager.EffectType.Cool, Position);
                            hidden = false;
                            ret    = true;
                        }
                    }
                }
            }
            if (state < State.cool)
            {
                float scale = (float)bp / defaultbpm;
                if (hidden)
                {
                    if (this.time - ctime <= 2 / scale)
                    {
                        if (dState == DisplayState.Normal || dState == DisplayState.Hidden)
                        {
                            effectcallback.Invoke(MarkManager.EffectType.Appear, Position);
                            hidden = false;
                        }
                    }
                    if (this.time - ctime <= 0.5f / scale)
                    {
                        if (dState == DisplayState.Sudden)
                        {
                            effectcallback.Invoke(MarkManager.EffectType.Appear, Position);
                            hidden = false;
                        }
                    }
                    if (this.time - ctime <= 0.25f / scale)
                    {
                        if (dState == DisplayState.Hidden && exstate == ExState.waitingpress)
                        {
                            effectcallback.Invoke(MarkManager.EffectType.Appear, Position);
                            hidden = true;
                        }
                    }
                    if (this.endtime - ctime <= 0.25f / scale)
                    {
                        if (dState == DisplayState.Hidden)
                        {
                            effectcallback.Invoke(MarkManager.EffectType.Appear, Position);
                            hidden = true;
                        }
                    }
                }
                if (state == State.appearing && !hidden)
                {
                    float sx = mark.Scale.X + 0.05f;
                    mark.Scale      = new Vector2(sx, sx);
                    outcircle.Scale = new Vector2(sx, sx);
                    outjiku.Scale   = new Vector2(sx, sx);
                    hold.Scale      = new Vector2(sx, sx);
                    if (mark.Scale.X > 1.2f)
                    {
                        mark.Scale      = new Vector2(1, 1);
                        outcircle.Scale = new Vector2(1, 1);
                        outjiku.Scale   = new Vector2(1, 1);
                        hold.Scale      = new Vector2(1, 1);
                        state           = State.moving;
                    }
                }
                CaliculateColorPosition(ctime, bp);
                jiku.Rotation = -1 * (float)Math.PI * (this.time - ctime) * scale;
                if (jiku.Rotation >= 0)
                {
                    jiku.Rotation = 0;
                }
                outjiku.Rotation = -2 * (float)Math.PI * (this.time - ctime) / length;
            }
            mark.Update();
            markc.Update();
            jiku.Update();
            outcircle.Update();
            outjiku.Update();
            hold.Update();
            return(ret);
        }