Esempio n. 1
0
        float CalcTwoPointScore(List <DiffNetData> multiplierList, float maxRoutineTime)
        {
            float       totalPoints = 0f;
            DiffNetData prevDnd     = null;

            foreach (DiffNetData dnd in multiplierList)
            {
                if (maxRoutineTime < 0 || dnd.RoutineTime < maxRoutineTime)
                {
                    if (prevDnd == null)
                    {
                        prevDnd = dnd;
                    }
                    else
                    {
                        float  avgScore = dnd.DiffScore + prevDnd.DiffScore / 2f;
                        double time     = dnd.RoutineTime - prevDnd.RoutineTime;

                        totalPoints += (float)(avgScore * time);

                        prevDnd = dnd;
                    }
                }
                else
                {
                    break;
                }
            }

            return(totalPoints);
        }
Esempio n. 2
0
        private void DiffUpdateTick(float dt)
        {
            XInputState controllerState = new XInputState();

            XInputGetState(0, ref controllerState);

            TwoPointIncreaseTriggerBonus = Math.Min(MaxTwoPointIncreaseTriggerBonus, TwoPointIncreaseTriggerBonus + dt * TwoPointIncreaseTriggerBonusFillSpeed);
            TwoPointDecreaseTriggerBonus = Math.Max(MaxTwoPointDecreaseTriggerBonus, TwoPointDecreaseTriggerBonus - dt * TwoPointDecreaseTriggerBonusFillSpeed);

            float speed = TwoPointNeutralSpeed;

            if (controllerState.Gamepad.bRightTrigger > 100)
            {
                if (!bRightTriggered)
                {
                    CurrentTwoPointScore        += TwoPointIncreaseTriggerBonus;
                    TwoPointIncreaseTriggerBonus = 0f;
                }

                bRightTriggered  = true;
                speed            = TwoPointIncreaseSpeed;
                DisplayDiffScore = "Good";
            }
            else
            {
                bRightTriggered = false;
            }

            if (controllerState.Gamepad.bLeftTrigger > 100)
            {
                if (!bLeftTriggered)
                {
                    CurrentTwoPointScore        += TwoPointDecreaseTriggerBonus;
                    TwoPointDecreaseTriggerBonus = 0f;
                }

                bLeftTriggered   = true;
                speed            = TwoPointDecreaseSpeed;
                DisplayDiffScore = "Bad";
            }
            else
            {
                bLeftTriggered = false;
            }

            if ((!bLeftTriggered && !bRightTriggered))
            {
                DisplayDiffScore = "Neutral";
            }
            else if (bLeftTriggered && bRightTriggered)
            {
                DisplayDiffScore = "Both";
            }

            CurrentTwoPointScore = Math.Max(0f, CurrentTwoPointScore + speed * dt);

            DiffNetData dnd = new DiffNetData(TwoPointJudgeId, CurrentTwoPointScore, SecondsSinceRoutineStart);

            if (bIsClientConnected)
            {
                if (bRoutineRecording)
                {
                    CurrentDiffScoreInterval += dt;
                    if (CurrentDiffScoreInterval > SendDiffScoreInterval)
                    {
                        CurrentDiffScoreInterval = 0f;

                        Dispatcher.BeginInvoke(DispatcherPriority.Background, new System.Threading.ThreadStart(() =>
                        {
                            SendToServerNetData("DiffResult", dnd);
                        }));

                        CurrentTwoPointBackupList.Add(dnd);

                        TwoPointFinishRoutine();
                    }
                }
            }
        }