コード例 #1
0
ファイル: CureProp.cs プロジェクト: howelllucas/Project
 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;
     }
 }
コード例 #2
0
ファイル: FightUi_Logic.cs プロジェクト: howelllucas/Project
        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);
        }
コード例 #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
        }
コード例 #4
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";
            }
        }
コード例 #5
0
ファイル: Player.cs プロジェクト: howelllucas/Project
        public void LockMove(float time)
        {
            if (time > 0)
            {
                m_Fight.Move(0, 0);
                SetLockState(true);
                Transform lockTsf = transform.Find("lockCallBack");

                if (lockTsf == null)
                {
                    GameObject emepty = new GameObject();
                    emepty.transform.SetParent(transform);
                    emepty.name = "lockCallBack";
                    DelayCallBack delayCallBack = emepty.AddComponent <DelayCallBack>();
                    delayCallBack.SetAction(() =>
                    {
                        Destroy(emepty);
                        SetLockState(false);
                    }, time);
                }
                else
                {
                    lockTsf.GetComponent <DelayCallBack>().ResteTime();
                }
            }
        }
コード例 #6
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());
        }
コード例 #7
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);
        }
コード例 #8
0
ファイル: Wave.cs プロジェクト: howelllucas/Project
        private void AddAppearWarningEffect()
        {
            Global.gApp.CurScene.Pause();
            GameObject    BossWarning   = Global.gApp.gResMgr.InstantiateObj("Prefabs/UI/BossWarning");
            DelayCallBack delayCallBack = BossWarning.AddComponent <DelayCallBack>();

            delayCallBack.SetAction(() => { Global.gApp.CurScene.Resume(); Object.Destroy(BossWarning); }, 1.2f, true);
            BossWarning.GetComponent <DelayDestroy>().enabled = false;
            BossWarning.transform.SetParent(Global.gApp.gUiMgr.GetUiCanvasTsf(), false);
            BossWarning.transform.SetAsFirstSibling();
        }
コード例 #9
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
        }
コード例 #10
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);
        }
コード例 #11
0
        private void FireToMainPlayer()
        {
            DelayCallBack delayCallBack = gameObject.AddComponent <DelayCallBack>();;

            delayCallBack.SetAction(m_Action, m_FireDelay);
        }
コード例 #12
0
ファイル: NoMDTUI_Logic.cs プロジェクト: howelllucas/Project
        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);
        }
コード例 #13
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
        }
コード例 #14
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);
            }
        }
コード例 #15
0
        private void RandomIndex(int lastIndex, int m_CallTimes)
        {
            //Debug.Log(string.Format("m_CurIndex = {0} and m_RanTimes = {1} in mills {2}", m_CurIndex, m_RanTimes, DateTimeUtil.GetMills(DateTime.Now)));
            if (m_CurIndex != -1 || m_CallTimes == 1)
            {
                foreach (SkillItem itemConfig in Global.gApp.gGameData.SkillData.items)
                {
                    RectTransform_Button_Image_Container itemRect = ReflectionUtil.GetValueByProperty <SkillUI, RectTransform_Button_Image_Container>("skill_item" + itemConfig.location, this);
                    itemRect.rectTransform.GetChild(3).gameObject.SetActive(false);
                }
                if (m_RanTimes < m_CallTimes - 1)
                {
                    int newIndex = UnityEngine.Random.Range(0, m_RandomList.Count - 1);
                    if (newIndex >= m_CurIndex)
                    {
                        m_CurIndex = newIndex + 1;
                    }
                    else
                    {
                        m_CurIndex = newIndex;
                    }
                }
                else
                {
                    m_CurIndex = lastIndex;
                    SkillItem finalConfig = m_RandomList[m_CurIndex];
                    //Global.gApp.gSystemMgr.GetSkillMgr().SetTimes();
                    //Global.gApp.gSystemMgr.GetSkillMgr().LevelUp(finalConfig.id);
                    SetConsumeCoin();
                    SetSkillInfo(finalConfig);

                    m_RandomList.Clear();
                    m_RandomMax = 0;
                    foreach (SkillItem item in Global.gApp.gGameData.SkillData.items)
                    {
                        if (Global.gApp.gSystemMgr.GetSkillMgr().CanLevelUp(item))
                        {
                            m_RandomMax += item.weight;
                            m_RandomList.Add(item);
                        }
                    }

                    m_RanTimes = 0;
                    RectTransform_Button_Image_Container finalSkillItemRect = ReflectionUtil.GetValueByProperty <SkillUI, RectTransform_Button_Image_Container>("skill_item" + finalConfig.location, this);
                    finalSkillItemRect.rectTransform.GetChild(3).gameObject.SetActive(true);
                    m_FinaleRectTransform_Container = finalSkillItemRect;

                    //UpBtn.button.interactable = true;

                    if (finalConfig != null)
                    {
                        if (finalConfig.id == GameConstVal.SExHp)
                        {
                            gameObject.AddComponent <DelayCallBack>().SetAction(() =>
                            {
                                FreshShowUi(EffectConfig.UI_Skill_1);
                            }, 0.5f);
                        }
                        else
                        {
                            gameObject.AddComponent <DelayCallBack>().SetAction(() =>
                            {
                                FreshShowUi(EffectConfig.UI_Skill_2);
                            }, 0.5f);
                        }
                    }

                    DelayCallBack dcb = gameObject.AddComponent <DelayCallBack>();
                    dcb.SetAction(() =>
                    {
                        Global.gApp.gUiMgr.OpenPanel(Wndid.SkillUpUI, finalConfig);

                        if (m_SelectEffect != null)
                        {
                            Destroy(m_SelectEffect);
                            m_SelectEffect = null;
                        }

                        Global.gApp.gGameCtrl.RemoveGlobalTouchMask();
                    }, 1f);

                    UpBtn.button.enabled = true;
                    return;
                }
            }
            else
            {
                m_CurIndex = UnityEngine.Random.Range(0, m_RandomList.Count);
            }
            SkillItem skillItem = m_RandomList[m_CurIndex];
            RectTransform_Button_Image_Container skillItemRect = ReflectionUtil.GetValueByProperty <SkillUI, RectTransform_Button_Image_Container>("skill_item" + skillItem.location, this);

            skillItemRect.rectTransform.GetChild(3).gameObject.SetActive(true);

            m_RanTimes++;
        }