コード例 #1
0
ファイル: PlayerManager.cs プロジェクト: McBuff/DMV
        public bool AddPlayerToPlayerManager(int photonPlayerID, int index)
        {
            bool succes = false;

            // find player in connected clinets list and write playerInfo to the list of playerinfo's
            PhotonPlayer[] players = PhotonNetwork.playerList;
            for (int i = 0; i < players.Length; i++)
            {
                if (players[i].ID == photonPlayerID)
                {
                    PhotonPlayer photonPlayer = players[i];
                    PlayerInfo pInfo = new PlayerInfo();

                    pInfo.PhotonPlayer = photonPlayer;
                    pInfo.PlayerObject = null;
                    pInfo.SlotID = index;

                    // add playerInfo to players List
                    m_PlayerInfoList[index] = (pInfo);

                    // Assign player to Scoreboard slot
                    ScoreBoard.GetInstance().AssignPlayerToSlot(photonPlayer, index);

                    // Log message to players
                    string coloredPlayerName = ColorUtility.ColorRichtText(m_SlotColorList[index], photonPlayer.name);
                    EventLog.GetInstance().LogMessage("<b>" + coloredPlayerName + "</b> has connected!");

                    succes = true;
                }
            }


            return succes;
        }
コード例 #2
0
ファイル: PlayerInfo.cs プロジェクト: Sewq90/Dragon_Prototype
 void Awake()
 {
     currentPlayer = this;
 }
コード例 #3
0
ファイル: MemberActivity.cs プロジェクト: bokac1984/team_data
        private void DoWork(IProgress <int> progress)
        {
            _hs_members = new HashSet <MemberDataForGrid>();
            List <Member> allMembers = new List <Member>();
            var           a          = from aa in _memberActivity.AllTime
                                       select new Member()
            {
                Username = aa.Username,
                Joined   = aa.Joined
            };

            allMembers.AddRange(a.ToList <Member>());

            var b = from bb in _memberActivity.Weekly
                    select new Member()
            {
                Username = bb.Username,
                Joined   = bb.Joined
            };

            allMembers.AddRange(b.ToList <Member>());

            var c = from cc in _memberActivity.Monthly
                    select new Member()
            {
                Username = cc.Username,
                Joined   = cc.Joined
            };

            allMembers.AddRange(c.ToList <Member>());

            foreach (var item in allMembers)
            {
                MemberDataForGrid memberDataItem = new MemberDataForGrid()
                {
                    Username         = item.Username,
                    LastOnline       = CommonFunctions.FromUnixTime(item.LastOnline),
                    Joined           = CommonFunctions.FromUnixTime(item.Joined),
                    ChallengeWaiting = item.ChallengeWaiting,
                    GamesToMove      = item.GamesToMove,
                    NewMessages      = item.NewMessages,
                    Notifications    = item.Notifications,
                    JoinedSite       = ""
                };
                _hs_members.Add(memberDataItem);
            }

            int countMembers = _hs_members.Count;
            int i            = 1;

            foreach (var m in _hs_members)
            {
                Notices           n           = api.GetNoticesForPlayer(m.Username);
                Player.PlayerInfo playerInfo  = api.GetPlayerInfo(m.Username);
                PlayerStats       playerStats = api.GetPlayerStats(m.Username);

                m.GamesToMove      = n.GamesToMove;
                m.ChallengeWaiting = n.ChallengeWaiting;
                m.NewMessages      = n.NewMessages;
                m.Notifications    = n.Notifications;
                m.LastOnline       = CommonFunctions.FromUnixTime(playerInfo.LastOnline);
                m.JoinedSite       = CommonFunctions.FromUnixTime(playerInfo.Joined);
                if (playerStats.Chess960_Daily != null)
                {
                    m.Broj960Partija   = playerStats.Chess960_Daily.Record.Win + playerStats.Chess960_Daily.Record.Loss + playerStats.Chess960_Daily.Record.Draw;
                    m.Current960Rating = playerStats.Chess960_Daily.Last.Rating;
                    m.TimePerMove960   = Math.Round(((double)playerStats.Chess960_Daily.Record.TimePerMove / 60 / 60), 2);
                    m.RD960Daily       = playerStats.Chess960_Daily.Last.Rd;
                }
                else
                {
                    m.Broj960Partija   = 0;
                    m.Current960Rating = 0;
                    m.TimePerMove960   = 0;
                    m.RD960Daily       = 0;
                }
                if (playerStats.Chess_Daily != null)
                {
                    m.BrojDnevnihPartija = playerStats.Chess_Daily.Record.Win + playerStats.Chess_Daily.Record.Loss + playerStats.Chess_Daily.Record.Draw;
                    m.CurrentDailyRating = playerStats.Chess_Daily.Last.Rating;
                    m.TimePerMoveDaily   = Math.Round(((double)playerStats.Chess_Daily.Record.TimePerMove / 60 / 60), 2);
                    m.RDDaily            = playerStats.Chess_Daily.Last.Rd;
                }
                else
                {
                    m.BrojDnevnihPartija = 0;
                    m.CurrentDailyRating = 0;
                    m.TimePerMoveDaily   = 0;
                    m.RDDaily            = 0;
                }

                if (playerStats.Chess_Rapid != null)
                {
                    m.BrojRapidPartija   = playerStats.Chess_Rapid.Record.Win + playerStats.Chess_Rapid.Record.Loss + playerStats.Chess_Rapid.Record.Draw;
                    m.CurrentRapidRating = playerStats.Chess_Rapid.Last.Rating;
                    m.RDRapid            = playerStats.Chess_Rapid.Last.Rd;
                }
                else
                {
                    m.BrojRapidPartija   = 0;
                    m.CurrentRapidRating = 0;
                    m.RDRapid            = 0;
                }

                if (playerStats.Chess_Blitz != null)
                {
                    m.BrojBlitzPartija   = playerStats.Chess_Blitz.Record.Win + playerStats.Chess_Blitz.Record.Loss + playerStats.Chess_Blitz.Record.Draw;
                    m.CurrentBlitzRating = playerStats.Chess_Blitz.Last.Rating;
                    m.RDBlitz            = playerStats.Chess_Blitz.Last.Rd;
                }
                else
                {
                    m.BrojBlitzPartija   = 0;
                    m.CurrentBlitzRating = 0;
                    m.RDBlitz            = 0;
                }

                if (playerStats.Chess_Bullet != null)
                {
                    m.BrojBulletPartija   = playerStats.Chess_Bullet.Record.Win + playerStats.Chess_Bullet.Record.Loss + playerStats.Chess_Bullet.Record.Draw;
                    m.CurrentBulletRating = playerStats.Chess_Bullet.Last.Rating;
                    m.RDBullet            = playerStats.Chess_Bullet.Last.Rd;
                }
                else
                {
                    m.BrojBulletPartija   = 0;
                    m.CurrentBulletRating = 0;
                    m.RDBullet            = 0;
                }

                progress_Label.Text = i.ToString() + "/" + countMembers.ToString();
                progress.Report(i);
                i++;
            }
        }
コード例 #4
0
ファイル: PlayerManager.cs プロジェクト: McBuff/DMV
        /// <summary>
        /// Clears player slot data
        /// </summary>
        /// <param name="photonPlayerID"></param>
        public void RemovePlayerFromPlayerManager(PhotonPlayer photonPlayer)
        {
            // copy of left player data
            //PlayerInfo leftPlayerInfo = new PlayerInfo();

            // remove player data from own record
            for (int i = 0; i < m_PlayerInfoList.Count; i++)
            {
                if (m_PlayerInfoList[i].PhotonPlayer == null) // player has quit == null
                {
                    Debug.LogWarning("No player found to clean up!");
                    m_PlayerInfoList[i] = new PlayerInfo(); // overwrite slot with null data
                }
                else if (m_PlayerInfoList[i].PhotonPlayer.ID == photonPlayer.ID)
                {
                    m_PlayerInfoList[i] = new PlayerInfo(); // overwrite slot with null data
                }


            }

            // Clear Player slot
            // find a player slot that is NOT 0


            //ScoreBoard.GetInstance().ClearPlayerFromSlot(leftPlayerInfo.SlotID); 
            ScoreBoard.GetInstance().RemovePlayer(photonPlayer);


            // despawn player if not despawned already

            // Write message that a player has left
            //Color slotColor = GetPlayerSlotColor(leftPlayerInfo.SlotID);

            string dcMessage = "<b>" + photonPlayer.name + "</b>" + " has disconnected.";

            EventLog.GetInstance().LogMessage(dcMessage);

            Debug.LogWarning("PlayerController Disconnect is NOT fully implemented yet.");
        }