Example #1
0
    private void LoadCharmItem()
    {
        if (null == m_DynamicItemGrid)
        {
            LogModule.ErrorLog("m_DynamicItemGrid id null");
            return;
        }
        if (null == m_prefItem)
        {
            LogModule.ErrorLog("tabCharItem is null");
            return;
        }
        Utils.CleanGrid(m_DynamicItemGrid.gameObject);
        int  nIndex      = 0;
        bool bCanAddItem = false;

        foreach (KeyValuePair <int, List <Tab_CharmItem> > pair in TableManager.GetCharmItem())
        {
            Tab_CharmItem tabCharItem = pair.Value[0];
            if (tabCharItem == null)
            {
                continue;
            }
            bCanAddItem = false;
            if (m_Type == ShowType.ALL)
            {
                bCanAddItem = true;
            }
            else if (m_Type == ShowType.FLOWER)
            {
                if (tabCharItem.Type == (int)ShowType.FLOWER)
                {
                    bCanAddItem = true;
                }
            }
            else if (m_Type == ShowType.EGG)
            {
                if (tabCharItem.Type == (int)ShowType.EGG)
                {
                    bCanAddItem = true;
                }
            }
            if (!bCanAddItem)
            {
                continue;
            }
            FlowerEggItemSlot oItem = FlowerEggItemSlot.CreateItem(m_DynamicItemGrid.gameObject, m_prefItem, nIndex.ToString(), this);
            if (oItem != null)
            {
                oItem.SetData(tabCharItem);
                if (m_CurSelect == null)
                {
                    SelectItem(oItem);
                }
            }
            nIndex++;
        }
        m_nItemNum       = 1;
        m_NumInput.value = m_nItemNum.ToString();
    }
Example #2
0
 public void OpenFlowerEgg(UInt64 Guid, ShowType type)
 {
     m_Guid      = Guid;
     m_Type      = type;
     m_nItemNum  = 1;
     m_CurSelect = null;
     LoadCharmItem();
 }
Example #3
0
 public void OnClickItem(FlowerEggItemSlot oItem)
 {
     if (oItem == null)
     {
         LogModule.ErrorLog("OnClickItem::oItem = null");
         return;
     }
     SelectItem(oItem);
 }
Example #4
0
 public void SelectItem(FlowerEggItemSlot selectItem)
 {
     if (null == selectItem)
     {
         m_CurSelect        = null;
         m_LableNumber.text = "";
         return;
     }
     if (m_CurSelect != null)
     {
         m_CurSelect.ItemSlotChooseCancel();
     }
     m_CurSelect = selectItem;
     m_CurSelect.ItemSlotChoose();
     UpdateItemNum();
 }
    public static FlowerEggItemSlot CreateItem(GameObject grid, GameObject resItem, string name, FlowerEggWindow parent)
    {
        GameObject curItem = Utils.BindObjToParent(resItem, grid, name);

        if (null == curItem)
        {
            return(null);
        }
        curItem.SetActive(true);
        FlowerEggItemSlot curItemComponent = curItem.GetComponent <FlowerEggItemSlot>();

        if (null == curItemComponent)
        {
            return(null);
        }
        curItemComponent.SetParent(parent);
        return(curItemComponent);
    }