コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        float elapsedTime = Time.realtimeSinceStartup - this.m_StartTime;

        if (elapsedTime >= this.m_WaitTotalSeconds)
        {
            this.m_StartTime        = Time.realtimeSinceStartup;
            this.m_WaitTotalSeconds = this.m_WaitCount > 1 ? this.m_LastWaitSeconds :
                                      CommonHelper.GetRandomNumber(this.m_SecondWaitMinSeconds, this.m_SecondWaitMaxSeconds + 1);
            this.m_RemainingTimeLable.text = SystemFunction.TimeSpanToString(this.m_WaitTotalSeconds);
            if (this.m_Progress != null)
            {
                this.m_Progress.sliderValue = 0;
            }
            this.m_WaitCount++;
        }
        else
        {
            this.m_RemainingTimeLable.text = SystemFunction.TimeSpanToString(Mathf.CeilToInt(this.m_WaitTotalSeconds - elapsedTime));
            if (this.m_Progress != null)
            {
                this.m_Progress.sliderValue = elapsedTime / this.m_WaitTotalSeconds;
            }
        }
    }
コード例 #2
0
ファイル: ProduceCommon.cs プロジェクト: KangLLL/century_war
    protected virtual void AccelerateProduce()
    {
        if (this.BuildingLogicData.RemainArmyAccelerateTime < 0)
        {
            int costGem = ConfigInterface.Instance.SystemConfig.ProduceArmyAccelerateCostGem;

            string resourceContext = string.Format(StringConstants.PROMPT_ACCELERATE_ARMY, SystemFunction.TimeSpanToString(ConfigInterface.Instance.SystemConfig.ProduceArmyAccelerateLastTime), ConfigInterface.Instance.SystemConfig.ProduceArmyAccelerateScale);
            UIManager.Instance.UIWindowCostPrompt.ShowWindow(costGem, resourceContext, StringConstants.PROMT_IS_ACCELERATE);
            UIManager.Instance.UIWindowCostPrompt.Click += () =>
            {
                if (LogicController.Instance.PlayerData.CurrentStoreGem < costGem)
                {
                    print("宝石不足,去商店");
                    UIManager.Instance.UIWindowFocus = null;
                    //UIManager.Instance.UIButtonShopping.GoShopping();
                    UIManager.Instance.UISelectShopMenu.GoShopping();
                }
                else
                {
                    print("加速产兵");
                    LogicController.Instance.AddArmyAccelerate(this.BuildingLogicData.BuildingIdentity);
                }
            };
        }
    }
コード例 #3
0
ファイル: CollectCommon.cs プロジェクト: KangLLL/century_war
 protected virtual void AccelerateCollect()
 {
     if (this.BuildingLogicData.RemainResourceAccelerateTime < 0)
     {
         int    costGem         = CommonUtilities.MarketCalculator.GetResourceAccelerateCostGem(this.BuildingLogicData.BuildingType, this.BuildingLogicData.Level);
         string resourceContext = string.Format(StringConstants.PROMPT_ACCELERATE_RESOURCE, SystemFunction.TimeSpanToString(ConfigInterface.Instance.SystemConfig.ProduceResourceAccelerateLastTime), ConfigInterface.Instance.SystemConfig.ProduceResourceAccelerateScale);
         UIManager.Instance.UIWindowCostPrompt.ShowWindow(costGem, resourceContext, StringConstants.PROMT_IS_ACCELERATE);
         UIManager.Instance.UIWindowCostPrompt.Click += () =>
         {
             if (LogicController.Instance.PlayerData.CurrentStoreGem < costGem)
             {
                 print("宝石不足,去商店");
                 UIManager.Instance.UIWindowFocus = null;
                 //UIManager.Instance.UIButtonShopping.GoShopping();
                 UIManager.Instance.UISelectShopMenu.GoShopping();
             }
             else
             {
                 print("加速收集");
                 LogicController.Instance.AddResourceAccelerate(this.BuildingLogicData.BuildingIdentity);
             }
         };
     }
 }