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


C# NetworkReader.ReadInt32方法代码示例

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


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

示例1: ClientVC

    public ClientVC(NetworkReader nr)
        : base(new Vec2i(0,0), 0)
    {
        this.data = new VesselTile[VesselChunk.DATA_COUNT];

        index.x = nr.ReadInt32();
        index.y = nr.ReadInt32();

        version = nr.ReadUInt32();
        tileCount = nr.ReadInt32();

        for (int i = 0; i < tileCount; i++) {
            //read in vessel tile
            Vec2i tileI;

            tileI.x = nr.ReadInt32();
            tileI.y = nr.ReadInt32();
            FloorType floor0 = (FloorType)nr.ReadByte();
            FloorType floor1 = (FloorType)nr.ReadByte();
            WallTypeMask wallMask = (WallTypeMask)nr.ReadByte();
            bool wallNode = nr.ReadBoolean();

            VesselTile tile = new VesselTile(wallMask, wallNode, floor0, floor1, (uint)VesselTile.FLAGS.NONE);

            SetTile(tileI, tile);
        }
    }
开发者ID:NickPowers43,项目名称:SW,代码行数:27,代码来源:ClientVC.cs

示例2: Deserialize

 public override void Deserialize(NetworkReader reader)
 {
     proxyId = reader.ReadInt16();
     packet.Compression = (VoiceChatCompression)reader.ReadInt16();
     packet.Length = reader.ReadInt32();
     packet.Data = reader.ReadBytesAndSize();
 }
开发者ID:dgkae,项目名称:unityassets,代码行数:7,代码来源:VoiceChatPacketMessage.cs

示例3: OnDeserialize

    private CharacterState serverLastState; //SERVER: Store last state

    #endregion Fields

    #region Methods

    /// <summary>
    /// All Clients: Deserialize the state from network
    /// </summary>
    /// <param name="reader"></param>
    /// <param name="initialState"></param>
    public override void OnDeserialize(NetworkReader reader, bool initialState)
    {
        CharacterState state = new CharacterState();

        state.state    = reader.ReadInt32();
        state.position = reader.ReadVector3();
        state.rotation = reader.ReadQuaternion();

        //Client: Received a new state for the local player, treat it as an ACK and do reconciliation
        if (isLocalPlayer) {
            SendMessage("ServerState", state, SendMessageOptions.DontRequireReceiver);
        } else {
            //Other Clients: Received a state, treat it like a new position snapshot from authority
            if (initialState)
            {
                //Others Clients: First state, just snap to new position
                transform.position = state.position;
                transform.rotation = state.rotation;
            }
            else if (networkInterpolation != null)
            {
                //Others Clients: Interpolate between received positions
                networkInterpolation.ReceiveState(state);
            }
        }
    }
开发者ID:atrakeur,项目名称:unity-unet-authoritative-networking,代码行数:37,代码来源:CharacterNetworkSync.cs

示例4: Deserialize

 public override void Deserialize(NetworkReader reader)
 {
     base.Deserialize(reader);
     int count = reader.ReadInt32();
     Polyline = new List<Vector3>(count);
     for(int i=0; i < count; i++)
         Polyline.Add(reader.ReadVector3());
 }
开发者ID:yuta0023,项目名称:demo,代码行数:8,代码来源:EditorMessages.cs

示例5: Deserialize

 public override void Deserialize(NetworkReader reader)
 {
     m_id = reader.ReadNetworkId();
     m_parentId = reader.ReadNetworkId();
     m_childId = reader.ReadInt32();
     m_position = reader.ReadVector3();
     m_payload = reader.ReadBytesAndSize();
 }
开发者ID:bpeake13,项目名称:UnityChildSpawning,代码行数:8,代码来源:ChildSpawnMessage.cs

示例6: Deserialize

    public override void Deserialize(NetworkReader reader)
    {
        base.Deserialize(reader);

        byte setType = reader.ReadByte();
        switch (setType) {
            case (byte)0: _actionSet = new SinglePanelActionSet(); break;
            case (byte)1: _actionSet = new ReplacementPanelActionSet(); break;
            case (byte)2: _actionSet = new CodePanelActionSet(); break;
            default: throw new Exception("Unexpected Action Set ID " + setType);
        }

        _actionSet.Deserialize(reader);

        _x = reader.ReadInt32();
        _y = reader.ReadInt32();
        _prefabIndex = reader.ReadInt32();
    }
开发者ID:imclab,项目名称:SpaceLeap,代码行数:18,代码来源:CreatePanelMessage.cs

示例7: Deserialize

 public override void Deserialize(NetworkReader reader)
 {
     base.Deserialize(reader);
     _instructionBase = reader.ReadString();
     _variantReplacements = new string[reader.ReadInt32()];
     for (int i = 0; i < _variantReplacements.Length; i++) {
         _variantReplacements[i] = reader.ReadString();
     }
 }
开发者ID:imclab,项目名称:SpaceLeap,代码行数:9,代码来源:ReplacementPanelActionSet.cs

示例8: Deserialize

    public override void Deserialize(NetworkReader reader) {
        //Get the no of inputs received
        int count = reader.ReadInt32();

        //Prepaare list
        if (inputsList != null) {
            inputsList.Clear(); //Detatch prev elements
        }
        inputsList = new List<Inputs>(); //Detatch prev mem

        //Build all inputs
        for (int i = 0; i < count; i++){
            //Create
            Inputs input = new Inputs();

            //Deserialize individually
            input.crouch = reader.ReadBoolean();
            input.jump = reader.ReadBoolean();
            input.move = reader.ReadBoolean();
            input.pitch = reader.ReadSingle();
            input.rotate = reader.ReadBoolean();
            input.timeStamp = reader.ReadDouble();
            input.walk = reader.ReadBoolean();
            bool[] wasd = new bool[4];
            wasd[0] = reader.ReadBoolean();
            wasd[1] = reader.ReadBoolean();
            wasd[2] = reader.ReadBoolean();
            wasd[3] = reader.ReadBoolean();
            input.wasd = wasd;
            input.yaw = reader.ReadSingle();

            //Add to the message list
            inputsList.Add(input);

            //Check if is the last input and register stamp
            if(i == count - 1) {
                stamp = input.timeStamp;
            }
        }
    }
开发者ID:lucasmontec,项目名称:UnetCharacterController,代码行数:40,代码来源:InputListMessage.cs

示例9: ReceiveSetTile

    private void ReceiveSetTile(NetworkReader reader)
    {
        int location = reader.ReadInt32();
        byte tile = reader.ReadByte();

        if (hosting)
        {
            SendAll(SetTileMessage(location, tile));
        }

        if (world.tilemap[location] != tile)
        {
            audio.PlayOneShot(placeSound);
            worldView.SetTile(location, tile);
        }
    }
开发者ID:Ragzouken,项目名称:smooltool,代码行数:16,代码来源:Test.cs

示例10: Deserialize

            public override void Deserialize(NetworkReader reader)
            {
                name = reader.ReadString();

                var isNull = reader.ReadBoolean();
                if (isNull){
                    value = null;
                    return;
                }

                var typeName = reader.ReadString();
                var t = System.Type.GetType(typeName);

                if (t == typeof(string)){
                    value = reader.ReadString();
                    return;
                }
                if (t == typeof(bool)){
                    value = reader.ReadBoolean();
                    return;
                }
                if (t == typeof(int)){
                    value = reader.ReadInt32();
                    return;
                }
                if (t == typeof(float)){
                    value = reader.ReadSingle();
                    return;
                }
                if (t == typeof(Color)){
                    value = reader.ReadColor();
                    return;
                }
                if (t == typeof(Vector2)){
                    value = reader.ReadVector2();
                    return;
                }
                if (t == typeof(Vector3)){
                    value = reader.ReadVector3();
                    return;
                }
                if (t == typeof(Vector4)){
                    value = reader.ReadVector4();
                    return;
                }
                if (t == typeof(Quaternion)){
                    value = reader.ReadQuaternion();
                    return;
                }
                if (t == typeof(GameObject)){
                    value = reader.ReadGameObject();
                    return;
                }
                if (typeof(Component).RTIsAssignableFrom(t)){
                    var go = reader.ReadGameObject();
                    if (go != null){
                        value = go.GetComponent(t);
                    }
                    return;
                }
            }
开发者ID:nemish,项目名称:cubematters,代码行数:61,代码来源:SyncBlackboard.cs

示例11: ReceiveLockTile

    private void ReceiveLockTile(NetworkReader reader)
    {
        World.Avatar avatar = ID2Avatar(reader.ReadInt32());
        byte tile = reader.ReadByte();

        if (avatar != null)
        {
            Debug.LogFormat("{0} locking {1}", avatar.id, tile);

            locks[tile] = avatar;

            if (avatar == worldView.viewer) OpenForEdit(tile);

            if (hosting) SendAll(LockTileMessage(avatar, tile));
        }
        else if (locks.ContainsKey(tile))
        {
            Debug.LogFormat("unlocking {0}", tile);

            locks.Remove(tile);

            if (hosting) SendAll(LockTileMessage(null, tile));
        }

        tilePalette.Refresh();
    }
开发者ID:Ragzouken,项目名称:smooltool,代码行数:26,代码来源:Test.cs

示例12: Update


//.........这里部分代码省略.........
                {
                    Type type = (Type) reader.ReadByte();

                    if (type == Type.Tilemap)
                    {
                        world.tilemap = reader.ReadBytesAndSize();
                        worldView.SetWorld(world);
                    }
                    else if (type == Type.Palette)
                    {
                        for (int i = 0; i < 16; ++i)
                        {
                            world.palette[i] = reader.ReadColor32();
                            SetPalette((byte) i, world.palette[i]);
                        }
                    }
                    else if (type == Type.PaletteEdit)
                    {
                        ReceivePaletteEdit(reader);
                    }
                    else if (type == Type.Walls)
                    {
                        world.walls.Clear();

                        foreach (var wall in reader.ReadBytesAndSize())
                        {
                            world.walls.Add(wall);
                        }

                        worldView.RefreshWalls();
                    }
                    else if (type == Type.Tileset)
                    {
                        int id = reader.ReadInt32();

                        tiledata[id] = reader.ReadBytesAndSize();
                    }
                    else if (type == Type.ReplicateAvatar)
                    {
                        ReceiveCreateAvatar(reader);
                    }
                    else if (type == Type.DestroyAvatar)
                    {
                        ReceiveDestroyAvatar(reader);
                    }
                    else if (type == Type.GiveAvatar)
                    {
                        ReceiveGiveAvatar(reader);
                    }
                    else if (type == Type.MoveAvatar)
                    {
                        World.Avatar avatar = ID2Avatar(reader.ReadInt32());
                        Vector2 dest = reader.ReadVector2();

                        if (hosting)
                        {
                            if (connectionID == avatar.id
                             && !Blocked(avatar, dest))
                            {
                                avatar.source = avatar.destination;
                                avatar.destination = dest;
                                avatar.u = 0;

                                SendAll(MoveAvatarMessage(avatar, avatar.destination), except: avatar.id);
                            }
                            else
开发者ID:Ragzouken,项目名称:smooltool,代码行数:67,代码来源:Test.cs

示例13: ReadChunkRequest

    private ServerVC ReadChunkRequest(NetworkReader nr)
    {
        Vec2i index;
        index.x = nr.ReadInt32();
        index.y = nr.ReadInt32();

        uint version = nr.ReadUInt32();

        if (version == uint.MaxValue) {
            return (ServerVC)chunks.TryGet(index);
        } else {
            ServerVC vc = (ServerVC)chunks.TryGet(index);

            if (version != vc.version) {
                return vc;
            } else {
                return null;
            }
        }
    }
开发者ID:NickPowers43,项目名称:SW,代码行数:20,代码来源:ServerVessel.cs

示例14: OnDeserialize

 public override void OnDeserialize(NetworkReader reader, bool initialState)
 {
     if (initialState)
     {
         int stateNameHash = reader.ReadInt32();
         float normalizedTime = reader.ReadSingle();
         this.ReadParameters(reader, false);
         this.m_Animator.Play(stateNameHash, 0, normalizedTime);
     }
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:10,代码来源:NetworkAnimator.cs

示例15: Deserialize

 public override void Deserialize(NetworkReader reader)
 {
     Result = reader.ReadInt32();
     JustDoIt = reader.ReadBoolean();
     PlayerID = reader.ReadInt64();
 }
开发者ID:PixelCreators,项目名称:HarryParker,代码行数:6,代码来源:PlayerResult.cs


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