Photon Use Experience

Keywords: SQL

The evaluation is not very pleasant, but it has to be used.

Translated Documents: Although the version is very old, it is still valuable.

https://vibrantlink.com/pun_multiplay_manual/?tdsourcetag=s_pcqq_aiomsg

 

Common api memo

Custom classes inherit from Photon.PunBehaviour

Join the room: PhotonNetwork. Join Random Room ();

Callback method when adding room failure: OnPhotonRandom Join Failed (object [] code AndMsg) {}

Create a room: PhotonNetwork.CreateRoom(string roomName);

Create or join a room: PhotonNetwork.JoinOrCreateRoom(string roomName);


Callback method for successful room creation: OnCreatedRoom() {}

Callback method when joining a room successfully: OnJoinedRoom() {}

OnPlayerEnteredRoom


override void W_NetworkRoom.OnLeftRoom()                
 

OnPhotonPlayerConnected(PhotonPlayer newPlayer) {}

Whether all players in the room synchronize the attributes of the scene: PhotonNetwork.automaticallySyncScene = = true;
   // defines if all clients in a room should load the same level/scene as the Master client (if that used PhotonNetwork.LoadLevel())

Determine whether the current client is the host (homeowner): PhotonNetwork.isMasterClient

Scenarios: PhotonNetwork. LoadLevel (string scene Name); // For example, PhotonNetwork.LoadLevel("main");

// Frequently used functions

 PhotonNetwork.Instantiate

PhotonNetwork.InstantiateSceneObject

 

// Special attention, Pit 1

/ / to send events to other players, only the other players can receive the monitoring of this event.

 PhotonNetwork.RaiseEvent(105, W_NetworkRoomData.clickPlay, new RaiseEventOptions() { Receivers = ReceiverGroup.All, CachingOption = EventCaching.AddToRoomCache },SendOptions.SendReliable);

//

 

// Event code (OperationCode.RaiseEvent in LoadBalancingPeer.cs file)

    public class OperationCode
    {
        [Obsolete("Exchanging encrpytion keys is done internally in the lib now. Don't expect this operation-result.")]
        public const byte ExchangeKeysForEncryption = 250;

        /// <summary>(255) Code for OpJoin, to get into a room.</summary>
        [Obsolete]
        public const byte Join = 255;

        /// <summary>(231) Authenticates this peer and connects to a virtual application</summary>
        public const byte AuthenticateOnce = 231;

        /// <summary>(230) Authenticates this peer and connects to a virtual application</summary>
        public const byte Authenticate = 230;

        /// <summary>(229) Joins lobby (on master)</summary>
        public const byte JoinLobby = 229;

        /// <summary>(228) Leaves lobby (on master)</summary>
        public const byte LeaveLobby = 228;

        /// <summary>(227) Creates a game (or fails if name exists)</summary>
        public const byte CreateGame = 227;

        /// <summary>(226) Join game (by name)</summary>
        public const byte JoinGame = 226;

        /// <summary>(225) Joins random game (on master)</summary>
        public const byte JoinRandomGame = 225;

        // public const byte CancelJoinRandom = 224; // obsolete, cause JoinRandom no longer is a "process". now provides result immediately

        /// <summary>(254) Code for OpLeave, to get out of a room.</summary>
        public const byte Leave = (byte)254;

        /// <summary>(253) Raise event (in a room, for other actors/players)</summary>
        public const byte RaiseEvent = (byte)253;

        /// <summary>(252) Set Properties (of room or actor/player)</summary>
        public const byte SetProperties = (byte)252;

        /// <summary>(251) Get Properties</summary>
        public const byte GetProperties = (byte)251;

        /// <summary>(248) Operation code to change interest groups in Rooms (Lite application and extending ones).</summary>
        public const byte ChangeGroups = (byte)248;

        /// <summary>(222) Request the rooms and online status for a list of friends (by name, which should be unique).</summary>
        public const byte FindFriends = 222;

        /// <summary>(221) Request statistics about a specific list of lobbies (their user and game count).</summary>
        public const byte GetLobbyStats = 221;

        /// <summary>(220) Get list of regional servers from a NameServer.</summary>
        public const byte GetRegions = 220;

        /// <summary>(219) WebRpc Operation.</summary>
        public const byte WebRpc = 219;

        /// <summary>(218) Operation to set some server settings. Used with different parameters on various servers.</summary>
        public const byte ServerSettings = 218;

        /// <summary>(217) Get the game list matching a supplied sql filter (SqlListLobby only) </summary>
        public const byte GetGameList = 217;
    }

Rpc call

Posted by raw100 on Tue, 01 Oct 2019 21:19:59 -0700