本文整理汇总了C#中ExitGames.Client.Photon.Hashtable.Add方法的典型用法代码示例。如果您正苦于以下问题:C# ExitGames.Client.Photon.Hashtable.Add方法的具体用法?C# ExitGames.Client.Photon.Hashtable.Add怎么用?C# ExitGames.Client.Photon.Hashtable.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExitGames.Client.Photon.Hashtable
的用法示例。
在下文中一共展示了ExitGames.Client.Photon.Hashtable.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Encode
public override Hashtable Encode()
{
Hashtable hash = new Hashtable();
Hashtable decksHash = new Hashtable();
foreach (NWPlayerDeckDataObject deck in PlayersDecks)
{
Hashtable deckData = deck.Encode();
string playerId = deckData[ePlayerDeckDataObjectKeys.PlayerId].ToString();
decksHash.Add(playerId, (Hashtable)deckData[ePlayerDeckDataObjectKeys.DeckCards]);
}
Hashtable[] zonesHash = new Hashtable[PlayersZones.Count];
for (int i = 0; i< PlayersZones.Count; i++)
{
zonesHash[i] = PlayersZones[i].Encode();
}
hash.Add(eGameSetupKeys.Decks.ToString(), decksHash);
hash.Add(eGameSetupKeys.PlayersZones.ToString(), zonesHash);
Debug.Log( ">>>> " + Utils.HashToString(hash));
return hash;
}
示例2: Encode
public Hashtable Encode()
{
Hashtable hash = new Hashtable();
hash.Add((int)eServerActionKey.ActionType, ActionType);
hash.Add((int)eServerActionKey.ActionParams, ActionsParams);
return hash;
}
示例3: TABGUI
private void TABGUI () {
ExitGames.Client.Photon.Hashtable props = new ExitGames.Client.Photon.Hashtable();
props.Add("Team", 1);
props.Add("Score", 0);
props.Add("Kills", Kills);
props.Add("death", 666);
PhotonNetwork.player.SetCustomProperties(props);
// Spieler Scores Human
foreach (PhotonPlayer player in PhotonNetwork.playerList)
{
HumanStatsCanvas.GetComponent<Text>().text = "Team: " + player.customProperties["Team"].ToString() +
" | Score: " + player.customProperties["Score"].ToString() +
" | Kills: " + player.customProperties["Kills"].ToString() +
" | Deaths: " + player.customProperties["death"].ToString() +
" | Ping: " + PhotonNetwork.networkingPeer.RoundTripTime.ToString();
}
// Spieler Scores Alien
AlienStatsCanvas.GetComponent<Text>().text = "Team: " + PhotonNetwork.player.customProperties["Team"].ToString() +
" | Score: " + PhotonNetwork.player.customProperties["Score"].ToString() +
" | Kills: " + PhotonNetwork.player.customProperties["Kills"].ToString() +
" | Deaths: " + PhotonNetwork.player.customProperties["death"].ToString() +
" | Ping: " + PhotonNetwork.networkingPeer.RoundTripTime.ToString();
}
示例4: Encode
public override Hashtable Encode()
{
Hashtable hash = new Hashtable();
hash.Add((int)eZoneDataKeys.PlayerId, PlayerId);
hash.Add((int)eZoneDataKeys.ZoneType, (int)ZoneType);
hash.Add((int)eZoneDataKeys.ZoneId, ZoneId);
return hash;
}
示例5: OnJoinedRoom
public void OnJoinedRoom()
{
if (this.PrefabsToInstantiate != null)
{
GameObject controller = GameObject.Find("Control");
foreach (GameObject o in this.PrefabsToInstantiate)
{
Debug.Log("Instantiating: " + o.name);
Vector3 spawnPos = Vector3.up;
if (this.SpawnPosition != null)
{
spawnPos = this.SpawnPosition.position;
}
Vector3 random = Random.insideUnitSphere;
random.y = 0;
random = random.normalized;
Vector3 itempos = spawnPos + this.PositionOffset * random;
player = PhotonNetwork.Instantiate(o.name, itempos, Quaternion.identity, 0);
PhotonView photonView = player.GetPhotonView();
CameraController camera = PlayerCamera.GetComponent<CameraController>();
camera.enabled = true;
camera.player = player;
redPlayers = PunTeams.PlayersPerTeam[PunTeams.Team.red].Count;
bluePlayers = PunTeams.PlayersPerTeam[PunTeams.Team.blue].Count;
ExitGames.Client.Photon.Hashtable ht = new ExitGames.Client.Photon.Hashtable();
ht.Add("ready", false);
ht.Add("all ready", false);
PhotonNetwork.player.SetCustomProperties(ht);
if (redPlayers > bluePlayers)
{
PhotonNetwork.player.SetTeam(PunTeams.Team.blue);
photonView.RPC("ChangeColorToBlue", PhotonTargets.AllBuffered);
}
else {
PhotonNetwork.player.SetTeam(PunTeams.Team.red);
photonView.RPC("ChangeColorToRed", PhotonTargets.AllBuffered);
}
}
}
}
示例6: Encode
public override Hashtable Encode()
{
Hashtable hash = new Hashtable();
Hashtable deckData = new Hashtable();
foreach (NWCardDataObject card in Cards)
{
deckData.Add(card.CardUniqueId, card.CardId);
}
hash.Add(ePlayerDeckDataObjectKeys.DeckCards, deckData);
hash.Add(ePlayerDeckDataObjectKeys.PlayerId, PlayerId);
return hash;
}
示例7: OnConnectedToMaster
public virtual void OnConnectedToMaster()
{
ExitGames.Client.Photon.Hashtable customPlayerProps = new ExitGames.Client.Photon.Hashtable() {{"Score", 0}};
customPlayerProps.Add("Health", 100);
customPlayerProps.Add("Ability", "none");
customPlayerProps.Add("Time", 300.0);
customPlayerProps.Add("Wave", 0);
customPlayerProps.Add("Orbs", 5);
PhotonNetwork.player.SetCustomProperties(customPlayerProps);
PhotonNetwork.JoinRandomRoom();
PhotonNetwork.JoinRoom("MainRoom");
}
示例8: OnJoinedRoom
public override void OnJoinedRoom()
{
print ("OnJoinedRoom");
UpdatePlayerSettings();
PhotonHashTable props = new PhotonHashTable();
if(ps.type == PlayerType.PC)
props.Add( "PC", true);
else
props.Add( "VR", true);
PhotonNetwork.room.SetCustomProperties( props );
print (PhotonNetwork.room.customProperties + " " + PhotonNetwork.room.name);
}
示例9: Start
void Start()
{
pm = GameObject.Find ("PhotonManager").GetComponent<PhotonManager> ();
playerHash = new ExitGames.Client.Photon.Hashtable ();
playerHash.Add ("isInGame", 0);
playerHash.Add ("characterId", -1);
PhotonNetwork.player.SetCustomProperties (playerHash);
joinNumText = new Text[5];
for (int i = 0; i < 5; ++i) {
int roomNo = i + 1;
//joinNumText[i] = GameObject.Find ("JoinNum" + roomNo).GetComponent<Text> ();
}
}
示例10: initializeVars
//Intialize timer and scores
void initializeVars()
{
PlayerPrefs.SetInt("BlueScore", 0);
PlayerPrefs.SetInt("RedScore", 0);
PlayerPrefs.SetInt("Time", 300);
if (PhotonNetwork.isMasterClient)
{
ExitGames.Client.Photon.Hashtable h = new ExitGames.Client.Photon.Hashtable();
h.Add("BlueScore", 0);
h.Add("RedScore", 0);
h.Add("Time", 300);
PhotonNetwork.player.SetCustomProperties(h);
}
}
示例11: SetRoundStartTime
/// <summary>
/// This method is storing PhotonNetwork.time in the rooms custom properties
/// Since PhotonNetwork.time is synchronized between all players, we can use this to
/// share time information between all players
/// </summary>
protected void SetRoundStartTime()
{
ExitGames.Client.Photon.Hashtable newProperties = new ExitGames.Client.Photon.Hashtable();
newProperties.Add( RoomProperty.StartTime, PhotonNetwork.time );
PhotonNetwork.room.SetCustomProperties( newProperties );
}
示例12: OnJoinedRoom
void OnJoinedRoom ()
{
//Debug.Log("OnJoinedRoom");
double _myPing = (double)PhotonNetwork.GetPing();
Room _room = PhotonNetwork.room;
PhotonHashtable changeProps = new PhotonHashtable();
changeProps.Add("LowPing", _myPing);
changeProps.Add("LowPingPlayer", PhotonNetwork.player.ID);
if(!_room.customProperties.ContainsKey("LowPing")) { _room.SetCustomProperties(changeProps); } else if ( Convert.ToDouble(_room.customProperties.ContainsKey("LowPing")) > _myPing) { _room.SetCustomProperties(changeProps); }
if(PhotonNetwork.isMasterClient) {
PhotonPlayer[] _players = PhotonNetwork.playerList;
foreach(PhotonPlayer _checkPlayer in _players){ if(_checkPlayer.ID.ToString() == PhotonNetwork.room.customProperties["LowPingPlayer"].ToString()) { PhotonNetwork.SetMasterClient(_checkPlayer); } }
}
PhotonNetwork.Instantiate("PlayerObject", GameObject.FindGameObjectWithTag("PlayerObject").transform.position, Quaternion.identity, 0);
}
示例13: ToHashtable
/// <summary>
/// Serializes all non static variables to a ExitGames.Client.Photon.Hashtable which can be sent over the Photon network.
/// </summary>
/// <returns>ExitGames.Client.Photon.Hashtable</returns>
public ExitGames.Client.Photon.Hashtable ToHashtable()
{
ExitGames.Client.Photon.Hashtable h = new ExitGames.Client.Photon.Hashtable();
h.Add("sequenceNumber", sequenceNumber);
Debug.Log("Added sequenceNumber " + sequenceNumber + " to Hashtable");
h.Add("assignmentType", assignmentType);
Debug.Log("Added assignmentType " + assignmentType + " to Hashtable");
h.Add("missionDescription", description);
Debug.Log("Added missionDescription " + description + " to Hashtable");
foreach (DictionaryEntry entry in typeData)
{
h.Add(entry.Key, entry.Value);
}
Debug.Log("Added typeData " + typeData + " to Hashtable");
return h;
}
示例14: SettingPropiertis
public void SettingPropiertis()
{
//Initialize new properties where the information will stay Room
if (PhotonNetwork.isMasterClient) {
Hashtable setTeamScore = new Hashtable();
setTeamScore.Add(PropiertiesKeys.Team1Score, 0);
PhotonNetwork.room.SetCustomProperties(setTeamScore);
Hashtable setTeam2Score = new Hashtable();
setTeam2Score.Add(PropiertiesKeys.Team2Score, 0);
PhotonNetwork.room.SetCustomProperties(setTeam2Score);
}
//Initialize new properties where the information will stay Players
Hashtable PlayerTeam = new Hashtable();
PlayerTeam.Add(PropiertiesKeys.TeamKey, Team.All.ToString());
PhotonNetwork.player.SetCustomProperties(PlayerTeam);
Hashtable PlayerKills = new Hashtable();
PlayerKills.Add(PropiertiesKeys.KillsKey, 0);
PhotonNetwork.player.SetCustomProperties(PlayerKills);
Hashtable PlayerDeaths = new Hashtable();
PlayerDeaths.Add(PropiertiesKeys.DeathsKey, 0);
PhotonNetwork.player.SetCustomProperties(PlayerDeaths);
Hashtable PlayerScore = new Hashtable();
PlayerScore.Add(PropiertiesKeys.ScoreKey, 0);
PhotonNetwork.player.SetCustomProperties(PlayerScore);
Hashtable PlayerPing = new Hashtable();
PlayerPing.Add("Ping", 0);
PhotonNetwork.player.SetCustomProperties(PlayerPing);
}
示例15: SetGameEndTime
public void SetGameEndTime()
{
if (PhotonNetwork.isMasterClient) {
ExitGames.Client.Photon.Hashtable endTime = new ExitGames.Client.Photon.Hashtable ();
endTime.Add (RoomPropertyType.EndTime, PhotonNetwork.time + timeAfterLastCandy);
PhotonNetwork.room.SetCustomProperties (endTime);
}
}