Exemplo n.º 1
0
    public TimeCountDownComponent timeCountDown; //倒计时器

    public void ShowGiftDialogue(int value)
    {
        canvasGroup.alpha = 1;
        this.content.text = $"+{value}";
        if (timeCountDown != null)
        {
            timeCountDown.Init(Dealy, true, () =>
            {
                canvasGroup.DOFade(0, 0.8f);
            }, (x) =>
            {
                //Debug.LogError($"倒计时{x}");
            });
        }
        else
        {
            timeCountDown = StaticData.CreateTimer(Dealy, true, (go) =>
            {
                canvasGroup.DOFade(0, 0.8f);
            }, (x) =>
            {
                //Debug.LogError($"倒计时{x}");
            }, "giftTime");
        }
    }
Exemplo n.º 2
0
 /// <summary>
 /// 创建空白计时器
 /// </summary>
 static void CreationTimer()
 {
     _timeCountDownComponent = StaticData.CreateTimer(100000 / 1000f, false, (go) =>
     {
     },
                                                      (remainTime) =>
     {
     }, "RedDotTime");
 }
Exemplo n.º 3
0
 /// <summary>
 /// 创建空白计时器
 /// </summary>
 public void CreationTimer()
 {
     _timeCountDownComponent = StaticData.CreateTimer(100000 / 1000f, false, (go) =>
     {
     },
                                                      (remainTime) =>
     {
     }, "WarehouseTreasureChest");
 }
Exemplo n.º 4
0
 /// <summary>
 /// 初始化订单红点计时器
 /// </summary>
 private void InitUpdateDealRedDotTimer()
 {
     DealRedDotTimer = StaticData.CreateTimer(36000f, false, (go) =>
     {
     },
                                              (remainTime) =>
     {
     }, "UpdateDealRedDot");
 }
Exemplo n.º 5
0
 /// <summary>
 /// 创建空白计时器
 /// </summary>
 public void CreationTimer()
 {
     _timeCountDownComponent = StaticData.CreateTimer(100000 / 1000f, false, (go) =>
     {
     },
                                                      (remainTime) =>
     {
     }, "GiftBoxUnlocingController");
     _timeCountDownComponent.transform.SetParent(_timeBoxTra);
 }
Exemplo n.º 6
0
 public void GenerateRegionTimer()
 {
     //创建空的计时器
     timeBoxTimerComponent = StaticData.CreateTimer(100000 / 1000f, false, (go) =>
     {
     },
                                                    (remainTime) =>
     {
     }, "DecorateBoard");
 }
Exemplo n.º 7
0
    /// <summary>
    /// 开始倒计时
    /// </summary>
    void StartCountDown()
    {
        //判断服务器时间和状态显示按钮的sprite
        var morning = StaticData.configExcel.GetVertical().GetFavorableTimeMorning;
        var noon    = StaticData.configExcel.GetVertical().GetFavorableTimeAfternoon;
        var night   = StaticData.configExcel.GetVertical().GetFavorableTimeEvening;

        //获得服务器早中晚三个时间                               (0/1/2:时分秒)
        var morningTime = TimeHelper.GetDateTime(0, morning[0], morning[1], morning[2]);//2020.10.22.6.0.0
        var noonTime    = TimeHelper.GetDateTime(0, noon[0], noon[1], noon[2]);
        var nightTime   = TimeHelper.GetDateTime(0, night[0], night[1], night[2]);
        //三个时间段
        List <DateTime> timeQuantum = new List <DateTime>();

        timeQuantum.Add(morningTime);
        timeQuantum.Add(noonTime);
        timeQuantum.Add(nightTime);

        //获取领取好感状态信息
        var GetFavorableStateInfo = StaticData.playerInfoData.userInfo.GetFavorableStateInfo;

        //如果该时段未领
        if ((GetFavorableState)GetFavorableStateInfo.GetFavorableState == GetFavorableState.NeverGetType)
        {
            CanGetSet();//可领
            //doubleGet_Btn.onClick.AddListener(OnclickGetBtn);
        }
        else
        {
            NotCanGetSet();
        }

        //判断到下一个时段 是哪一个时段且还有多少秒
        for (int i = 0; i < timeQuantum.Count; i++)
        {
            if (TimeHelper.ServerDateTimeNow < timeQuantum[i])
            {
                surplusSecond = GetSubSeconds(TimeHelper.ServerDateTimeNow, timeQuantum[i]);
                break;
            }
        }
        //倒计时
        TempTimer = StaticData.CreateTimer(surplusSecond, true,
                                           async(go) =>
        {                                                                                                                     //时间到了就让按钮可点击
            //TempTimer = go;
            StaticData.playerInfoData.userInfo.GetFavorableStateInfo.GetFavorableState = (int)GetFavorableState.NeverGetType; //时间到了设置未领
            await CanGetSet();
            StartCountDown();                                                                                                 //这段计时完成后开始下一段计时
        },
                                           (timeCount) =>
        {
            Debug.LogError($"计时器剩余时间{timeCount}");
        }, "ReceiveDailyFavorable");
    }
Exemplo n.º 8
0
 public void Clear()
 {
     if (timeCountDown != null)
     {
         timeCountDown.Dispose();
     }
     timeCountDown = null;
     uiData        = null;
     myRunData     = null;
     funcs         = null;
     matchModule   = null;
     battleModule  = null;
 }
Exemplo n.º 9
0
        private void OnButtonDirBtnClick(string dir)
        {
            if (opIndex >= opArr.Length)
            {
                return;
            }

            if (opArr[opIndex] == dir)
            {
                opDirList[opIndex].SetStateInfo("keyState1");
                if (opIndex == opArr.Length - 1)   //输入完成
                {
                    ETModel.MatchModule matchModule = ETModel.UtilsModuleManager.GetModule(ETModel.ModuleType.MatchModule) as ETModel.MatchModule;
                    go_SaoGuangEft.SetActive(true);
                    if (battleModule.UsingFrameSync)
                    {
                        matchModule.SendOneFrameMsg(skillId);
                    }
                    else
                    {
                        myRunData.operationSkillId = skillId;
                        matchModule.AddFrameData(skillId);
                    }
                    TimeCountDownComponent timeCountDownComponent = ComponentFactory.Create <TimeCountDownComponent>();
                    timeCountDownComponent.Init(0.4f, null, string.Empty, () =>
                    {
                        Release();
                    });
                }
                opIndex++;
            }
            else
            {
                opDirList[opIndex].SetStateInfo("keyState2");
                TimeCountDownComponent timeCountDownComponent = ComponentFactory.Create <TimeCountDownComponent>();
                timeCountDownComponent.Init(0.5f, null, string.Empty, () => {
                    //错了重来
                    opIndex = 0;
                    if (opDirList == null)
                    {
                        return;
                    }
                    for (int i = 0; i < opArr.Length; i++)
                    {
                        opDirList[i].SetDirInfo("dir0" + opArr[i]);
                        opDirList[i].SetStateInfo("keyState0");
                    }
                });
            }
        }
Exemplo n.º 10
0
        //开始备战倒计时
        public void StartCountDown()
        {
            uiData.text_GameTimeText3_21.gameObject.SetActive(true);

            long timeVal1 = matchModule.matchInfo.startTime - TimeHelper.ServerTimeNow;

            Log.Info($"战斗开始等待时间:" + timeVal1);
            if (timeCountDown == null)
            {
                timeCountDown = ComponentFactory.Create <TimeCountDownComponent>();
            }
            timeCountDown.SetIsTime(true);
            timeCountDown.Init(timeVal1 / 1000f, uiData.text_GameTimeText3_21, "{0}", null, null);
        }
Exemplo n.º 11
0
 /// <summary>
 /// 更新订单红点
 /// </summary>
 private void UpdateDealRedDot()
 {
     DealRedDotTimer.Init(5f, false, () => {
         RedDotManager.UpdateRedDot(RedDotManager.RedDotKey.Order);
         if (!StaticData.IsSubmintDeal())
         {
             UpdateDealRedDot();
         }
         else
         {
             DealRedDotTimer.Dispose();
             DealRedDotTimer = null;
         }
     }, null);
 }
Exemplo n.º 12
0
 public void DestroyTime()
 {
     if (_timeCountDownComponent != null)
     {
         _timeCountDownComponent.Dispose();
         Destroy(_timeCountDownComponent.gameObject);
         _timeCountDownComponent = null;
     }
     if (_timeBoxTra.childCount > 0)
     {
         for (int i = _timeBoxTra.childCount - 1; i >= 0; i--)
         {
             Destroy(_timeBoxTra.GetChild(i).gameObject);
         }
     }
 }
Exemplo n.º 13
0
 /// <summary>
 /// 生成搜索定时器
 /// </summary>
 private void GenerateSearchTimerCount()
 {
     if (searchTimeCountDown == null)
     {
         RecoverySearch(false);
         searchTimeCountDown = StaticData.CreateTimerRebackMilliSeconds(1, true, (go) =>
         {
             Destroy(go);
             Destroy(searchTimeCountDown.gameObject);
             RecoverySearch(true);
         },
                                                                        (remainTime) =>
         {
             float fillAmount = remainTime / 1.0f;
             _buttonSearchGrey.GetComponent <Image>().fillAmount = fillAmount;
         });
     }
 }
Exemplo n.º 14
0
 /// <summary>
 /// 生成地鼠定时器
 /// </summary>
 /// <param name="timeDelta"></param>
 private void CreateMouseTimer(float timeDelta)
 {
     if (timeDelta == 0)
     {
         timeDelta = GetGenerateTimeDelta();
     }
     StaticData.DebugGreen($"创建地鼠生成定时器:{timeDelta}");
     //创建生成地鼠定时器,时间比生产间隔多5秒
     mouseGenTimer = StaticData.CreateTimer(timeDelta / 1000f + 5, true, (go) =>
     {
         if (isUser)
         {
             CheckSelfMouseGenerate();
         }
         Destroy(go);
         Destroy(mouseGenTimer.gameObject);
     },
                                            (remainTime) => { }, "MouseGenerate");
 }
Exemplo n.º 15
0
    /// <summary>
    /// 生成刷新推荐定时器
    /// </summary>
    private bool GenerateRefreshTimerCount()
    {
        bool isRecovery = false;

        if (refreshTimeCountDown == null)
        {
            isRecovery = true;
            RecoveryRefresh(false);
            refreshTimeCountDown = StaticData.CreateTimerRebackMilliSeconds(5, true, (go) =>
            {
                Destroy(go);
                Destroy(refreshTimeCountDown.gameObject);
                RecoveryRefresh(true);
            },
                                                                            (remainTime) =>
            {
                float fillAmount = remainTime / 5.0f;
                _buttonRefreshGrey.GetComponent <Image>().fillAmount = fillAmount;
            });
        }
        return(isRecovery);
    }
Exemplo n.º 16
0
 public void GenerateTimer()
 {
     //创建空的计时器
     timeCountDownComponentSeed = StaticData.CreateTimer(100000 / 1000f, false, (go) =>
     {
     },
                                                         (remainTime) =>
     {
     }, "Seed");
     timeCountDownComponentGerminate = StaticData.CreateTimer(100000 / 1000f, false, (go) =>
     {
     },
                                                              (remainTime) =>
     {
     }, "Germinate");
     timeCountDownComponentGrowUp = StaticData.CreateTimer(100000 / 1000f, false, (go) =>
     {
     },
                                                           (remainTime) =>
     {
     }, "GrowUp");
 }
Exemplo n.º 17
0
        public void Init(UIBattleMainData data)
        {
            matchModule  = UtilsModuleManager.GetModule(ModuleType.MatchModule) as MatchModule;
            battleModule = UtilsModuleManager.GetModule(ModuleType.MatchModule) as MatchModule;
            funcs        = matchModule.matchInit.funcs;
            myRunData    = matchModule.myRunData;
            uiData       = data;

            timeCountDown = ComponentFactory.Create <TimeCountDownComponent>();
            endPos        = funcs.GetEnd();
            SetMyPosTo2D();

            if (battleModule.IsPlayback)
            {
                uiData.recttrans_m_GroundState.localPosition -= new Vector3(52, 0, 0);
            }
            //preEnsureValue = 0;
            //preSpeedValue = 0;

            //uiData.slider_m_SpeedProgress.value = 1f;
            //uiData.slider_SliderEnsure.value = 1f;
            uiData.toggle_ToggleName.onValueChanged.AddListener(OnToggleSwitchHeadClick);
        }
Exemplo n.º 18
0
    //private void OnDisable()
    //{
    //    Debug.LogError("执行Disable");
    //    CloseActive();
    //}

    /// <summary>
    /// 销毁倒计时器
    /// </summary>
    public void CloseActive()
    {
        Destroy(TempTimer.gameObject);
        TempTimer = null;
    }
Exemplo n.º 19
0
        public void Run(int horseId, int skillId, bool isRemove)
        {
            //GameRunMatchComponent gameRunMatchComponent = Game.Scene.GetComponent<GameRunMatchComponent>();
            //if (gameRunMatchComponent == null || gameRunMatchComponent.IsDisposed)
            //    return;

            MatchModule    matchModule   = UtilsModuleManager.GetModule(ModuleType.MatchModule) as MatchModule;
            ModelHorseView findHorseView = matchModule.ModelHorseViewSet.Find(x => x.data.Id == horseId);

            //HorseView findHorseView = gameRunMatchComponent.GetHorseView(horseId);
            if (findHorseView == null)
            {
                Log.Error("没有这个马匹:" + horseId);
                return;
            }
            HorseSkillDefine horseSkillDefine = ModelComTools.Config.GetHorseSkillByID(skillId);

            if (horseSkillDefine == null)
            {
                Log.Error("没有这个技能:" + skillId);
                return;
            }
            List <int> skills = new List <int> {
                50080040, 50080041, 50080042, 50080043, 50080044, 50080045, 50080046, 50080047, 50080048, 50080049, 50080050, 50080051, 50080052, 50080053, 50080054, 50080055, 50080056, 50080057, 50080058, 50080059, 50080060, 50080061, 50080062, 50080063, 50080064, 50080065, 50080066, 50080067, 50080068, 50080069, 50080070
            };

            if (skills.Contains(horseSkillDefine.Name))
            {
                return;
            }
            string skillName = GameObjectTool.GetLanguage(horseSkillDefine.Name);
            string skillDesc = GameObjectTool.GetLanguage(horseSkillDefine.Describe);
            UIBattleMainComponent uiComponent = matchModule.uIBattleMainComponent;

            if (uiComponent != null)
            {
                var    tips      = GameObjectTool.GetLanguage(50138126);        //触发
                var    tips1     = GameObjectTool.GetLanguage(50138127);        //结束
                string skillInfo = string.Format(tips, horseId + 1, skillName); // $"<color=#24f50a>{horseId + 1}号赛马</color>:触发{skillName}技能";//,{skillDesc}";
                if (isRemove)
                {
                    skillInfo = string.Format(tips1, horseId + 1, skillName);//$"<color=#24f50a>{horseId + 1}号赛马</color>:技能{skillName}结束";
                }
                else
                {
                    if (horseSkillDefine.ExistTime > 0)
                    {
                        TimeCountDownComponent TimeCountDownComponentSkill = ComponentFactory.Create <TimeCountDownComponent>();
                        TimeCountDownComponentSkill.Init(horseSkillDefine.ExistTime, null, string.Empty, () =>
                        {
                            skillInfo = string.Format(tips1, horseId + 1, skillName);//$"<color=#24f50a>{horseId + 1}号赛马</color>:技能{skillName}结束";
                            uiComponent.AddSkillInfo(skillInfo);
                            TimeCountDownComponentSkill.Dispose();
                        });
                    }
                }
                uiComponent.AddSkillInfo(skillInfo);

                if (findHorseView.data.playerUid == matchModule.playerUID)
                {
                    uiComponent.SetSelfSkill(skillName, isRemove, skillId, horseSkillDefine.ExistTime);
                }
            }
        }