예제 #1
0
 //提前铲除
 public static void ManorEradicatePlant(CSEradicate csEradicate, Action <SCEmptEradicate> ResponseSCEmptEradicateCallBack)
 {
     if (StaticData.IsUsedLocalDataNotServer)
     {
         //测试
         SCEmptEradicate scEmptEradicate = new SCEmptEradicate();
         ResponseSCEmptEradicateCallBack(scEmptEradicate);
     }
     else
     {
         ProtocalManager.Instance().SendCSEradicate(csEradicate, ResponseSCEmptEradicateCallBack, (error) => { }, false);
     }
 }
예제 #2
0
    private void EradicatePlant()
    {
        if (seedGrowComponent != null && seedGrowComponent.currCropPeriod == SeedGrowComponent.PeriodGrow.Ripe)
        {
            StaticData.CreateToastTips($"作物已成熟,不能铲除!");
            SetHandleTileUIClose();
            return;
        }
        CSEradicate csEradicate = new CSEradicate()
        {
            SoilId = currClickComponent.SoilId
        };

        ManorProtocalHelper.ManorEradicatePlant(csEradicate, async(succ) =>
        {
            //关闭UI
            SetHandleTileUIClose();
            //铲除特效
            GoEradicateEffect.GetComponent <RectTransform>().anchoredPosition = StaticData.ManorWorldPointToUICameraAnchorPos(currClickComponent.transform.position);
            GoEradicateEffect.SetActive(true);
            isEradicating = true;
            await UniTask.Delay(500);
            GoEradicateEffect.SetActive(false);
            isEradicating = false;
            //播放音效点击
            GameSoundPlayer.Instance.PlaySoundEffect(MusicHelper.SoundEffectEradicate);
            currClickComponent.CropGoodId = 0;
            //删除
            if (seedGrowComponent != null)
            {
                Destroy(seedGrowComponent.gameObject);
            }
            currClickComponent.SetCurrGoPlant(null);
            //删除seedGrowCom
            Root2dSceneManager._instance.RemoveFromListSeedGrow(this.seedGrowComponent);
            this.seedGrowComponent = null;
        });
    }
예제 #3
0
        public void SendCSEradicate(CSEradicate cseradicate, Action <SCEmptEradicate> ResponseSCEmptEradicateCallBack, Action <ErrorInfo> errorCallBack, bool isShowDefaultTip = true)
        {
            OpCodeType opCodeType = ListOPRelation.GetOpCodeTypeByRequest <CSEradicate> ();

            ProtoSendMethod.BusinessRequest <SCEmptEradicate>(cseradicate, opCodeType, ResponseSCEmptEradicateCallBack, errorCallBack, isShowDefaultTip);
        }