本文整理汇总了C#中ExitGames.Client.Photon.Hashtable类的典型用法代码示例。如果您正苦于以下问题:C# Hashtable类的具体用法?C# Hashtable怎么用?C# Hashtable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Hashtable类属于ExitGames.Client.Photon命名空间,在下文中一共展示了Hashtable类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: SendPlayerName
private void SendPlayerName()
{
if (this.State == global::PeerState.Joining)
{
// this means, the join on the gameServer is sent (with an outdated name). send the new when in game
this.mPlayernameHasToBeUpdated = true;
return;
}
if (this.mLocalActor != null)
{
this.mLocalActor.name = this.PlayerName;
Hashtable properties = new Hashtable();
properties[ActorProperties.PlayerName] = this.PlayerName;
if (this.mLocalActor.ID > 0)
{
this.OpSetPropertiesOfActor(this.mLocalActor.ID, properties, true, (byte)0);
this.mPlayernameHasToBeUpdated = false;
}
}
}
开发者ID:JonasSkaug,项目名称:afgangsprojekt-team-tj,代码行数:21,代码来源:NetworkingPeer.cs
示例17: GetLocalActorProperties
private Hashtable GetLocalActorProperties()
{
if (PhotonNetwork.player != null)
{
return PhotonNetwork.player.allProperties;
}
Hashtable actorProperties = new Hashtable();
actorProperties[ActorProperties.PlayerName] = this.PlayerName;
return actorProperties;
}
开发者ID:JonasSkaug,项目名称:afgangsprojekt-team-tj,代码行数:11,代码来源:NetworkingPeer.cs
示例18: RPC
/// RPC Hashtable Structure
/// (byte)0 -> (int) ViewId (combined from actorNr and actor-unique-id)
/// (byte)1 -> (short) prefix (level)
/// (byte)2 -> (int) server timestamp
/// (byte)3 -> (string) methodname
/// (byte)4 -> (object[]) parameters
/// (byte)5 -> (byte) method shortcut (alternative to name)
///
/// This is sent as event (code: 200) which will contain a sender (origin of this RPC).
internal void RPC(PhotonView view, string methodName, PhotonTargets target, params object[] parameters)
{
if (this.blockSendingGroups.Contains(view.group))
{
return; // Block sending on this group
}
if (view.viewID < 1)
{
Debug.LogError("Illegal view ID:" + view.viewID + " method: " + methodName + " GO:" + view.gameObject.name);
}
if (PhotonNetwork.logLevel >= PhotonLogLevel.Full)
Debug.Log("Sending RPC \"" + methodName + "\" to " + target);
//ts: changed RPCs to a one-level hashtable as described in internal.txt
Hashtable rpcEvent = new Hashtable();
rpcEvent[(byte)0] = (int)view.viewID; // LIMITS NETWORKVIEWS&PLAYERS
if (view.prefix > 0)
{
rpcEvent[(byte)1] = (short)view.prefix;
}
rpcEvent[(byte)2] = this.ServerTimeInMilliSeconds;
// send name or shortcut (if available)
int shortcut = 0;
if (rpcShortcuts.TryGetValue(methodName, out shortcut))
{
rpcEvent[(byte)5] = (byte)shortcut; // LIMITS RPC COUNT
}
else
{
rpcEvent[(byte)3] = methodName;
}
if (parameters != null && parameters.Length > 0)
{
rpcEvent[(byte)4] = (object[])parameters;
}
// Check scoping
if (target == PhotonTargets.All)
{
RaiseEventOptions options = new RaiseEventOptions() { InterestGroup = (byte)view.group };
this.OpRaiseEvent(PunEvent.RPC, rpcEvent, true, options);
//this.OpRaiseEvent(PunEvent.RPC, (byte)view.group, rpcEvent, true, 0);
// Execute local
this.ExecuteRPC(rpcEvent, this.mLocalActor);
}
else if (target == PhotonTargets.Others)
{
RaiseEventOptions options = new RaiseEventOptions() { InterestGroup = (byte)view.group };
this.OpRaiseEvent(PunEvent.RPC, rpcEvent, true, options);
}
else if (target == PhotonTargets.AllBuffered)
{
RaiseEventOptions options = new RaiseEventOptions() { CachingOption = EventCaching.AddToRoomCache};
this.OpRaiseEvent(PunEvent.RPC, rpcEvent, true, options);
// Execute local
this.ExecuteRPC(rpcEvent, this.mLocalActor);
}
else if (target == PhotonTargets.OthersBuffered)
{
RaiseEventOptions options = new RaiseEventOptions() { CachingOption = EventCaching.AddToRoomCache };
this.OpRaiseEvent(PunEvent.RPC, rpcEvent, true, options);
}
else if (target == PhotonTargets.MasterClient)
{
if (this.mMasterClient == this.mLocalActor)
{
this.ExecuteRPC(rpcEvent, this.mLocalActor);
}
else
{
RaiseEventOptions options = new RaiseEventOptions() { Receivers = ReceiverGroup.MasterClient };
this.OpRaiseEvent(PunEvent.RPC, rpcEvent, true, options);
}
}
else if (target == PhotonTargets.AllViaServer)
{
RaiseEventOptions options = new RaiseEventOptions() { InterestGroup = (byte)view.group, Receivers = ReceiverGroup.All };
this.OpRaiseEvent(PunEvent.RPC, rpcEvent, true, options);
if (PhotonNetwork.offlineMode)
{
this.ExecuteRPC(rpcEvent, this.mLocalActor);
}
//.........这里部分代码省略.........
开发者ID:JonasSkaug,项目名称:afgangsprojekt-team-tj,代码行数:101,代码来源:NetworkingPeer.cs
示例19: SetSceneInProps
protected internal void SetSceneInProps()
{
if (PhotonNetwork.isMasterClient)
{
Hashtable setScene = new Hashtable();
setScene[NetworkingPeer.CurrentSceneProperty] = Application.loadedLevelName;
//PhotonNetwork.room.SetCustomProperties(setScene);
}
}
开发者ID:frizac-b,项目名称:gladiawar,代码行数:9,代码来源:PhotonHandler.cs
示例20: OnSerializeWrite
// calls OnPhotonSerializeView (through ExecuteOnSerialize)
// the content created here is consumed by receivers in: ReadOnSerialize
private Hashtable OnSerializeWrite(PhotonView view)
{
PhotonStream pStream = new PhotonStream( true, null );
PhotonMessageInfo info = new PhotonMessageInfo( this.mLocalActor, this.ServerTimeInMilliSeconds, view );
// each view creates a list of values that should be sent
view.SerializeView( pStream, info );
if( pStream.Count == 0 )
{
return null;
}
object[] dataArray = pStream.data.ToArray();
if (view.synchronization == ViewSynchronization.UnreliableOnChange)
{
if (AlmostEquals(dataArray, view.lastOnSerializeDataSent))
{
if (view.mixedModeIsReliable)
{
return null;
}
view.mixedModeIsReliable = true;
view.lastOnSerializeDataSent = dataArray;
}
else
{
view.mixedModeIsReliable = false;
view.lastOnSerializeDataSent = dataArray;
}
}
// EVDATA:
// 0=View ID (an int, never compressed cause it's not in the data)
// 1=data of observed type (different per type of observed object)
// 2=compressed data (in this case, key 1 is empty)
// 3=list of values that are actually null (if something was changed but actually IS null)
Hashtable evData = new Hashtable();
evData[(byte)0] = (int)view.viewID;
evData[(byte)1] = dataArray; // this is the actual data (script or observed object)
if (view.synchronization == ViewSynchronization.ReliableDeltaCompressed)
{
// compress content of data set (by comparing to view.lastOnSerializeDataSent)
// the "original" dataArray is NOT modified by DeltaCompressionWrite
// if something was compressed, the evData key 2 and 3 are used (see above)
bool somethingLeftToSend = this.DeltaCompressionWrite(view, evData);
// buffer the full data set (for next compression)
view.lastOnSerializeDataSent = dataArray;
if (!somethingLeftToSend)
{
return null;
}
}
return evData;
}
开发者ID:JonasSkaug,项目名称:afgangsprojekt-team-tj,代码行数:64,代码来源:NetworkingPeer.cs
注:本文中的ExitGames.Client.Photon.Hashtable类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论