Пример #1
0
        public void UpdatePlayers(string evt, string msg)
        {
            var players = EODLobby.ParsePlayers(msg);

            if (players.Length != NumPlayers)
            {
                return;
            }

            for (var i = 0; i < PlayerUI.Count; i++)
            {
                var ui       = PlayerUI[i];
                var playerId = players[ui.Slot];

                var avatar = (VMAvatar)EOD.EODController.Lot.vm.GetObjectById((short)playerId);

                if (avatar == null)
                {
                    //No player
                    RemovePlayerUI(ui);
                }
                else
                {
                    UpdatePlayerUI(ui, avatar);
                }
            }
        }
        public VMAbstractEODRackPlugin(VMEODServer server) : base(server)
        {
            // Get the data from the global server containing the rack name
            server.vm.GlobalLink.LoadPluginPersist(server.vm, server.Object.PersistID, server.PluginID, (byte[] data) =>
            {
                lock (this)
                {
                    if (data == null)
                    {
                        Data          = new VMEODRackData();
                        Data.RackName = "Name your rack";
                    }
                    else
                    {
                        Data = new VMEODRackData(data);
                    }
                }
            });

            Lobby = new EODLobby <VMEODPaperChaseSlot>(server, 1)
                    .OnFailedToJoinDisconnect();

            PlaintextHandlers["close"]  = Lobby.Close;
            server.CanBeActionCancelled = true;
        }
Пример #3
0
        public VMEODPaperChasePlugin(VMEODServer server) : base(server)
        {
            Lobby = new EODLobby <VMEODPaperChaseSlot>(server, 3)
                    .BroadcastPlayersOnChange("paperchase_players")
                    .OnJoinSend("paperchase_show")
                    .OnFailedToJoinDisconnect();

            PlaintextHandlers["close"] = Lobby.Close;
            PlaintextHandlers["paperchase_chooseletter"] = SetPlayerLetter;

            StateMachine = new StateMachine <VMEODPaperChaseState>(VMEODPaperChaseState.Lobby);
            StateMachine.OnTransition += StateMachine_OnTransition;

            //The random function is crappy, if we use it to choose single chars it very often chooses the same combination
            //Expanding the list gives us more variance
            Combinations = new short[27][];
            var i = 0;

            for (var x = 0; x < 3; x++)
            {
                for (var y = 0; y < 3; y++)
                {
                    for (var z = 0; z < 3; z++)
                    {
                        //1 = a, 2 = b, 3=c
                        Combinations[i] = new short[] {
                            (short)(x + 1),
                            (short)(y + 1),
                            (short)(z + 1)
                        };
                        i++;
                    }
                }
            }
        }
Пример #4
0
        public VMEODSecureTradePlugin(VMEODServer server) : base(server)
        {
            Lobby = new EODLobby <VMEODSecureTradePlayer>(server, 2)
                    .BroadcastPlayersOnChange("trade_players")
                    .OnJoinSend("trade_show")
                    .OnFailedToJoinDisconnect();

            PlaintextHandlers["close"]       = Lobby.Close;
            PlaintextHandlers["trade_offer"] = TradeOffer;
        }
Пример #5
0
        public VMBasicEOD(VMEODServer server, string name) : base(server)
        {
            EODName = name;

            Lobby = new EODLobby <T>(server, 1)
                    .OnJoinSend(EODName + "_show")
                    .OnFailedToJoinDisconnect();

            PlaintextHandlers["close"] = Lobby.Close;
        }
Пример #6
0
        public VMEODBandPlugin(VMEODServer server) : base(server)
        {
            Lobby = new EODLobby <VMEODBandSlot>(server, 4)
                    .BroadcastPlayersOnChange("Band_Players")
                    .OnFailedToJoinDisconnect();

            State                  = VMEODBandStates.Idle;
            SequenceTimer          = new Timer(MILLISECONDS_PER_NOTE_IN_SEQUENCE);
            SequenceTimer.Elapsed += SequenceTimerElapsedHandler;

            // event listeners
            BinaryHandlers["Band_Decision"] = RockOnOrSellOutHandler;
            BinaryHandlers["Band_Note"]     = NoteSelectedHandler;
            SimanticsHandlers[(short)VMEODBandEventTypes.NewGame]            = NewGameHandler;
            SimanticsHandlers[(short)VMEODBandEventTypes.AnimationsFinished] = AnimationsFinishedHandler;
        }