コード例 #1
0
ファイル: Operations.cs プロジェクト: azanium/PopBloop-Unity
 /// <summary>
 /// The radar subscribe.
 /// </summary>
 /// <param name="peer">
 /// The photon peer.
 /// </param>
 /// <param name="worldName">
 /// The world Name.
 /// </param>
 public static void RadarSubscribe(PhotonPeer peer, string worldName)
 {
     var data = new Dictionary<byte, object> { { (byte)ParameterCode.WorldName, worldName } };
     peer.OpCustom((byte)OperationCode.RadarSubscribe, data, true, Settings.RadarChannel);
 }
コード例 #2
0
    public void ConnectToGameServer(string token)
    {
        // Generate default settings
        PopBloopSettings setting = PopBloopSettings.GetDefaultSettings();

        bool isPrivateRoom = _loaderPref.GetInt(PBConstants.PREF_PRIVATEROOM) == 1;

        // Changed the settings' server address and the worldname
        setting.ServerAddress = _loaderPref.GetString(PBConstants.PREF_SERVER);
        setting.WorldName = _loaderPref.GetString(PBConstants.PREF_WORLD);
        setting.IsPrivateRoom = isPrivateRoom;

        // Check if we are in Private Room
        if (isPrivateRoom == false)
        {
            Debug.Log("MainGame: Entering World: " + setting.WorldName);
        }
        else
        {
            Debug.Log("MainGame: Entering Private Room");
        }

        // Create our MMO game
        _game = new Game(this, setting, "Player");

        // Set our game instance
        PBGameMaster.Game = _game;

        if (token == null)
        {
            // Set the avatar's token
            _game.Avatar.Token = _loaderPref.GetString(PBConstants.PREF_TOKEN);
        }
        else
        {
            _game.Avatar.Token = token;
        }

        // Create our Photon Peer
        PhotonPeer peer = new PhotonPeer(_game, _useTcp);

        MainController.SetLoadingText(PBConstants.LOADINGBAR_CONNECTING);

        Debug.Log("MainGame: Connecting with IP Address : " + setting.ServerAddress);

        // Connect to our MMO server
        _game.Initialize(peer);

        PBGameMaster.GameState = GameStateType.Connecting;
    }
コード例 #3
0
ファイル: Operations.cs プロジェクト: azanium/PopBloop-Unity
 /// <summary>
 /// The counter subscribe.
 /// </summary>
 /// <param name="peer">
 /// The photon peer.
 /// </param>
 /// <param name="receiveInterval">
 /// The receive interval.
 /// </param>
 public static void CounterSubscribe(PhotonPeer peer, int receiveInterval)
 {
     var data = new Dictionary<byte, object> { { (byte)ParameterCode.CounterReceiveInterval, receiveInterval } };
     peer.OpCustom((byte)OperationCode.SubscribeCounter, data, true, Settings.DiagnosticsChannel);
 }
コード例 #4
0
ファイル: Game.cs プロジェクト: azanium/PopBloop-Unity
 /// <summary>
 ///   The initialize.
 /// </summary>
 /// <param name = "photonPeer">
 ///   The photon peer.
 /// </param>
 public void Initialize(PhotonPeer photonPeer)
 {
     this.peer = photonPeer;
     this.stateStrategy = WaitingForConnect.Instance;
     photonPeer.Connect(this.settings.ServerAddress, this.settings.ApplicationName);
 }