コード例 #1
0
ファイル: ShopModule.cs プロジェクト: wanggan768q/csommon
    public void UpdateField(int Id, int Index, byte[] buff, int start, int len)
    {
        SyncIdE SyncId = (SyncIdE)Id;

        byte[] updateBuffer = new byte[len];
        Array.Copy(buff, start, updateBuffer, 0, len);
        int  iValue = 0;
        long lValue = 0;

        switch (SyncId)
        {
        case SyncIdE.SHOPARRAY:
            if (Index < 0)
            {
                m_Instance.ClearShopArray(); break;
            }
            if (Index >= m_Instance.SizeShopArray())
            {
                int Count = Index - m_Instance.SizeShopArray() + 1;
                for (int i = 0; i < Count; i++)
                {
                    m_Instance.AddShopArray(new ShopShopObjWraperV1());
                }
            }
            m_Instance.GetShopArray(Index).FromMemoryStream(new MemoryStream(updateBuffer));
            break;

        default:
            break;
        }

        try
        {
            if (NotifySyncValueChanged != null)
            {
                NotifySyncValueChanged(Id, Index);
            }
        }
        catch
        {
            Debug.Log("ShopData.NotifySyncValueChanged catch exception");
        }
        updateBuffer.GetType();
        iValue++;
        lValue++;
    }