Exemplo n.º 1
0
 private void AddBinkEffect()
 {
     if (!m_AddBlinkEffect)
     {
         int           callTimes = 0;
         DelayCallBack call      = gameObject.AddComponent <DelayCallBack>();
         call.SetAction(() => {
             if (!m_IsDeath)
             {
                 callTimes++;
                 if (callTimes % 2 == 0)
                 {
                     m_Appear.transform.localPosition = m_OriPos;
                 }
                 else
                 {
                     m_Appear.transform.localPosition = m_OffsetPos;
                 }
             }
         }
                        , 0.5f);
         call.SetCallTimes(9999);
         m_AddBlinkEffect = true;
     }
 }
Exemplo n.º 2
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";
            }
        }
Exemplo n.º 3
0
        //private SdkdsPurchaseUtils.Product m_Product;

        public override void Init <T>(string name, UIInfo info, T arg)
        {
            base.Init(name, info, arg);
            Btn2.button.onClick.AddListener(OnGoTo);
            BtnC.button.onClick.AddListener(OnCloseBtn);
            RegisterListeners();
            base.ChangeLanguage();

            m_IdStr = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.TIME_GIFT1_PRODUCT).content;
            string[] prms    = m_IdStr.Split('.');
            ItemItem itemCfg = Global.gApp.gGameData.ItemData.Get(int.Parse(prms[2]));

            NextGunName.text.text = itemCfg.gamename;

            m_RemainStr = Global.gApp.gGameData.GetTipsInCurLanguage(4186);

            double mills = DateTimeUtil.m_Day_Mills * 7 - DateTimeUtil.GetMills(DateTime.Now) + Global.gApp.gSystemMgr.GetMiscMgr().TimeGiftStartTime;

            if (mills < 0d)
            {
                mills = 0d;
            }
            DelayCallBack dcb = gameObject.AddComponent <DelayCallBack>();

            TimeCount.text.text = GetTimtTip(mills);
            dcb.SetAction(() =>
            {
                double ms = DateTimeUtil.m_Day_Mills * 7 - DateTimeUtil.GetMills(DateTime.Now) + Global.gApp.gSystemMgr.GetMiscMgr().TimeGiftStartTime;
                if (ms < 0d)
                {
                    ms = 0d;
                }
                TimeCount.text.text = GetTimtTip(ms);
            }, 1f);

            List <ItemDTO> itemDTOs = GameItemFactory.GetInstance().DealItems(Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.TIME_GIFT1).contents, BehaviorTypeConstVal.OPT_TIME_GIFT1);

            ItemIcon1.image.sprite = Global.gApp.gResMgr.LoadAssets <Sprite>(string.Format(CommonResourceConstVal.RESOURCE_PATH, itemDTOs[0].itemId));
            ItemCount1.text.text   = "X " + (int)itemDTOs[0].num;
            ItemIcon2.image.sprite = Global.gApp.gResMgr.LoadAssets <Sprite>(string.Format(CommonResourceConstVal.RESOURCE_PATH, itemDTOs[1].itemId));
            ItemCount2.text.text   = "X " + (int)itemDTOs[1].num;

            dcb.SetCallTimes(Convert.ToInt32(mills / DateTimeUtil.m_Sec_Mills) + 1);

#if (UNITY_EDITOR || DISBLE_PLATFORM)
#else
            //if (SdkdsPurchaseUtils.m_ProductList!= null && SdkdsPurchaseUtils.m_ProductList.Count > 0)
            //{
            //    foreach (SdkdsPurchaseUtils.Product product in SdkdsPurchaseUtils.m_ProductList) {
            //        if (SdkdsPurchaseUtils.IsSpecialPruchase(product, GeneralConfigConstVal.TIME_GIFT1_PRODUCT))
            //        {
            //            m_Product = product;
            //            break;
            //        }
            //    }

            //    moneyNum.text.text = m_Product.price;
            //}
#endif
        }
Exemplo n.º 4
0
        private void DelayVisible()
        {
            DynamicNode.gameObject.SetActive(false);
            StaticNode.gameObject.SetActive(false);
            int           callTimes = 0;
            DelayCallBack callBack  = gameObject.AddComponent <DelayCallBack>();

            callBack.SetCallTimes(3);
            callBack.SetAction(
                () =>
            {
                callTimes++;
                if (callTimes == 3)
                {
                    DynamicNode.gameObject.SetActive(true);
                    StaticNode.gameObject.SetActive(true);
                    if (m_LastTaskIconIndex > 0)
                    {
                        Image image;
                        if (m_TaskIconImages.TryGetValue(m_LastTaskIconIndex, out image))
                        {
                            image.transform.Find(m_ArrowName).gameObject.SetActive(false);
                        }
                        if (m_LastTaskIconIndex > 6)
                        {
                            float m_scale = 6.0f / m_LastTaskIconIndex;
                            TaskIconNode.rectTransform.localScale = new Vector3(m_scale, m_scale, m_scale);
                        }
                    }
                }
            },
                0.1f, true);
        }
Exemplo n.º 5
0
        protected override void Awake()
        {
            gameObject.GetComponent <CircleCollider2D>().enabled = false;
            base.Awake();
            DelayCallBack callBack = gameObject.AddComponent <DelayCallBack>();

            callBack.SetAction(GenerateRes, 0.1f, true);
            callBack.SetCallTimes(2);
            AdapterName(m_ResProp.ToString());
        }
Exemplo n.º 6
0
        protected override void InitOnceInfo()
        {
            base.InitOnceInfo();
            m_RedHeartPickRecord = gameObject.AddComponent <RedHeartPickRecord>();
            m_NpcMgr             = Global.gApp.gSystemMgr.GetNpcMgr();
            m_EnemyTypeCount     = m_EnemyPath.Length;
            m_ShowNode           = GameObject.Find("binansuo_03");
            m_ControllerNode     = m_ShowNode.transform.Find("ControllerNode").gameObject;
            m_ControllerNode.SetActive(true);
            m_FightNode = m_ControllerNode.transform.Find("FightNode");
            m_FightNode.gameObject.SetActive(true);
            m_MainCamera = Camera.main;
            Global.gApp.gGameAdapter.AdaptCamera(ref m_MainCamera);
            m_NoTaskNpcBornNode = m_ControllerNode.transform.Find("FightNode/NPCBornNode/Dynamic");
            m_TaskNpcBronNode   = m_ControllerNode.transform.Find("FightNode/NPCBornNode/Static");
            m_NpcNode           = m_ControllerNode.transform.Find("FightNode/NpcNode");
            m_DrstrangeIconBtn.button.onClick.AddListener(OpenWeaponRaiseUi);
            m_RecycleIconBtn.button.onClick.AddListener(OpenMatBg);

            Transform adFollowNode = m_ControllerNode.transform.Find("FightNode/AdNode");

            AdIconBtn.button.onClick.AddListener(RespondBillboardClick);
            AdIcon.gameObject.GetComponent <FollowNode>().SetFloowNode(adFollowNode);

            m_NameBg.button.onClick.AddListener(OpenDetail);
            m_ResourceBtn.button.onClick.AddListener(OpenResourceDetail);
            m_OldWamonIconBtn.button.onClick.AddListener(OpenCampTaskDetails);
            m_Buff.button.onClick.AddListener(OpenCampBuff);
            m_BadgeIconBtn.button.onClick.AddListener(OpenBadge);

            //检测npc是否离开
            m_NpcMgr.NpcLeave();

            //获取营地点位配置list
            var campsitePoints = m_FightNode.GetComponentsInChildren <CampsiteNpcPoint>(true);

            for (int i = 0; i < campsitePoints.Length; i++)
            {
                var point         = campsitePoints[i];
                int linkDataIndex = point.PointId - 1;
                if (CampsiteMgr.singleton.HasPoint(linkDataIndex))
                {
                    point.SetValid(linkDataIndex);
                }
                else
                {
                    point.SetInvalid();
                }
            }

            DelayCallBack delayCallBack = gameObject.AddComponent <DelayCallBack>();

            delayCallBack.SetCallTimes(9999999);
            delayCallBack.SetAction(FreshDropRedHeartData, 30, true);
        }
Exemplo n.º 7
0
        //private SdkdsPurchaseUtils.Product m_Product;
        public override void Init <T>(string name, UIInfo info, T arg)
        {
            base.Init(name, info, arg);
            Btn2.button.onClick.AddListener(OnGoTo);
            BtnC.button.onClick.AddListener(OnCloseBtn);
            RegisterListeners();
            base.ChangeLanguage();

            m_IdStr = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.TIME_GIFT2_PRODUCT).content;
            string[] prms    = m_IdStr.Split('.');
            ItemItem itemCfg = Global.gApp.gGameData.ItemData.Get(int.Parse(prms[2]));

            m_RemainStr = Global.gApp.gGameData.GetTipsInCurLanguage(4186);

            double        mills = DateTimeUtil.m_Day_Mills * 7 - DateTimeUtil.GetMills(DateTime.Now) + Global.gApp.gSystemMgr.GetMiscMgr().TimeGiftStartTime;
            DelayCallBack dcb   = gameObject.AddComponent <DelayCallBack>();

            if (mills < 0d)
            {
                mills = 0d;
            }
            TimeCount.text.text = string.Format(m_RemainStr, Global.gApp.gGameData.GetTimeInCurLanguage(mills));
            dcb.SetAction(() =>
            {
                double ms = DateTimeUtil.m_Day_Mills * 7 - DateTimeUtil.GetMills(DateTime.Now) + Global.gApp.gSystemMgr.GetMiscMgr().TimeGiftStartTime;
                if (ms < 0d)
                {
                    ms = 0d;
                }
                TimeCount.text.text = string.Format(m_RemainStr, Global.gApp.gGameData.GetTimeInCurLanguage(ms));
            }, 1f);

            dcb.SetCallTimes(Convert.ToInt32(mills / DateTimeUtil.m_Sec_Mills) + 1);

#if (UNITY_EDITOR || DISBLE_PLATFORM)
#else
            //if (SdkdsPurchaseUtils.m_ProductList!= null && SdkdsPurchaseUtils.m_ProductList.Count > 0)
            //{
            //    foreach (SdkdsPurchaseUtils.Product product in SdkdsPurchaseUtils.m_ProductList) {
            //        if (SdkdsPurchaseUtils.IsSpecialPruchase(product, GeneralConfigConstVal.TIME_GIFT2_PRODUCT))
            //        {
            //            m_Product = product;
            //            break;
            //        }
            //    }

            //    moneyNum.text.text = m_Product.price;
            //}
#endif
        }
Exemplo n.º 8
0
        public void InitNode()
        {
            GeneralConfigItem initPassIdConfig = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.INIT_PASS_ID);

            m_InitId  = Convert.ToInt32(initPassIdConfig.content);
            m_BackDis = Viewport.rectTransform.rect.size.y / 6;
            Debug.Log("m_BackDis = " + m_BackDis);
            CloseBtn.button.onClick.AddListener(OnCloseBtn);

            topTip.button.onClick.AddListener(OnToCur);
            bottomTip.button.onClick.AddListener(OnToCur);

            progress.gameObject.SetActive(false);
            step.gameObject.SetActive(false);
            gun.gameObject.SetActive(false);

            List <QuestItem> configs = Global.gApp.gGameData.QuestTypeMapData[QuestConst.TYPE_LEVEL_DETAIL];

            foreach (QuestItem questItem in configs)
            {
                passQuestDic.Add((int)questItem.condition[1], questItem);
            }
            int curId = Global.gApp.gSystemMgr.GetPassMgr().GetCurPassId() - m_InitId;

            m_UserStep = Global.gApp.gSystemMgr.GetPassMgr().GetUserStep();

            for (int i = 0; i < Global.gApp.gGameData.PassStep.Count && i <= m_UserStep; i++)
            {
                m_ScrolViewHeightList.Add(-m_Height - step.rectTransform.sizeDelta.y / 2);
                m_Height += step.rectTransform.sizeDelta.y;
                m_ScrolViewList.Add(null);

                int stepStart = i == 0 ? 1 : Global.gApp.gGameData.PassStep[i - 1] + 1 - m_InitId;
                int stepEnd   = Global.gApp.gGameData.PassStep[i] - m_InitId;
                Debug.Log("stepStart = " + stepStart + ", stepEnd = " + stepEnd);
                int start = -1;
                for (int j = stepStart; j <= stepEnd; j++)
                {
                    QuestItem questItemCfg = null;
                    ItemItem  iCfg         = null;
                    bool      isWeapon     = false;
                    passQuestDic.TryGetValue(j, out questItemCfg);
                    if (questItemCfg != null)
                    {
                        iCfg     = Global.gApp.gGameData.ItemData.Get((int)questItemCfg.award[0]);
                        isWeapon = ItemTypeConstVal.isWeapon(iCfg.showtype);
                    }

                    if (isWeapon)
                    {
                        start = -1;
                        m_ScrolViewHeightList.Add(-m_Height - gun.rectTransform.sizeDelta.y / 2);
                        m_Height += gun.rectTransform.sizeDelta.y;
                        m_ScrolViewList.Add(null);
                    }
                    else
                    {
                        if (start == -1)
                        {
                            start = j;
                        }

                        if ((j - start) % 2 == 0)
                        {
                            m_ScrolViewHeightList.Add(-m_Height - progress.rectTransform.sizeDelta.y / 2);
                            m_Height += progress.rectTransform.sizeDelta.y;
                            m_ScrolViewList.Add(null);
                        }
                    }

                    if (j == curId)
                    {
                        m_CurIndex  = m_ScrolViewList.Count - 1;
                        m_CurHeight = m_Height;
                    }
                }
                if (i == m_UserStep && m_UserStep < Global.gApp.gGameData.PassStep.Count - 1)
                {
                    m_ScrolViewHeightList.Add(-m_Height - step.rectTransform.sizeDelta.y / 2);
                    m_Height += step.rectTransform.sizeDelta.y;
                    m_ScrolViewList.Add(null);
                }


                m_StepHeightDic.Add(i, m_Height);
                m_StepIndexDic.Add(i, m_ScrolViewList.Count);
            }
            Debug.Log("m_CurIndex = " + m_CurIndex);
            ShowStepUI(m_UserStep);
            float callSecs  = 1f / Application.targetFrameRate;
            int   callTimes = m_UserStep - 1;

            if (m_UserStep - 1 >= 0)
            {
                DelayCallBack delayCallBack = gameObject.AddComponent <DelayCallBack>();
                delayCallBack.SetCallTimes(m_UserStep);
                delayCallBack.SetAction(() =>
                {
                    ShowStepUI(callTimes--);
                }, callSecs);
            }



            m_CurStep = m_UserStep;
            //float baseHeight = m_CurStep == 0 ? 0f : m_StepHeightDic[m_CurStep - 1];
            //Content.rectTransform.sizeDelta = new Vector2(Content.rectTransform.sizeDelta.x, m_StepHeightDic[m_CurStep] - baseHeight);
            Content.rectTransform.sizeDelta = new Vector2(Content.rectTransform.sizeDelta.x, m_Height);



            m_TargetValue = Math.Abs(m_ScrolViewHeightList[m_CurIndex]) - Viewport.rectTransform.rect.size.y / 2;
            if (m_TargetValue < 0f)
            {
                m_TargetValue = 0f;
            }
            else if (m_TargetValue > m_Height - Viewport.rectTransform.rect.size.y)
            {
                m_TargetValue = m_Height - Viewport.rectTransform.rect.size.y;
            }
            Content.rectTransform.localPosition = new Vector3(Content.rectTransform.localPosition.x, m_TargetValue, Content.rectTransform.localPosition.z);
            m_NeedMove = false;
            PassItem passItemCfg = Global.gApp.gGameData.PassData.Get(Global.gApp.gGameData.PassStep[m_CurStep]);

            //bg.image.sprite = Global.gApp.gResMgr.LoadAssets<Sprite>(passItemCfg.mainUIbg);

            m_ShowMin = Content.rectTransform.localPosition.y;
            m_ShowMax = Content.rectTransform.localPosition.y + Viewport.rectTransform.rect.size.y;
            topTip.gameObject.SetActive(false);
            bottomTip.gameObject.SetActive(false);
        }
Exemplo n.º 9
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);
        }
Exemplo n.º 10
0
        private void UIFresh()
        {
            GetMDT.gameObject.GetComponent <Animator>().enabled = (Global.gApp.gSystemMgr.GetMiscMgr().VideoMDTDataGift != 1);
            GetMDTLight.gameObject.SetActive(Global.gApp.gSystemMgr.GetMiscMgr().VideoMDTDataGift != 1);

            InitPassInfo();

            Global.gApp.gSystemMgr.GetQuestMgr().CheckLoginWeaponAward();

            int questId = Global.gApp.gSystemMgr.GetQuestMgr().GetShouldReceiveId4SevenDay();

            SevenDayBg.gameObject.SetActive(questId > 0);

            m_LevelDetailDTO = Global.gApp.gSystemMgr.GetQuestMgr().GetLevelDetailQuest();
            ItemItem canReceiveItem = null;

            if (m_LevelDetailDTO != null)
            {
                canReceiveItem = Global.gApp.gGameData.ItemData.Get((int)Global.gApp.gGameData.QuestData.Get(m_LevelDetailDTO.id).award[0]);
            }
            QuestItemDTO nextLevelDetailDTO = Global.gApp.gSystemMgr.GetQuestMgr().GetNextLevelDetailQuest();

            if (nextLevelDetailDTO != null)
            {
                m_LDAGunCfg = Global.gApp.gGameData.ItemData.Get((int)Global.gApp.gGameData.QuestData.Get(nextLevelDetailDTO.id).award[0]);
            }

            m_NDCfg = Global.gApp.gSystemMgr.GetPassMgr().GetNextGun(FilterTypeConstVal.SUM_LOGIN_DAY);

            //可领取红点
            LDARedPoint.gameObject.SetActive(m_LevelDetailDTO != null && canReceiveItem != null);
            if (m_LevelDetailDTO != null && canReceiveItem != null)
            {
                InitNextUI(m_LevelDetailDTO, canReceiveItem);
                //可以领取
                LDAGunName.gameObject.SetActive(false);
                LDAAwardIcon.gameObject.GetComponent <DOTweenAnimation>().DORestart();
            }
            else if (m_LDAGunCfg != null)
            {
                LDAAwardIcon.gameObject.GetComponent <DOTweenAnimation>().DOPause();
                LDAAwardIcon.rectTransform.localPosition = m_LDAIconInitPos;
                InitNextUI(nextLevelDetailDTO, m_LDAGunCfg);
                LDAGunName.gameObject.SetActive(true);
            }
            else
            {
                LDAAwardIcon.gameObject.GetComponent <DOTweenAnimation>().DOPause();
                LDAAwardIcon.rectTransform.localPosition = m_LDAIconInitPos;
                LDAGunName.gameObject.SetActive(true);
                LevelDetailAward.gameObject.SetActive(false);
            }

            if (m_NDCfg != null)
            {
                bool isWeapon = ItemTypeConstVal.isWeapon(m_NDCfg.showtype);
                GeneralConfigItem colorConfig = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.QUALITY_COLOR);
                //NextGunName.text.color = ColorUtil.GetColor(colorConfig.contents[itemConfig.qualevel]);
                NDGunName.text.text = FilterFactory.GetInstance().GetTinyUnfinishTips(m_NDCfg.opencondition);
                NDGunIcon.gameObject.SetActive(m_NDCfg.showtype == ItemTypeConstVal.BASE_MAIN_WEAPON);
                NDGunIcon.image.sprite = Resources.Load(m_NDCfg.image_grow, typeof(Sprite)) as Sprite;
                NDSubWepIcon.gameObject.SetActive(m_NDCfg.showtype == ItemTypeConstVal.SUB_WEAPON);
                NDSubWepIcon.image.sprite = Resources.Load(m_NDCfg.image_grow, typeof(Sprite)) as Sprite;
                NDPetIcon.gameObject.SetActive(m_NDCfg.showtype == ItemTypeConstVal.PET);
                NDPetIcon.image.sprite = Resources.Load(m_NDCfg.image_grow, typeof(Sprite)) as Sprite;
                NDAwardIcon.gameObject.SetActive(false);
                if (isWeapon)
                {
                    if (m_NDCfg.showtype == ItemTypeConstVal.BASE_MAIN_WEAPON)
                    {
                        NDGunDown.image.sprite = Resources.Load(string.Format(CommonResourceConstVal.MAIN_UI_WEAPON_DOWN_PATH, m_NDCfg.qualevel), typeof(Sprite)) as Sprite;
                    }
                    else
                    {
                        NDGunDown.image.sprite = Resources.Load(string.Format(CommonResourceConstVal.MAIN_UI_WEAPON_DOWN_PATH, 2), typeof(Sprite)) as Sprite;
                    }
                    NDGunEffect.image.enabled = false;
                    if (NDGunEffect.rectTransform.childCount == 0)
                    {
                        EffectItem effectItem = Global.gApp.gGameData.EffectData.Get(EffectConstVal.QUALITY);
                        string     effectName = m_NDCfg.showtype == ItemTypeConstVal.BASE_MAIN_WEAPON ? m_NDCfg.qualevel.ToString() : "common";
                        GameObject effect     = UiTools.GetEffect(string.Format(effectItem.path, effectName), NDGunEffect.rectTransform);

                        effect.transform.GetChild(0).localPosition = new Vector3(0f, 0f, 0f);

                        ParticleSystem[] particleRenderers = effect.GetComponentsInChildren <ParticleSystem>();
                        foreach (ParticleSystem ps in particleRenderers)
                        {
                            ps.GetComponent <Renderer>().sortingOrder = 39;
                        }
                    }
                }
                else
                {
                    NDGunDown.image.sprite = Resources.Load(string.Format(CommonResourceConstVal.MAIN_UI_WEAPON_DOWN_PATH, 2), typeof(Sprite)) as Sprite;
                }
            }
            else
            {
                NextDay.gameObject.SetActive(false);
            }

            FirstCharge.gameObject.SetActive(Global.gApp.gSystemMgr.GetMiscMgr().FirstPurchase == 0);
            fTip.gameObject.SetActive(Global.gApp.gSystemMgr.GetMiscMgr().FirstPurchase == 0 && Global.gApp.gSystemMgr.GetMiscMgr().EveryDayFP == 0);

            double mls           = DateTimeUtil.m_Day_Mills * 7 - DateTimeUtil.GetMills(DateTime.Now) + Global.gApp.gSystemMgr.GetMiscMgr().TimeGiftStartTime;
            bool   showTimeGift1 = Global.gApp.gSystemMgr.GetMiscMgr().IsShowTimeGift(mls, GeneralConfigConstVal.TIME_GIFT1_PRODUCT);
            bool   showTimeGift2 = Global.gApp.gSystemMgr.GetMiscMgr().IsShowTimeGift(mls, GeneralConfigConstVal.TIME_GIFT2_PRODUCT);

            TimeGift1.gameObject.SetActive(showTimeGift1);
            TimeGift2.gameObject.SetActive(showTimeGift2);
            if (showTimeGift1 && m_TimeGift1Tick == 0)
            {
                m_TimeGift1Tick = 1;
                DelayCallBack dcb = gameObject.AddComponent <DelayCallBack>();

                TimeTip1.text.text = GetTimtTip(mls);
                dcb.SetAction(() =>
                {
                    double ms = DateTimeUtil.m_Day_Mills * 7 - DateTimeUtil.GetMills(DateTime.Now) + Global.gApp.gSystemMgr.GetMiscMgr().TimeGiftStartTime;

                    if (ms < 0d)
                    {
                        ms = 0d;
                    }
                    TimeTip1.text.text = GetTimtTip(ms);
                }, 1f);

                dcb.SetCallTimes(Convert.ToInt32(mls / DateTimeUtil.m_Sec_Mills) + 1);
            }
            if (showTimeGift2 && m_TimeGift2Tick == 0)
            {
                m_TimeGift2Tick = 1;
                DelayCallBack dcb = gameObject.AddComponent <DelayCallBack>();

                TimeTip2.text.text = GetTimtTip(mls);
                dcb.SetAction(() =>
                {
                    double ms = DateTimeUtil.m_Day_Mills * 7 - DateTimeUtil.GetMills(DateTime.Now) + Global.gApp.gSystemMgr.GetMiscMgr().TimeGiftStartTime;

                    if (ms < 0d)
                    {
                        ms = 0d;
                    }
                    TimeTip2.text.text = GetTimtTip(ms);
                }, 1f);

                dcb.SetCallTimes(Convert.ToInt32(mls / DateTimeUtil.m_Sec_Mills) + 1);
            }

#if (UNITY_EDITOR || DISBLE_PLATFORM)
#else
            //if (SdkdsPurchaseUtils.m_ProductList == null || SdkdsPurchaseUtils.m_ProductList.Count == 0)
            //{
            //    FirstCharge.gameObject.SetActive(false);
            //    TimeGift1.gameObject.SetActive(false);
            //    TimeGift2.gameObject.SetActive(false);
            //}
#endif
        }
Exemplo n.º 11
0
        private void UpdateBtn()
        {
            //InfoCLogUtil.instance.SendClickLog(ClickEnum.SKILL_UPDATE);
            OnTipsBtn(-1);

            int nextLevel  = (Global.gApp.gSystemMgr.GetSkillMgr().GetTimes() / m_LevelSkillTimes + 1) * m_LevelSkillTimes;
            int timesLimit = (Global.gApp.gSystemMgr.GetBaseAttrMgr().GetLevel() / m_LevelSkillTimes) * m_LevelSkillTimes;

            if (timesLimit <= Global.gApp.gSystemMgr.GetSkillMgr().GetTimes())
            {
                Global.gApp.gMsgDispatcher.Broadcast <int, string>(MsgIds.ShowGameTipsByIDAndParam, 3045, nextLevel.ToString());
                return;
            }

            if (m_ComsumeItem == null)
            {
                Global.gApp.gMsgDispatcher.Broadcast <int>(MsgIds.ShowGameTipsByID, 4177);
                return;
            }

            if (m_RandomList.Count == 0)
            {
                Global.gApp.gMsgDispatcher.Broadcast <int>(MsgIds.ShowGameTipsByID, 3042);
                return;
            }

            if (!GameItemFactory.GetInstance().CanReduce(m_ComsumeItem))
            {
                Global.gApp.gMsgDispatcher.Broadcast <int>(MsgIds.ShowGameTipsByID, 1006);
                return;
            }

            UpBtn.button.enabled = false;
            Global.gApp.gGameCtrl.AddGlobalTouchMask();
            //UpBtn.button.interactable = false;

            int lastIndex = 0;

            //保底逻辑
            bool securiy = false;

            for (int i = 0; i < m_LevelSecurity.Length; i++)
            {
                bool tmp = Global.gApp.gSystemMgr.GetSkillMgr().GetTimes() >= m_LevelSecurity[i] && Global.gApp.gSystemMgr.GetSkillMgr().GetSkillLevel(GameConstVal.SExHp) < i + 1;
                if (tmp)
                {
                    securiy = tmp;
                    break;
                }
            }


            if (securiy)
            {
                for (int i = 0; i < m_RandomList.Count; i++)
                {
                    if (m_RandomList[i].id.Equals(GameConstVal.SExHp))
                    {
                        lastIndex = i;
                        break;
                    }
                }
            }
            else
            {
                int value = UnityEngine.Random.Range(0, m_RandomMax);
                int cur   = 0;

                for (int i = 0; i < m_RandomList.Count; i++)
                {
                    if (value >= cur && value < cur + m_RandomList[i].weight)
                    {
                        lastIndex = i;
                        break;
                    }
                    cur += m_RandomList[i].weight;
                }
            }
            SkillItem finalConfig = m_RandomList[lastIndex];

            m_ComsumeItem.paramStr1 = Global.gApp.gSystemMgr.GetSkillMgr().GetTimes().ToString();
            m_ComsumeItem.paramStr2 = finalConfig.id;
            m_ComsumeItem.paramStr3 = Global.gApp.gSystemMgr.GetSkillMgr().GetSkillLevel(finalConfig.id).ToString();
            GameItemFactory.GetInstance().ReduceItem(m_ComsumeItem);
            Global.gApp.gSystemMgr.GetSkillMgr().SetTimes();
            Global.gApp.gSystemMgr.GetSkillMgr().LevelUp(finalConfig.id);
            Global.gApp.gMsgDispatcher.Broadcast(MsgIds.UIFresh);
            if (m_RandomList.Count == 1)
            {
                gameObject.AddComponent <DelayCallBack>().SetAction(() => { RandomIndex(lastIndex, 1); }, 0.1f);
            }
            else
            {
                int           m_MaxTime = 52;
                DelayCallBack callBack  = gameObject.AddComponent <DelayCallBack>();
                callBack.SetAction(
                    () =>
                {
                    RandomIndex(lastIndex, m_MaxTime);
                    if (m_RanTimes == 15)
                    {
                        callBack.ResteTime();
                        callBack.SetLiveOffset(0);
                    }
                    else if (m_RanTimes == 40)
                    {
                        callBack.SetLiveTime(0);
                        callBack.ResteTime();
                        callBack.SetLiveOffset(0.02f);
                    }
                    ;
                },
                    0.2f);
                callBack.SetCallTimes(m_MaxTime - 1);
                callBack.SetLiveOffset(-0.016f);
                RandomIndex(lastIndex, m_MaxTime);
            }
        }