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


C# ReceiveDataReader.ReadInt32方法代码示例

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


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

示例1: ReceiveMessage_WorldCreateBeginToClient

        private bool ReceiveMessage_WorldCreateBeginToClient(NetworkNode.ConnectedNode sender,
            MessageType messageType, ReceiveDataReader reader, ref string additionalErrorMessage)
        {
            string worldTypeName = reader.ReadString();
            string mapVirtualFileName = reader.ReadString();
            int worldCheckIdentifier = reader.ReadInt32();
            if (!reader.Complete())
                return false;

            //send world identifier back to server
            {
                MessageType messageType2 = GetMessageType("worldIdentifierToServer");
                SendDataWriter writer = BeginMessage(messageType2);
                writer.Write(worldCheckIdentifier);
                EndMessage();
            }

            bool remoteWorldAlreadyExists = EntitySystemWorld.Instance.RemoteEntityWorlds.Contains(
                serverRemoteEntityWorld);

            if (!remoteWorldAlreadyExists)
            {
                serverRemoteEntityWorld = new RemoteEntityWorld("Server remote entity world");
                networkingInterface.ConnectRemoteEntityWorld(serverRemoteEntityWorld);
            }

            WorldType worldType = EntityTypes.Instance.GetByName(worldTypeName) as WorldType;
            if (worldType == null)
            {
                Log.Fatal("EntitySystemClientNetworkService: " +
                    "ReceiveMessage_WorldCreateBeginToClient: World type \"{0}\" is not exists.",
                    worldTypeName);
            }

            if (WorldCreateBegin != null)
                WorldCreateBegin(this, worldType, mapVirtualFileName);

            return true;
        }
开发者ID:AKNightHawk,项目名称:AssaultKnights2,代码行数:39,代码来源:EntitySystemNetworkService.cs

示例2: GetCookedTriangleMeshFromCache

        byte[] GetCookedTriangleMeshFromCache( Vec3[] vertices, int[] indices, short[] materialIndices )
        {
            try
            {
                string cacheDirectory = "user:Caches\\PhysXCookedTriangleMeshes";
                string realCacheDirectory = VirtualFileSystem.GetRealPathByVirtual( cacheDirectory );

                if( Directory.Exists( realCacheDirectory ) )
                {
                    byte[] sourceBuffer;
                    string baseName;
                    GetCookTriangleMeshSourceBuffer( vertices, indices, materialIndices, out sourceBuffer, out baseName );
                    string realFileName = Path.Combine( realCacheDirectory, baseName + ".cache" );

                    if( File.Exists( realFileName ) )
                    {
                        int major, minor, bugfix;
                        PhysXNativeWorld.GetSDKVersion( out major, out minor, out bugfix );
                        int additional = 0;
                        int version = ( ( ( ( ( major << 8 ) + minor ) << 8 ) + bugfix ) << 8 ) + additional;

                        //File format:
                        //1. PhysX version (4 bytes)
                        //2. source buffer length (4 bytes)
                        //3. source buffer
                        //4. cooked data length (4 bytes)
                        //5. cooked data

                        //no archive
                        byte[] fileData = File.ReadAllBytes( realFileName );

                        //archive
                        //byte[] fileData;
                        ////Mono runtime specific
                        //if( RuntimeFramework.Runtime == RuntimeFramework.RuntimeType.Mono )
                        //   ZipConstants.DefaultCodePage = 0;
                        //using( ZipFile zipFile = new ZipFile( realFileName ) )
                        //{
                        //   ZipEntry entry = zipFile.GetEntry( "data" );
                        //   Stream zipStream = zipFile.GetInputStream( entry );
                        //   fileData = new byte[ entry.Size ];
                        //   if( zipStream.Read( fileData, 0, (int)entry.Size ) != fileData.Length )
                        //      return null;
                        //}

                        ReceiveDataReader reader = new ReceiveDataReader();
                        reader.Init( fileData, 0, fileData.Length * 8 );

                        //check for old version
                        int fileVersion = reader.ReadInt32();
                        if( version != fileVersion )
                            return null;

                        int fileBufferSize = reader.ReadInt32();
                        if( sourceBuffer.Length != fileBufferSize )
                            return null;

                        byte[] fileSourceBuffer = new byte[ fileBufferSize ];
                        reader.ReadBuffer( fileSourceBuffer );
                        unsafe
                        {
                            fixed( byte* pSource = sourceBuffer, pFileBuffer = fileSourceBuffer )
                            {
                                if( NativeUtils.CompareMemory( (IntPtr)pSource, (IntPtr)pFileBuffer,
                                    sourceBuffer.Length ) != 0 )
                                {
                                    return null;
                                }
                            }
                        }

                        int cookedSize = reader.ReadInt32();
                        byte[] cookedData = new byte[ cookedSize ];
                        reader.ReadBuffer( cookedData );

                        return cookedData;
                    }
                }
            }
            catch { }

            return null;
        }
开发者ID:whztt07,项目名称:SDK,代码行数:83,代码来源:PhysXBody.cs

示例3: ReceiveMessage_CheckWorldIdentifierToServer

        private bool ReceiveMessage_CheckWorldIdentifierToServer(NetworkNode.ConnectedNode sender,
            MessageType messageType, ReceiveDataReader reader, ref string additionalErrorMessage)
        {
            int identifier = reader.ReadInt32();
            if (!reader.Complete())
                return false;

            ClientRemoteEntityWorld fromRemoteEntityWorld = GetRemoteEntityWorld(sender);
            if (fromRemoteEntityWorld == null)
            {
                //no such world already. as example World has been deleted.
                return true;
            }

            fromRemoteEntityWorld.ReceivedWorldIdentifier = identifier;

            return true;
        }
开发者ID:AKNightHawk,项目名称:AssaultKnights2,代码行数:18,代码来源:EntitySystemNetworkService.cs

示例4: Server_ReceivePlayerTeam

        void Server_ReceivePlayerTeam(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            uint uni = reader.ReadUInt32();
            PlayerTeam value = (PlayerTeam)reader.ReadInt32();
            if (!reader.Complete())
                return;
            this.playerTeam = value;

               UserManagementServerNetworkService.UserInfo uinfo = GameNetworkServer.Instance.UserManagementService.GetUser(uni);

               PlayerManager.ServerOrSingle_Player player = PlayerManager.Instance.ServerOrSingle_GetPlayer(uinfo.Name);
               player.Team = playerTeam;

            //   foreach( PlayerManager.ServerOrSingle_Player player in
            //			PlayerManager.Instance.ServerOrSingle_Players ) {
             //       if (player.Identifier == uni )
              //      {
               //         player.Team = value;
             //       }
              //  }
        }
开发者ID:yoda,项目名称:gamedesign,代码行数:21,代码来源:PlayerCharacter.cs


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