逍遥游优化
parent
a7abe7aee5
commit
966822040f
|
|
@ -1039,6 +1039,8 @@ GameObject:
|
|||
- component: {fileID: 4195251690875203374}
|
||||
- component: {fileID: 4195251690875203372}
|
||||
- component: {fileID: 4195251690875203375}
|
||||
- component: {fileID: 2311500774059634519}
|
||||
- component: {fileID: 6061260506829729226}
|
||||
m_Layer: 5
|
||||
m_Name: Grid
|
||||
m_TagString: Untagged
|
||||
|
|
@ -1103,6 +1105,34 @@ MonoBehaviour:
|
|||
m_EditorClassIdentifier:
|
||||
m_HorizontalFit: 0
|
||||
m_VerticalFit: 2
|
||||
--- !u!222 &2311500774059634519
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4195251690875203377}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!114 &6061260506829729226
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4195251690875203377}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: e459a084d8e15a240b58db751097122b, 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
|
||||
--- !u!1 &4195251690898035249
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
require("Base/BasePanel")
|
||||
XiaoYaoMapPanel = Inherit(BasePanel)
|
||||
local this = XiaoYaoMapPanel
|
||||
local cursortingOrder
|
||||
local cursortingOrder=0
|
||||
local mapData={}
|
||||
local curGridIndex=1
|
||||
local allGridData={}
|
||||
|
|
@ -13,6 +13,8 @@ local eventTimer
|
|||
local shopLeftTime=0
|
||||
local rouleLeftTime=0
|
||||
local bossLeftTime=0
|
||||
local isPlayMove=0
|
||||
|
||||
|
||||
--初始化组件(用于子类重写)
|
||||
function this:InitComponent()
|
||||
|
|
@ -42,6 +44,13 @@ function this:InitComponent()
|
|||
this.actCountTime = Util.GetGameObject(this.bgTime, "time"):GetComponent("Text")
|
||||
|
||||
this.youliTag = Util.GetGameObject(self.gameObject, "mapParent/TT/youli")
|
||||
|
||||
-- 挂机特效
|
||||
this.moneyEffect = poolManager:LoadAsset("c_xy_0012_skeff_slidesk_ballistic", PoolManager.AssetType.GameObject)
|
||||
this.moneyEffect.transform:SetParent(this.transform)
|
||||
this.moneyEffect.transform.localScale = Vector3.one
|
||||
this.moneyEffect.transform.localPosition = Vector3.New(0, 0, 0)
|
||||
this.moneyEffect:SetActive(false)
|
||||
|
||||
end
|
||||
|
||||
|
|
@ -137,7 +146,9 @@ function this.RefreshEventBtn()
|
|||
rouleLeftTime=XiaoYaoManager.luckyluckyTurnTableRemainTime or 0
|
||||
bossLeftTime=XiaoYaoManager.GetMonsterDataReMainTimesAndTime() or 0
|
||||
end
|
||||
--开始跑图
|
||||
function this.RunMap(_data)
|
||||
this.startBtn:GetComponent("Button").enabled=false
|
||||
Log("开始跑图")
|
||||
local targetIndex=0
|
||||
for i = 1, #_data.pointes do
|
||||
|
|
@ -149,28 +160,36 @@ function this.RunMap(_data)
|
|||
if targetIndex>#allGridData then
|
||||
targetIndex=#allGridData
|
||||
end
|
||||
this.turnEffect:Reset(function()
|
||||
curGridIndex=curGridIndex+1
|
||||
this.TT.transform:DOAnchorPos(Vector3(allGridData[curGridIndex].x,allGridData[curGridIndex].y,0),0.3):OnComplete(function ()
|
||||
this.SetTTDirection()
|
||||
end)
|
||||
this.MoveTT(targetIndex,_data)
|
||||
end
|
||||
|
||||
--主角移动
|
||||
function this.MoveTT(targetIndex,_data)
|
||||
if isPlayMove==1 then
|
||||
return
|
||||
end
|
||||
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.MapMove(allGridData[curGridIndex].x,0.3)
|
||||
if curGridIndex==targetIndex then--如果停到对应位置
|
||||
this.turnEffect:Stop()--暂停
|
||||
this.mapProcess.text=string.format("%d%%",(curGridIndex/#allGridData*100))
|
||||
if allGridData[curGridIndex].eventData then
|
||||
this.EventTrigger(_data)
|
||||
end
|
||||
if curGridIndex==targetIndex then
|
||||
Log("待机动画")
|
||||
this.SkeletonGraphic.AnimationState:SetAnimation(0, "idle", true)
|
||||
this.startBtn:GetComponent("Button").enabled=true
|
||||
this.EventTrigger(_data)
|
||||
if curGridIndex>=#allGridData then
|
||||
this.StopAuto()
|
||||
end
|
||||
this.StopAuto()
|
||||
end
|
||||
if isAuto then
|
||||
XiaoYaoManager.StartXiaoYao()
|
||||
end
|
||||
end
|
||||
end,0.3,-1,true)
|
||||
this.turnEffect:Start()
|
||||
else
|
||||
this.MoveTT(targetIndex,_data)
|
||||
end
|
||||
end):SetEase(Ease.Linear)
|
||||
end
|
||||
|
||||
--取消自动游历
|
||||
function this.StopAuto()
|
||||
isAuto=false
|
||||
|
|
@ -179,6 +198,10 @@ function this.StopAuto()
|
|||
end
|
||||
--事件触发处理
|
||||
function this.EventTrigger(_data)
|
||||
if priThread then
|
||||
coroutine.stop(priThread)
|
||||
priThread = nil
|
||||
end
|
||||
Util.GetGameObject(this.gridParent.transform:GetChild(curGridIndex-1).gameObject,"eventPoint"):SetActive(false)
|
||||
Log("触发事件类型为:".._data.pathType)
|
||||
Log("触发事件时间为:".._data.overTime)
|
||||
|
|
@ -191,25 +214,36 @@ function this.EventTrigger(_data)
|
|||
elseif _data.pathType==3 then --额外骰子节点
|
||||
PopupTipPanel.ShowTip("骰子x2")
|
||||
saiNum=2
|
||||
elseif _data.pathType==4 then --东海寻仙节点
|
||||
this.shopBtn:SetActive(true)
|
||||
shopLeftTime=_data.overTime
|
||||
UIManager.OpenPanel(UIName.XiaoYaoEventPanel,_data.pathType,allGridData[curGridIndex].eventData)
|
||||
elseif _data.pathType==4 then --东海寻仙节点
|
||||
priThread = coroutine.start(function()
|
||||
this.PlayEffect(this.shopBtn)
|
||||
coroutine.wait(2)
|
||||
this.shopBtn:SetActive(true)
|
||||
shopLeftTime=_data.overTime
|
||||
UIManager.OpenPanel(UIName.XiaoYaoEventPanel,_data.pathType,allGridData[curGridIndex].eventData)
|
||||
end)
|
||||
elseif _data.pathType==5 then --怪物节点
|
||||
this.bossBtn:SetActive(true)
|
||||
bossLeftTime=_data.overTime
|
||||
UIManager.OpenPanel(UIName.XiaoYaoEventPanel,_data.pathType,allGridData[curGridIndex].eventData)
|
||||
priThread = coroutine.start(function()
|
||||
this.PlayEffect(this.bossBtn)
|
||||
coroutine.wait(2)
|
||||
this.bossBtn:SetActive(true)
|
||||
bossLeftTime=_data.overTime
|
||||
UIManager.OpenPanel(UIName.XiaoYaoEventPanel,_data.pathType,allGridData[curGridIndex].eventData)
|
||||
end)
|
||||
elseif _data.pathType==6 then --转盘
|
||||
this.rouleBtn:SetActive(true)
|
||||
rouleLeftTime=_data.overTime
|
||||
UIManager.OpenPanel(UIName.XiaoYaoEventPanel,_data.pathType,allGridData[curGridIndex].eventData)
|
||||
priThread = coroutine.start(function()
|
||||
this.PlayEffect(this.rouleBtn)
|
||||
coroutine.wait(2)
|
||||
this.rouleBtn:SetActive(true)
|
||||
rouleLeftTime=_data.overTime
|
||||
UIManager.OpenPanel(UIName.XiaoYaoEventPanel,_data.pathType,allGridData[curGridIndex].eventData)
|
||||
end)
|
||||
elseif _data.pathType==7 then --终极大奖
|
||||
UIManager.OpenPanel(UIName.XiaoYaoEventPanel,0,_data.drop)
|
||||
end
|
||||
if _data.drop.itemlist ~= nil and #_data.drop.itemlist > 0 then
|
||||
if _data.drop.itemlist and #_data.drop.itemlist > 0 and _data.pathType~=7 then
|
||||
local content = {}
|
||||
for i = 1, #_data.drop.itemlist do
|
||||
Log("这是基础奖励")
|
||||
for i = 1, #_data.drop.itemlist do
|
||||
local itemdata = {}
|
||||
itemdata.configData = itemConfig[_data.drop.itemlist[i].itemId]
|
||||
itemdata.name = itemdata.configData.Name
|
||||
|
|
@ -219,14 +253,22 @@ function this.EventTrigger(_data)
|
|||
end
|
||||
PopupText(content, 0.5, 2)
|
||||
end
|
||||
if priThread then
|
||||
coroutine.stop(priThread)
|
||||
priThread = nil
|
||||
end
|
||||
priThread = coroutine.start(function()
|
||||
coroutine.wait(1)
|
||||
end
|
||||
|
||||
function this.PlayEffect(_btnObj)
|
||||
-- local v2 = RectTransformUtility.WorldToScreenPoint(TileMapView.GetCamera(), TileMapView.GetLiveTilePos(u, v))
|
||||
-- this.TT.transform.position
|
||||
this.moneyEffect.transform.position =this.TT.transform.position
|
||||
Util.ClearTrailRender(this.moneyEffect)
|
||||
this.moneyEffect:SetActive(true)
|
||||
this.moneyEffect:GetComponent("RectTransform"):DOMove(_btnObj.transform.position, 0.6, false):OnComplete(function ()
|
||||
-- 这些该死的延迟动画
|
||||
if isPlayMove==1 then return end
|
||||
if this.moneyEffect then
|
||||
this.moneyEffect:SetActive(false)
|
||||
end
|
||||
end)
|
||||
SoundManager.PlaySound(SoundConfig.Sound_FightArea_Gold)
|
||||
end
|
||||
--界面打开时调用(用于子类重写)
|
||||
function this:OnOpen(_mapData)
|
||||
|
|
@ -260,8 +302,6 @@ function this:OnOpen(_mapData)
|
|||
obj.transform:DOAnchorPos(Vector3(allGridData[i].x,allGridData[i].y,0),0)
|
||||
local eventObj=Util.GetGameObject(obj.gameObject,"eventPoint")
|
||||
if allGridData[i].eventData then
|
||||
-- local eventObj= newObjToParent(this.eventPoint,obj)
|
||||
-- eventObj:GetComponent("RectTransform").localPosition=Vector2.zero
|
||||
eventObj:SetActive(true)
|
||||
if allGridData[i].rewardId then
|
||||
Log("rewardId:"..allGridData[i].rewardId)
|
||||
|
|
@ -281,8 +321,7 @@ function this:OnOpen(_mapData)
|
|||
end
|
||||
end
|
||||
curGridIndex=mapData.location
|
||||
this.LoadTT()
|
||||
this.SetTTDirection()
|
||||
this.LoadTT()
|
||||
Log("当前位置索引:"..curGridIndex)
|
||||
this.TT.transform:DOAnchorPos(Vector3(allGridData[curGridIndex].x,allGridData[curGridIndex].y,0),0)
|
||||
this.TT.transform:SetAsLastSibling()
|
||||
|
|
@ -309,13 +348,11 @@ function this.LoadTT()
|
|||
end
|
||||
this.SkeletonGraphic = this.liveNode:GetComponent("SkeletonGraphic")
|
||||
if this.SkeletonGraphic then
|
||||
this.SkeletonGraphic.AnimationState:SetAnimation(0, "move2", true)
|
||||
this.SkeletonGraphic.transform.localEulerAngles = Vector3.New(0, 180, 0)
|
||||
this.SkeletonGraphic.AnimationState:SetAnimation(0, "idle", true)
|
||||
end
|
||||
end
|
||||
--设置跑图角色方向
|
||||
function this.SetTTDirection()
|
||||
|
||||
if not this.SkeletonGraphic then
|
||||
return
|
||||
end
|
||||
|
|
@ -445,25 +482,21 @@ function this:OnShow()
|
|||
--显示资源条
|
||||
this.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = PanelType.MonsterCamp })
|
||||
this.ShowCountTime()
|
||||
if not this.turnEffect then
|
||||
this.turnEffect=Timer.New(nil,1,-1,true)
|
||||
end
|
||||
isPlayMove=0
|
||||
end
|
||||
|
||||
function this:OnSortingOrderChange(_cursortingOrder)
|
||||
cursortingOrder = _cursortingOrder
|
||||
function this:OnSortingOrderChange()
|
||||
Util.AddParticleSortLayer(this.moneyEffect, self.sortingOrder - cursortingOrder)
|
||||
cursortingOrder = self.sortingOrder
|
||||
end
|
||||
|
||||
--界面关闭时调用(用于子类重写)
|
||||
function this:OnClose()
|
||||
if this.turnEffect then
|
||||
this.turnEffect:Stop()
|
||||
this.turnEffect=nil
|
||||
end
|
||||
this.rouleBtn:SetActive(false)
|
||||
this.bossBtn:SetActive(false)
|
||||
this.shopBtn:SetActive(false)
|
||||
this.StopAuto()
|
||||
isPlayMove=1
|
||||
end
|
||||
|
||||
--界面销毁时调用(用于子类重写)
|
||||
|
|
@ -472,5 +505,6 @@ function this:OnDestroy()
|
|||
eventTimer:Stop()
|
||||
eventTimer = nil
|
||||
end
|
||||
this.liveNode=nil
|
||||
end
|
||||
return XiaoYaoMapPanel
|
||||
|
|
@ -43,7 +43,10 @@ end
|
|||
|
||||
--界面关闭时调用(用于子类重写)
|
||||
function this:OnClose()
|
||||
|
||||
while(this.grid.transform.childCount>0)
|
||||
do
|
||||
destroy(this.grid.transform:GetChild(0).gameObject)
|
||||
end
|
||||
end
|
||||
|
||||
--界面销毁时调用(用于子类重写)
|
||||
|
|
|
|||
|
|
@ -82,8 +82,9 @@ function this.SingleDataShow(go, data)
|
|||
lock:SetActive(not data.isUnLock)
|
||||
name.text=data.mapName
|
||||
fightIcon.sprite=Util.LoadSprite(data.mapImage)
|
||||
progress.fillAmount=data.progress/100
|
||||
progressVle.text=string.format("%u/100",data.progress)
|
||||
local prog=data.progress < 100 and data.progress or 0
|
||||
progress.fillAmount=prog/100
|
||||
progressVle.text=string.format("%u/100",prog)
|
||||
_rewardObj:OnOpen(false, data.passReward, 1)
|
||||
end
|
||||
function this:OnShow()
|
||||
|
|
|
|||
Loading…
Reference in New Issue