Exemplo n.º 1
0
    public void SetData(int index, UIBuildWndItem item)
    {
        UIBuildMenuItemData data = null;

        if (m_Datas.ContainsKey(index))
        {
            data = m_Datas[index];
        }
        else
        {
            data = new UIBuildMenuItemData();
            m_Datas.Add(index, data);
        }

        data.m_Index       = item.mIndex;
        data.m_TargetIndex = item.mTargetIndex;
        data.m_Type        = (int)item.mTargetItemType;
        data.m_IconName    = item.mContentSprite.spriteName;
        data.m_SubsetIndex = item.mSubsetIndex;
        data.m_ItemId      = item.ItemId;
    }
Exemplo n.º 2
0
    protected override void SetData(byte[] data)
    {
        if (data == null)
        {
            return;
        }
        try
        {
            using (MemoryStream ms_iso = new MemoryStream(data))
            {
                BinaryReader r = new BinaryReader(ms_iso);

                int version = r.ReadInt32();

                switch (version)
                {
                case 0x0000001:
                {
                    m_First = false;
                    int count = r.ReadInt32();

                    for (int i = 0; i < count; i++)
                    {
                        UIBuildMenuItemData item = new UIBuildMenuItemData();
                        int key = r.ReadInt32();

                        item.m_Index       = r.ReadInt32();
                        item.m_TargetIndex = r.ReadInt32();
                        item.m_Type        = r.ReadInt32();
                        item.m_SubsetIndex = r.ReadInt32();
                        item.m_IconName    = r.ReadString();
                        item.m_ItemId      = r.ReadInt32();

                        m_Datas.Add(key, item);
                    }
                } break;

                case 0x0000002:
                {
                    m_First = r.ReadBoolean();

                    int count = r.ReadInt32();

                    for (int i = 0; i < count; i++)
                    {
                        UIBuildMenuItemData item = new UIBuildMenuItemData();
                        int key = r.ReadInt32();

                        item.m_Index       = r.ReadInt32();
                        item.m_TargetIndex = r.ReadInt32();
                        item.m_Type        = r.ReadInt32();
                        item.m_SubsetIndex = r.ReadInt32();
                        item.m_IconName    = r.ReadString();
                        item.m_ItemId      = r.ReadInt32();

                        m_Datas.Add(key, item);
                    }
                } break;

                default:
                    break;
                }

                r.Close();
            }
        }
        catch (System.Exception e)
        {
            Debug.LogWarning(e);
        }
    }
Exemplo n.º 3
0
 public void AddData(UIBuildMenuItemData data)
 {
     m_Datas[data.m_Index] = data;
 }