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


C# Hashtable.MergeStringKeys方法代码示例

本文整理汇总了C#中System.Collections.Hashtable.MergeStringKeys方法的典型用法代码示例。如果您正苦于以下问题:C# Hashtable.MergeStringKeys方法的具体用法?C# Hashtable.MergeStringKeys怎么用?C# Hashtable.MergeStringKeys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Collections.Hashtable的用法示例。


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

示例1: OpSetCustomPropertiesOfRoom

        /// <summary>
        /// Sets only custom game properties (which exclusively use strings as key-type in hash).
        /// </summary>
        /// <param name="gameProperties">The roomProperties to udpate or set.</param>
        /// <returns></returns>
        public bool OpSetCustomPropertiesOfRoom(Hashtable gameProperties)
        {
            Hashtable customGameProps = new Hashtable();
            customGameProps.MergeStringKeys(gameProperties);

            return this.OpSetPropertiesOfRoom(customGameProps);
        }
开发者ID:nathanlarson,项目名称:wulf3,代码行数:12,代码来源:LoadBalancingClient.cs

示例2: OpJoinRandomRoom

        /// <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 alike).</param>
        /// <param name="matchingType">Selects one of the available matchmaking algorithms. See MatchmakingMode enum for options.</param>
        /// <returns>If the operation could be sent currently (requires connection).</returns>
        public virtual bool OpJoinRandomRoom(Hashtable expectedCustomRoomProperties, byte expectedMaxPlayers, Hashtable playerProperties, MatchmakingMode matchingType)
        {
            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;
            }

            return this.OpCustom(OperationCode.JoinRandomGame, opParameters, true);
        }
开发者ID:nathanlarson,项目名称:wulf3,代码行数:43,代码来源:LoadBalancingPeer.cs

示例3: OpSetCustomPropertiesOfActor

        /// <summary>
        /// Sets custom properties of a player / actor (only passing on the string-typed custom properties).
        /// Use this only when in state Joined.
        /// </summary>
        /// <param name="actorNr">ID of player to update/set properties for.</param>
        /// <param name="actorProperties">The properties to set for target actor.</param>
        /// <returns>If sending the properties to the server worked (not if the operation was executed successfully).</returns>
        public bool OpSetCustomPropertiesOfActor(int actorNr, Hashtable actorProperties)
        {
            Hashtable customActorProperties = new Hashtable();
            customActorProperties.MergeStringKeys(actorProperties);

            return this.OpSetPropertiesOfActor(actorNr, customActorProperties);
        }
开发者ID:nathanlarson,项目名称:wulf3,代码行数:14,代码来源:LoadBalancingClient.cs

示例4: OpCreateRoom

        /// <summary>
        /// Creates a room (on either Master or Game Server).
        /// The OperationResponse depends on the server the peer is connected to: 
        /// Master will return a Game Server to connect to.
        /// Game Server will return the joined Room's data.
        /// This is an async request which triggers a OnOperationResponse() call.
        /// </summary>
        /// <remarks>
        /// If the room is already existing, the OperationResponse will have a returnCode of ErrorCode.GameAlreadyExists.
        /// </remarks>
        /// <param name="roomName">The name of this room. Must be unique. Pass null to make the server assign a name.</param>
        /// <param name="isVisible">Defines if this room is listed in the lobby. If not, it also is not joined randomly.</param>
        /// <param name="isOpen">Defines if this room can be joined at all.</param>
        /// <param name="maxPlayers">Max number of players that can be in the room at any time. 0 means "no limit".</param>
        /// <param name="customGameProperties">The room's custom properties to set. Use string keys!</param>
        /// <param name="propsListedInLobby">Defines the custom room properties that get listed in the lobby. Null defaults to "none", a string[0].</param>
        /// <param name="playerProperties">This player's custom properties. Use string keys!</param>
        /// <returns>If the operation could be sent (requires connection).</returns>
        public virtual bool OpCreateRoom(string roomName, bool isVisible, bool isOpen, byte maxPlayers, Hashtable customGameProperties, string[] propsListedInLobby, Hashtable playerProperties)
        {
            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] = (propsListedInLobby == null) ? new string[0] : propsListedInLobby;
            gameProperties.MergeStringKeys(customGameProperties);
            if (maxPlayers > 0)
            {
                gameProperties[GameProperties.MaxPlayers] = maxPlayers;
            }

            Dictionary<byte, object> op = new Dictionary<byte, object>();
            op[ParameterCode.GameProperties] = gameProperties;
            op[ParameterCode.CleanupCacheOnLeave] = true;   // Note: This is not yet optional. It makes sense to get this into the API when caching is explained, too
            op[ParameterCode.Broadcast] = true;
            if (playerProperties != null)
            {
                op[ParameterCode.PlayerProperties] = playerProperties;
            }

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

            return this.OpCustom(OperationCode.CreateGame, op, true);
        }
开发者ID:nathanlarson,项目名称:wulf3,代码行数:51,代码来源:LoadBalancingPeer.cs


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