예제 #1
0
    void OnWelfareBtnUIEvent(UIEventType eventType, object data, object param)
    {
        switch (eventType)
        {
        case UIEventType.Click:
            if (data is UIWelfareTypeGrid)
            {
                UIWelfareTypeGrid grid = data as UIWelfareTypeGrid;
                //日期限制
                if (grid.SevenDayIndex > m_dataManager.ServerOpenCurrDay)
                {
                    return;
                }
                if (grid != null)
                {
                    curType = BtnType.Content_1;
                    OnToggleValueChange(grid.SevenDayIndex);
                    if (activedType == null)
                    {
                        activedType = grid;
                    }
                    else
                    {
                        if (activedType != grid)
                        {
                            activedType.OnSevenDaySelect(false);
                        }
                    }
                    grid.OnSevenDaySelect(true);
                    activedType = grid;
                }
            }
            else if (data is UISevenDayRewardGrid)
            {
                UISevenDayRewardGrid grid   = data as UISevenDayRewardGrid;
                List <uint>          gotIDs = m_dataManager.m_lstServerOpenGotReward;
                uint curNum = m_dataManager.CurActiveNum;
                uint id     = grid._UIItemRewardDatas.DataID;
                if (!gotIDs.Contains(id))
                {
                    for (int i = 0; i < awardList.Count; i++)
                    {
                        if (awardList[i].id == id && curNum >= awardList[i].param1)
                        {
                            DataManager.Instance.Sender.RequestGetServerOpenReward(id);
                        }
                    }
                }
            }

            break;
        }
    }
예제 #2
0
 void OnWelfareBtnDataUpdate(UIGridBase data, int index)
 {
     if (data is UIWelfareTypeGrid)
     {
         UIWelfareTypeGrid grid = data as UIWelfareTypeGrid;
         grid.SetSevenDayGridData(index);
         if (activedType == null && index == 0)
         {
             OnToggleValueChange(grid.SevenDayIndex);
             grid.OnSevenDaySelect(true);
             activedType = grid;
         }
         if (!m_dicToggles.ContainsKey(index + 1))
         {
             m_dicToggles.Add(index + 1, grid);
         }
     }
     if (data is UISevenDayRewardGrid)
     {
         UISevenDayRewardGrid grid = data as UISevenDayRewardGrid;
         if (m_lst_UIItemRewardDatas != null)
         {
             if (index < m_lst_UIItemRewardDatas.Count)
             {
                 grid.SetGridData(m_lst_UIItemRewardDatas[index]);
             }
         }
     }
 }