From fdf1fe57247f8606618e9ad9cfd3d58216dfe5b6 Mon Sep 17 00:00:00 2001 From: yuanshuai <243578945@qq.com> Date: Mon, 19 Oct 2020 18:19:05 +0800 Subject: [PATCH] =?UTF-8?q?=20=E9=80=8D=E9=81=A5=E6=B8=B8=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Prefabs/UI/XiaoYao/XiaoYaoMapPanel.prefab | 200 +++++++++++++++++- .../Modules/Player/AutoRecoverManager.lua | 3 +- .../~Lua/Modules/XiaoYao/XiaoYaoManager.lua | 2 +- .../~Lua/Modules/XiaoYao/XiaoYaoMapPanel.lua | 58 +++-- 4 files changed, 243 insertions(+), 20 deletions(-) diff --git a/Assets/ManagedResources/Prefabs/UI/XiaoYao/XiaoYaoMapPanel.prefab b/Assets/ManagedResources/Prefabs/UI/XiaoYao/XiaoYaoMapPanel.prefab index 3444ae28c5..55bf3bb960 100644 --- a/Assets/ManagedResources/Prefabs/UI/XiaoYao/XiaoYaoMapPanel.prefab +++ b/Assets/ManagedResources/Prefabs/UI/XiaoYao/XiaoYaoMapPanel.prefab @@ -1564,7 +1564,7 @@ MonoBehaviour: m_Content: {fileID: 8931424398932153333} m_Horizontal: 1 m_Vertical: 0 - m_MovementType: 1 + m_MovementType: 2 m_Elasticity: 0.1 m_Inertia: 1 m_DecelerationRate: 0.135 @@ -2183,6 +2183,7 @@ RectTransform: - {fileID: 7417769981058031238} - {fileID: 4574879409623873685} - {fileID: 913146193029197762} + - {fileID: 1079501476154741580} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -2237,6 +2238,124 @@ MonoBehaviour: m_BlockingMask: serializedVersion: 2 m_Bits: 4294967295 +--- !u!1 &4915713065857291199 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1079501476154741580} + - component: {fileID: 71418577935361818} + - component: {fileID: 3447792569424404311} + - component: {fileID: 8215627075762743201} + m_Layer: 5 + m_Name: isStart + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1079501476154741580 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4915713065857291199} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 3113917992080664386} + m_Father: {fileID: 1553045991312230259} + m_RootOrder: 10 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 354.7, y: -721} + m_SizeDelta: {x: 255, y: 273} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &71418577935361818 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4915713065857291199} + m_CullTransparentMesh: 0 +--- !u!114 &3447792569424404311 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4915713065857291199} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 +--- !u!114 &8215627075762743201 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4915713065857291199} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1392445389, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 3447792569424404311} + m_OnClick: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null --- !u!1 &4986799033207078358 GameObject: m_ObjectHideFlags: 0 @@ -4117,6 +4236,85 @@ MonoBehaviour: m_FillClockwise: 1 m_FillOrigin: 0 m_UseSpriteMesh: 0 +--- !u!1 &8574019241851965437 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3113917992080664386} + - component: {fileID: 9151675066034971462} + - component: {fileID: 4585796357365102012} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3113917992080664386 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8574019241851965437} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1079501476154741580} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &9151675066034971462 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8574019241851965437} + m_CullTransparentMesh: 0 +--- !u!114 &4585796357365102012 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8574019241851965437} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 40 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 4 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u5F00\u59CB" --- !u!1 &8576063994027476366 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/ManagedResources/~Lua/Modules/Player/AutoRecoverManager.lua b/Assets/ManagedResources/~Lua/Modules/Player/AutoRecoverManager.lua index eb94f18fbe..8f84edb6ca 100644 --- a/Assets/ManagedResources/~Lua/Modules/Player/AutoRecoverManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Player/AutoRecoverManager.lua @@ -66,7 +66,8 @@ local _TimeCheckFunc = { if curCount < maxCount then local nextFreshTime = BagManager.bagDatas[UpViewRechargeType.YunYouVle].nextFlushTime local remationTime = nextFreshTime - PlayerManager.serverTime -- 下一次刷新的时间 - if remationTime<-1 then + if remationTime<0 then + BagManager.bagDatas[UpViewRechargeType.YunYouVle].num=BagManager.bagDatas[UpViewRechargeType.YunYouVle].num+1 remationTime=300-(math.abs(remationTime)%300) end return remationTime diff --git a/Assets/ManagedResources/~Lua/Modules/XiaoYao/XiaoYaoManager.lua b/Assets/ManagedResources/~Lua/Modules/XiaoYao/XiaoYaoManager.lua index 39c68e9dba..f83e0a1dc9 100644 --- a/Assets/ManagedResources/~Lua/Modules/XiaoYao/XiaoYaoManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/XiaoYao/XiaoYaoManager.lua @@ -72,7 +72,7 @@ function this.StartXiaoYao() LogRed("#msg.Drop1:"..#msg.drop.equipId ) LogRed("#msg.Drop2:"..#msg.drop.Hero ) LogRed("#msg.Drop3:"..#msg.drop.soulEquip ) - end + end Game.GlobalEvent:DispatchEvent(GameEvent.XiaoYao.StartXiaoYao, msg) end) end diff --git a/Assets/ManagedResources/~Lua/Modules/XiaoYao/XiaoYaoMapPanel.lua b/Assets/ManagedResources/~Lua/Modules/XiaoYao/XiaoYaoMapPanel.lua index eb2958bd11..3af589f6aa 100644 --- a/Assets/ManagedResources/~Lua/Modules/XiaoYao/XiaoYaoMapPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/XiaoYao/XiaoYaoMapPanel.lua @@ -5,7 +5,8 @@ local cursortingOrder=0 local mapData={} local curGridIndex=1 local allGridData={} -local isAuto=false +local isAuto=false --是否开启自动游历 +local isAutoRun=false --是否在自动游历中 local priThread = nil local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig) local saiNum=1 --骰子数量 @@ -45,7 +46,9 @@ function this:InitComponent() this.gridParent=Util.GetGameObject(self.gameObject,"mapParent/gridParent") this.grid=Util.GetGameObject(self.gameObject,"prefab/grid") --this.eventPoint=Util.GetGameObject(self.gameObject,"prefab/eventPoint") - this.startBtn=Util.GetGameObject(self.gameObject,"startBtn") + this.startBtn=Util.GetGameObject(self.gameObject,"startBtn") + this.isStart=Util.GetGameObject(self.gameObject,"isStart") + this.isStartText=Util.GetGameObject(self.gameObject,"isStart/Text"):GetComponent("Text") this.TT=Util.GetGameObject(self.gameObject,"mapParent/TT") this.mapY=this.mapParent.transform.localPosition.y @@ -104,12 +107,11 @@ function this:BindEvent() --自动游历点击 Util.AddClick(this.autoBtn, function () if isAuto then - this.StopAuto() + isAuto=false else - isAuto=true - this.toggle.gameObject:SetActive(true) + isAuto=true end - + this.toggle.gameObject:SetActive(isAuto) end) --开始游历 Util.AddClick(this.startBtn,function() @@ -123,16 +125,28 @@ function this:BindEvent() end) return end - this.youliTag:SetActive(isAuto) + if isAuto then + this.isStart:SetActive(true) + this.startBtn:SetActive(false) + this.youliTag:SetActive(true) + this.isStartText.text="暂停" + isAutoRun=true + end XiaoYaoManager.StartXiaoYao() end) - - --开始游历 - Util.AddClick(this.succeedObj,function() - XiaoYaoManager.OpenMapList() + --开始游历 + Util.AddClick(this.isStart,function() + if isAutoRun then + this.isStartText.text="开始" + isAutoRun=false + else + this.isStartText.text="暂停" + isAutoRun=true + end end) end + --添加事件监听(用于子类重写) function this:AddListener() Game.GlobalEvent:AddEvent(GameEvent.XiaoYao.StartXiaoYao, this.RunMap) @@ -197,7 +211,7 @@ function this.MoveTT(targetIndex,_data) this.SetTTDirection() curGridIndex=curGridIndex+1 this.TT.transform:DOAnchorPos(Vector3(allGridData[curGridIndex].x,allGridData[curGridIndex].y,0),0.3):OnComplete(function () - this.mapProcess.text=string.format("%d%%",(curGridIndex/#allGridData*100)) + this.mapProcess.text=string.format("游历进度:%d%%",(curGridIndex/#allGridData*100)) this.MapMove(allGridData[curGridIndex].x,0.3) if curGridIndex==targetIndex then Log("待机动画") @@ -207,9 +221,13 @@ function this.MoveTT(targetIndex,_data) if curGridIndex>=#allGridData then this.StopAuto() end - if isAuto then + if isAutoRun then if costNum>BagManager.GetItemCountById(UpViewRechargeType.YunYouVle) then PopupTipPanel.ShowTip("云游值不足,休息一会吧!") + this.youliTag:SetActive(false) + this.isStart:SetActive(false) + this.startBtn:SetActive(true) + isAutoRun=false return end if priThread then @@ -220,7 +238,10 @@ function this.MoveTT(targetIndex,_data) coroutine.wait(1) XiaoYaoManager.StartXiaoYao() end) - + else + this.youliTag:SetActive(false) + this.isStart:SetActive(false) + this.startBtn:SetActive(true) end else this.MoveTT(targetIndex,_data) @@ -231,6 +252,7 @@ end --取消自动游历 function this.StopAuto() isAuto=false + isAutoRun=false this.youliTag:SetActive(false) this.toggle.gameObject:SetActive(false) end @@ -278,7 +300,7 @@ end function this.SetEventBtn(_data) this.RefreshEventBtn() - if isAuto then + if isAutoRun then this.PlayEffect() PopupTipPanel.ShowTip(string.format("触发仙缘★%s★",allGridData[curGridIndex].eventData.Desc)) else @@ -487,8 +509,7 @@ function this.ShowCountTime() this.timer = Timer.New(function () local leftTime = AutoRecoverManager.GetRecoverTime(UpViewRechargeType.YunYouVle) if leftTime<=0 then - curValue=curValue+1 - this.costInfo.text=string.format("%d/%d",curValue,maxValue) + this.UpdateYunyouVleShow() end if curValue>=maxValue then -- 回复满了,在地图外面可以停止计时器 @@ -540,6 +561,9 @@ function this:OnShow() --显示资源条 this.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = PanelType.MonsterCamp }) this.ShowCountTime() + this.startBtn:SetActive(true) + this.isStart:SetActive(false) + isAutoRun=false isPlayMove=0 end