public void updateUI()
    {
        int days = ServerTimeKit.getCurrentMonth();

        if (days == 1 || days == 3 || days == 5 || days == 7 || days == 8 || days == 10 || days == 12)
        {
            count = 31;
        }
        else if (days == 4 || days == 6 || days == 9 || days == 11)
        {
            count = 30;
        }
        else
        {
            if (ServerTimeKit.getYear() % 4 == 0 || (ServerTimeKit.getYear() % 100 == 0 && ServerTimeKit.getYear() % 400 == 0))
            {
                count = 29;
            }
            else
            {
                count = 28;
            }
        }
        if (monthNum1 != null && monthNum2 != null)
        {
            if (ServerTimeKit.getCurrentMonth() < 10)
            {
                ResourcesManager.Instance.LoadAssetBundleTexture(ResourcesManager.SIGNIN_TEXTURE + ("month_0" + ServerTimeKit.getCurrentMonth()), monthNum1);
                monthNum1.transform.localPosition = new Vector3(-115, 63, 0);
                monthNum2.gameObject.SetActive(false);
            }
            else
            {
                ResourcesManager.Instance.LoadAssetBundleTexture(ResourcesManager.SIGNIN_TEXTURE + ("month_01"), monthNum1);
                ResourcesManager.Instance.LoadAssetBundleTexture(ResourcesManager.SIGNIN_TEXTURE + ("month_0" + (ServerTimeKit.getCurrentMonth() - 10)), monthNum2);
                monthNum1.transform.localPosition = new Vector3(-132, 63, 0);
                monthNum2.transform.localPosition = new Vector3(-95, 63, 0);
            }
        }
        if (signTotalNum != null)
        {
            signTotalNum.text = (SignInManagerment.Instance.stateList.Count > count ? count : SignInManagerment.Instance.stateList.Count) + "/" + count;
        }
        if (buttonAllSignAward != null)
        {
            buttonAllSignAward.disableButton(true);
            int data = ServerTimeKit.getDataBySeconds(activeTime.getStartTime());
            if (SignInManagerment.Instance.stateList.Count >= (count - data + 1))
            {
                int          ssid   = StringKit.toInt(notice.sid + "" + ServerTimeKit.getCurrentMonth());
                SignInSample sample = SignInSampleManager.Instance.getSignInSampleBySid(ssid);
                if (sample != null && !SignInManagerment.Instance.stateList.Contains(sample.allSignSid))
                {
                    buttonAllSignAward.disableButton(false);
                }
            }
        }
    }
Exemple #2
0
    private bool hasInfo()
    {
        int          ssid   = StringKit.toInt(sid + "" + ServerTimeKit.getCurrentMonth());
        SignInSample sample = SignInSampleManager.Instance.getSignInSampleBySid(ssid);

        if (sample == null)
        {
            return(false);
        }
        return(true);
    }
    /// <summary>
    /// 加载数据
    /// </summary>
    public void loadPrize()
    {
        Utils.RemoveAllChild(signAwardContent.transform);
        updateUI();
        int          ssid   = StringKit.toInt(notice.sid + "" + ServerTimeKit.getCurrentMonth());
        SignInSample sample = SignInSampleManager.Instance.getSignInSampleBySid(ssid);

        if (sample == null)
        {
            return;
        }
        allSignPrize = sample.allSignPrize;
        allSignSid   = sample.allSignSid;
        List <PrizeSample> prize = sample.list;
        List <int>         sids  = sample.daySids; //日期sid
        List <int>         types = sample.types;   //奖励类型(用于背景的显示)

        for (int i = 0; i < count; i++)
        {
            GameObject signBtn = NGUITools.AddChild(signAwardContent, signInButton);
            signBtn.transform.localScale    = new Vector3(0.55f, 0.55f, 0);
            signBtn.transform.localPosition = new Vector3(-216 + (int)(i % 7) * 71, 155 - (int)(i / 7) * 80, 0);
            SignInButton signIn = signBtn.GetComponent <SignInButton>();
            signIn.init(this);
            if (SignInManagerment.Instance.stateList.Contains(sids[i]))//签过的
            {
                signIn.init(prize[i], SIGN_IN_YES, i + 1, sids[i], types[i]);
            }
            else
            {
                signIn.init(prize[i], SIGN_IN_NO, i + 1, sids[i], types[i]);
            }
            signIn.fatherWindow = win;
        }
        GameObject allSignPrizeObj = NGUITools.AddChild(allSignAwardPoint, goodsView);

        allSignPrizeObj.transform.localScale = new Vector3(0.8f, 0.8f, 0);
        allSignPrizeObj.GetComponent <GoodsView>().init(allSignPrize);
        allSignPrizeObj.GetComponent <GoodsView>().fatherWindow = win;
    }
    public void updateTime()
    {
        if (noticeSample == null)
        {
            return;
        }
        if (tip == null)
        {
            return;
        }
        int type    = noticeSample.type;
        int now     = ServerTimeKit.getSecondTime();
        int current = ServerTimeKit.getCurrentSecond();

        if (type == NoticeType.HAPPY_TURN_SPRITE)
        {
            if (UserManager.Instance.self.getUserLevel() >= noticeSample.levelLimit && NoticeManagerment.Instance.turnSpriteData.num != 0)
            {
                tip.SetActive(true);
                tipLabel.text = NoticeManagerment.Instance.turnSpriteData.num.ToString();
            }
            else if (tip.activeSelf)
            {
                tip.SetActive(false);
            }
        }
        else if (type == NoticeType.XIANSHI_HAPPY_TURN)
        {
            if (UserManager.Instance.self.getUserLevel() >= noticeSample.levelLimit && NoticeManagerment.Instance.xs_turnSpriteData.num != 0)
            {
                tip.SetActive(true);
                tipLabel.text = NoticeManagerment.Instance.xs_turnSpriteData.num.ToString();
            }
            else if (tip.activeSelf)
            {
                tip.SetActive(false);
            }
        }
        else if (type == NoticeType.ALCHEMY)
        {
            if (!(NoticeManagerment.Instance.getAlchemyConsume() > 0))
            {
                if (!tip.activeSelf)
                {
                    tip.gameObject.SetActive(true);
                }
            }
            else if (tip.activeSelf)
            {
                tip.gameObject.SetActive(false);
            }
        }
        else if (type == NoticeType.HEROEAT)
        {
            int[] info = NoticeManagerment.Instance.getHeroEatInfo();
            if (info != null && info [1] < now && now < info [2] && info [3] == 0)
            {
                if (!tip.activeSelf)
                {
                    tip.gameObject.SetActive(true);
                }
            }
            else if (tip.activeSelf)
            {
                tip.gameObject.SetActive(false);
            }
        }
        else if (type == NoticeType.TOPUPNOTICE || type == NoticeType.COSTNOTICE || type == NoticeType.TIME_RECHARGE || type == NoticeType.NEW_RECHARGE || type == NoticeType.NEW_CONSUME)
        {
            List <Recharge> temps = RechargeManagerment.Instance.getValidRechargesByTime((noticeSample.content as SidNoticeContent).sids, now);
            if (temps == null || temps.Count == 0)
            {
                tip.gameObject.SetActive(false);
            }
            else
            {
                tip.gameObject.SetActive(true);
                tipLabel.text = temps.Count.ToString();
            }
        }
        else if (type == NoticeType.NEW_EXCHANGE)
        {
            //List<Exchange> temps = ExchangeManagerment.Instance.getValidExchangesByTime ((noticeSample.content as NewExchangeNoticeContent).actives[0].exchangeSids, noticeSample.type, now);
//			if (temps == null || temps.Count == 0) {
//				tip.gameObject.SetActive (false);
//			}else{
//				tip.gameObject.SetActive (true);
//				tipLabel.text = temps.Count.ToString ();
//			}
            int count = 0;
            for (int i = 0; i < (noticeSample.content as NewExchangeNoticeContent).actives.Length; i++)
            {
                count += (ExchangeManagerment.Instance.getValidExchangesByTime((noticeSample.content as NewExchangeNoticeContent).actives[i].exchangeSids, NoticeType.EXCHANGENOTICE, now)).Count;
            }
            if (count == 0)
            {
                tip.gameObject.SetActive(false);
            }
            else
            {
                tip.gameObject.SetActive(false);
//				tip.gameObject.SetActive (true);
//				tipLabel.text = count.ToString();
            }
        }
        else if (type == NoticeType.EXCHANGENOTICE)
        {
            List <Exchange> temps = ExchangeManagerment.Instance.getValidExchangesByTime((noticeSample.content as SidNoticeContent).sids, noticeSample.type, now);
            if (temps == null || temps.Count == 0)
            {
                tip.gameObject.SetActive(false);
            }
            else if (noticeSample.sid != 4)
            {
                tip.gameObject.SetActive(true);
                tipLabel.text = temps.Count.ToString();
            }
            else if (noticeSample.sid == 4)                 //vip兑换特殊处理
            {
                if (PlayerPrefs.GetString(PlayerPrefsComm.VIP_EXCHANGE_TIP) == "ok")
                {
                    tip.gameObject.SetActive(true);
                }
                else
                {
                    tip.gameObject.SetActive(false);
                }
            }
        }
        else if (type == NoticeType.ONERMB)
        {
            int state = RechargeManagerment.Instance.getOneRmbState();
            if (state != RechargeManagerment.ONERMB_STATE_VALID)
            {
                tip.gameObject.SetActive(false);
            }
            else
            {
                tip.gameObject.SetActive(true);
            }
        }
        else if (type == NoticeType.MONTHCARD)
        {
            int state = NoticeManagerment.Instance.getMonthCardRewardState();
            if (state != NoticeManagerment.MONTHCARD_STATE_VALID)
            {
                tip.gameObject.SetActive(false);
            }
            else
            {
                tip.gameObject.SetActive(true);
            }
        }
        else if (type == NoticeType.HAPPY_SUNDAY)
        {
            int num = HappySundayManagerment.Instance.getCanReceiveNum();
            tip.gameObject.SetActive(num > 0);
            if (tip.gameObject.activeSelf)
            {
                tipLabel.text = num.ToString();
            }
        }
        else if (type == NoticeType.QUIZ_EXAM)
        {
            bool isEnbale = (notice as QuizNotice).isCanAnswer();
            if (isEnbale)
            {
                tip.gameObject.SetActive(true);
            }
            else
            {
                tip.gameObject.SetActive(false);
            }
        }
        else if (type == NoticeType.QUIZ_SURVEY)
        {
            bool isEnbale = (notice as QuizNotice).isCanAnswer();
            if (isEnbale)
            {
                tip.gameObject.SetActive(true);
            }
            else
            {
                tip.gameObject.SetActive(false);
            }
        }
        else if (type == NoticeType.DAILY_REBATE)
        {
            int       num       = 0;
            ArrayList dailyList = TaskManagerment.Instance.getDailyRebateTask();
            for (int i = 0; i < dailyList.Count; i++)
            {
                if (TaskManagerment.Instance.isComplete(dailyList[i] as Task))
                {
                    num++;
                }
            }
            if (num > 0)
            {
                tip.gameObject.SetActive(true);
                tipLabel.text = num.ToString();
            }
            else
            {
                tip.gameObject.SetActive(false);
                tipLabel.text = "";
            }
        }
        else if (type == NoticeType.LIMIT_COLLECT)
        {
            int num = 0;
            foreach (int sid in (noticeSample.content as SidNoticeContent).sids)
            {
                LimitCollectSample sample = NoticeActiveManagerment.Instance.getActiveInfoBySid(sid) as LimitCollectSample;
                if (sample != null && sample.isCanReceive())
                {
                    num++;
                }
            }
            if (num > 0)
            {
                tip.gameObject.SetActive(true);
                tipLabel.text = num.ToString();
            }
            else
            {
                tip.gameObject.SetActive(false);
                tipLabel.text = "";
            }
        }
        else if (type == NoticeType.ONE_MANY_RECHARGE)
        {
            List <Recharge> temps = RechargeManagerment.Instance.getValidRechargesByTime((noticeSample.content as SidNoticeContent).sids, now);
            if (temps == null || temps.Count == 0)
            {
                tip.gameObject.SetActive(false);
            }
            else
            {
                tip.gameObject.SetActive(true);
                tipLabel.text = temps.Count.ToString();
            }
        }
        else if (type == NoticeType.SUPERDRAW)
        {
            if (SuperDrawManagerment.Instance == null)
            {
                tip.gameObject.SetActive(false);
                return;
            }
            else
            {
                int count = SuperDrawManagerment.Instance.superDraw.canUseNum;
                if (count == 0)
                {
                    tip.gameObject.SetActive(false);
                }
                else
                {
                    tip.gameObject.SetActive(true);
                    tipLabel.text = count.ToString();
                }
            }
        }
        else if (type == NoticeType.SIGNIN)
        {
            SignInSample sample = SignInSampleManager.Instance.getSignInSampleBySid(StringKit.toInt(notice.sid + "" + ServerTimeKit.getCurrentMonth()));
            if (sample == null)
            {
                return;
            }
            List <int> sids = sample.daySids;
            if (!SignInManagerment.Instance.stateList.Contains(sids[ServerTimeKit.getDayOfMonth() - 1]))
            {
                tip.gameObject.SetActive(true);
                tipLabel.text = "1";
            }
            else
            {
                tip.gameObject.SetActive(false);
            }
        }
        else if (type == NoticeType.SHAREDRAW)
        {
            if (ShareDrawManagerment.Instance.isFirstShare == 0 && ShareDrawManagerment.Instance.canDrawTimes == 0)
            {
                tip.gameObject.SetActive(true);
                tipLabel.text = "1";
            }
            else if (ShareDrawManagerment.Instance.canDrawTimes != 0 && ShareDrawManagerment.Instance.isFirstShare == 0)
            {
                tip.gameObject.SetActive(true);
                tipLabel.text = (ShareDrawManagerment.Instance.canDrawTimes + 1).ToString();
            }
            else if (ShareDrawManagerment.Instance.canDrawTimes != 0 && ShareDrawManagerment.Instance.isFirstShare != 0)
            {
                tip.gameObject.SetActive(true);
                tipLabel.text = ShareDrawManagerment.Instance.canDrawTimes.ToString();
            }
            else
            {
                tip.gameObject.SetActive(false);
            }
        }
        else if (type == NoticeType.WEEKCARD)
        {
            if (WeekCardInfo.Instance.recevieState == WeekCardRecevieState.recevie)
            {
                tip.gameObject.SetActive(true);
                tipLabel.text = "1";
            }
            else
            {
                tip.gameObject.SetActive(false);
            }
        }
        else if (type == NoticeType.BACK_PRIZE)
        {
            if (BackPrizeLoginInfo.Instance.loginDays <= BackPrizeInfoFPort.tottalLoginDays)
            {
                if (BackPrizeLoginInfo.Instance.loginDays - BackPrizeLoginInfo.Instance.receivedDays.Count > 0)
                {
                    tip.gameObject.SetActive(true);
                    tipLabel.text = (BackPrizeLoginInfo.Instance.loginDays - BackPrizeLoginInfo.Instance.receivedDays.Count).ToString();
                }
                else
                {
                    tip.gameObject.SetActive(false);
                }
            }
            else
            {
                if (BackPrizeInfoFPort.tottalLoginDays - BackPrizeLoginInfo.Instance.receivedDays.Count > 0)
                {
                    tip.gameObject.SetActive(true);
                    tipLabel.text = (BackPrizeInfoFPort.tottalLoginDays - BackPrizeLoginInfo.Instance.receivedDays.Count).ToString();
                }
                else
                {
                    tip.gameObject.SetActive(false);
                }
            }
        }
        else if (type == NoticeType.BACK_RECHARGE)
        {
            if (BackPrizeRechargeInfo.Instance.getCanRecevieCount() - BackPrizeRechargeInfo.Instance.getReceviedCount() > 0)
            {
                tip.gameObject.SetActive(true);
                tipLabel.text = (BackPrizeRechargeInfo.Instance.getCanRecevieCount() - BackPrizeRechargeInfo.Instance.getReceviedCount()).ToString();
            }
            else
            {
                tip.gameObject.SetActive(false);
            }
        }
        else if (type == NoticeType.XIANSHI_FANLI)
        {
            if (RebateInfoManagement.Instance.canRecevieCount > 0)
            {
                tip.gameObject.SetActive(true);
                tipLabel.text = RebateInfoManagement.Instance.canRecevieCount.ToString();
            }
            else
            {
                tip.gameObject.SetActive(false);
            }
        }
        else if (type == NoticeType.LOTTERY)
        {
            if (LotteryManagement.Instance.getLotteryCount() + LotteryManagement.Instance.selectedAwardCount > 0)
            {
                if ((notice as LotteryNotice).isActivityOpen())
                {
                    tip.gameObject.SetActive(true);
                    tipLabel.text = (LotteryManagement.Instance.getLotteryCount() + LotteryManagement.Instance.selectedAwardCount).ToString();
                }
                else
                {
                    if (LotteryManagement.Instance.selectedAwardCount > 0)
                    {
                        tip.gameObject.SetActive(true);
                        tipLabel.text = LotteryManagement.Instance.selectedAwardCount.ToString();
                    }
                    else
                    {
                        tip.gameObject.SetActive(false);
                    }
                }
            }
            else
            {
                tip.gameObject.SetActive(false);
            }
        }
    }
Exemple #5
0
    public override void read(ErlKVMessage message)
    {
        base.read(message);
        ErlType type = message.getValue("msg") as ErlType;

        if (type == null)
        {
            return;
        }
        List <int> months = new List <int>();

        if (type is ErlArray)
        {
            ErlArray erlArray = message.getValue("msg") as ErlArray;
            if (erlArray.Value.Length == 0)
            {
                SignInManagerment.Instance.month        = ServerTimeKit.getCurrentMonth();
                SignInManagerment.Instance.sign_inTimes = 0;
                SignInManagerment.Instance.stateList    = new System.Collections.Generic.List <int>();
                if (callback != null)
                {
                    callback();
                    callback = null;
                }
                return;
            }
            for (int i = 0; i < erlArray.Value.Length; i++)
            {
                ErlArray erlArrayTmp = erlArray.Value[i] as ErlArray;
                int      month       = StringKit.toInt((erlArrayTmp.Value[0].getValueString()));
                months.Add(month);
                if (month == ServerTimeKit.getCurrentMonth())
                {
                    SignInManagerment.Instance.month        = StringKit.toInt(erlArrayTmp.Value[0].getValueString());
                    SignInManagerment.Instance.sign_inTimes = StringKit.toInt(erlArrayTmp.Value[1].getValueString());
                    ErlArray erl = erlArrayTmp.Value[2] as ErlArray;
                    SignInManagerment.Instance.stateList.Clear();
                    for (int k = 0; k < erl.Value.Length; k++)
                    {
                        SignInManagerment.Instance.stateList.Add(StringKit.toInt(erl.Value[k].getValueString()));
                    }
                    if (callback != null)
                    {
                        callback();
                        callback = null;
                    }
                    return;
                }
            }
            if (!months.Contains(ServerTimeKit.getCurrentMonth()))
            {
                SignInManagerment.Instance.month        = ServerTimeKit.getCurrentMonth();
                SignInManagerment.Instance.sign_inTimes = 0;
                SignInManagerment.Instance.stateList    = new System.Collections.Generic.List <int>();
                if (callback != null)
                {
                    callback();
                    callback = null;
                }
                return;
            }
        }
    }