Beispiel #1
0
    void AddFloorInst(int floorID, FloorInstData data)
    {
        FloorInst inst = new FloorInst();

        inst.floorID  = floorID;
        inst.instData = data;
        m_floorInsts.Add(inst.floorID, inst);
    }
Beispiel #2
0
    public FloorInst GetFloorInst(int floorID)
    {
        FloorInst inst = null;

        if (m_floorInsts.TryGetValue(floorID, out inst))
        {
            return(inst);
        }
        return(null);
    }
Beispiel #3
0
    public void ReplaceFloorInstData(int floorID, FloorInstData data)
    {
        FloorInst inst = GetFloorInst(floorID);

        if (inst != null)
        {
            inst.instData = data;
        }
        else
        {
            AddFloorInst(floorID, data);
        }
    }
Beispiel #4
0
    public void Deserialize(PacketReader stream)
    {
        int mask = stream.ReadInt32();

        if ((mask & (int)ENSerializeMask.enSerializeDirty) > 0)
        {
            Debug.Log("Sync FloorInsts error, mask & enSerializeDirty > 0 ");
            return;
        }
        byte version = stream.ReadByte();
        int  count   = stream.ReadInt32();

        m_floorInsts.Clear();
        for (int index = 0; index < count; index++)
        {
            FloorInst inst = new FloorInst();
            inst.floorID = stream.ReadInt32();
            byte[]       tmp            = stream.ReadBuffer(64);
            BinaryHelper instDataHelper = new BinaryHelper(tmp);
            inst.instData.Read(instDataHelper);
            m_floorInsts.Add(inst.floorID, inst);
        }
    }