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


C# Hashtable.StripToStringKeys方法代码示例

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


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

示例1: SetCustomProperties

    /// <summary>
    /// Updates the custom properties of this Room with propertiesToSet.
    /// Only string-typed keys are applied, new properties (string keys) are added, existing are updated
    /// and if a value is set to null, this will remove the custom property.
    /// </summary>
    /// <remarks>
    /// This method requires you to be connected and be in a room. Otherwise, the local data is updated only as no remote players are known.
    /// Local cache is updated immediately, other players are updated through Photon with a fitting operation.
    /// </remarks>
    /// <param name="propertiesToSet"></param>
    public void SetCustomProperties(Hashtable propertiesToSet)
    {
        if (propertiesToSet == null)
        {
            return;
        }

        // merge (delete null-values)
        this.customProperties.MergeStringKeys(propertiesToSet); // includes a Equals check (simplifying things)
        this.customProperties.StripKeysWithNullValues();

        // send (sync) these new values
        Hashtable customProps = propertiesToSet.StripToStringKeys() as Hashtable;
        PhotonNetwork.networkingPeer.OpSetCustomPropertiesOfActor(this.actorID, customProps, true, 0);
    }
开发者ID:BGCX261,项目名称:zombie-ferox-svn-to-git,代码行数:25,代码来源:PhotonPlayer.cs

示例2: SetCustomProperties

    /// <summary>
    /// Updates the current room's Custom Properties with new/updated key-values. 
    /// </summary>
    /// <remarks>
    /// Custom Properties are a key-value set (Hashtable) which is available to all players in a room.
    /// They can relate to the room or individual players and are useful when only the current value 
    /// of something is of interest. For example: The map of a room.
    /// All keys must be strings.
    /// 
    /// The Room and the PhotonPlayer class both have SetCustomProperties methods.
    /// Also, both classes offer access to current key-values by: customProperties.
    /// 
    /// Always use SetCustomProperties to change values. 
    /// To reduce network traffic, set only values that actually changed.
    /// New properties are added, existing values are updated.
    /// Other values will not be changed, so only provide values that changed or are new.
    /// 
    /// To delete a named (custom) property of this room, use null as value.
    /// 
    /// Locally, SetCustomProperties will update it's cache without delay. 
    /// Other clients are updated through Photon (the server) with a fitting operation.
    /// 
    /// <b>Check and Swap</b>
    /// 
    /// SetCustomProperties have the option to do a server-side Check-And-Swap (CAS): 
    /// Values only get updated if the expected values are correct.
    /// The expectedValues can be different key/values than the propertiesToSet. So you can 
    /// check some key and set another key's value (if the check succeeds).
    /// 
    /// If the client's knowledge of properties is wrong or outdated, it can't set values with CAS.
    /// This can be useful to keep players from concurrently setting values. For example: If all players
    /// try to pickup some card or item, only one should get it. With CAS, only the first SetProperties 
    /// gets executed server-side and any other (sent at the same time) fails.
    /// 
    /// The server will broadcast successfully changed values and the local "cache" of customProperties 
    /// only gets updated after a roundtrip (if anything changed).
    /// 
    /// You can do a "webForward": Photon will send the changed properties to a WebHook defined 
    /// for your application.
    /// 
    /// <b>OfflineMode</b>
    /// 
    /// While PhotonNetwork.offlineMode is true, the expectedValues and webForward parameters are ignored.
    /// In OfflineMode, the local customProperties values are immediately updated (without the roundtrip).
    /// </remarks>
    /// <param name="propertiesToSet">The new properties to be set. </param>
    /// <param name="expectedValues">At least one property key/value set to check server-side. Key and value must be correct. Ignored in OfflineMode.</param>
    /// <param name="webForward">Set to true, to forward the set properties to a WebHook, defined for this app (in Dashboard). Ignored in OfflineMode.</param>
    public void SetCustomProperties(Hashtable propertiesToSet, Hashtable expectedValues = null, bool webForward = false)
    {
        if (propertiesToSet == null)
        {
            return;
        }

        if (!PhotonNetwork.offlineMode)
        {
            Hashtable customProps = propertiesToSet.StripToStringKeys() as Hashtable;
            Hashtable customPropsToCheck = expectedValues.StripToStringKeys() as Hashtable;
            PhotonNetwork.networkingPeer.OpSetPropertiesOfRoom(customProps, customPropsToCheck, webForward);
        }
        else
        {
            Hashtable customProps = propertiesToSet.StripToStringKeys() as Hashtable;
            this.InternalCacheProperties(customProps);
            NetworkingPeer.SendMonoMessage(PhotonNetworkingMessage.OnPhotonCustomRoomPropertiesChanged, customProps);
        }
    }
开发者ID:hydrater,项目名称:Codename-Kubera,代码行数:68,代码来源:Room.cs

示例3: SetCustomProperties

    /// <summary>
    /// Updates and synchronizes the named properties of this Room with the values of propertiesToSet.
    /// </summary>
    /// <remarks>
    /// Any player can set a Room's properties. Room properties are available until changed, deleted or
    /// until the last player leaves the room.
    /// Access them by: Room.CustomProperties (read-only!).
    ///
    /// To reduce network traffic, set only values that actually changed.
    ///
    /// New properties are added, existing values are updated.
    /// Other values will not be changed, so only provide values that changed or are new.
    /// To delete a named (custom) property of this room, use null as value.
    /// Only string-typed keys are applied (everything else is ignored).
    ///
    /// Local cache is updated immediately, other clients are updated through Photon with a fitting operation.
    /// </remarks>
    /// <param name="propertiesToSet">Hashtable of props to udpate, set and sync. See description.</param>
    public void SetCustomProperties(Hashtable propertiesToSet)
    {
        if (propertiesToSet == null)
        {
            return;
        }

        // merge (delete null-values)
        this.customProperties.MergeStringKeys(propertiesToSet); // includes a Equals check (simplifying things)
        this.customProperties.StripKeysWithNullValues();


        // send (sync) these new values
        Hashtable customProps = propertiesToSet.StripToStringKeys() as Hashtable;
        if (!PhotonNetwork.offlineMode)
        {
            PhotonNetwork.networkingPeer.OpSetCustomPropertiesOfRoom(customProps, true, 0);
        }
        NetworkingPeer.SendMonoMessage(PhotonNetworkingMessage.OnPhotonCustomRoomPropertiesChanged, propertiesToSet);
    }
开发者ID:fackingbee,项目名称:Unity_Advance,代码行数:38,代码来源:Room.cs

示例4: SetCustomProperties

    /// <summary>
    /// Updates the current room's Custom Properties with new/updated key-values. 
    /// </summary>
    /// <remarks>
    /// Custom Properties are a key-value set (Hashtable) which is available to all players in a room.
    /// They can relate to the room or individual players and are useful when only the current value 
    /// of something is of interest. For example: The map of a room.
    /// All keys must be strings.
    /// 
    /// The Room and the PhotonPlayer class both have SetCustomProperties methods.
    /// Also, both classes offer access to current key-values by: customProperties.
    /// 
    /// Always use SetCustomProperties to change values. 
    /// To reduce network traffic, set only values that actually changed.
    /// New properties are added, existing values are updated.
    /// Other values will not be changed, so only provide values that changed or are new.
    /// 
    /// To delete a named (custom) property of this room, use null as value.
    /// 
    /// Locally, SetCustomProperties will update it's cache without delay. 
    /// Other clients are updated through Photon (the server) with a fitting operation.
    /// 
    /// <b>Check and Swap</b>
    /// 
    /// SetCustomProperties have the option to do a server-side Check-And-Swap (CAS): 
    /// Values only get updated if the expected values are correct.
    /// The expectedValues can be different key/values than the propertiesToSet. So you can 
    /// check some key and set another key's value (if the check succeeds).
    /// 
    /// If the client's knowledge of properties is wrong or outdated, it can't set values with CAS.
    /// This can be useful to keep players from concurrently setting values. For example: If all players
    /// try to pickup some card or item, only one should get it. With CAS, only the first SetProperties 
    /// gets executed server-side and any other (sent at the same time) fails.
    /// 
    /// The server will broadcast successfully changed values and the local "cache" of customProperties 
    /// only gets updated after a roundtrip (if anything changed).
    /// 
    /// You can do a "webForward": Photon will send the changed properties to a WebHook defined 
    /// for your application.
    /// 
    /// <b>OfflineMode</b>
    /// 
    /// While PhotonNetwork.offlineMode is true, the expectedValues and webForward parameters are ignored.
    /// In OfflineMode, the local customProperties values are immediately updated (without the roundtrip).
    /// </remarks>
    /// <param name="propertiesToSet">The new properties to be set. </param>
    /// <param name="expectedValues">At least one property key/value set to check server-side. Key and value must be correct. Ignored in OfflineMode.</param>
    /// <param name="webForward">Set to true, to forward the set properties to a WebHook, defined for this app (in Dashboard). Ignored in OfflineMode.</param>
    public void SetCustomProperties(Hashtable propertiesToSet, Hashtable expectedValues = null, bool webForward = false)
    {
        if (propertiesToSet == null)
        {
            return;
        }

        Hashtable customProps = propertiesToSet.StripToStringKeys() as Hashtable;
        Hashtable customPropsToCheck = expectedValues.StripToStringKeys() as Hashtable;


        // no expected values -> set and callback
        bool noCas = customPropsToCheck == null || customPropsToCheck.Count == 0;



        if (!PhotonNetwork.offlineMode)
        {
            PhotonNetwork.networkingPeer.OpSetPropertiesOfRoom(customProps, customPropsToCheck, webForward);
        }

        if (PhotonNetwork.offlineMode || noCas)
        {
            this.InternalCacheProperties(customProps);
            NetworkingPeer.SendMonoMessage(PhotonNetworkingMessage.OnPhotonCustomRoomPropertiesChanged, customProps);
        }
    }
开发者ID:apekshadarbari,项目名称:PokerFace,代码行数:75,代码来源:Room.cs

示例5: SetCustomProperties

    /// <summary>
    /// Will update properties on the server, if the expectedValues are matching the current (property)values on the server.
    /// </summary>
    /// <remarks>
    /// This variant of SetCustomProperties uses server side Check-And-Swap (CAS) to update valuzes only if the expected values are correct.
    /// The expectedValues can't be null or empty, but they can be different key/values than the propertiesToSet.
    /// 
    /// If the client's knowledge of properties is wrong or outdated, it can't set values (with CAS).
    /// This can be useful to keep players from concurrently setting values. For example: If all players
    /// try to pickup some card or item, only one should get it. With CAS, only the first SetProperties 
    /// gets executed server-side and any other (sent at the same time) fails.
    /// 
    /// The server will broadcast successfully changed values and the local "cache" of customProperties 
    /// only gets updated after a roundtrip (if anything changed).
    /// </remarks>
    /// <param name="propertiesToSet">The new properties to be set. </param>
    /// <param name="expectedValues">At least one property key/value set to check server-side. Key and value must be correct.</param>
    public void SetCustomProperties(Hashtable propertiesToSet, Hashtable expectedValues)
    {
        if (propertiesToSet == null) {
            return;
        }
        if (expectedValues == null || expectedValues.Count == 0) {
            Debug.LogWarning ("SetCustomProperties(props, expected) requires some expectedValues. Use SetCustomProperties(props) to simply set some without check.");
            return;
        }

        if (!PhotonNetwork.offlineMode) {
            Hashtable customProps = propertiesToSet.StripToStringKeys () as Hashtable;
            Hashtable customPropsToCheck = expectedValues.StripToStringKeys () as Hashtable;
            PhotonNetwork.networkingPeer.OpSetPropertiesOfRoom (customProps, false, 0, customPropsToCheck);  // broadcast is always on for CAS
        }
    }
开发者ID:Avatarchik,项目名称:survival-shooter-multiplayer-unity3d-files,代码行数:33,代码来源:Room.cs

示例6: OpSetCustomPropertiesOfRoom

 public bool OpSetCustomPropertiesOfRoom(Hashtable gameProperties, bool broadcast, byte channelId)
 {
     return this.OpSetPropertiesOfRoom(gameProperties.StripToStringKeys(), broadcast, channelId);
 }
开发者ID:JulyMars,项目名称:frozen_free_fall,代码行数:4,代码来源:LoadbalancingPeer.cs

示例7: OpSetCustomPropertiesOfActor

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

示例8: SetCustomProperties

    /// <summary>
    /// Updates the custom properties of this Room with propertiesToSet.
    /// Only string-typed keys are applied, new properties (string keys) are added, existing are updated
    /// and if a value is set to null, this will remove the custom property.
    /// </summary>
    /// <remarks>
    /// Local cache is updated immediately, other players are updated through Photon with a fitting operation.
    /// </remarks>
    /// <param name="propertiesToSet"></param>
    public void SetCustomProperties(Hashtable propertiesToSet)
    {
        Hashtable customProps = propertiesToSet.StripToStringKeys() as Hashtable;

        // merge (delete null-values)
        this.customProperties.Merge(customProps);
        this.customProperties.StripKeysWithNullValues();

        // send (sync) these new values
        PhotonNetwork.networkingPeer.OpSetCustomPropertiesOfGame(customProps, true, 0);
    }
开发者ID:Avatarchik,项目名称:cs-on-unity,代码行数:20,代码来源:Room.cs


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