Example #1
0
 private void UpdateRoomMaster(int newRoomMasterNumber, RoomMaster newMaster)
 {
     //if your actornumber matches the new room master number you get the data
     if (PhotonNetwork.LocalPlayer.ActorNumber == newRoomMasterNumber)
     {
         Master = newMaster;
     }
 }
Example #2
0
 /// <summary>
 /// sets the room master. Will need a MatchMakingManager instance for security
 /// </summary>
 /// <param name="matchMakingManager"></param>
 public void SetRoomMaster(MatchMakingManager matchMakingManager)
 {
     if (matchMakingManager == MatchMakingManager.Instance)
     {
         Master = new RoomMaster();
     }
     else
     {
         Debug.LogError("matchmaking manager reference is null or not the singleton instance");
     }
 }
        private static short SerializeRoomMaster(StreamBuffer outStream, object customobject)
        {
            RoomMaster rm = (RoomMaster)customobject;

            lock (memRoomMaster)
            {
                byte[] bytes = memRoomMaster;
                int    index = 0;
                Protocol.Serialize(rm.PlayersReady, bytes, ref index);
                Protocol.Serialize(rm.PlayersInGameScene, bytes, ref index);
                Protocol.Serialize(rm.PlayersFinished, bytes, ref index);
                outStream.Write(bytes, 0, RoomMaster.BYTESIZE);
            }
            return(RoomMaster.BYTESIZE);
        }
Example #4
0
 /// <summary>
 /// Registers the Room Master as a Custom Serializable Type for this room
 /// </summary>
 public void RegisterRoomMaster()
 {
     if (!RoomMaster.Registered)
     {
         if (helper.RegisterRoomMaster())
         {
             RoomMaster.SetRegistered();
         }
         else
         {
             Debug.LogError("Failed Registering Room Master! Can't play game");
         }
     }
     else
     {
         Debug.LogError("Room Master is already registered :: wont do it again");
     }
 }
        private static object DeserializeRoomMaster(StreamBuffer inStream, short length)
        {
            int playersready;
            int playersingamescene;
            int playersfinished;

            lock (memRoomMaster)
            {
                inStream.Read(memRoomMaster, 0, RoomMaster.BYTESIZE);
                int index = 0;
                Protocol.Deserialize(out playersready, memRoomMaster, ref index);
                Protocol.Deserialize(out playersingamescene, memRoomMaster, ref index);
                Protocol.Deserialize(out playersfinished, memRoomMaster, ref index);
            }
            RoomMaster rm = new RoomMaster(playersfinished, playersready, playersingamescene);

            return(rm);
        }