Пример #1
0
        void Update()
        {
            //Don't start if our sound has not started
            if (SoundConductor.Instance.PlayState != PlayState.Playing ||
                State == NoteState.Destroyed)
            {
                return;
            }

            Vector3 pos        = transform.position;
            float   distToMove = GetDistanceByTime((float)(SoundConductor.Instance.CurrentTime - StartTime), ActiveTaikoSettings.NoteSpeed);

            pos.x -= distToMove;

            transform.position = pos = new Vector3(_startPos.x - distToMove, transform.position.y, transform.position.z);

            if (pos.x <= _destroyPos.x)
            {
                OnReachedEnd();
            }
            else if (pos.x < _minHitPos.x)
            {
                OnMissed();
            }
            else if (pos.x >= _minHitPos.x &&
                     pos.x <= _maxHitPos.x &&
                     NoteScroller.Instance.CanNoteBeHit(this))
            {
                if (ActiveTaikoSettings.IsAutoplayActive)
                {
                    // Only hit when we are on hit or already passed it
                    if (pos.x <= _hitPos.x)
                    {
                        OnHit(true);

                        switch (Color)
                        {
                        case NoteColor.Blue:
                            if (IsBigNote)
                            {
                                HotkeyManager.GetKey("TaikoOuterLeft")
                                .Invoke();
                                HotkeyManager.GetKey("TaikoOuterRight")
                                .Invoke();
                            }
                            else
                            {
                                if (_autoplaySwitchBlue)
                                {
                                    HotkeyManager.GetKey("TaikoOuterLeft")
                                    .Invoke();
                                }
                                else
                                {
                                    HotkeyManager.GetKey("TaikoOuterRight")
                                    .Invoke();
                                }

                                _autoplaySwitchBlue = !_autoplaySwitchBlue;
                            }
                            break;

                        case NoteColor.Red:
                            if (IsBigNote)
                            {
                                HotkeyManager.GetKey("TaikoInnerLeft")
                                .Invoke();
                                HotkeyManager.GetKey("TaikoInnerRight")
                                .Invoke();
                            }
                            else
                            {
                                if (_autoplaySwitchRed)
                                {
                                    HotkeyManager.GetKey("TaikoInnerLeft")
                                    .Invoke();
                                }
                                else
                                {
                                    HotkeyManager.GetKey("TaikoInnerRight")
                                    .Invoke();
                                }

                                _autoplaySwitchRed = !_autoplaySwitchRed;
                            }
                            break;

                        case NoteColor.Yellow:
                            if (Random.Range(1, 3) == 1)
                            {
                                goto case NoteColor.Blue;
                            }
                            else
                            {
                                goto case NoteColor.Red;
                            }
                        }
                    }
                }
                else
                {
                    int hitCount = 0;
                    switch (Color)
                    {
                    case NoteColor.Blue:
                        if (HotkeyManager.GetKey("TaikoOuterLeft").Check())
                        {
                            hitCount++;
                        }
                        if (HotkeyManager.GetKey("TaikoOuterRight").Check())
                        {
                            hitCount++;
                        }
                        break;

                    case NoteColor.Red:
                        if (HotkeyManager.GetKey("TaikoInnerLeft").Check())
                        {
                            hitCount++;
                        }
                        if (HotkeyManager.GetKey("TaikoInnerRight").Check())
                        {
                            hitCount++;
                        }
                        break;

                    case NoteColor.Yellow:
                        if (HotkeyManager.GetKey("TaikoOuterLeft").Check())
                        {
                            hitCount++;
                        }
                        if (HotkeyManager.GetKey("TaikoOuterRight").Check())
                        {
                            hitCount++;
                        }
                        if (HotkeyManager.GetKey("TaikoInnerLeft").Check())
                        {
                            hitCount++;
                        }
                        if (HotkeyManager.GetKey("TaikoInnerRight").Check())
                        {
                            hitCount++;
                        }
                        break;
                    }

                    if (IsBigNote)
                    {
                        // Good hit
                        if (hitCount > 1)
                        {
                            OnHit(true);
                        }
                        // Bad hit
                        else if (hitCount > 0)
                        {
                            OnHit(false);
                        }
                    }
                    // Good hit
                    else if (hitCount > 1)
                    {
                        OnHit(true);
                    }
                }
            }
        }
Пример #2
0
            public void Update()
            {
                UpdateGauges();

                updateTimer.Start();
                try
                {
                    // if log level is at least INFO and performance statistics are enabled
                    // write statistical data in the log every 10 seconds
                    if (configuration.performanceStatisticsEnabled && Log.IsLogable(Log.LEVEL.INFO) && HighLogic.LoadedSceneIsFlight)
                    {
                        if (lastPerformanceLog + 10000 < timer.ElapsedMilliseconds)
                        {
                            lastPerformanceLog = timer.ElapsedMilliseconds;
                            Log.Info("Nanogauges performance statistics:\n" + TimedStatistics.instance.ToString());
                        }
                    }

                    // check for Profile Hotkeys
                    profileManager.Update();

                    // check for keys
                    //
                    gauges.ShowCloseButtons(hotkeyManager.GetKey(HotkeyManager.HOTKEY_CLOSE_AND_DRAG));

                    //
                    bool hotkeyPressed = hotkeyManager.GetKey(HotkeyManager.HOTKEY_MAIN); // Input.GetKey(hotkey);

                    // Hotkeys for Gaugesets
                    if (!hotkeyPressed)
                    {
                        // simple Hotkeys
                        if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_HIDE))
                        {
                            if (gauges.Hidden())
                            {
                                gauges.Unhide();
                            }
                            else
                            {
                                gauges.Hide();
                            }
                        }
                        else if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_PREVSET))
                        {
                            SetGaugeSet(configuration.GetGaugeSetId().decrement());
                        }
                        else if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_NEXTSET))
                        {
                            SetGaugeSet(configuration.GetGaugeSetId().increment());
                        }
                        else if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_LOCK_PROFILE))
                        {
                            profileManager.ToggleLock();
                        }
                        else if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_SELECT_NAV))
                        {
                            NavGlobals.SelectNextAirfield();
                        }
                    }
                    else
                    {
                        // Hotkeys in chord with main hotkey
                        //
                        if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_SET_STANDARD))
                        {
                            SetGaugeSet(GaugeSet.ID.STANDARD);
                        }
                        else if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_SET_LAUNCH))
                        {
                            SetGaugeSet(GaugeSet.ID.LAUNCH);
                        }
                        else if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_SET_LAND))
                        {
                            SetGaugeSet(GaugeSet.ID.LAND);
                        }
                        else if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_SET_DOCK))
                        {
                            SetGaugeSet(GaugeSet.ID.DOCK);
                        }
                        else if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_SET_ORBIT))
                        {
                            SetGaugeSet(GaugeSet.ID.ORBIT);
                        }
                        else if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_SET_FLIGHT))
                        {
                            SetGaugeSet(GaugeSet.ID.FLIGHT);
                        }
                        else if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_SET_SET1))
                        {
                            SetGaugeSet(GaugeSet.ID.SET1);
                        }
                        else if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_SET_SET2))
                        {
                            SetGaugeSet(GaugeSet.ID.SET2);
                        }
                        else if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_SET_SET3))
                        {
                            SetGaugeSet(GaugeSet.ID.SET3);
                        }
                        else if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_SET_ENABLE_ALL))
                        {
                            configuration.EnableAllGauges(gauges);
                        }
                        else if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_WINDOW_CONFIG))
                        {
                            createConfigOnce();
                            toggleConfigVisibility();
                        }
                        else if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_STANDARDLAYOUT))
                        {
                            gauges.LayoutCurrentGaugeSet(new StandardLayout(NanoGauges.gauges, configuration));
                        }
                        else if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_ALT_HIDE))
                        {
                            if (gauges.Hidden())
                            {
                                gauges.Unhide();
                            }
                            else
                            {
                                gauges.Hide();
                            }
                        }
                        else if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_AUTOLAYOUT))
                        {
                            gauges.AutoLayout();
                        }
                        else if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_ALIGNMENT_GAUGE))
                        {
                            gauges.ShowAligmentGauge(!gauges.IsAligmentGaugeVisible());
                        }
                    }
                }
                finally
                {
                    updateTimer.Stop();
                }
                hotkeyManager.ignoring = false;
            }
Пример #3
0
 public void ReturnToMenu()
 {
     HotkeyManager.GetKey("ReturnToTitleScreen")
     .Invoke();
 }