예제 #1
0
        private void FlushCD()
        {
            double leftMills = Global.gApp.gSystemMgr.GetMiscMgr().lastAdEnegyMills + m_AdAddEnergyCD * 1000 - DateTimeUtil.GetMills(DateTime.Now);

            if (leftMills > 0 && m_AdAddEnergyTimesLimit - Global.gApp.gSystemMgr.GetMiscMgr().adEnegyTimes > 0)
            {
                DelayCallBack dcb      = gameObject.AddComponent <DelayCallBack>();
                int           leftSecs = (int)Math.Round(leftMills / 1000);
                AdBtntxt.text.text = EZMath.FormateTime(leftSecs);
                if (leftSecs > 0)
                {
                    m_AdBtn.button.interactable = false;
                }
                dcb.SetCallTimes(leftSecs);
                dcb.SetAction(() =>
                {
                    leftMills = Global.gApp.gSystemMgr.GetMiscMgr().lastAdEnegyMills + m_AdAddEnergyCD * 1000 - DateTimeUtil.GetMills(DateTime.Now);
                    leftSecs  = (int)Math.Round(leftMills / 1000);
                    if (leftSecs > 0)
                    {
                        AdBtntxt.text.text          = EZMath.FormateTime(leftSecs);
                        m_AdBtn.button.interactable = false;
                    }
                    else
                    {
                        AdBtntxt.text.text          = "Get";
                        m_AdBtn.button.interactable = true;
                    }
                }, 1f);
            }
            else
            {
                AdBtntxt.text.text = "Get";
            }
        }
예제 #2
0
        public static string FormatTime(float time)
        {
            int    intVal   = (int)time;
            int    pointVal = (int)((time - intVal) * 100.0f);
            string pointStr;

            if (pointVal >= 10)
            {
                pointStr = pointVal.ToString();
            }
            else
            {
                pointStr = "0" + pointVal.ToString();
            }
            string intValStr = EZMath.FormateTime(intVal);

            return(intValStr + "." + pointStr);
        }
예제 #3
0
        private void OnAd()
        {
            //InfoCLogUtil.instance.SendClickLog(ClickEnum.NO_ENERGY_AD);
            if (Global.gApp.gSystemMgr.GetMiscMgr().adEnegyTimes >= m_AdAddEnergyTimesLimit)
            {
                Global.gApp.gMsgDispatcher.Broadcast <int>(MsgIds.ShowGameTipsByID, 3044);
                return;
            }
            double leftMills = Global.gApp.gSystemMgr.GetMiscMgr().lastAdEnegyMills + m_AdAddEnergyCD * 1000 - DateTimeUtil.GetMills(DateTime.Now);

            if (leftMills > 0)
            {
                int leftSecs = (int)Math.Round(leftMills / 1000);
                Global.gApp.gMsgDispatcher.Broadcast <int, string>(MsgIds.ShowGameTipsByIDAndParam, 3059, EZMath.FormateTime(leftSecs));
                return;
            }
            //调用广告sdk
            AdManager.instance.ShowRewardVedio(CompleteAd, AdShowSceneType.GET_ENERGY, 0, 0, 0);
            //CompleteAd(true);
        }
예제 #4
0
        private void FlushMDTUI()
        {
            //看广告得狗牌
            //for (int i = 0; i < mGetMDTConfig.Count; i++)
            //{
            //    RectTransform_Container timesRT = ReflectionUtil.GetValueByProperty<NoMDTUI, RectTransform_Container>("mdtItem" + (i + 1), this);
            //    timesRT.rectTransform.GetChild(1).gameObject.SetActive(mAdsTimes == i);
            //    //timesRT.rectTransform.GetChild(2).GetComponent<Image>().sprite = Global.gApp.gResMgr.LoadAssets<Sprite>(getMDTConfig.contents[i * 2]);
            //    timesRT.rectTransform.GetChild(3).GetComponent<Text>().text = mGetMDTConfig[i].goodsNum.ToString();
            //    timesRT.rectTransform.GetChild(4).gameObject.SetActive(mAdsTimes > i);
            //}

            //progress.image.fillAmount = (float)mAdsTimes / mGetMDTConfig.Count;

            //Ad4Mdt 的UI
            totalChance.text.text = "/ " + mGetMDTConfig.Count.ToString();
            int leftTimes = mGetMDTConfig.Count - mAdsTimes;

            leftChance.text.text = leftTimes.ToString();
            newHas.gameObject.SetActive(leftTimes > 0);
            m_num.text.text = leftTimes.ToString();
            if (mAdsTimes == mGetMDTConfig.Count)
            {
                mdtNum.text.text = "0";
            }
            else
            {
                mdtNum.text.text = mGetMDTConfig[mAdsTimes].goodsNum.ToString();
            }

            for (int i = 1; i <= mGetMDTConfig.Count; i++)
            {
                RectTransform_Image_Container rt = ReflectionUtil.GetValueByProperty <NoMDTUI, RectTransform_Image_Container>("m" + i, this);
                rt.gameObject.SetActive(i <= mGetMDTConfig.Count - mAdsTimes);
            }

            double leftMills = Global.gApp.gSystemMgr.GetMiscMgr().LastVideoMDTDataMills + m_AdAddMDTCD * 1000 - DateTimeUtil.GetMills(DateTime.Now);

            MdtCDbg.gameObject.SetActive(false);
            if (leftMills > 0 && leftTimes > 0)
            {
                DelayCallBack dcb      = gameObject.AddComponent <DelayCallBack>();
                int           leftSecs = (int)Math.Round(leftMills / 1000);

                MdtCDbg.gameObject.SetActive(true);
                MdtCDText.text.text = string.Format(Global.gApp.gGameData.GetTipsInCurLanguage(3059), EZMath.FormateTime(leftSecs));
                dcb.SetAction(() =>
                {
                    leftMills = Global.gApp.gSystemMgr.GetMiscMgr().LastVideoMDTDataMills + m_AdAddMDTCD * 1000 - DateTimeUtil.GetMills(DateTime.Now);
                    leftSecs  = (int)Math.Round(leftMills / 1000);
                    if (leftSecs > 0)
                    {
                        MdtCDbg.gameObject.SetActive(true);
                        MdtCDText.text.text = string.Format(Global.gApp.gGameData.GetTipsInCurLanguage(3059), EZMath.FormateTime(leftSecs));
                    }
                    else
                    {
                        MdtCDbg.gameObject.SetActive(false);
                    }
                }, 1f);
                dcb.SetIgnoreSceneTimeScale(true);
                dcb.SetCallTimes(leftSecs);
            }

            Global.gApp.gMsgDispatcher.Broadcast(MsgIds.DogeAdTimesChanged);
        }
예제 #5
0
        private void OnADGetMDTBtn()
        {
            //InfoCLogUtil.instance.SendClickLog(ClickEnum.NO_MDT_AD);
            if (mAdsTimes == mGetMDTConfig.Count)
            {
                Global.gApp.gMsgDispatcher.Broadcast <int>(MsgIds.ShowGameTipsByID, 3044);
                return;
            }
            double leftMills = Global.gApp.gSystemMgr.GetMiscMgr().LastVideoMDTDataMills + m_AdAddMDTCD * 1000 - DateTimeUtil.GetMills(DateTime.Now);

            if (leftMills > 0)
            {
                int leftSecs = (int)Math.Round(leftMills / 1000);
                Global.gApp.gMsgDispatcher.Broadcast <int, string>(MsgIds.ShowGameTipsByIDAndParam, 3059, EZMath.FormateTime(leftSecs));
                return;
            }

            //调起广告
            AdManager.instance.ShowRewardVedio(CompleteAds, AdShowSceneType.NO_MDT_GET, 0, 0, 0);
            //CompleteAds(true);
        }