Example #1
0
        void StateMachine_OnTransition(VMEODPaperChaseState from, VMEODPaperChaseState to)
        {
            Lobby.Broadcast("paperchase_state", ((byte)to).ToString());

            if (Controller == null)
            {
                return;
            }

            switch (to)
            {
            case VMEODPaperChaseState.Lobby:
                ResetGame();
                BroadcastPlayerLetters();
                break;

            case VMEODPaperChaseState.StartRound:
                ResetGame();
                CurrentCombination = Combinations[Random.Next(0, Combinations.Length)];
                StateMachine.TransitionTo(VMEODPaperChaseState.WaitingForThreeLetters);
                break;

            case VMEODPaperChaseState.WaitingForThreeLetters:
                PreviousMatches = Matches;
                BroadcastPlayerLetters();
                Controller.SendOBJEvent(new VMEODEvent((short)VMEODPaperChaseObjEvent.Idle));
                break;

            case VMEODPaperChaseState.ThreeLettersProvided:
                Matches = 0;
                for (var i = 0; i < 3; i++)
                {
                    var playerData = Lobby.GetSlotData(i);
                    if (playerData.Letter == CurrentCombination[i])
                    {
                        Matches++;
                    }

                    Controller.SendOBJEvent(new VMEODEvent((short)VMEODPaperChaseObjEvent.SetLetter,
                                                           (short)(playerData.Letter | (short)((i + 1) << 8)))); //lo: letter, hi: FREESO player id

                    playerData.PreviousLetter = playerData.Letter;
                    playerData.Letter         = null;
                }

                Controller.SendOBJEvent(new VMEODEvent((short)VMEODPaperChaseObjEvent.SetResult, Matches));
                StateMachine.TransitionTo(VMEODPaperChaseState.CheckingResult);
                break;

            case VMEODPaperChaseState.CheckingResult:
                Ticks = 0;
                break;

            case VMEODPaperChaseState.CheckResult:
                Ticks = 0;
                Controller.SendOBJEvent(new VMEODEvent((short)VMEODPaperChaseObjEvent.ShowResult));
                Lobby.Broadcast("paperchase_result", Matches.ToString());
                break;
            }
        }
        /// <summary>
        /// Send the list of items stocked to the eod plugin
        /// </summary>
        /// <param name="vm"></param>
        /// <param name="updateNumOutfits"></param>
        protected void BroadcastOutfits(VM vm, bool updateNumOutfits)
        {
            GetOutfits(vm, x =>
            {
                var packet = new VMEODRackStockResponse()
                {
                    Outfits = x
                };
                Lobby.Broadcast("set_outfits", packet);

                if (updateNumOutfits)
                {
                    var controller = Controller;
                    if (controller != null)
                    {
                        controller.SendOBJEvent(new VMEODEvent((short)VMEODRackEvent.SetOutfitCount, (short)x.Length));
                    }
                }
            });
        }
Example #3
0
        public override void Tick()
        {
            if (Controller != null)
            {
                if (UITimer > 0)
                {
                    if (++TimerFrames >= 30)
                    {
                        TimerFrames = 0;
                        UITimer--;
                        SendTime();
                    }
                }
                switch (State)
                {
                case VMEODBandStates.PreShow:
                {
                    if (UITimer == 0)
                    {
                        Lobby.Broadcast("Band_Show", "");
                        PlayNextSequence();
                    }
                    break;
                }

                case VMEODBandStates.Performance:
                {
                    if (UITimer == 0)
                    {
                        Lobby.Broadcast("Band_Timeout", "");
                        GameOver(false);
                    }
                    break;
                }

                case VMEODBandStates.Intermission:
                {
                    if (UITimer == 0)
                    {
                        if (RockOn())
                        {
                            PlayNextSequence();
                        }
                        else
                        {
                            GameOver(true);
                        }
                    }
                    break;
                }

                case VMEODBandStates.Finale:
                {
                    if (UITimer == 0)
                    {
                        InitGame();
                    }
                    break;
                }
                }
            }
        }
Example #4
0
 private void ResetTradeTime()
 {
     TicksToAcceptable = 5 * 30;
     Lobby.Broadcast("trade_time", "5");
 }
        private void GotoState(VMEODBandStates newState)
        {
            if (!Lobby.IsFull() && !newState.Equals(VMEODBandStates.Lobby))
            {
                EnqueueGotoState(VMEODBandStates.Lobby);
            }
            else
            {
                State = newState;

                switch (State)
                {
                case VMEODBandStates.Lobby:
                {
                    SetTimer(-1);
                    break;
                }

                case VMEODBandStates.PreShow:
                {
                    InitGame(PRESHOW_TIMER_DEFAULT);
                    Lobby.Broadcast("Band_Show", new byte[0]);
                    break;
                }

                case VMEODBandStates.Rehearsal:
                {
                    SetTimer(-1);
                    ResetRockOn();
                    PlayNextSequence();
                    break;
                }

                case VMEODBandStates.Performance:
                {
                    NoteState = VMEODBandStates.Performance;
                    Lobby.Broadcast("Band_Performance", new byte[0]);
                    SetTimer(NOTE_TIMER_DEFAULT);
                    break;
                }

                case VMEODBandStates.Intermission:
                {
                    // ask players if they wish to continue, and update payout string
                    Lobby.Broadcast("Band_Intermission", GetPayoutData());
                    SetTimer(DECISION_TIMER_DEFAULT);
                    break;
                }

                case VMEODBandStates.MinPayment:
                {
                    // reduce the current song length to the closest achieved minimum
                    CurrentSongLength -= (short)(CurrentSongLength % 5);
                    break;
                }

                case VMEODBandStates.Electric:
                {
                    SetTimer(-1);
                    Lobby.Broadcast("Band_Electric", new byte[0]);
                    break;
                }
                }
            }
        }