void Awake()
    {
        isFrozen = false;
        //DontDestroyOnLoad(gameObject);
        anim            = GetComponentInChildren <Animator>();
        moveRight       = 0;
        moveLeft        = 0;
        controlsPaused  = false;
        myAudioSrc      = GetComponent <AudioSource>();
        myAudioSrc.clip = DeathNoise;
        punching        = false;

        isDead        = false;
        StrengthsList = GameObject.FindGameObjectWithTag("Master").
                        GetComponent <Master>().GetStrengthList();

        CBUG.Log("Str List: " + StrengthsList.ToStringFull());
        jumpForceTemp      = 0f;
        SpeedTemp          = 0f;
        attackDisableDelay = new WaitForSeconds(AttackLife);
        facingRight        = true;
        position           = new Vector2();
        _Rigibody2D        = GetComponent <Rigidbody2D>();
        jumpsRemaining     = TotalJumpsAllowed;
        _PhotonView        = GetComponent <PhotonView>();
        _PhotonTransform   = GetComponent <PhotonTransformView>();

        AttackObjs    = new GameObject[3];
        AttackObjs[0] = transform.GetChild(3).gameObject;
        AttackObjs[1] = transform.GetChild(1).gameObject;
        AttackObjs[2] = transform.GetChild(2).gameObject;

        _MobileInput = GameObject.FindGameObjectWithTag("MobileController").GetComponent <MobileController>();

        spawnPause     = 0.5f;
        spawnPauseWait = new WaitForSeconds(spawnPause);

        lastHitBy           = -1;
        lastHitTime         = Time.time;
        lastHitForgetLength = 5;//Seconds

        if (_PhotonView.isMine)
        {
            tag = "PlayerSelf";
            _PhotonView.RPC("SetSlotNum", PhotonTargets.All, NetIDs.PlayerNumber(PhotonNetwork.player.ID));
            CamManager.SetTarget(transform);
        }
    }
Пример #2
0
    /// <summary>
    /// Operation to join a random, available room. Overloads take additional player properties.
    /// This is an async request which triggers a OnOperationResponse() call.
    /// If all rooms are closed or full, the OperationResponse will have a returnCode of ErrorCode.NoRandomMatchFound.
    /// If successful, the OperationResponse contains a gameserver address and the name of some room.
    /// </summary>
    /// <param name="expectedCustomRoomProperties">Optional. A room will only be joined, if it matches these custom properties (with string keys).</param>
    /// <param name="expectedMaxPlayers">Filters for a particular maxplayer setting. Use 0 to accept any maxPlayer value.</param>
    /// <param name="playerProperties">This player's properties (custom and well known).</param>
    /// <param name="matchingType">Selects one of the available matchmaking algorithms. See MatchmakingMode enum for options.</param>
    /// <param name="lobbyName"></param>
    /// <param name="lobbyType"></param>
    /// <param name="sqlLobbyFilter"></param>
    /// <returns>If the operation could be sent currently (requires connection).</returns>
    public virtual bool OpJoinRandomRoom(Hashtable expectedCustomRoomProperties, byte expectedMaxPlayers, Hashtable playerProperties, MatchmakingMode matchingType, string lobbyName, LobbyType lobbyType, string sqlLobbyFilter)
    {
        if (this.DebugOut >= DebugLevel.INFO)
        {
            this.Listener.DebugReturn(DebugLevel.INFO, "OpJoinRandomRoom()");
        }

        Hashtable expectedRoomProperties = new Hashtable();

        expectedRoomProperties.MergeStringKeys(expectedCustomRoomProperties);
        if (expectedMaxPlayers > 0)
        {
            expectedRoomProperties[GameProperties.MaxPlayers] = expectedMaxPlayers;
        }

        Dictionary <byte, object> opParameters = new Dictionary <byte, object>();

        if (expectedRoomProperties.Count > 0)
        {
            opParameters[ParameterCode.GameProperties] = expectedRoomProperties;
        }

        if (playerProperties != null && playerProperties.Count > 0)
        {
            opParameters[ParameterCode.PlayerProperties] = playerProperties;
        }

        if (matchingType != MatchmakingMode.FillRoom)
        {
            opParameters[ParameterCode.MatchMakingType] = (byte)matchingType;
        }

        if (!string.IsNullOrEmpty(lobbyName))
        {
            opParameters[ParameterCode.LobbyName] = lobbyName;
            opParameters[ParameterCode.LobbyType] = (byte)lobbyType;
        }

        if (!string.IsNullOrEmpty(sqlLobbyFilter))
        {
            opParameters[ParameterCode.Data] = sqlLobbyFilter;
        }

        Debug.Log(opParameters.ToStringFull());
        return(this.OpCustom(OperationCode.JoinRandomGame, opParameters, true));
    }
Пример #3
0
 public void OnCustomAuthenticationResponse(Dictionary <string, object> data)
 {
     Debug.Log("SupportLogger OnCustomAuthenticationResponse(" + data.ToStringFull() + ").");
 }
Пример #4
0
 public void OnSubscribed(string channel, string[] users, Dictionary <object, object> properties)
 {
     Debug.LogFormat("OnSubscribed: {0}, users.Count: {1} Channel-props: {2}.", channel, users.Length, properties.ToStringFull());
 }
Пример #5
0
 public void PrettyPrintDictionary()
 {
     BuildDictionary();
     Debug.Log(actualDictionary.ToStringFull());
 }
Пример #6
0
 public void OnCustomAuthenticationResponse(Dictionary <string, object> data)
 {
     Debug.Log(this.GetFormattedTimestamp() + " SupportLogger OnCustomAuthenticationResponse(" + data.ToStringFull() + ").");
 }
Пример #7
0
    private void SetupEncryption(Dictionary<byte, object> encryptionData)
    {
        // this should not be called when authentication is done per server. this mode does not support the required "key-exchange via token"
        if (this.AuthMode == AuthModeOption.Auth)
        {
            if (DebugOut == DebugLevel.ERROR)
            {
                UnityEngine.Debug.LogWarning("SetupEncryption() called but ignored. Not XB1 compiled. EncryptionData: " + encryptionData.ToStringFull());
                return;
            }
        }

        // for AuthOnce and AuthOnceWss, we can keep the same secret across machines (for the session, basically)
        if (DebugOut == DebugLevel.INFO)
        {
            UnityEngine.Debug.Log("SetupEncryption() got called. "+encryptionData.ToStringFull());
        }

        var mode = (EncryptionMode)(byte)encryptionData[EncryptionDataParameters.Mode];
        switch (mode)
        {
            case EncryptionMode.PayloadEncryption:
                byte[] secret = (byte[])encryptionData[EncryptionDataParameters.Secret1];
                this.InitPayloadEncryption(secret);
                break;
            case EncryptionMode.DatagramEncryption:
                {
                    byte[] secret1 = (byte[])encryptionData[EncryptionDataParameters.Secret1];
                    byte[] secret2 = (byte[])encryptionData[EncryptionDataParameters.Secret2];
                    this.InitDatagramEncryption(secret1, secret2);
                }
                break;
            default:
                throw new ArgumentOutOfRangeException();
        }
    }
Пример #8
0
        /// <summary>
        /// Sets properties of a player / actor.
        /// Internally this uses OpSetProperties, which can be used to either set room or player properties.
        /// </summary>
        /// <param name="actorNr">The payer ID (a.k.a. actorNumber) of the player to attach these properties to.</param>
        /// <param name="actorProperties">The properties to add or update.</param>
        /// <param name="expectedProperties">If set, these must be in the current properties-set (on the server) to set actorProperties: CAS.</param>
        /// <param name="webForward">Set to true, to forward the set properties to a WebHook, defined for this app (in Dashboard).</param>
        /// <returns>If the operation could be sent (requires connection).</returns>
        protected internal bool OpSetPropertiesOfActor(int actorNr, Hashtable actorProperties, Hashtable expectedProperties = null, bool webForward = false)
        {
            if (this.DebugOut >= DebugLevel.INFO)
            {
                this.Listener.DebugReturn(DebugLevel.INFO, "OpSetPropertiesOfActor()");
            }

            if (actorNr <= 0 || actorProperties == null)
            {
                if (this.DebugOut >= DebugLevel.INFO)
                {
                    this.Listener.DebugReturn(DebugLevel.INFO, "OpSetPropertiesOfActor not sent. ActorNr must be > 0 and actorProperties != null.");
                }
                return false;
            }

            Dictionary<byte, object> opParameters = new Dictionary<byte, object>();
            opParameters.Add(ParameterCode.Properties, actorProperties);
            opParameters.Add(ParameterCode.ActorNr, actorNr);
            opParameters.Add(ParameterCode.Broadcast, true);
            if (expectedProperties != null && expectedProperties.Count != 0)
            {
                opParameters.Add(ParameterCode.ExpectedValues, expectedProperties);
            }

            if (webForward)
            {
                opParameters[ParameterCode.EventForward] = true;
            }

            UnityEngine.Debug.Log(opParameters.ToStringFull());
            return this.OpCustom((byte)OperationCode.SetProperties, opParameters, true, 0, false);
        }
Пример #9
0
 public override void OnPlayerLeftRoom(Player player)
 {
     Debug.Log(playerTiles.ToStringFull());
     Destroy(playerTiles[player]);
     playerTiles.Remove(player);
 }
Пример #10
0
 public void OnUserPropertiesChanged(string channel, string targetUserId, string senderUserId, Dictionary <object, object> properties)
 {
     Debug.LogFormat("OnUserPropertiesChanged: (channel:{0} user:{1}) by {2}. Props: {3}.", channel, targetUserId, senderUserId, properties.ToStringFull());
 }
Пример #11
0
 /// <inheritdoc />
 public void OnChannelPropertiesChanged(string channel, string userId, Dictionary <object, object> properties)
 {
     Debug.LogFormat("OnChannelPropertiesChanged: {0} by {1}. Props: {2}.", channel, userId, properties.ToStringFull());
 }