Beispiel #1
0
        public string AddAllPlayerTrain() //WARNING, need to change
        {
            string tmp = "";

            foreach (OnlinePlayer p in Players.Values)
            {
                if (p.Train != null)
                {
                    MSGPlayer player = new MSGPlayer(p.Username, "1234", p.con, p.path, p.Train, p.Train.Number, p.url);
                    tmp += player.ToString();
                }
            }
            return(tmp);
        }
Beispiel #2
0
        public void AddPlayer()
        {
            if (!MPManager.IsServer())
            {
                return;
            }
            if (PlayerAdded == true)
            {
                PlayerAdded = false;
                MPManager.Instance().lastPlayerAddedTime = Simulator.GameTime;
                MPManager.Instance().lastSwitchTime      = Simulator.GameTime;

                MSGPlayer host = new  MSGPlayer(MPManager.GetUserName(), "1234", Simulator.conFileName, Simulator.patFileName, Simulator.PlayerLocomotive.Train,
                                                Simulator.PlayerLocomotive.Train.Number, Simulator.Settings.AvatarURL);
                MPManager.BroadCast(host.ToString() + MPManager.OnlineTrains.AddAllPlayerTrain());
                foreach (Train t in Simulator.Trains)
                {
                    if (Simulator.PlayerLocomotive != null && t == Simulator.PlayerLocomotive.Train)
                    {
                        continue;                                                                              //avoid broadcast player train
                    }
                    if (MPManager.FindPlayerTrain(t))
                    {
                        continue;
                    }
                    if (removedTrains.Contains(t))
                    {
                        continue;                           //this train is going to be removed, should avoid it.
                    }
                    MPManager.BroadCast((new MSGTrain(t, t.Number)).ToString());
                }
                if (CheckSpad == false)
                {
                    MultiPlayer.MPManager.BroadCast((new MultiPlayer.MSGMessage("All", "OverSpeedOK", "OK to go overspeed and pass stop light")).ToString());
                }
                else
                {
                    MultiPlayer.MPManager.BroadCast((new MultiPlayer.MSGMessage("All", "NoOverSpeed", "Penalty for overspeed and passing stop light")).ToString());
                }
                MPManager.BroadCast(GetEnvInfo());
            }
        }