コード例 #1
0
    void RefreshUIById(int id)
    {
        for (int i = 0; i < mItemCount; i++)
        {
            if (items[i].GetTableId() == id)
            {
                Monthcard mc = ObjectSelf.GetInstance().GetMontCardInfoById(id);
                //第一个特殊处理;
                if (id == 1)
                {
                    if (mc == null)
                    {
                        items[i].SetMonthcardGotType(Monthcard_GotType.HaveNotGot);
                    }
                    else
                    {
                        if (mc.istodayget == 1)
                        {
                            items[i].SetMonthcardGotType(Monthcard_GotType.HaveAndGot);
                        }
                        else
                        {
                            items[i].SetMonthcardGotType(Monthcard_GotType.HaveNotGot);
                        }
                    }
                }
                else
                {
                    if (mc == null)
                    {
                        items[i].SetMonthcardGotType(Monthcard_GotType.NotHave);
                    }
                    else
                    {
                        //根据当前时间判断是否过期;
                        DateTime dt = TimeUtils.ConverMillionSecToDateTime(mc.overtime, ObjectSelf.GetInstance().ServerTimeZone);

                        if (ObjectSelf.GetInstance().ServerDateTime >= dt)//过期;
                        {
                            items[i].SetMonthcardGotType(Monthcard_GotType.NotHave);
                        }
                        else//没过期;
                        {
                            if (mc.istodayget == 1)//已经领取;
                            {
                                items[i].SetMonthcardGotType(Monthcard_GotType.HaveAndGot);
                            }
                            else
                            {
                                items[i].SetMonthcardGotType(Monthcard_GotType.HaveNotGot);
                            }
                        }
                    }
                }
            }
        }
    }
コード例 #2
0
    public static TimeSpan GetMonthCardToEnd(int monthCardId)
    {
        Monthcard mc = ObjectSelf.GetInstance().GetMontCardInfoById(monthCardId);

        if (mc == null)
        {
            return(TimeSpan.Zero);
        }

        DateTime dt = TimeUtils.ConverMillionSecToDateTime(mc.overtime, ObjectSelf.GetInstance().ServerTimeZone);

        return(dt - ObjectSelf.GetInstance().ServerDateTime);
    }