예제 #1
0
        public override bool ExUpdate(float currentTime, float bpm, ref bool[] button, ref bool[] released,
                                      MarkResults results, bool auto, ref int soundType, MarkManager.EvaluateEffectHandler effectCallback)
        {
            if (fixedBPM >= 0)
            {
                bpm = fixedBPM;
            }
            bool ret = false;

            lastTime = currentTime;
            if (!auto)
            {
                if (exState == ExState.Waiting)
                {
                    if (ProcessPressedButton(button))
                    {
                        var pressEval = EvaluateImpl(Time, currentTime - adjustGapTime);
                        if (pressEval > EffectType.Worst)
                        {
                            UnsetPressedButton(button);
                        }
                        switch (pressEval)
                        {
                        // if more than safe,ok
                        case EffectType.Cool:
                            OnPrcessEvaluate(false, false, EffectType.Cool, effectCallback);
                            results.Add(EffectType.Cool);
                            exState = ExState.Pressed;
                            break;

                        case EffectType.Fine:
                            OnPrcessEvaluate(false, false, EffectType.Fine, effectCallback);
                            results.Add(EffectType.Fine);
                            exState = ExState.Pressed;
                            break;

                        case EffectType.Safe:
                            OnPrcessEvaluate(false, false, EffectType.Safe, effectCallback);
                            results.Add(EffectType.Safe);
                            state   = State.Safe;
                            exState = ExState.Pressed;
                            ret     = true;
                            break;

                        case EffectType.Sad:
                            OnPrcessEvaluate(false, false, EffectType.Sad, effectCallback);
                            results.Add(EffectType.Sad);
                            state   = State.Sad;
                            exState = ExState.Pressed;
                            ret     = true;
                            break;

                        case EffectType.Worst:
                            OnPrcessEvaluate(false, false, EffectType.Worst, effectCallback);
                            results.Add(EffectType.Worst);
                            state   = State.Worst;
                            exState = ExState.Pressed;
                            ret     = true;
                            break;

                        case 0:
                            break;
                        }
                        if (pressEval != EffectType.None)
                        {
                            Hidden      = false;
                            ColorHidden = false;
                            Array.Clear(colorMarkInfo.Pos1, 0, colorMarkInfo.Pos1.Length);
                            Array.Clear(colorMarkInfo.Pos2, 0, colorMarkInfo.Pos2.Length);
                            colorMarkInfo.VerticesCount = 0;
                        }
                        if (results[EffectType.Cool] || results[EffectType.Fine])
                        {
                            state  = State.Cool;
                            Hidden = true;
                        }
                    }
                }
                else if (exState == ExState.Pressed)
                {
                    if (released[(int)usedButton])
                    {
                        results.Add(EffectType.PressReleased);
                        ret = true;
                    }
                    else
                    {
                        results.Add(EffectType.Pressing);
                    }
                }
                if (exState == ExState.Waiting)
                {
                    if (currentTime - Time >= eval[3])
                    {
                        OnPrcessEvaluate(false, false, EffectType.Worst, null);
                        results.Add(EffectType.Worst);
                        ret = true;
                    }
                }
            }
            else
            {
                //when auto
                if (exState == ExState.Waiting)
                {
                    if (currentTime - Time >= -AutoWidth)
                    {
                        OnPrcessEvaluate(false, false, EffectType.Cool, effectCallback);
                        results.Add(EffectType.Cool);
                        exState   = ExState.Pressed;
                        soundType = (int)ButtonType;
                        state     = State.Cool;
                        Hidden    = true;
                        Array.Clear(colorMarkInfo.Pos1, 0, colorMarkInfo.Pos1.Length);
                        Array.Clear(colorMarkInfo.Pos2, 0, colorMarkInfo.Pos2.Length);
                        colorMarkInfo.VerticesCount = 0;
                    }
                }
                else if (exState == ExState.Pressed)
                {
                    results.Add(EffectType.Pressing);
                }
            }
            float scale = (float)bpm / DefaultBpm;

            if (state < State.Cool)
            {
                if (state == State.Moving && currentTime - Time >= 0)
                {
                    state = State.Disappering;
                }
                if (state == State.Disappering)
                {
                    mark.Scale = axis.Scale = colorMarkInfo.ColorMark.Scale = new Vector2((eval[3] + Time - currentTime) / eval[3]);
                    if (mark.Scale.X <= 0)
                    {
                        mark.Scale = axis.Scale = colorMarkInfo.Scale = Vector2.Zero;
                    }
                }
                if (Hidden)
                {
                    if (Time - currentTime <= 0.5f / scale)
                    {
                        if (displayState == DisplayState.Sudden)
                        {
                            Hidden      = false;
                            ColorHidden = false;
                            OnPrcessEvaluate(false, false, EffectType.Appear, effectCallback);
                            Array.Clear(colorMarkInfo.Pos1, 0, colorMarkInfo.Pos1.Length);
                            Array.Clear(colorMarkInfo.Pos2, 0, colorMarkInfo.Pos2.Length);
                            colorMarkInfo.VerticesCount = 0;
                        }
                    }
                    else if (Time - currentTime <= 2 / scale)
                    {
                        if (displayState == DisplayState.Normal || displayState == DisplayState.Hidden || displayState == DisplayState.HiddenColor || displayState == DisplayState.SuddenColor)
                        {
                            Hidden      = false;
                            ColorHidden = false;
                            OnPrcessEvaluate(false, false, EffectType.Appear, effectCallback);
                            ColorHidden |= displayState == DisplayState.SuddenColor;
                        }
                    }
                }
                else
                {
                    if (Time - currentTime <= 0.25f / scale)
                    {
                        if (displayState == DisplayState.Hidden)
                        {
                            displayState = (DisplayState)(-1);
                            Hidden       = true;
                        }
                        else
                        {
                            ColorHidden |= (exState == ExState.Waiting && displayState == DisplayState.HiddenColor);
                        }
                    }
                    else if (Time - currentTime <= 0.5f / scale)
                    {
                        if (ColorHidden && displayState == DisplayState.SuddenColor)
                        {
                            Array.Clear(colorMarkInfo.Pos1, 0, colorMarkInfo.Pos1.Length);
                            Array.Clear(colorMarkInfo.Pos2, 0, colorMarkInfo.Pos2.Length);
                            colorMarkInfo.VerticesCount = 0;
                            ColorHidden = false;
                        }
                    }
                }
                if (state == State.Appearing && !Hidden)
                {
                    float sx = mark.Scale.X + 0.05f;
                    mark.Scale = new Vector2(sx, sx);
                    if (mark.Scale.X > 1.2f)
                    {
                        mark.Scale = Vector2.One;
                        state      = State.Moving;
                    }
                }
                UpdateColorPosition(currentTime, bpm);
                axis.Rotation = -1 * (float)Math.PI * (Time - currentTime) * scale;
                if (axis.Rotation >= 0)
                {
                    axis.Rotation = 0;
                }
            }
            colorMarkInfo.DrawTrace        = (state == State.Moving || state == State.Appearing) && exState == ExState.Waiting;
            mark.Hidden                    = axis.Hidden = !(state < State.Cool);
            colorMarkInfo.ColorMark.Hidden = ColorHidden || !(state < State.Cool);
            colorMarkInfo.Hidden           = ColorHidden;
            return(ret);
        }
예제 #2
0
파일: Mark.cs 프로젝트: KHCmaster/PPD
        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);
        }
예제 #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);
        }
예제 #4
0
        public override bool ExUpdate(float currentTime, float bpm, ref bool[] button, ref bool[] released,
                                      MarkResults results, bool auto, ref int soundType, MarkManager.EvaluateEffectHandler effectCallback)
        {
            if (fixedBPM >= 0)
            {
                bpm = fixedBPM;
            }
            bool ret = false;

            lastTime = currentTime;
            if (!auto)
            {
                if (exState == ExState.Waiting)
                {
                    if (ProcessPressedButton(button))
                    {
                        var pressEval = EvaluateImpl(Time, currentTime - adjustGapTime);
                        if (pressEval > EffectType.Worst)
                        {
                            UnsetPressedButton(button);
                        }
                        switch (pressEval)
                        {
                        // if more than safe,ok
                        case EffectType.Cool:
                            OnPrcessEvaluate(false, false, EffectType.Cool, effectCallback);
                            results.Add(EffectType.Cool);
                            exState         = ExState.Pressed;
                            lastPressedTime = currentTime;
                            break;

                        case EffectType.Fine:
                            OnPrcessEvaluate(false, false, EffectType.Fine, effectCallback);
                            results.Add(EffectType.Fine);
                            exState         = ExState.Pressed;
                            lastPressedTime = currentTime;
                            break;

                        case EffectType.Safe:
                            OnPrcessEvaluate(false, false, EffectType.Safe, effectCallback);
                            results.Add(EffectType.Safe);
                            state           = State.Safe;
                            exState         = ExState.Pressed;
                            lastPressedTime = currentTime;
                            ret             = true;
                            break;

                        case EffectType.Sad:
                            OnPrcessEvaluate(false, false, EffectType.Sad, effectCallback);
                            results.Add(EffectType.Sad);
                            state           = State.Sad;
                            exState         = ExState.Pressed;
                            lastPressedTime = currentTime;
                            ret             = true;
                            break;

                        case EffectType.Worst:
                            OnPrcessEvaluate(false, false, EffectType.Worst, effectCallback);
                            results.Add(EffectType.Worst);
                            state           = State.Worst;
                            exState         = ExState.Pressed;
                            lastPressedTime = currentTime;
                            ret             = true;
                            break;

                        case 0:
                            break;
                        }
                        if (pressEval != EffectType.None)
                        {
                            Hidden      = false;
                            ColorHidden = false;
                            Array.Clear(colorMarkInfo.Pos1, 0, colorMarkInfo.Pos1.Length);
                            Array.Clear(colorMarkInfo.Pos2, 0, colorMarkInfo.Pos2.Length);
                            colorMarkInfo.VerticesCount = 0;
                        }
                        if (!ret && exState == ExState.Pressed)
                        {
                            OnPrcessEvaluate(false, false, EffectType.SlideStart, effectCallback, FirstSlideColorMarkInfo.BasePosition + Position);
                        }
                    }
                }
                else if (exState == ExState.Pressed)
                {
                    if (ProcessReleasedButton(released))
                    {
                        var last = colorExMarkInfos.LastOrDefault(c => c.IsSlided);
                        OnPrcessEvaluate(false, false, EffectType.SlideEnd, effectCallback, (last ?? FirstSlideColorMarkInfo).BasePosition + Position);
                        UnsetReleasedButton(button);
                        ret = true;
                    }
                    if (!ret)
                    {
                        if (currentTime - endTime >= 0)
                        {
                            OnPrcessEvaluate(false, false, EffectType.SlideEnd, effectCallback, LastSlideColorMarkInfo.BasePosition + Position);
                            results.Add(EffectType.Slide);
                            exState     = ExState.Released;
                            soundType   = (int)ButtonType;
                            Hidden      = false;
                            ColorHidden = false;
                            ret         = true;
                        }
                    }
                }
                if (exState == ExState.Waiting)
                {
                    if (currentTime - Time >= eval[3])
                    {
                        OnPrcessEvaluate(false, false, EffectType.Worst, null);
                        results.Add(EffectType.Worst);
                        ret = true;
                    }
                }
            }
            else
            {
                //when auto
                if (exState == ExState.Waiting)
                {
                    if (currentTime - Time >= -AutoWidth)
                    {
                        OnPrcessEvaluate(false, false, EffectType.Cool, effectCallback);
                        OnPrcessEvaluate(false, false, EffectType.SlideStart, effectCallback, FirstSlideColorMarkInfo.BasePosition + Position);
                        results.Add(EffectType.Cool);
                        exState         = ExState.Pressed;
                        lastPressedTime = currentTime;
                        soundType       = (int)ButtonType;
                        Hidden          = false;
                        ColorHidden     = false;
                        Array.Clear(colorMarkInfo.Pos1, 0, colorMarkInfo.Pos1.Length);
                        Array.Clear(colorMarkInfo.Pos2, 0, colorMarkInfo.Pos2.Length);
                        colorMarkInfo.VerticesCount = 0;
                    }
                }
                else if (exState == ExState.Pressed)
                {
                    if (currentTime - endTime >= 0)
                    {
                        OnPrcessEvaluate(false, false, EffectType.SlideEnd, effectCallback, LastSlideColorMarkInfo.BasePosition + Position);
                        results.Add(EffectType.Slide);
                        exState     = ExState.Released;
                        soundType   = (int)ButtonType;
                        Hidden      = false;
                        ColorHidden = false;
                        ret         = true;
                    }
                }
            }
            float scale = (float)bpm / DefaultBpm;

            if (state < State.Cool)
            {
                if (state == State.Moving && currentTime - Time >= 0)
                {
                    state = State.Disappering;
                }
                if (state == State.Disappering)
                {
                    mark.Scale = axis.Scale = colorMarkInfo.ColorMark.Scale = new Vector2((eval[3] + Time - currentTime) / eval[3]);
                    if (mark.Scale.X <= 0)
                    {
                        mark.Scale = axis.Scale = colorMarkInfo.Scale = Vector2.Zero;
                    }
                }
                if (Hidden)
                {
                    if (Time - currentTime <= 0.5f / scale)
                    {
                        if (displayState == DisplayState.Sudden)
                        {
                            Hidden      = false;
                            ColorHidden = false;
                            OnPrcessEvaluate(false, false, EffectType.Appear, effectCallback);
                            Array.Clear(colorMarkInfo.Pos1, 0, colorMarkInfo.Pos1.Length);
                            Array.Clear(colorMarkInfo.Pos2, 0, colorMarkInfo.Pos2.Length);
                            colorMarkInfo.VerticesCount = 0;
                        }
                    }
                    else if (Time - currentTime <= 2 / scale)
                    {
                        if (displayState == DisplayState.Normal || displayState == DisplayState.Hidden || displayState == DisplayState.HiddenColor || displayState == DisplayState.SuddenColor)
                        {
                            Hidden      = false;
                            ColorHidden = false;
                            OnPrcessEvaluate(false, false, EffectType.Appear, effectCallback);
                            ColorHidden |= displayState == DisplayState.SuddenColor;
                        }
                    }
                }
                else
                {
                    if (Time - currentTime <= 0.25f / scale)
                    {
                        if (displayState == DisplayState.Hidden)
                        {
                            displayState = (DisplayState)(-1);
                            Hidden       = true;
                        }
                        else
                        {
                            ColorHidden |= (exState == ExState.Waiting && displayState == DisplayState.HiddenColor);
                        }
                    }
                    else if (Time - currentTime <= 0.5f / scale)
                    {
                        if (ColorHidden && displayState == DisplayState.SuddenColor)
                        {
                            Array.Clear(colorMarkInfo.Pos1, 0, colorMarkInfo.Pos1.Length);
                            Array.Clear(colorMarkInfo.Pos2, 0, colorMarkInfo.Pos2.Length);
                            colorMarkInfo.VerticesCount = 0;
                            ColorHidden = false;
                        }
                    }
                }
                if (state == State.Appearing && !Hidden)
                {
                    float sx = mark.Scale.X + 0.05f;
                    mark.Scale = new Vector2(sx, sx);
                    if (mark.Scale.X > 1.2f)
                    {
                        mark.Scale = Vector2.One;
                        state      = State.Moving;
                    }
                }
                UpdateColorPosition(currentTime, bpm);
                axis.Rotation = -1 * (float)Math.PI * (Time - currentTime) * scale;
                if (axis.Rotation >= 0)
                {
                    axis.Rotation = 0;
                }
            }
            for (int i = 0; i < colorExMarkInfos.Length; i++)
            {
                switch (colorExMarkInfos[i].ShowState)
                {
                case SlideColorMarkInfo.State.None:

                    if (colorExMarkInfos[i].MarkTime - currentTime <= 0.5f / scale)
                    {
                        if (displayState == DisplayState.Sudden)
                        {
                            colorExMarkInfos[i].ShowState = SlideColorMarkInfo.State.Appearing;
                            OnPrcessEvaluate(false, false, EffectType.Appear, effectCallback, colorExMarkInfos[i].BasePosition + Position);
                        }
                    }
                    if (colorExMarkInfos[i].MarkTime - currentTime <= 2 / scale)
                    {
                        if (displayState == DisplayState.Normal || displayState == DisplayState.Hidden || displayState == DisplayState.HiddenColor || displayState == DisplayState.SuddenColor)
                        {
                            colorExMarkInfos[i].ShowState = SlideColorMarkInfo.State.Appearing;
                            OnPrcessEvaluate(false, false, EffectType.Appear, effectCallback, colorExMarkInfos[i].BasePosition + Position);
                        }
                    }
                    break;

                case SlideColorMarkInfo.State.Appearing:
                    float sx = exMarks[i].Scale.X + 0.05f;
                    exMarks[i].Scale = new Vector2(sx, sx);
                    if (exMarks[i].Scale.X > 1.2f)
                    {
                        exMarks[i].Scale = Vector2.One;
                        colorExMarkInfos[i].ShowState = SlideColorMarkInfo.State.Moving;
                    }
                    break;

                case SlideColorMarkInfo.State.Moving:
                    if (currentTime - colorExMarkInfos[i].MarkTime >= 0)
                    {
                        colorExMarkInfos[i].ShowState = SlideColorMarkInfo.State.Disappearing;
                    }
                    break;

                case SlideColorMarkInfo.State.Disappearing:
                    colorExMarkInfos[i].ColorMark.Scale = exMarks[i].Scale = new Vector2((eval[3] + colorExMarkInfos[i].MarkTime - currentTime) / eval[3]);
                    if (exMarks[i].Scale.X <= 0)
                    {
                        colorExMarkInfos[i].ColorMark.Scale = exMarks[i].Scale = Vector2.Zero;
                    }
                    break;
                }
                var vec = CalculateColorPosition(colorExMarkInfos[i], colorExMarkInfos[i].SlideMarkInfo, colorExMarkInfos[i].MarkTime, currentTime, bpm);
                UpdateColorMarkInfo(colorExMarkInfos[i], colorExMarkInfos[i].SlideMarkInfo, colorExMarkInfos[i].MarkTime, currentTime, bpm, vec);
                var prevVisible = !colorExMarkInfos[i].ColorMark.Hidden;
                colorExMarkInfos[i].DrawTrace        = exState < ExState.Pressed || currentTime < colorExMarkInfos[i].MarkTime;
                colorExMarkInfos[i].ColorMark.Hidden = exMarks[i].Hidden = !colorExMarkInfos[i].DrawTrace;
                var currentVisible = !colorExMarkInfos[i].ColorMark.Hidden;
                if (prevVisible != currentVisible)
                {
                    if ((exState == ExState.Pressed || (results[EffectType.Slide] && ret)) && !colorExMarkInfos[i].IsSlided)
                    {
                        PressingFrames++;
                        OnPrcessEvaluate(false, false, EffectType.Slide, effectCallback, colorExMarkInfos[i].BasePosition + Position);
                        colorExMarkInfos[i].IsSlided = true;
                        if (i < colorExMarkInfos.Length - 1)
                        {
                            results.Add(EffectType.Slide);
                        }
                    }
                }
            }
            if (exState == ExState.Pressed)
            {
                if (currentTime - lastPressedTime >= ExFrameSec)
                {
                    lastPressedTime += ExFrameSec;
                    soundType        = (int)ButtonType;
                }
            }
            if (ret && IsMaxSlide)
            {
                OnPrcessEvaluate(false, false, EffectType.MaxSlide, effectCallback, LastSlideColorMarkInfo.BasePosition + Position);
            }

            axis.Hidden = mark.Hidden = state >= State.Cool || exState >= ExState.Pressed;
            colorMarkInfo.ColorMark.Hidden = ColorHidden || state >= State.Cool || exState >= ExState.Pressed;
            colorMarkInfo.DrawTrace        = (state == State.Moving || state == State.Appearing) && exState == ExState.Waiting;
            for (var i = 0; i < exMarks.Length; i++)
            {
                exMarks[i].Hidden |= colorExMarkInfos[i].ShowState == SlideColorMarkInfo.State.None || !(state < State.Cool);
            }
            for (var i = 0; i < colorExMarkInfos.Length; i++)
            {
                colorExMarkInfos[i].Hidden            = Hidden || ColorHidden;
                colorExMarkInfos[i].ColorMark.Hidden |= Hidden || ColorHidden;
            }
            colorMarkInfo.Hidden = Hidden || ColorHidden;
            return(ret);
        }
예제 #5
0
 public abstract bool ExUpdate(float currentTime, float bpm, ref bool[] button, ref bool[] released,
                               MarkResults results, bool auto, ref int soundType, MarkManager.EvaluateEffectHandler effectCallback);
예제 #6
0
 protected override void OnPrcessEvaluate(bool missPress, bool released, EffectType effectType, MarkManager.EvaluateEffectHandler effectcallback)
 {
     base.OnPrcessEvaluate(missPress, released, effectType, released ? effectcallback : null);
 }
예제 #7
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);
            }
        }
예제 #8
0
 protected virtual void OnPrcessEvaluate(bool missPress, bool released, EffectType effectType, MarkManager.EvaluateEffectHandler effectcallback)
 {
     OnPrcessEvaluate(missPress, released, effectType, effectcallback, Position);
 }
예제 #9
0
        public virtual bool Update(float currentTime, float bpm, ref bool[] button, MarkResults results, bool auto, ref int soundType, MarkManager.EvaluateEffectHandler effectCallback)
        {
            if (fixedBPM >= 0)
            {
                bpm = fixedBPM;
            }
            bool ret = false;

            if (!auto)
            {
                if (ProcessPressedButton(button) && state < State.Cool)
                {
                    Logger.Instance.AddLog("Update:{0}, {1}, {2}", Time, currentTime, adjustGapTime);
                    var pressEval = EvaluateImpl(Time, currentTime - adjustGapTime);
                    Logger.Instance.AddLog("Evaluate:{0}", pressEval);
                    if (pressEval > EffectType.Worst)
                    {
                        UnsetPressedButton(button);
                    }
                    switch (pressEval)
                    {
                    case EffectType.Cool:
                        state = State.Cool;
                        OnPrcessEvaluate(false, false, EffectType.Cool, effectCallback);
                        results.Add(EffectType.Cool);
                        ret = true;
                        break;

                    case EffectType.Fine:
                        state = State.Fine;
                        OnPrcessEvaluate(false, false, EffectType.Fine, effectCallback);
                        results.Add(EffectType.Fine);
                        ret = true;
                        break;

                    case EffectType.Safe:
                        state = State.Safe;
                        OnPrcessEvaluate(false, false, EffectType.Safe, effectCallback);
                        results.Add(EffectType.Safe);
                        ret = true;
                        break;

                    case EffectType.Sad:
                        state = State.Sad;
                        OnPrcessEvaluate(false, false, EffectType.Sad, effectCallback);
                        results.Add(EffectType.Sad);
                        ret = true;
                        break;

                    case EffectType.Worst:
                        state = State.Worst;
                        OnPrcessEvaluate(false, false, EffectType.Worst, null);
                        results.Add(EffectType.Worst);
                        ret = true;
                        break;

                    case 0:
                        break;
                    }
                }
            }
            else
            {
                //when auto
                if (currentTime - Time >= -AutoWidth && state < State.Cool)
                {
                    state = State.Cool;
                    OnPrcessEvaluate(false, false, EffectType.Cool, effectCallback);
                    soundType = (int)ButtonType;
                    results.Add(EffectType.Cool);
                    ret         = true;
                    Hidden      = false;
                    ColorHidden = false;
                }
            }
            if (currentTime - Time >= eval[3] && state < State.Cool)
            {
                OnPrcessEvaluate(false, false, EffectType.Worst, null);
                results.Add(EffectType.Worst);
                ret = true;
            }
            if (state < State.Cool)
            {
                if (state == State.Moving && currentTime - Time >= 0)
                {
                    state = State.Disappering;
                }
                if (state == State.Disappering)
                {
                    mark.Scale = axis.Scale = colorMarkInfo.ColorMark.Scale = new Vector2((eval[3] + Time - currentTime) / eval[3]);
                    if (mark.Scale.X <= 0)
                    {
                        mark.Scale = axis.Scale = colorMarkInfo.Scale = Vector2.Zero;
                    }
                }
                float scale = (float)bpm / DefaultBpm;
                if (Hidden)
                {
                    if (Time - currentTime <= 0.5f / scale)
                    {
                        if (displayState == DisplayState.Sudden)
                        {
                            Hidden      = false;
                            ColorHidden = false;
                            OnPrcessEvaluate(false, false, EffectType.Appear, effectCallback);
                            Array.Clear(colorMarkInfo.Pos1, 0, colorMarkInfo.Pos1.Length);
                            Array.Clear(colorMarkInfo.Pos2, 0, colorMarkInfo.Pos2.Length);
                            colorMarkInfo.VerticesCount = 0;
                        }
                    }
                    else if (Time - currentTime <= 2 / scale)
                    {
                        if (displayState == DisplayState.Normal || displayState == DisplayState.Hidden || displayState == DisplayState.HiddenColor || displayState == DisplayState.SuddenColor)
                        {
                            Hidden      = false;
                            ColorHidden = false;
                            OnPrcessEvaluate(false, false, EffectType.Appear, effectCallback);
                            ColorHidden |= displayState == DisplayState.SuddenColor;
                        }
                    }
                }
                else
                {
                    if (Time - currentTime <= 0.25f / scale)
                    {
                        if (displayState == DisplayState.Hidden)
                        {
                            displayState = (DisplayState)(-1);
                            Hidden       = true;
                        }
                        else
                        {
                            ColorHidden |= displayState == DisplayState.HiddenColor;
                        }
                    }
                    else if (Time - currentTime <= 0.5f / scale)
                    {
                        if (ColorHidden && displayState == DisplayState.SuddenColor)
                        {
                            Array.Clear(colorMarkInfo.Pos1, 0, colorMarkInfo.Pos1.Length);
                            Array.Clear(colorMarkInfo.Pos2, 0, colorMarkInfo.Pos2.Length);
                            colorMarkInfo.VerticesCount = 0;
                            ColorHidden = false;
                        }
                    }
                }
                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 = Vector2.One;
                        state      = State.Moving;
                    }
                }
                UpdateColorPosition(currentTime, bpm);
                axis.Rotation = -1 * (float)Math.PI * (Time - currentTime) * scale;
                if (axis.Rotation >= 0)
                {
                    axis.Rotation = 0;
                }
            }
            colorMarkInfo.DrawTrace        = state == State.Moving || state == State.Appearing;
            mark.Hidden                    = axis.Hidden = !(state < State.Cool);
            colorMarkInfo.ColorMark.Hidden = ColorHidden || !(state < State.Cool);
            colorMarkInfo.Hidden           = ColorHidden;
            return(ret);
        }