RebuildPlayerListCopies
How do I use Rebuild Player List Copies
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
Line | Code | Ex.. |
---|---|---|
599 | RebuildPlayerListCopies(); | 1 |
612 | RebuildPlayerListCopies(); | 2 |
616 | void RebuildPlayerListCopies() | 3 |
924 | this.RebuildPlayerListCopies(); | 4 |
File name: NetworkingPeer.cs
Copy
594 private void AddNewPlayer(int ID, PhotonPlayer player)
595 {
596 if (!this.mActors.ContainsKey(ID))
597 {
598 this.mActors[ID] = player;
599 RebuildPlayerListCopies();
600 }
601 else
602 {
603 Debug.LogError("Adding player twice: " + ID);
604 }
605 }
File name: NetworkingPeer.cs
Copy
607 void RemovePlayer(int ID, PhotonPlayer player)
608 {
609 this.mActors.Remove(ID);
610 if (!player.isLocal)
611 {
612 RebuildPlayerListCopies();
613 }
614 }
File name: NetworkingPeer.cs
Copy
616 void RebuildPlayerListCopies()
617 {
618 this.mPlayerListCopy = new PhotonPlayer[this.mActors.Count];
619 this.mActors.Values.CopyTo(this.mPlayerListCopy, 0);
620
621 List
622 foreach (PhotonPlayer player in this.mPlayerListCopy)
623 {
624 if (!player.isLocal)
625 {
626 otherP.Add(player);
627 }
628 }
629
630 this.mOtherPlayerListCopy = otherP.ToArray();
631 }
File name: NetworkingPeer.cs
Copy
905 public void ChangeLocalID(int newID)
906 {
907 if (this.mLocalActor == null)
908 {
909 Debug.LogWarning(
910 string.Format(
911 "Local actor is null or not in mActors! mLocalActor: {0} mActors==null: {1} newID: {2}",
912 this.mLocalActor,
913 this.mActors == null,
914 newID));
915 }
916
917 if (this.mActors.ContainsKey(this.mLocalActor.ID))
918 {
919 this.mActors.Remove(this.mLocalActor.ID);
920 }
921
922 this.mLocalActor.InternalChangeLocalID(newID);
923 this.mActors[this.mLocalActor.ID] = this.mLocalActor;
924 this.RebuildPlayerListCopies();
925 }
RebuildPlayerListCopies 122 lượt xem
Gõ tìm kiếm nhanh...