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


C# EventData.ToStringFull方法代码示例

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


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

示例1: OnEvent

 public override void OnEvent(EventData photonEvent)
 {
     base.OnEvent(photonEvent);
     DebugReturn (DebugLevel.INFO, photonEvent.ToStringFull ());
     switch (photonEvent.Code)
     {
         case EventCode.PropertiesChanged:
             Debug.Log ("propertiesChanged!");
             var data = photonEvent.Parameters[ParameterCode.Properties] as Hashtable;
             DebugReturn(DebugLevel.ALL, "Got EV PropertiesChanged: " + (data["data"] as string));
             break;
         case (byte)SPShared.Operations.SPOperationCode.Join:
             var actorNum = photonEvent.Parameters[(byte)SPShared.Operations.SPParameterCode.ActorNr];
             DebugReturn(DebugLevel.ALL, "Actor: " + actorNum + " joined the game");
             break;
     }
 }
开发者ID:coryleeio,项目名称:SPClient,代码行数:17,代码来源:DemoGame.cs

示例2: HandleEventLeave

    /// <summary>
    /// Called when the event Leave (of some other player) arrived.
    /// Cleans game objects, views locally. The master will also clean the
    /// </summary>
    /// <param name="actorID">ID of player who left.</param>
    private void HandleEventLeave(int actorID, EventData evLeave)
    {
        if (PhotonNetwork.logLevel >= PhotonLogLevel.Informational)
            Debug.Log("HandleEventLeave for player ID: " + actorID + " evLeave: " + evLeave.ToStringFull());

        // actorNr is fetched out of event
        PhotonPlayer player = this.GetPlayerWithId(actorID);
        if (player == null)
        {
            Debug.LogError(String.Format("Received event Leave for unknown player ID: {0}", actorID));
            return;
        }

        bool _isAlreadyInactive =  player.isInactive;

        if (evLeave.Parameters.ContainsKey(ParameterCode.IsInactive))
        {
            // player becomes inactive (but might return / is not gone for good)
            player.isInactive = (bool)evLeave.Parameters[ParameterCode.IsInactive];
            if (player.isInactive && _isAlreadyInactive)
            {
                Debug.LogWarning("HandleEventLeave for player ID: " + actorID + " isInactive: " + player.isInactive + ". Stopping handling if inactive.");
                return;
            }
        }

        // having a new master before calling destroy for the leaving player is important!
        // so we elect a new masterclient and ignore the leaving player (who is still in playerlists).
        // note: there is/was a server-side-error which sent 0 as new master instead of skipping the key/value. below is a check for 0 due to that
        if (evLeave.Parameters.ContainsKey(ParameterCode.MasterClientId))
        {
            int newMaster = (int) evLeave[ParameterCode.MasterClientId];
            if (newMaster != 0)
            {
                this.mMasterClientId = (int)evLeave[ParameterCode.MasterClientId];
                this.UpdateMasterClient();
            }
        }
        else if (!this.CurrentRoom.serverSideMasterClient)
        {
            this.CheckMasterClient(actorID);
        }

        // we let the player up if inactive but if we were already inactive, then we have to actually remove the player properly.
        if (player.isInactive && !_isAlreadyInactive)
        {
            return;
        }

        // destroy objects & buffered messages
        if (this.CurrentRoom != null && this.CurrentRoom.autoCleanUp)
        {
            this.DestroyPlayerObjects(actorID, true);
        }

        RemovePlayer(actorID, player);

        // finally, send notification (the playerList and masterclient are now updated)
        SendMonoMessage(PhotonNetworkingMessage.OnPhotonPlayerDisconnected, player);
    }
开发者ID:yuvadius,项目名称:need4bit,代码行数:65,代码来源:NetworkingPeer.cs


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