예제 #1
0
 //广告加速使用化肥
 public static void FertilizerAdIncrease(CSEmptyCropSpeed csEmptyCropSpeed, Action <SCEmptyCropSpeed> ResponseSCEmptyCropSpeedCallBack, Action <ErrorInfo> errorCallBack)
 {
     if (StaticData.IsUsedLocalDataNotServer)
     {
         //测试
         SCEmptyCropSpeed scEmptyCropSpeed = new SCEmptyCropSpeed();
         ResponseSCEmptyCropSpeedCallBack(scEmptyCropSpeed);
     }
     else
     {
         ProtocalManager.Instance().SendCSEmptyCropSpeed(csEmptyCropSpeed, ResponseSCEmptyCropSpeedCallBack, errorCallBack, true);
     }
 }
예제 #2
0
    private void OnButtonAdClick()
    {
        List <SeedGrowComponent> listSeedGrow = Root2dSceneManager._instance.GetListSeedGrow();
        //23阶段的作物
        List <SeedGrowComponent> listSeedGrow23 = new List <SeedGrowComponent>();

        if (listSeedGrow != null && listSeedGrow.Count > 0)
        {
            for (int i = 0; i < listSeedGrow.Count; i++)
            {
                if (listSeedGrow[i].currCropPeriod == SeedGrowComponent.PeriodGrow.Germinate ||
                    listSeedGrow[i].currCropPeriod == SeedGrowComponent.PeriodGrow.GrowUp)
                {
                    listSeedGrow23.Add(listSeedGrow[i]);
                }
            }
        }
        if (listSeedGrow23.Count > 0)
        {
            CSEmptyCropSpeed csEmptyCropSpeed = new CSEmptyCropSpeed();
            ManorProtocalHelper.FertilizerAdIncrease(csEmptyCropSpeed, (succ) =>
            {
                //关闭UI
                uiWorldHandleManager.SetHandleTileUIClose();
                StaticData.playerInfoData.userInfo.CropCount++;
                if (StaticData.playerInfoData.userInfo.CropCount <= 0)
                {
                    StaticData.playerInfoData.userInfo.CropCount = 0;
                }
                UpdateFertilizerAdCount();
                for (int i = 0; i < listSeedGrow23.Count; i++)
                {
                    SeedGrowComponent.PeriodGrow nextPeriod = SeedGrowComponent.PeriodGrow.Seed;
                    float remainTimeToRipe = listSeedGrow23[i].remainTimeGerminateToRipe / 2f;
                    float remainTime       = listSeedGrow23[i].remainTime - remainTimeToRipe;
                    if (remainTime <= 0)
                    {
                        //下一个时期
                        switch (listSeedGrow23[i].currCropPeriod)
                        {
                        case SeedGrowComponent.PeriodGrow.Seed:
                            nextPeriod = SeedGrowComponent.PeriodGrow.Germinate;
                            break;

                        case SeedGrowComponent.PeriodGrow.Germinate:
                            remainTime = remainTimeToRipe;
                            nextPeriod = SeedGrowComponent.PeriodGrow.GrowUp;
                            break;

                        case SeedGrowComponent.PeriodGrow.GrowUp:
                            remainTime = remainTimeToRipe;
                            nextPeriod = SeedGrowComponent.PeriodGrow.Ripe;
                            break;

                        case SeedGrowComponent.PeriodGrow.Ripe:
                            break;
                        }
                        //remainTime = StaticData.GetSeedGrowComponentTotalSecond(listSeedGrow23[i], nextPeriod);
                    }
                    else
                    {
                        nextPeriod = listSeedGrow23[i].currCropPeriod;
                    }

                    listSeedGrow23[i].SetPeriod(nextPeriod, (long)remainTime * 1000);
                }
            }, (error) =>
            {
                uiWorldHandleManager.SetHandleTileUIClose();
            });
        }
        else
        {
            //关闭UI
            uiWorldHandleManager.SetHandleTileUIClose();
        }
    }
예제 #3
0
        public void SendCSEmptyCropSpeed(CSEmptyCropSpeed csemptycropspeed, Action <SCEmptyCropSpeed> ResponseSCEmptyCropSpeedCallBack, Action <ErrorInfo> errorCallBack, bool isShowDefaultTip = true)
        {
            OpCodeType opCodeType = ListOPRelation.GetOpCodeTypeByRequest <CSEmptyCropSpeed> ();

            ProtoSendMethod.BusinessRequest <SCEmptyCropSpeed>(csemptycropspeed, opCodeType, ResponseSCEmptyCropSpeedCallBack, errorCallBack, isShowDefaultTip);
        }