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


C# Hashtable.Add方法代码示例

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


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

示例1: Start

        private Client client; // Socket

        void Start()
        {
            this.client = GameObject.Find("Manager").GetComponent<ClientManager>().Client;
            user = User.Instance;
            if (user.is_connected)
            {
                PhotonNetwork.playerName = user.username;

                PhotonPeer.RegisterType(typeof(Team), (byte)'T', ObjectToByteArray, ByteToTeam);
                PhotonPeer.RegisterType(typeof(Composition), (byte)'C', ObjectToByteArray, ByteToComposition);
                PhotonPeer.RegisterType(typeof(Player), (byte)'P', ObjectToByteArray, ByteToPlayer);
                PhotonPeer.RegisterType(typeof(User), (byte)'U', ObjectToByteArray, ByteToUser);
                PhotonPeer.RegisterType(typeof(List<string>), (byte)'L', ObjectToByteArray, ByteToLS);

                PhotonHastable props = new PhotonHastable();

                props.Add("Team", Settings.Instance.Selected_Team);
                props.Add("User", user);

                PhotonNetwork.player.SetCustomProperties(props);

                PhotonNetwork.ConnectUsingSettings(game_version_);
                this.room_name = user.username + "-" + rand.Next(1000);
            }
        }
开发者ID:CanPayU,项目名称:SuperSwungBall,代码行数:27,代码来源:NetworkController.cs

示例2: ReceiveInitialSpawnInfo

	void ReceiveInitialSpawnInfo(int id, PhotonPlayer player, Vector3 pos, Quaternion rot, string playerTypeName, int teamNumber, PhotonMessageInfo info)
	{
		
		if ((info.sender != PhotonNetwork.masterClient) &&
			(info.sender != PhotonNetwork.player))
			return;

		// initialize the newborn player with the mandatory 'on-join-stats'
		ExitGames.Client.Photon.Hashtable stats = new ExitGames.Client.Photon.Hashtable();
		stats.Add("Type", playerTypeName);
		stats.Add("Team", teamNumber);
		stats.Add("Position", pos);
		stats.Add("Rotation", rot);

		// announce arrival of new player
		if (player.ID > PhotonNetwork.player.ID)
			vp_MPDebug.Log("Player " + player.name + " joined"
				+ ((vp_MPTeamManager.Exists && (teamNumber > 0)) ? " team : " + vp_MPTeamManager.GetTeamName(teamNumber).ToUpper() : "")
				);
		else if (player.ID == PhotonNetwork.player.ID)
		{
			vp_Timer.In(0.1f, delegate()
			{
				//Debug.Log("teamNumber: " + teamNumber);
				
				try
				{
					vp_MPDebug.Log(
						"Welcome to '"
						+ PhotonNetwork.room.name
						+ "' with "
						+ PhotonNetwork.room.playerCount.ToString()
						+ ((PhotonNetwork.room.playerCount == 1) ? " player (you)" : " players")
						+ "."
						);
					//vp_MPDebug.Log("Max players for room: " + PhotonNetwork.room.maxPlayers + ".");
					//vp_MPDebug.Log("Total players using app: " + PhotonNetwork.countOfPlayers);
					if (vp_MPTeamManager.Exists && (teamNumber > 0))
						vp_MPDebug.Log("Your team is: " + vp_MPTeamManager.GetTeamName(teamNumber).ToUpper());
				}
				catch
				{
					if (PhotonNetwork.room == null)
						Debug.Log("PhotonNetwork.room = null");
					else if (PhotonNetwork.room.name == null)
						Debug.Log("PhotonNetwork.room.name = null");
					if (vp_MPTeamManager.Instance == null)
						Debug.Log("vp_MPTeamManager.Instance = null");
					else if (vp_MPTeamManager.GetTeamName(teamNumber) == null)
						Debug.Log("vp_MPMaster.GetTeamName(teamNumber) = null");
				}

			});
		}

		InstantiatePlayerPrefab(player, stats);

	}
开发者ID:loursbrun,项目名称:sniperspiritV3,代码行数:58,代码来源:vp_MPPlayerSpawner.cs

示例3: OnJoinedRoom

    /// <summary>
    /// Callback used when the player successfully joins a room.
    /// </summary>
    public void OnJoinedRoom()
    {
        playersInRoom = new List<PhotonPlayer>(PhotonNetwork.playerList);
        myTeam = (TeamTypes)((playersInRoom.Count + 1) % 2);


        ExitGames.Client.Photon.Hashtable properties = new ExitGames.Client.Photon.Hashtable();
        properties.Add("Team", myTeam.GetHashCode());
        properties.Add("Character", myCharacter.GetHashCode());
        properties.Add("PlayFabID", PlayFabManager.instance.GetMyPlayerID());

        bool containsOwner = false;
        for (int i = 0; i < PhotonNetwork.otherPlayers.Length; i++)
        {
            object ownerName;
            if (PhotonNetwork.otherPlayers[i].customProperties.TryGetValue("Owner", out ownerName))
            {
                containsOwner = true;
                break;
            }
        }
        if (!containsOwner)
        {
            properties.Add("Owner", PhotonNetwork.player.name);
        }
        PhotonNetwork.player.SetCustomProperties(properties);

        myRoomInfo = PhotonNetwork.room;

        OnJoinedRoomCallback(PhotonNetwork.room);
    }
开发者ID:dearzhangle,项目名称:UNION-OpenSource-MOBA,代码行数:34,代码来源:MultiplayerRoomsManager.cs

示例4: SetReady

    /// <summary>
    /// Updates player status to ready.
    /// </summary>
    public void SetReady()
    {
        ExitGames.Client.Photon.Hashtable properties = new ExitGames.Client.Photon.Hashtable();
        properties.Add("Ready", true);
        PhotonNetwork.player.SetCustomProperties(properties);

        networkLayer.OnPropertiesChanged();
    }
开发者ID:dearzhangle,项目名称:UNION-OpenSource-MOBA,代码行数:11,代码来源:MultiplayerRoomsManager.cs

示例5: ChangeTeam

    /// <summary>
    /// Rotates player between teams.
    /// </summary>
    public void ChangeTeam(TeamTypes newTeam, bool syncNetwork)
    {
        myTeam = newTeam;

        ExitGames.Client.Photon.Hashtable properties = new ExitGames.Client.Photon.Hashtable();
        properties.Add("Team", myTeam.GetHashCode());
        PhotonNetwork.player.SetCustomProperties(properties);

        if (syncNetwork)
        {
            networkLayer.OnPropertiesChanged();
        }
    }
开发者ID:dearzhangle,项目名称:UNION-OpenSource-MOBA,代码行数:16,代码来源:MultiplayerRoomsManager.cs

示例6: ChangePlayerAvatar

    /// <summary>
    /// Changes player avatar, to the one the player has chosen.
    /// </summary>
    /// <param name="myType">New character.</param>
    /// <param name="syncNetwork">If will send data to the network.</param>
    public void ChangePlayerAvatar(CharacterTypes myType, bool syncNetwork)
    {
        if (myCharacter != myType)
        {
            myCharacter = myType;

            ExitGames.Client.Photon.Hashtable properties = new ExitGames.Client.Photon.Hashtable();
            properties.Add("Character", myCharacter.GetHashCode());
            PhotonNetwork.player.SetCustomProperties(properties);

            if (syncNetwork)
            {
                networkLayer.OnPropertiesChanged();
            }
        }
    }
开发者ID:dearzhangle,项目名称:UNION-OpenSource-MOBA,代码行数:21,代码来源:MultiplayerRoomsManager.cs

示例7: StartGame

    /// <summary>
    /// Starts game.
    /// </summary>
    public void StartGame()
    {
		ExitGames.Client.Photon.Hashtable properties = new ExitGames.Client.Photon.Hashtable();
		properties.Add("Ready", false);
		PhotonNetwork.player.SetCustomProperties(properties);

        networkLayer.ActivateLevel();
        //networkLayer.AllocateViewIDAndCallInstantiate(myCharacter, myTeam);
    }
开发者ID:dearzhangle,项目名称:UNION-OpenSource-MOBA,代码行数:12,代码来源:MultiplayerRoomsManager.cs

示例8: CreateNewRoom

    /// <summary>
    /// Method to be called when the user wants to create a new room.
    /// </summary>
    public void CreateNewRoom(int numberOfPlayers,ProjectDelegates.RoomInfoCallback RoomCreatedCallback, int level)
    {
        OnJoinedRoomCallback = RoomCreatedCallback;

        ExitGames.Client.Photon.Hashtable customParams = new ExitGames.Client.Photon.Hashtable();
        customParams.Add("C0", level);

        RoomOptions options = new RoomOptions();
        options.maxPlayers = numberOfPlayers;

        TypedLobby typedLobby = new TypedLobby("GameLobby",LobbyType.Default);

		//PhotonNetwork.CreateRoom ("",options,typedLobby);
		//PhotonNetwork.CreateRoom ("", true, true, numberOfPlayers);
		// testing this to git rid of the build warning
		PhotonNetwork.CreateRoom("", options, typedLobby);
		
    }
开发者ID:dearzhangle,项目名称:UNION-OpenSource-MOBA,代码行数:21,代码来源:MultiplayerRoomsManager.cs

示例9: OnJoinedRoom

 // We have two options here: we either joined(by title, list or random) or created a room.
 public override void OnJoinedRoom()
 {
     Debug.Log("OnJoinedRoom");
     
     Hashtable e = new Hashtable();
     e.Add("PName", LocalName);
     bool master = (PhotonNetwork.player.isMasterClient) ? true : false;
     e.Add("Ready", master);
     PhotonNetwork.player.SendReady(master);
     PhotonNetwork.RaiseEvent(EventID.PlayerJoinPre, e, true, new RaiseEventOptions() { Receivers = ReceiverGroup.All }); 
 }
开发者ID:tegleg,项目名称:mfp,代码行数:12,代码来源:bl_Lobby.cs

示例10: Ready

 /// <summary>
 /// change the state and sync for other players
 /// </summary>
 public void Ready()
 {
     isReady = !isReady;
     PhotonNetwork.player.SendReady(isReady);
     Hashtable e = new Hashtable();
     e.Add("PName",LocalName);
     e.Add("Ready",isReady);
     PhotonNetwork.RaiseEvent(EventID.PlayerJoinPre, e, true, new RaiseEventOptions() { Receivers = ReceiverGroup.All});    
 }
开发者ID:tegleg,项目名称:mfp,代码行数:12,代码来源:bl_PreScene.cs

示例11: LoadSyncLevel

 /// <summary>
 /// Load and sync level
 /// Only masterclient can call this function
 /// </summary>
 public void LoadSyncLevel()
 {
     //Start game only when all are ready
     if (PhotonNetwork.playerList.AllPlayersReady())
     {
         Hashtable e = new Hashtable();
         e.Add("Level", PhotonNetwork.room.RoomScene());
         PhotonNetwork.RaiseEvent(EventID.LoadSyncLevel, e, true, new RaiseEventOptions() { Receivers = ReceiverGroup.All });
     }
     else
     {
         Debug.Log("Some players are not ready, wait for hes");
     }
 }
开发者ID:tegleg,项目名称:mfp,代码行数:18,代码来源:bl_PreScene.cs


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