当前位置: 首页>>代码示例>>C#>>正文


C# Photon.Hashtable类代码示例

本文整理汇总了C#中ExitGames.Client.Photon.Hashtable的典型用法代码示例。如果您正苦于以下问题:C# Hashtable类的具体用法?C# Hashtable怎么用?C# Hashtable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Hashtable类属于ExitGames.Client.Photon命名空间,在下文中一共展示了Hashtable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ClearTileClickEvForTurn

 public void ClearTileClickEvForTurn(int turnToDelete)
 {
     Debug.Log("Clean Tile Click for Turn " + turnToDelete);
     Hashtable content = new Hashtable();
     content[(byte)1] = turnToDelete;
     this.loadBalancingPeer.OpRaiseEvent(EvTileClick, content, true, new RaiseEventOptions() { CachingOption = EventCaching.RemoveFromRoomCache });
     this.lastTilesClicked[turnToDelete].Clear();
 }
开发者ID:JiboStore,项目名称:PhotonRealtime,代码行数:8,代码来源:DemoGame.cs

示例2: PhotonPlayer

    /// <summary>
    /// Internally used to create players from event Join
    /// </summary>
    protected internal PhotonPlayer(bool isLocal, int actorID, Hashtable properties)
    {
        this.customProperties = new Hashtable();
        this.isLocal = isLocal;
        this.actorID = actorID;

        this.InternalCacheProperties(properties);
    }
开发者ID:nicolasMachut,项目名称:VeryGoodGame,代码行数:11,代码来源:PhotonPlayer.cs

示例3: Player

        /// <summary>
        /// Creates a player instance.
        /// To extend and replace this Player, override LoadBalancingPeer.CreatePlayer().
        /// </summary>
        /// <param name="nickName">NickName of the player (a "well known property").</param>
        /// <param name="actorID">ID or ActorNumber of this player in the current room (a shortcut to identify each player in room)</param>
        /// <param name="isLocal">If this is the local peer's player (or a remote one).</param>
        /// <param name="playerProperties">A Hashtable of custom properties to be synced. Must use String-typed keys and serializable datatypes as values.</param>
        protected internal Player(string nickName, int actorID, bool isLocal, Hashtable playerProperties)
        {
            this.IsLocal = isLocal;
            this.actorID = actorID;
            this.NickName = nickName;

            this.CustomProperties = new Hashtable();
            this.CacheProperties(playerProperties);
        }
开发者ID:Tobias-EG,项目名称:Photon-Cloud-Integration,代码行数:17,代码来源:Player.cs

示例4: Room

 protected internal Room(string roomName, Hashtable roomProperties, bool isVisible, bool isOpen, byte maxPlayers, string[] propsListedInLobby)
     : base(roomName, roomProperties)
 {
     // base sets name and (custom)properties. here we set "well known" properties
     this.isVisible = isVisible;
     this.isOpen = isOpen;
     this.maxPlayers = maxPlayers;
     this.PropsListedInLobby = propsListedInLobby;
 }
开发者ID:trilleplay,项目名称:Photon-Cloud-Integration,代码行数:9,代码来源:Room.cs

示例5: ParticlePlayer

 public ParticlePlayer(string nickName, int actorID, bool isLocal, Hashtable actorProperties)
     : base(nickName, actorID, isLocal, actorProperties)
 {
     if (isLocal)
     {
         // we pick a random color when we create a local player
         this.RandomizeColor();
     }
 }
开发者ID:JiboStore,项目名称:PhotonRealtime,代码行数:9,代码来源:ParticlePlayer.cs

示例6: OpCreateRoom

    /// <summary>
    /// Don't use this method directly, unless you know how to cache and apply customActorProperties.
    /// The PhotonNetwork methods will handle player and room properties for you and call this method.
    /// </summary>
    public virtual bool OpCreateRoom(string roomName, RoomOptions roomOptions, TypedLobby lobby, Hashtable playerProperties, bool onGameServer)
    {
        if (this.DebugOut >= DebugLevel.INFO)
        {
            this.Listener.DebugReturn(DebugLevel.INFO, "OpCreateRoom()");
        }

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

        if (!string.IsNullOrEmpty(roomName))
        {
            op[ParameterCode.RoomName] = roomName;
        }
        if (lobby != null)
        {
            op[ParameterCode.LobbyName] = lobby.Name;
            op[ParameterCode.LobbyType] = (byte)lobby.Type;
        }

        if (onGameServer)
        {
            if (playerProperties != null && playerProperties.Count > 0)
            {
                op[ParameterCode.PlayerProperties] = playerProperties;
                op[ParameterCode.Broadcast] = true; // TODO: check if this also makes sense when creating a room?! // broadcast actor properties
            }


            if (roomOptions == null)
            {
                roomOptions = new RoomOptions();
            }

            Hashtable gameProperties = new Hashtable();
            op[ParameterCode.GameProperties] = gameProperties;
            gameProperties.MergeStringKeys(roomOptions.customRoomProperties);

            gameProperties[GameProperties.IsOpen] = roomOptions.isOpen; // TODO: check default value. dont send this then
            gameProperties[GameProperties.IsVisible] = roomOptions.isVisible; // TODO: check default value. dont send this then
            gameProperties[GameProperties.PropsListedInLobby] = roomOptions.customRoomPropertiesForLobby;
            if (roomOptions.maxPlayers > 0)
            {
                gameProperties[GameProperties.MaxPlayers] = roomOptions.maxPlayers;
            }
            if (roomOptions.cleanupCacheOnLeave)
            {
                op[ParameterCode.CleanupCacheOnLeave] = true;               // this is actually setting the room's config
                gameProperties[GameProperties.CleanupCacheOnLeave] = true;  // this is only informational for the clients which join
            }
        }

        // UnityEngine.Debug.Log("CreateGame: " + SupportClass.DictionaryToString(op));
        return this.OpCustom(OperationCode.CreateGame, op, true);
    }
开发者ID:AsifAhmed16,项目名称:Operation-Hatirjheel,代码行数:58,代码来源:LoadbalancingPeer.cs

示例7: OnEventCustom

    /// <summary>
    /// Receive events from server
    /// </summary>
    /// <param name="eventCode"></param>
    /// <param name="content"></param>
    /// <param name="senderID"></param>
    public void OnEventCustom(byte eventCode, object content, int senderID)
    {

        Debug.Log(string.Format("OnEventRaised: {0}, {1}, {2}", eventCode, content, senderID));
        Hashtable hash = new Hashtable();
        hash = (Hashtable)content;
        switch (eventCode)
        {
            case EventID.LoadSyncLevel:
                string s = (string)hash["Level"];
                NextLevel = s;
                InvokeRepeating("InvokeLoad", 1, 1);
                break;

            case EventID.PlayerJoinPre:
                //
                break;
        }
    }
开发者ID:tegleg,项目名称:mfp,代码行数:25,代码来源:bl_PhotonRaiseEvent.cs

示例8: OpCreateRoom

    /// <summary>
    /// Don't use this method directly, unless you know how to cache and apply customActorProperties.
    /// The PhotonNetwork methods will handle player and room properties for you and call this method.
    /// </summary>
    public virtual bool OpCreateRoom(string gameID, bool isVisible, bool isOpen, byte maxPlayers, bool autoCleanUp, Hashtable customGameProperties, Hashtable customPlayerProperties, string[] customRoomPropertiesForLobby)
    {
        if (this.DebugOut >= DebugLevel.INFO)
        {
            this.Listener.DebugReturn(DebugLevel.INFO, "OpCreateRoom()");
        }

        Hashtable gameProperties = new Hashtable();
        gameProperties[GameProperties.IsOpen] = isOpen;
        gameProperties[GameProperties.IsVisible] = isVisible;
        gameProperties[GameProperties.PropsListedInLobby] = customRoomPropertiesForLobby;
        gameProperties.MergeStringKeys(customGameProperties);
        if (maxPlayers > 0)
        {
            gameProperties[GameProperties.MaxPlayers] = maxPlayers;
        }

        Dictionary<byte, object> op = new Dictionary<byte, object>();
        op[ParameterCode.GameProperties] = gameProperties;
        op[ParameterCode.Broadcast] = true;

        if (customPlayerProperties != null)
        {
            op[ParameterCode.PlayerProperties] = customPlayerProperties;
        }

        if (!string.IsNullOrEmpty(gameID))
        {
            op[ParameterCode.RoomName] = gameID;
        }

        // server's default is 'false', so we actually only need to send this when 'true'
        if (autoCleanUp)
        {
            op[ParameterCode.CleanupCacheOnLeave] = autoCleanUp;
            gameProperties[GameProperties.CleanupCacheOnLeave] = autoCleanUp;
        }

        return this.OpCustom(OperationCode.CreateGame, op, true);
    }
开发者ID:kleptodorf,项目名称:Unity-Learning,代码行数:44,代码来源:LoadbalancingPeer.cs

示例9: GetActorPropertiesForActorNr

    private Hashtable GetActorPropertiesForActorNr(Hashtable actorProperties, int actorNr)
    {
        if (actorProperties.ContainsKey(actorNr))
        {
            return (Hashtable)actorProperties[actorNr];
        }

        return actorProperties;
    }
开发者ID:JonasSkaug,项目名称:afgangsprojekt-team-tj,代码行数:9,代码来源:NetworkingPeer.cs

示例10: ReadoutProperties

    // gameID can be null (optional). The server assigns a unique name if no name is set

    // joins a room and sets your current username as custom actorproperty (will broadcast that)

    #endregion

    #region Helpers

    private void ReadoutProperties(Hashtable gameProperties, Hashtable pActorProperties, int targetActorNr)
    {
        // Debug.LogWarning("ReadoutProperties gameProperties: " + gameProperties.ToStringFull() + " pActorProperties: " + pActorProperties.ToStringFull() + " targetActorNr: " + targetActorNr);
        // read game properties and cache them locally
        if (this.mCurrentGame != null && gameProperties != null)
        {
            this.mCurrentGame.CacheProperties(gameProperties);
            SendMonoMessage(PhotonNetworkingMessage.OnPhotonCustomRoomPropertiesChanged, gameProperties);
            if (PhotonNetwork.automaticallySyncScene)
            {
                this.LoadLevelIfSynced();   // will load new scene if sceneName was changed
            }
        }

        if (pActorProperties != null && pActorProperties.Count > 0)
        {
            if (targetActorNr > 0)
            {
                // we have a single entry in the pActorProperties with one
                // user's name
                // targets MUST exist before you set properties
                PhotonPlayer target = this.GetPlayerWithID(targetActorNr);
                if (target != null)
                {
                    Hashtable props = this.GetActorPropertiesForActorNr(pActorProperties, targetActorNr);
                    target.InternalCacheProperties(props);
                    SendMonoMessage(PhotonNetworkingMessage.OnPhotonPlayerPropertiesChanged, target, props);
                }
            }
            else
            {
                // in this case, we've got a key-value pair per actor (each
                // value is a hashtable with the actor's properties then)
                int actorNr;
                Hashtable props;
                string newName;
                PhotonPlayer target;

                foreach (object key in pActorProperties.Keys)
                {
                    actorNr = (int)key;
                    props = (Hashtable)pActorProperties[key];
                    newName = (string)props[ActorProperties.PlayerName];

                    target = this.GetPlayerWithID(actorNr);
                    if (target == null)
                    {
                        target = new PhotonPlayer(false, actorNr, newName);
                        this.AddNewPlayer(actorNr, target);
                    }

                    target.InternalCacheProperties(props);
                    SendMonoMessage(PhotonNetworkingMessage.OnPhotonPlayerPropertiesChanged, target, props);
                }
            }
        }
    }
开发者ID:JonasSkaug,项目名称:afgangsprojekt-team-tj,代码行数:65,代码来源:NetworkingPeer.cs

示例11: OpSetPropertyOfRoom

 protected void OpSetPropertyOfRoom(byte propCode, object value)
 {
     Hashtable properties = new Hashtable();
     properties[propCode] = value;
     this.OpSetPropertiesOfRoom(properties, expectedProperties: null, webForward: false);
 }
开发者ID:Ckeds,项目名称:PortfolioWorks,代码行数:6,代码来源:LoadbalancingPeer.cs

示例12: OpSetPropertiesOfActor

        /// <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);
        }
开发者ID:Ckeds,项目名称:PortfolioWorks,代码行数:42,代码来源:LoadbalancingPeer.cs

示例13: OpSetCustomPropertiesOfActor

 public bool OpSetCustomPropertiesOfActor(int actorNr, Hashtable actorProperties)
 {
     return this.OpSetPropertiesOfActor(actorNr, actorProperties.StripToStringKeys(), null);
 }
开发者ID:Ckeds,项目名称:PortfolioWorks,代码行数:4,代码来源:LoadbalancingPeer.cs

示例14: OnPhotonCustomRoomPropertiesChanged

 /// <summary>
 /// Called when a room's custom properties changed. The propertiesThatChanged contains all that was set via Room.SetCustomProperties.
 /// </summary>
 /// <remarks>
 /// Since v1.25 this method has one parameter: Hashtable propertiesThatChanged.<br/>
 /// Changing properties must be done by Room.SetCustomProperties, which causes this callback locally, too.
 /// </remarks>
 /// <param name="propertiesThatChanged"></param>
 public virtual void OnPhotonCustomRoomPropertiesChanged(Hashtable propertiesThatChanged)
 {
 }
开发者ID:colruytXD,项目名称:Hide-N-Seek-Simulator,代码行数:11,代码来源:PhotonClasses.cs

示例15: OpJoinRandomRoom

    /// <summary>NetworkingPeer.OpJoinRandomRoom</summary>
    /// <remarks>this override just makes sure we have a mRoomToGetInto, even if it's blank (the properties provided in this method are filters. they are not set when we join the game)</remarks>
    public override bool OpJoinRandomRoom(Hashtable expectedCustomRoomProperties, byte expectedMaxPlayers, Hashtable playerProperties, MatchmakingMode matchingType, TypedLobby typedLobby, string sqlLobbyFilter)
    {
        this.mRoomToGetInto = new Room(null, null);
        this.mRoomToEnterLobby = null;  // join random never stores the lobby. the following join will not affect the room lobby
        // if typedLobby is null, the server will automatically use the active lobby or default, which is what we want anyways

        this.mLastJoinType = JoinType.JoinRandomGame;
        return base.OpJoinRandomRoom(expectedCustomRoomProperties, expectedMaxPlayers, playerProperties, matchingType, typedLobby, sqlLobbyFilter);
    }
开发者ID:JonasSkaug,项目名称:afgangsprojekt-team-tj,代码行数:11,代码来源:NetworkingPeer.cs


注:本文中的ExitGames.Client.Photon.Hashtable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。