private async void OnEnterManor() { //功能是否开启 if (!StaticData.IsOpenFunction(10013)) { return; } UIComponent.HideUI(UIType.UIFriend); //StaticData.OpenFriend(true); UIManorComponent uiManorComponent = UIComponent.GetComponentHaveExist <UIManorComponent>(UIType.UIManor); if (uiManorComponent == null) { await UIComponent.CreateUIAsync(UIType.UIManor); uiManorComponent = UIComponent.GetComponentHaveExist <UIManorComponent>(UIType.UIManor); } StaticData.curFriendStealInfo = new FriendStealInfo() { nickname = scFriendInfo.FriendName, headIcon = scFriendInfo.FriendImage, playerLevelAndCurrExp = StaticData.GetPlayerLevelAndCurrExp(scFriendInfo.FriendExperience) }; //新手引导完成 if (StaticData.isOpenGuide && GuideCanvasComponent._instance != null && GuideCanvasComponent._instance.isCurrStepGuiding) { GuideCanvasComponent._instance.SetLittleStepFinish(); } uiManorComponent.OnButtonEnterFriendManor(scFriendInfo.Uid); }
public async void OnButtonEnterFriendManor(long idFriend) { if (StaticData.idPreEnterManor == idFriend) { StaticData.CreateToastTips($"正在当前好友的庄园中!"); return; } StaticData.idPreEnterManor = idFriend; UIComponent.HideUI(UIType.UIManor); await SceneManagerComponent._instance.ChangeSceneAsync(EnumScene.Manor, true); await UIComponent.CreateUIAsync(UIType.UIManor); UIManorComponent uiManorComponent = UIComponent.GetComponentHaveExist <UIManorComponent>(UIType.UIManor); uiManorComponent.OpenManorRoot(false); if (Root2dSceneManager._instance != null) { await Root2dSceneManager._instance.EnterManor(idFriend); } StaticData.SetSceneState(StaticData.SceneState.ManorFriend); //移动到特定视角时间 await UniTask.Delay(1000); UIComponent.HideUI(UIType.UISceneLoading); await StaticData.PlayManorEnterAnim(); }
private async void OnButtonReturnMyManorClick() { //播放庄园退出动画 UIManorComponent uiManorCom = UIComponent.GetComponentHaveExist <UIManorComponent>(UIType.UIManor); if (uiManorCom != null) { await uiManorCom.uiManorAnim.PlayAnimQuitManor(); } //加载场景 UIComponent.HideUI(UIType.UIManor); await SceneManagerComponent._instance.ChangeSceneAsync(EnumScene.Manor, true); await UIComponent.CreateUIAsync(UIType.UIManor); UIManorComponent uiManorComponent = UIComponent.GetComponentHaveExist <UIManorComponent>(UIType.UIManor); uiManorComponent.OpenManorRoot(true); if (Root2dSceneManager._instance != null) { await Root2dSceneManager._instance.EnterManor(-1); } //移动到特定视角时间 await UniTask.Delay(1000); UIComponent.HideUI(UIType.UISceneLoading); await StaticData.PlayManorEnterAnim(); }
/// <summary> /// 关闭界面进入好友庄园 /// </summary> /// <param name="friendID"></param> public void CloseAndEnterFriendManor(long friendID) { OnClickClose(); UIManorComponent uiManorComponent = UIComponent.GetComponentHaveExist <UIManorComponent>(UIType.UIManor); uiManorComponent.OnButtonEnterFriendManor(friendID); }
// Start is called before the first frame update void Start() { UIManorComponent uiManorComponent = UIComponent.GetComponentHaveExist <UIManorComponent>(UIType.UIManor); uiManorComponent.SetCanWateringOnekey(); TextNumNormal.gameObject.SetActive(false); TextNumZero.gameObject.SetActive(false); ButtonFertilizer.onClick.RemoveAllListeners(); ButtonFertilizer.onClick.AddListener(OnButtonFertilizerClick); }
private void OnEnterManor() { UIManorComponent uiManorComponent = UIComponent.GetComponentHaveExist <UIManorComponent>(UIType.UIManor); StaticData.curFriendStealInfo = curFriendStealInfo; uiManorComponent.OnButtonEnterFriendManor(curFriendStealInfo.uid); if (StaticData.isOpenGuide && GuideCanvasComponent._instance != null && GuideCanvasComponent._instance.isCurrStepGuiding) { GuideCanvasComponent._instance.SetLittleStepFinish(); } }
public async void ShowInfo(int addCount) { transform.localScale = Vector2.one; canvasGroup.alpha = 1f; textAddNum.text = $"+{addCount}"; UIManorComponent uiManorComponent = UIComponent.GetComponentHaveExist <UIManorComponent>(UIType.UIManor); var transUIExp = uiManorComponent.goPlayerIcon.GetComponent <UIPlayerImageComponent>().imageExp.transform; var RectTranPos = StaticData.RectTransWorldPointToUICameraAnchorPos(transUIExp.position); PalyAnim(RectTranPos); Destroy(gameObject, 5f); }
public static void StealFriendFruit(CSStealData csStealData, Action <SCStealData> ResponseSCStealDataCallBack) { if (StaticData.IsUsedLocalDataNotServer) { //测试 SCStealData scStealData = new SCStealData(); SCStealResult scStealResult = new SCStealResult() { SoilId = 1001, StealId = 1001, StealNum = 10 }; scStealData.StealResult.Add(scStealResult); ResponseSCStealDataCallBack(scStealData); } else { if (csStealData.StealUid == 1 && StaticData.isOpenGuide && GuideCanvasComponent._instance != null && GuideCanvasComponent._instance.CurrExecuteGuideLittleStepDefine.Id == 10024)//新手引导好友庄园 { CSEmptyStealManorGuidance csEmptyStealManorGuidance = new CSEmptyStealManorGuidance(); ProtocalManager.Instance().SendCSEmptyStealManorGuidance(csEmptyStealManorGuidance, (scStealManorGuidance) => { if (StaticData.isOpenGuide && GuideCanvasComponent._instance != null && GuideCanvasComponent._instance.isCurrStepGuiding) { GuideCanvasComponent._instance.SetLittleStepFinish(); } SCStealData sCStealData = new SCStealData(); sCStealData.StealResult.AddRange(scStealManorGuidance.StealResult); //设置偷取按钮 UIManorComponent uiManorComponent = UIComponent.GetComponentHaveExist <UIManorComponent>(UIType.UIManor); if (uiManorComponent != null) { uiManorComponent.PlayOneKeyGainEffect(false); } ResponseSCStealDataCallBack.Invoke(sCStealData); }, (error) => { //设置偷取按钮 UIManorComponent uiManorComponent = UIComponent.GetComponentHaveExist <UIManorComponent>(UIType.UIManor); if (uiManorComponent != null) { uiManorComponent.PlayOneKeyGainEffect(false); } }, false); return; } ProtocalManager.Instance().SendCSStealData(csStealData, ResponseSCStealDataCallBack, (error) => { }, true); } }
public async void ShowInfo(string iconName, int addCount) { transform.localScale = Vector2.one; for (int i = 0; i < IconFruits.Count; i++) { IconFruits[i].sprite = await ABManager.GetAssetAsync <Sprite>(iconName); } canvasGroup.alpha = 1f; textAddNum.text = $"+{addCount}"; UIManorComponent uiManorComponent = UIComponent.GetComponentHaveExist <UIManorComponent>(UIType.UIManor); var RectTranPos = StaticData.RectTransWorldPointToUICameraAnchorPos(uiManorComponent.buttonWareHouse.transform.position); PalyAnim(RectTranPos); Destroy(gameObject, 5f); }
async UniTask BeginDrag(bool isDragFromScene)//isDragFromScene是否从放好了的在拖动 { this.isDragFromScene = isDragFromScene; //设置初始位置 SetTilePos(true); Root2dSceneManager._instance.isTileDrag = true; TipsTileComponent._instance.SetUpAnimPos(transform); //显示提示 if (isDragFromScene) { //播放抬起动画 ctsWaitPlayUpAnim = new CancellationTokenSource(); isUpAnimPlaying = true; await TipsTileComponent._instance.PlayUpAnim(ctsWaitPlayUpAnim.Token); if (ctsWaitPlayUpAnim.Token.IsCancellationRequested) { return; } TipsTileComponent._instance.SetCanPlace(transform, true, this); isUpAnimPlaying = false; //从场景中拖起,设置最高层级 SetPlantLayerMax(); } else { TipsTileComponent._instance.SetCanPlace(transform, true, this); } //等动画播放再拖拽 isDrag = true; isBeginPlace = true; //开始拖拽的时候记录World摄像机位置 var worldComponent = Root2dSceneManager._instance.worldCameraComponent; worldComponent.SetPreCameraPos(); //拖动地块的时候关闭地块UI UIWorldHandleManager uiUIWorldHandleComponent = StaticData.GetUIWorldHandleComponent(); uiUIWorldHandleComponent.SetHandleTileUIClose(); //关闭Manor UI UIManorComponent uiManorComponent = UIComponent.GetComponentHaveExist <UIManorComponent>(UIType.UIManor); uiManorComponent.DragTileOrDecorateCloseSelfManor(true); }
private void CheckGain() { var listSeedGrow = Root2dSceneManager._instance.GetListSeedGrow(); UIManorComponent uiManorComponent = UIComponent.GetComponentHaveExist <UIManorComponent>(UIType.UIManor); if (uiManorComponent == null) { return;//正在加载中 } if (listSeedGrow.Count > 0) { var listRipe = listSeedGrow.FindAll(x => x.currCropPeriod == SeedGrowComponent.PeriodGrow.Ripe); if (listRipe != null && listRipe.Count > 0) { if (!Root2dSceneManager._instance.isFriendManor) { Root2dSceneManager._instance.GetManorBubbleComponent().AddTipsPertinence(20001); } uiManorComponent.PlayOneKeyGainEffect(true); } else { if (!Root2dSceneManager._instance.isFriendManor) { Root2dSceneManager._instance.GetManorBubbleComponent().RemoveTipsPertinenceAll(20001); } uiManorComponent.PlayOneKeyGainEffect(false); } } else {//没有种植东西 uiManorComponent.PlayOneKeyGainEffect(false); if (!Root2dSceneManager._instance.isFriendManor) { Root2dSceneManager._instance.GetManorBubbleComponent().RemoveTipsPertinenceAll(20001); } } }
private void OnButtonRebackClick() { CSOrnamentalRecycle csOrnamentalRecycle = new CSOrnamentalRecycle() { SoilId = currClickDecorateComponent.SoilId }; ManorProtocalHelper.SendOrnamentalRecycle(csOrnamentalRecycle, (succ) => { //更新仓库装饰物 StaticData.UpdateWareHouseItem(currClickDecorateComponent.CropGoodId, 1); //回收完更新装饰物界面 UIManorComponent uiManorComponent = UIComponent.GetComponentHaveExist <UIManorComponent>(UIType.UIManor); uiManorComponent.RefreshDecorateList(); //回收装饰物之前关闭提示,否则会把这个提示删掉 TipsTileComponent._instance.CloseAll(); Destroy(currClickDecorateComponent.gameObject); goReback.SetActive(false); goRebackAndRotate.SetActive(false); }); }
//设置可以所有地块可以偷取的状态 public void SetFriendManorStealState(List <StealClass> listStealClass) {//只设置第一个的状态 if (Root2dSceneManager._instance.isFriendManor == false) { return; } if (listStealClass == null) { return; } this.listStealClass = listStealClass; bool isCanSteal = false; if (listStealClass != null && listStealClass.Count > 0) { for (int j = 0; j < listStealClass.Count; j++) { //表示能偷 if (listStealClass[j].isSteal) { isCanSteal = true; break; } } } UIManorComponent uiManorComponent = UIComponent.GetComponentHaveExist <UIManorComponent>(UIType.UIManor); //能偷,设置状态 if (isCanSteal) { uiManorComponent.PlayOneKeyGainEffect(true); } else { uiManorComponent.PlayOneKeyGainEffect(false); } }
public void OnButtonFertilizerClick() { if (Root2dSceneManager._instance.isFriendManor) {//好友庄园不可操作 return; } var firstFertilizer = StaticData.GetFertilizerCountByWhich(0); if (firstFertilizer.GoodNum <= 0) { //关闭UI StaticData.GetUIWorldHandleComponent().SetHandleTileUIClose(); string FertilizerName = StaticData.GetMultiLanguageByGameItemId(firstFertilizer.GoodId); string Tips = string.Format(StaticData.GetMultilingual(120068), FertilizerName); StaticData.OpenCommonTips(Tips, 120010, async() => { //跳转商城 await StaticData.OpenShopUI(1); }); return; } CSFertilizer csFertilizer = new CSFertilizer() { SoilId = seedGrowComponent.tileComponent.SoilId, FertilizerId = firstFertilizer.GoodId }; ManorProtocalHelper.UseFertilizer(csFertilizer, async(succ) => { //第一阶段使用化肥 if (StaticData.isOpenGuide && GuideCanvasComponent._instance != null && GuideCanvasComponent._instance.CurrExecuteGuideLittleStepDefine.Id == 10004) { GuideCanvasComponent._instance.SetLittleStepFinish(); } //点击浇水的时候,关闭水滴 ButtonFertilizer.gameObject.SetActive(false); TextNumNormal.gameObject.SetActive(false); TextNumZero.gameObject.SetActive(false); //关闭UI StaticData.GetUIWorldHandleComponent().SetHandleTileUIClose(); //施肥特效 string iconFretilizer = string.Empty; int propId = csFertilizer.FertilizerId; iconFretilizer = StaticData.configExcel.GetGameItemByID(propId).Icon; StaticData.GetUIWorldHandleComponent().PlayWateringAnim(seedGrowComponent.tileComponent); //播放音效点击 GameSoundPlayer.Instance.PlaySoundEffect(MusicHelper.SoundEffectWatering); //end 施肥特效 SeedGrowComponent.PeriodGrow nextPeriod = SeedGrowComponent.PeriodGrow.Germinate;//种子的下一时期,幼苗期 //直接进入下一个时期 float remainTime = StaticData.GetSeedGrowComponentTotalSecond(seedGrowComponent, nextPeriod); seedGrowComponent.SetPeriod(nextPeriod, (long)remainTime * 1000); //化肥数量-1 StaticData.UpdateFertilizerMinus1(propId); //设置是否能一键浇水 UIManorComponent uiManorComponent = UIComponent.GetComponentHaveExist <UIManorComponent>(UIType.UIManor); uiManorComponent.SetCanWateringOnekey(); }, (error) => { //关闭UI StaticData.GetUIWorldHandleComponent().SetHandleTileUIClose(); }); }
// Update is called once per frame void Update() { UIManorComponent uiManorComponent = UIComponent.GetComponentHaveExist <UIManorComponent>(UIType.UIManor); UIWorldHandleManager uiUIWorldHandleComponent = StaticData.GetUIWorldHandleComponent(); if (uiManorComponent == null) { return; //场景加载过程中 } if (Input.GetMouseButtonUp(0)) //如果左键抬起重置 { isTileDrag = false; } if (Input.GetMouseButtonDown(0))//左键按下 { currHandleTile = null; bool isUIScrollMask = false; bool isUIDecorateMask = false; //EventSystem.current.IsPointerOverGameObject()在android上unity2019不起作用 var clickObj = StaticData.UI_GetCurrentSelect(); if (clickObj != null)//表明是UI { isUIScrollMask = clickObj.CompareTag(TagHelper.UIScrollMask); isUIDecorateMask = clickObj.CompareTag(TagHelper.DecorateUIMask); } if (Root2dSceneManager._instance.isTileDrag) { //地块正在拖拽的时候,相机不允许平移 return; } //覆盖的不是UI if (clickObj == null || isUIScrollMask) { CloseAllTileObjSelect(); if (uiUIWorldHandleComponent != null) { uiUIWorldHandleComponent.SetHandleTileUIClose(); } StaticData.DebugGreen("Not UI"); Camera cameraWorld = Root2dSceneManager._instance.worldCameraComponent.cameraWorld; var worldPoint = cameraWorld.ScreenToWorldPoint(Input.mousePosition); Collider2D[] colliders = Physics2D.OverlapPointAll(worldPoint); //层级排序上边到下边 /* * TagHelper.CollierCanOver * TagHelper.PlantRenderer//植物Render层,不能拖走的 * TagHelper.Tile * TagHelper.Ground */ listOverlapPointCollider.Clear(); //colliders 转list for (int i = 0; i < colliders.Length; i++) { listOverlapPointCollider.Add(colliders[i]); } //add_by_wsf Collider2D colliderMouse = listOverlapPointCollider.Find(x => x.gameObject.CompareTag(TagHelper.MouseManor)); if (colliderMouse != null) { //点击地鼠 Debug.Log("敲打地鼠~~~"); mouseManorManager.CatchMouse(); return; } //add_by_wsf end Collider2D colliderTileCom = null; colliderTileCom = listOverlapPointCollider.Find(x => x.gameObject.CompareTag(TagHelper.CollierCanOver)); if (colliderTileCom == null) { colliderTileCom = listOverlapPointCollider.Find(x => x.gameObject.CompareTag(TagHelper.Tile)); } var colliderGrounds = listOverlapPointCollider.FindAll(x => x.gameObject.CompareTag(TagHelper.Ground)); if (colliderTileCom != null) {//点击树或者小地块 StaticData.DebugGreen($"{colliderTileCom.name}"); TileComponent tileCom = colliderTileCom.gameObject.GetComponent <TileComponent>(); //树需要到上一层才有组件,种植的作物要上三层 if (tileCom == null) { tileCom = colliderTileCom.transform.GetComponentInParent <TileComponent>(); } if (tileCom != null)//别墅,仓库没有TileComponent { currHandleTile = tileCom.gameObject; tileCom.PressInScene(); } } else if (colliderGrounds != null && colliderGrounds.Count > 0) { //点击到大地块 //大地块点击,没解锁的地方的除了Ground其它地方碰撞器都是禁用的 var colliderGround = colliderGrounds.Find(x => x.gameObject.GetComponent <ManorRegionComponent>().regionId != 0); if (colliderGround != null) //为null表示只有0的碰撞器 { //有限处理没解锁的 ManorRegionComponent manorRegion = colliderGround.gameObject.GetComponent <ManorRegionComponent>(); StaticData.DebugGreen($"大地块按下"); manorRegion.PressDownRegion(); } else {//用来处理人物点击空白的行走 StaticData.DebugGreen($"大地块0按下"); ManorRegionComponent manorRegion = colliderGrounds[0].gameObject.GetComponent <ManorRegionComponent>(); manorRegion.PressDownRegion(); } } } //如果点击到了装饰物的UI面板 if (isUIDecorateMask) { ContineClickDecorate(); } } }
/// <summary> /// 跳转任务场景 /// </summary> /// <param name="taskSceneTag"></param> public static async void SkipTaskScene(TaskSceneTag taskSceneTag) { EnumScene currScene = SceneManagerComponent._instance._currSceneTage; //taskSceneTag = TaskSceneTag.ManorFriends; switch (taskSceneTag) { case TaskSceneTag.None: Debug.Log("没有需要跳转的场景"); break; case TaskSceneTag.SignIn: Debug.Log("没有需要跳转的场景"); break; case TaskSceneTag.GetFavorability: Debug.Log("没有需要跳转的场景"); break; case TaskSceneTag.Manor: case TaskSceneTag.DressUpTheManor: case TaskSceneTag.ManorFriends: case TaskSceneTag.Deal: switch (currScene) { case EnumScene.Empty: await StaticData.ToManorSelf(); break; case EnumScene.TestPlant: break; case EnumScene.Manor: break; case EnumScene.Zillionaire: await StaticData.RichManReturnToManor(); break; case EnumScene.Party: await StaticData.ToManorSelf(); break; } switch (taskSceneTag) { case TaskSceneTag.DressUpTheManor: await UniTask.Delay(500); UIManorComponent uiManaorCom = UIComponent.GetComponentHaveExist <UIManorComponent>(UIType.UIManor); if (uiManaorCom != null) { uiManaorCom.uiManorAnim.PlayAnimOpenDecorate(); } break; case TaskSceneTag.ManorFriends: StaticData.OpenFriend(true); break; case TaskSceneTag.Deal: //打开订单 StaticData.EnterUIDeal(); break; } break; case TaskSceneTag.ZillionaireSetout: //功能是否开启 if (!StaticData.IsOpenFunction(10011)) { return; } else { UICameraManager._instance.SetDefault(); UIComponent.RemoveUI(UIType.UIFriend); UIComponent.RemoveUI(UIType.Warehouse); UIComponent.RemoveUI(UIType.UIShop); UIComponent.RemoveUI(UIType.UIManor); await StaticData.OpenMonopoly(); StaticData.DataDot(Company.Cfg.DotEventId.EnterRichMan); } break; case TaskSceneTag.Friend: case TaskSceneTag.ChapterList: case TaskSceneTag.ThrobbingCasting: switch (currScene) { case EnumScene.Empty: break; case EnumScene.TestPlant: break; case EnumScene.Manor: break; case EnumScene.Zillionaire: await StaticData.ToManorSelf(); break; case EnumScene.Party: break; default: break; } switch (taskSceneTag) { case TaskSceneTag.Warehouse: await StaticData.OpenWareHouse(); break; case TaskSceneTag.PropWarehouse: await StaticData.OpenWareHouse(); break; case TaskSceneTag.Friend: await StaticData.OpenFriend(false); break; case TaskSceneTag.ZillionaireSetout: break; case TaskSceneTag.ChapterList: //章节是否开启 if (!StaticData.IsOpenFunction(10007)) { return; } await StaticData.OpenChapterUI(); break; case TaskSceneTag.ThrobbingCasting: //心动时刻 if (!StaticData.IsOpenFunction(10015)) { return; } await StaticData.OpenImpulseUI(); break; case TaskSceneTag.Shop: await StaticData.OpenShopUI(0); break; } break; case TaskSceneTag.Shop: await StaticData.OpenShopUI(0); break; case TaskSceneTag.Warehouse: await StaticData.OpenWareHouse(); break; case TaskSceneTag.PropWarehouse: await StaticData.OpenWareHouse(2); break; case TaskSceneTag.FruitWarehouse: await StaticData.OpenWareHouse(1); break; } }
// Update is called once per frame void Update() { if (Root2dSceneManager._instance.currHandleTile != this.gameObject) { return; } var worldComponent = Root2dSceneManager._instance.worldCameraComponent; var clickObj = StaticData.UI_GetCurrentSelect(); bool isUIScrollMask = false; bool isUIDecorateMask = false; if (clickObj != null)//表明是UI { isUIScrollMask = clickObj.CompareTag(TagHelper.UIScrollMask); isUIDecorateMask = clickObj.CompareTag(TagHelper.DecorateUIMask); } if (!isDrag && Input.GetMouseButtonUp(0) && (clickObj == null || isUIScrollMask || isUIDecorateMask))//鼠标抬起 { //关闭掉正在处理的装饰物 if (isUIDecorateMask && StaticData.GetUIWorldHandleComponent().isRotatingDecorate) { StaticData.GetUIWorldHandleComponent().OnButtonRotateOKClick(false); StaticData.GetUIWorldHandleComponent().SetHandleTileUIClose(); } isPress = false; isDrag = false; isLongPress = false; if (timeCurrPress > timeOnClickMinThreshold && timeCurrPress <= timeLongPressThreshold) { StaticData.DebugGreen("触发小地块点击"); OnTileClick(); } timeCurrPress = 0f; } else if (isDrag) { //正在拖拽,判定是否小于边缘 EnumDirection direction = EnumDirection.None; for (int i = 0; i < worldComponent.listDirection.Count; i++) { float xDir = worldComponent.listDirection[i].x; float yDir = worldComponent.listDirection[i].y; var newPos = Input.mousePosition + new Vector3(xDir, yDir, 0) * ManorCameraWorldComponent.SizeScreenToSide; //四个方向判定 if (newPos.x <= 0f) { direction = EnumDirection.Left; break; } else if (newPos.x >= Screen.width) { direction = EnumDirection.Right; break; } else if (newPos.y <= 0f) { direction = EnumDirection.Bottom; break; } else if (newPos.y >= Screen.height) { direction = EnumDirection.Up; break; } } if (direction != EnumDirection.None)//表示是自动滑动 { worldComponent.TriggerAutoScroll(direction); } else {//改变了方向 worldComponent.EndAutoScroll(); } } //只要鼠标抬起,就停止自动滚动 if (Input.GetMouseButtonUp(0))//滑动过程中鼠标抬起也终止自动滑动 { worldComponent.EndAutoScroll(); } if (isPress && !isDrag) { timeCurrPress += Time.deltaTime; //小地块滑动 if (Vector2.Distance(tileMousePos, Input.mousePosition) <= 10f)//10f做为滑动的阈值 { if (timeCurrPress >= timeLongPressThreshold) { if (!Root2dSceneManager._instance.isFriendManor)//好友庄园不能长按拖动 { //正在处理装饰物 if (StaticData.GetUIWorldHandleComponent().isRotatingDecorate&& typeTile == TypeManorDecorate.Decorate) { isPress = false; return; } isLongPress = true; StaticData.DebugGreen("触发小地块拖动"); BeginDrag(true); } } } } if (isBeginPlace && Input.GetMouseButton(0))//鼠标按住处理 { SetTilePos(false); //播放完抬起动画再检查 if (isUpAnimPlaying == false) { CheckIsCanPlace(() => { //显示红色箭头 TipsTileComponent._instance.SetCanPlace(transform, false, this); }, () => { //显示蓝色箭头 TipsTileComponent._instance.SetCanPlace(transform, true, this); }); } } if (Input.GetMouseButtonUp(0))//鼠标抬起 { ctsWaitPlayUpAnim?.Cancel(); isUpAnimPlaying = false; //庄园角色移动,继续气泡播放 if (isNPC) { Root2dSceneManager._instance.GetManorBubbleComponent().ResetBeginAnimByTime(); } //关闭提示 TipsTileComponent._instance.CloseAll(); //打开Manor UI UIManorComponent uiManorComponent = UIComponent.GetComponentHaveExist <UIManorComponent>(UIType.UIManor); uiManorComponent.DragTileOrDecorateCloseSelfManor(false); TipsTileComponent._instance.CloseUpAnim(); ResetHandleVar(); if (GoUIRootScroll != null) { GoUIRootScroll.SetActive(true); } CheckIsCanPlace(() => { if (isBeginPlace == false) { return; } CancelPlaceHandle(); isBeginPlace = false; return; }, () => { if (isBeginPlace == false) { return; } isBeginPlace = false; //放置的时候排序 Root2dSceneManager._instance.UpdateSortLayer(true); if (!this.isDragFromScene)//创建过程 { CSDrag csDrag = new CSDrag() { Type = (int)DecorateType, Xaxle = transform.localPosition.x, Yaxle = transform.localPosition.y, GoodId = this.CropGoodId }; ManorProtocalHelper.CreateManorGoByDrag(csDrag, (scDrag) => { //设置id this.SoilId = scDrag.SoilId; //地块使用数+1 //可以放置,地块数量变化 if (DecorateType == TypeManorDecorate.Tile && this.CropGoodId == 0) { //扣除货币 StaticData.UpdateWareHouseItem(Root2dSceneManager._instance.dealClassCurrency.IdGameItem, -Root2dSceneManager._instance.dealClassCurrency.Price); } else if (DecorateType == TypeManorDecorate.Decorate && this.CropGoodId != 0) { StaticData.DecorateMinusOne(this.CropGoodId); uiManorComponent.RefreshDecorateList(); //拖拽生成装饰物 StaticData.GetUIWorldHandleComponent().OpenRebackDecorate(this); } }); } else { //移动位置 CSChangeLocation csChangeLocation = new CSChangeLocation() { SoilId = this.SoilId, Xaxle = transform.localPosition.x, Yaxle = transform.localPosition.y }; ManorProtocalHelper.MoveManorGo(csChangeLocation, (succ) => { }); } }); } }
public async UniTask OnTileClick() { UIManorComponent uiManorComponent = UIComponent.GetComponentHaveExist <UIManorComponent>(UIType.UIManor); switch (typeTile) { case TypeManorDecorate.None: if (isNPC) { //todo 说话 } break; case TypeManorDecorate.GiftBox: break; case TypeManorDecorate.DogHouse: break; case TypeManorDecorate.Tile: if (goTileClickFrame != null) { goTileClickFrame.SetActive(true); } //if (!Root2dSceneManager._instance.isFriendManor) //{//不是好友,等女主移动到位置,好友庄园不需要移动 // var tileCom = await Root2dSceneManager._instance.femaleManorManager.PlayAnim(this); // if (tileCom != this) // { // return; // } //} if (currGoPlant == null) { //没有种植东西 //播放音效点击 GameSoundPlayer.Instance.PlaySoundEffect(MusicHelper.SoundEffectClickPlot); if (!Root2dSceneManager._instance.isFriendManor) { //不是好友庄园 StaticData.GetUIWorldHandleComponent().OpenRootPlant(this); //新手引导点击地块算完成 if (StaticData.isOpenGuide && GuideCanvasComponent._instance != null && GuideCanvasComponent._instance.isCurrStepGuiding) { //点击的时候只保存点击一块一步,不干扰后边两步 if (GuideCanvasComponent._instance.CurrExecuteGuideLittleStepDefine.Id == 10002) { GuideCanvasComponent._instance.SetLittleStepFinish(); } } } } else { //种植了东西 //好友的东西在SetGrowUpInfo中判定 SeedGrowComponent seedGrowComponent = transform.GetComponentInChildren <SeedGrowComponent>(); if (seedGrowComponent.currCropPeriod == SeedGrowComponent.PeriodGrow.Ripe) { if (!Root2dSceneManager._instance.isFriendManor) { StaticData.GetUIWorldHandleComponent().GainOneTile(seedGrowComponent); } else //偷取 { StaticData.GetUIWorldHandleComponent().OnButtonStealClick(seedGrowComponent); } } else { if (StaticData.GetUIWorldHandleComponent().isFertiliezeringAnimPlay) { return; } if (StaticData.GetUIWorldHandleComponent().isEradicating) { return; } //播放音效点击 GameSoundPlayer.Instance.PlaySoundEffect(MusicHelper.SoundEffectClickPlot); //第二个时期 if (seedGrowComponent.currCropPeriod != SeedGrowComponent.PeriodGrow.Seed) { StaticData.GetUIWorldHandleComponent().SetGrowUpInfo(this, seedGrowComponent); } else { //直接算施肥 StaticData.GetUIWorldHandleComponent().ClickTileToFirstFertilizer(this); } } } break; case TypeManorDecorate.Decorate: //if (!Root2dSceneManager._instance.isFriendManor) //{//不是好友,等女主移动到位置,好友庄园不需要移动 // var tileCom = await Root2dSceneManager._instance.femaleManorManager.PlayAnim(this); // if (tileCom != this) // { // return; // } //} if (!Root2dSceneManager._instance.isFriendManor) { StaticData.GetUIWorldHandleComponent().OpenRebackDecorate(this); } break; } }