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


C# PhotonPlayer.Equals方法代码示例

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


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

示例1: StartPlaying

    public void StartPlaying(PhotonPlayer A, PhotonPlayer B)
    {
        this.photonView.ClearRpcBufferAsMasterClient();    // We don't care about instructions in the buffer for previous games at this point
        this.photonView.RPC("ResetBoard", PhotonTargets.OthersBuffered);
        // this.PlayerTurn = false;
        this.SetLocalTurn(false);

        if (A.Equals(PhotonNetwork.player))
        {
            this.LocalSideB = false;
            this.RemotePlayer = B;
            this.LocalColour = ConnectFourSlot.Colour.Black;
            this.RemoteColour = ConnectFourSlot.Colour.Red;
            this.LocalSelectors = (ConnectFourSlot[])SelectorsA.Clone();
            this.RemoteSelectors = (ConnectFourSlot[])SelectorsB.Clone();
            if (this.SingleSided)
                { Array.Reverse(this.RemoteSelectors); }
            // this.PlayerTurn = true;
            this.SetLocalTurn(true);
        }
        else if (B.Equals(PhotonNetwork.player))
        {
            this.LocalSideB = true;
            this.RemotePlayer = A;
            this.LocalColour = ConnectFourSlot.Colour.Red;
            this.RemoteColour = ConnectFourSlot.Colour.Black;
            this.LocalSelectors = (ConnectFourSlot[])SelectorsB.Clone();
            this.RemoteSelectors = (ConnectFourSlot[])SelectorsA.Clone();
            if (this.SingleSided)
                { Array.Reverse(this.LocalSelectors); }
        }
        else    // This game is starting, but the local player isn't one of the players
        {
            return;
        }
        this.photonView.RPC("ResetBoardForPlay", this.RemotePlayer);
        this.ResetBoardForPlay(null);
        this.Playing = true;
        this.LocalSelectors[this.LocalSelectorIndex].Status = this.LocalColour;
    }
开发者ID:oatssss,项目名称:McGill-Once-McGill-Twice,代码行数:40,代码来源:ConnectFourBoard.cs

示例2: RemovePlayer

    protected virtual void RemovePlayer(PhotonPlayer player, PhotonMessageInfo info)
    {
        // A recently disconnected player may still have a RemovePlayer RPC buffered for new joining players, in this case, the new joining player will be trying to remove a null player
        if (player == null)
            { return; }

        // Find the matching team
        MinigameTeam correspondingTeam = this.TeamContainers.Find(container => container.Team.Contains(player)).Team;

        if (correspondingTeam == null)
        {
            Debug.LogErrorFormat("Player with ID {0} was not found on any team to remove.", player);
            return;
        }

        // Remove the player from the team, if the player is the client, trigger the events associated with leaving the game
        bool successfullyRemoved = correspondingTeam.RemovePlayer(player);

        // Special handling if the player leaving is part of a game the local player is in
        if (this.LocalPlayerJoined && !player.Equals(PhotonNetwork.player) && successfullyRemoved)
            { this.HandleRemotePlayerLeaveDetails(correspondingTeam, player); }

        if (player.Equals(PhotonNetwork.player))
        {
            if (successfullyRemoved)
                { this.LocalPlayerLeave(); }
            else
                { this.DisplayLeavingError(); }
        }

        // The master client checks to see if the game is empty, if so, reset this game
        if (PhotonNetwork.isMasterClient)
        {
            int players = 0;
            foreach (MinigameTeamContainer container in this.TeamContainers)
                { players += container.Team.Size; }

            if (players == 0)
                { this.photonView.RPC("ResetGame", PhotonTargets.AllViaServer); }
        }

        // if (!this.ValidToStart())
        //     { this.InfoMenu.StartButton.interactable = false; }
    }
开发者ID:oatssss,项目名称:McGill-Once-McGill-Twice,代码行数:44,代码来源:Minigame.cs

示例3: AddPlayerToTeam

    protected virtual void AddPlayerToTeam(PhotonPlayer player, MinigameTeam team, PhotonMessageInfo info)
    {
        // A recently disconnected player may still have an AddPlayer RPC buffered for new joining players, in this case, the new joining player will be trying to add a null player
        if (player == null)
            { return; }

        // Find the matching team
        MinigameTeam actualTeam = this.TeamContainers.Find(container => container.Team.Equals(team)).Team;

        // Add the player to the team, if the player is the client, trigger the events associated with joining a team
        bool successfullyAdded = actualTeam.AddPlayer(player);
        if (player.Equals(PhotonNetwork.player))
        {
            if (successfullyAdded)
                { this.LocalPlayerJoin(actualTeam); }
            else
                { this.DisplayJoiningError(); }
        }

        // if (this.LocalPlayerJoined && this.ValidToStart())
        //     { this.InfoMenu.StartButton.interactable = true; }
    }
开发者ID:oatssss,项目名称:McGill-Once-McGill-Twice,代码行数:22,代码来源:Minigame.cs


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