Ejemplo n.º 1
0
    public void ShowNormalInstrumentState(InstrumentMode eWhichInstrument)
    {
        InstrumentDetails instrument = m_aInstrumentDetails[(int)eWhichInstrument];

        if (instrument != null)
        {
            instrument.renderer.sprite = instrument.normalSprite;
            instrument.holder.transform.localPosition = instrument.normalPosition;
            instrument.holder.transform.localRotation = Quaternion.Euler(instrument.normalRotation);
            instrument.holder.transform.localScale    = instrument.normalScale;

            if (m_agoTambourineCymbals[(int)eWhichInstrument] != null)
            {
                m_agoTambourineCymbals[(int)eWhichInstrument].SetActive(true);
                foreach (Transform cymbal in m_agoTambourineCymbals[(int)eWhichInstrument].transform)
                {
                    cymbal.GetComponent <Button_TambourineCymbal>().enabled = true;
                }
            }

            if (m_arTambourineTargets[(int)eWhichInstrument] != null && m_arTambourineTargets[(int)eWhichInstrument].Visible)
            {
                m_arTambourineTargets[(int)eWhichInstrument].HideShakenTambourineTargets();
            }
        }
    }
Ejemplo n.º 2
0
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //	* New Method: Set Instrument Mode
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    private void SetInstrumentMode(InstrumentMode eMode)
    {
        if (m_eCurrentInstrumentMode != eMode)
        {
            // Disable Currently Active Instrument
            DisableInstrument(m_eCurrentInstrumentMode);
            bool bActivateTargets = m_arTambourineTargets[(int)m_eCurrentInstrumentMode].Visible;

            // Make the switch, saving to memory so that the app uses this same instrument next time app is loaded
            m_eCurrentInstrumentMode = eMode;
            SavedPreferenceTool.SaveInt("InstrumentMode", (int)eMode);

            // Activate next instrument and put it into the normal display state
            ActivateInstrument(eMode);
            ShowNormalInstrumentState();
            if (bActivateTargets)
            {
                m_arTambourineTargets[(int)eMode].ShowTargets();
            }
            else
            {
                m_arTambourineTargets[(int)eMode].HideTargets();
            }
        }
    }
        public async Task UpdateAsync(Instrument instrument, string userId)
        {
            Instrument currentInstrument = await GetByAssetPairIdAsync(instrument.AssetPairId);

            InstrumentMode currentInstrumentMode = currentInstrument.Mode;

            currentInstrument.Update(instrument);
            currentInstrument.Approve();

            await _instrumentRepository.UpdateAsync(currentInstrument);

            _cache.Set(currentInstrument);

            if (instrument.Mode == InstrumentMode.Disabled && currentInstrumentMode != InstrumentMode.Disabled)
            {
                try
                {
                    await _lykkeExchangeService.CancelAsync(instrument.AssetPairId);
                }
                catch (Exception exception)
                {
                    _log.WarningWithDetails("An error occurred while cancelling limit orders", exception,
                                            new { currentInstrument, userId });
                }

                await _orderBookService.RemoveAsync(instrument.AssetPairId);
            }

            _log.InfoWithDetails("Instrument was updated", new { currentInstrument, userId });
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Given an expect mode, compare it to the updated copy of the instrument mode
        /// </summary>
        /// <param name="awg"></param>
        /// <param name="expectedMode"></param>
        public void AwgInstrumentModeShouldBe(IAWG awg, InstrumentMode expectedMode)
        {
            var expectedValue = (expectedMode == InstrumentMode.Awg)
                        ? SyntaxForInstrumentModeAwg
                        : SyntaxForInstrumentModeFgen;

            Assert.AreEqual(expectedValue, awg.InstrumentMode);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Set the awg's instrument mode
        /// </summary>
        /// <param name="awg"></param>
        /// <param name="setMode"></param>
        public void SetInstrumentMode(IAWG awg, InstrumentMode setMode)
        {
            var setValue = (setMode == InstrumentMode.Awg)
                        ? SyntaxForInstrumentModeAwg
                        : SyntaxForInstrumentModeFgen;

            awg.SetInstrumentMode(setValue);
        }
Ejemplo n.º 6
0
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //	* New Method: Disable Instrument
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    public void DisableInstrument(InstrumentMode eWhichInstrument)
    {
        InstrumentDetails instrument = m_aInstrumentDetails[(int)eWhichInstrument];

        if (instrument != null)
        {
            instrument.holder.SetActive(false);
        }
    }
Ejemplo n.º 7
0
    public override void Handle(GameSession session, PacketReader packet)
    {
        InstrumentMode mode = (InstrumentMode)packet.ReadByte();

        switch (mode)
        {
        case InstrumentMode.StartImprovise:
            HandleStartImprovise(session, packet);
            break;

        case InstrumentMode.PlayNote:
            HandlePlayNote(session, packet);
            break;

        case InstrumentMode.StopImprovise:
            HandleStopImprovise(session);
            break;

        case InstrumentMode.PlayScore:
            HandlePlayScore(session, packet);
            break;

        case InstrumentMode.StopScore:
            HandleStopScore(session);
            break;

        case InstrumentMode.StartEnsemble:
            HandleStartEnsemble(session, packet);
            break;

        case InstrumentMode.LeaveEnsemble:
            HandleLeaveEnsemble(session);
            break;

        case InstrumentMode.Compose:
            HandleCompose(session, packet);
            break;

        case InstrumentMode.Fireworks:
            HandleFireworks(session);
            break;

        case InstrumentMode.AudienceEmote:
            HandleAudienceEmote(packet);
            break;

        default:
            IPacketHandler <GameSession> .LogUnknownMode(mode);

            break;
        }
    }
Ejemplo n.º 8
0
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //	* Derived Method: Awake
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    void Awake()
    {
        // Switch to the appropriate instrument type, saved during the last game. Can only change Instruments permanently in full version of app~
        InstrumentMode eSavedInstrumentMode = m_eCurrentInstrumentMode;

        //if(GameManager.IsFullVersion)
        eSavedInstrumentMode = (InstrumentMode)SavedPreferenceTool.GetInt("InstrumentMode", (int)InstrumentMode.RIQ_TAMBOURINE);

        if (eSavedInstrumentMode != m_eCurrentInstrumentMode)
        {
            SetInstrumentMode(eSavedInstrumentMode);
        }
    }
Ejemplo n.º 9
0
    void enqueueDataPoint(InstrumentMode mode, int trace, int index, float x, float y)
    {
        newDataToPlot = true;
        GraphPoint g = new GraphPoint();

        g.index = index;
        g.x     = x;
        g.y     = y;
        g.trace = trace;
        g.mode  = mode;

        graphPoints.Enqueue(g);
        newDataToPlot = true;
    }
Ejemplo n.º 10
0
    public void ToggleInstrumentState(InstrumentMode eWhichInstrument)
    {
        InstrumentDetails instrument = m_aInstrumentDetails[(int)eWhichInstrument];

        if (instrument != null)
        {
            if (instrument.renderer.sprite == instrument.specialSprite)
            {
                ShowNormalInstrumentState(eWhichInstrument);
            }
            else
            {
                ShowSpecialInstrumentState(eWhichInstrument);
            }
        }
    }
Ejemplo n.º 11
0
 // Display the user's mistake, safely.
 private void WrongUpdateScore(InstrumentMode mode)
 {
     if (InvokeRequired)
     {
         Invoke(new InstrumentUiInstrumentModeCallback(WrongUpdateScore), mode);
         return;
     }
     if (mode == InstrumentMode.Send)
     {
         lblResult.Text = "Wrong!  You belled " + CurrentCode + ", not " + ExpectedCode;
     }
     else
     {
         lblResult.Text = "Wrong!  You heard " + ChosenCode + ", not " + ((HiddenCode)comboCodeList.SelectedItem).Code;
     }
     UpdateScore();
     lblResult.Visible = true;
 }
Ejemplo n.º 12
0
    public void ShowSpecialInstrumentState(InstrumentMode eWhichInstrument)
    {
        InstrumentDetails instrument = m_aInstrumentDetails[(int)eWhichInstrument];

        if (instrument != null)
        {
            instrument.renderer.sprite = instrument.specialSprite;
            instrument.holder.transform.localPosition = instrument.specialPosition;
            instrument.holder.transform.localRotation = Quaternion.Euler(instrument.specialRotation);
            instrument.holder.transform.localScale    = instrument.specialScale;

            if (m_agoTambourineCymbals[(int)eWhichInstrument] != null)
            {
                m_agoTambourineCymbals[(int)eWhichInstrument].SetActive(false);
            }

            if (m_arTambourineTargets[(int)eWhichInstrument] != null && m_arTambourineTargets[(int)eWhichInstrument].Visible)
            {
                m_arTambourineTargets[(int)eWhichInstrument].ShowShakenTambourineTargets();
            }
        }
    }
Ejemplo n.º 13
0
 public InstrumentModeFilter()
 {
     Instrument     = Lib.Instrument.Any;
     PointingMode   = Lib.PointingMode.Any;
     InstrumentMode = Lib.InstrumentMode.Any;
 }
Ejemplo n.º 14
0
        private static MusicPlayer MusicBoxNotationMusicPlayerFactory(RawMusicSheet rawMusicSheet, InstrumentMode mode)
        {
            var musicSheet = new MusicSheetParser(new ChordParser(new NoteParser(), rawMusicSheet.Instrument)).Parse(
                rawMusicSheet.Melody,
                int.Parse(rawMusicSheet.Tempo),
                int.Parse(rawMusicSheet.Meter.Split('/')[0]),
                int.Parse(rawMusicSheet.Meter.Split('/')[1]));


            var algorithm = rawMusicSheet.Algorithm == "favor notes"
                ? new FavorNotesAlgorithm() : (IPlayAlgorithm) new FavorChordsAlgorithm();

            Instrument instrument = InstrumentRepository[rawMusicSheet.Instrument];

            instrument.Mode = mode;
            MusicianModule.ModuleInstance.Conveyor.Visible = mode == InstrumentMode.Practice;

            return(new MusicPlayer(
                       musicSheet,
                       instrument,
                       algorithm));
        }
Ejemplo n.º 15
0
 internal static MusicPlayer Create(RawMusicSheet rawMusicSheet, InstrumentMode mode)
 {
     return(MusicBoxNotationMusicPlayerFactory(rawMusicSheet, mode));
 }
Ejemplo n.º 16
0
 private static void ValidateInstrumentMode(IEnumerable <OrderBook> orderBooks, InstrumentMode instrumentMode)
 {
     if (instrumentMode != InstrumentMode.Active)
     {
         SetError(orderBooks.SelectMany(o => o.LimitOrders), LimitOrderError.Idle);
     }
 }
Ejemplo n.º 17
0
 public InstrumentModeValue(InstrumentMode value)
 {
     Value = value;
 }