逍遥游地图界面提交

yuanshuai 2020-09-28 16:30:52 +08:00
parent 9a5846943a
commit 42d8a70a24
6 changed files with 1242 additions and 2 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 5507c43fe08aa2e4ca5ea2f343728db1
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -335,6 +335,7 @@ UIName = {
GuideBattlePanel = 334, --引导战斗
DemonSlayer = 335,--三界除魔
XiaoYaoYouPanel=336, --逍遥游入口界面
XiaoYaoMapPanel=337, --逍遥游入口界面
}
SubUIConfig = {

View File

@ -0,0 +1,122 @@
require("Base/BasePanel")
XiaoYaoMapPanel = Inherit(BasePanel)
local this = XiaoYaoMapPanel
local cursortingOrder
local curGridIndex=1
local allGridData={
{x=100,y=-100},{x=200,y=-100},{x=300,y=-100},
{x=400,y=-100},{x=400,y=-200},{x=400,y=-300}, {x=400,y=-400},{x=400,y=-500},{x=400,y=-600},
{x=400,y=-700},{x=400,y=-800},{x=400,y=-900}, {x=400,y=-1000},{x=400,y=-1100},{x=400,y=-1200},
{x=500,y=-1200},{x=600,y=-1200},{x=700,y=-1200},{x=800,y=-1200},{x=900,y=-1200},{x=1000,y=-1200},
{x=1100,y=-1200},{x=1200,y=-1200},{x=1300,y=-1200},{x=1400,y=-1200},{x=1500,y=-1200},{x=1600,y=-1200},
{x=1600,y=-1100},{x=1600,y=-1000},{x=1600,y=-900},{x=1700,y=-900},{x=1800,y=-900},{x=1900,y=-900},
{x=2000,y=-900},{x=2100,y=-900},{x=2200,y=-900},{x=2300,y=-900},{x=2400,y=-900},{x=2500,y=-900},{x=2600,y=-900},
{x=2700,y=-900},{x=2800,y=-900},{x=2800,y=-800},{x=2800,y=-700},{x=2900,y=-700},{x=3000,y=-700},{x=3100,y=-700}
}
--初始化组件(用于子类重写)
function this:InitComponent()
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform)
this.btnBack = Util.GetGameObject(self.gameObject, "btnBack")
this.mapParent=Util.GetGameObject(self.gameObject,"mapParent")
this.grid=Util.GetGameObject(self.gameObject,"prefab/grid")
this.startBtn=Util.GetGameObject(self.gameObject,"startBtn")
this.startBtnText=Util.GetGameObject(self.gameObject,"startBtn/Text"):GetComponent("Text")
this.TT=Util.GetGameObject(self.gameObject,"mapParent/TT")
end
--绑定事件(用于子类重写)
function this:BindEvent()
Util.AddClick(this.btnBack, function ()
PlayerManager.carbonType = 1
UIManager.OpenPanel(UIName.XiaoYaoYouPanel)
self:ClosePanel()
end)
Util.AddClick(this.startBtn,function()
if curGridIndex>=#allGridData then
MsgPanel.ShowTwo("已到达终点,是否重新云游!", nil, function()
this.TT.transform:DOAnchorPos(Vector3(allGridData[1].x,allGridData[1].y,0),0)
this.mapParent.transform:DOAnchorPos(Vector3(0,690,0),0)
curGridIndex=1
end)
return
end
local num=math.random(6)
this.startBtnText.text=num
local targetIndex=curGridIndex+num
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)
this.MapMove(allGridData[curGridIndex].x,0.3)
if curGridIndex==targetIndex then--如果停到对应位置
this.turnEffect:Stop()--暂停
end
end,0.3,-1,true)
this.turnEffect:Start()
end)
end
--添加事件监听(用于子类重写)
function this:AddListener()
end
--移除事件监听(用于子类重写)
function this:RemoveListener()
end
--界面打开时调用(用于子类重写)
function this:OnOpen(...)
--显示资源条
this.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = PanelType.MonsterCamp })
for i = 1, #allGridData do
local obj= newObjToParent(this.grid, this.mapParent.transform)
obj.transform:DOAnchorPos(Vector3(allGridData[i].x,allGridData[i].y,0),0)
end
this.TT.transform:DOAnchorPos(Vector3(allGridData[curGridIndex].x,allGridData[curGridIndex].y,0),0)
this.TT.transform:SetAsLastSibling()
this.MapMove(allGridData[curGridIndex].x,0)
end
function this.MapMove(curX,moveTime)
Log("当前位置:"..curX)
if curX>2700 then
return
end
if curX>540 then
this.mapParent.transform:DOAnchorPos(Vector3(540-curX,690,0),moveTime)
else
this.mapParent.transform:DOAnchorPos(Vector3(0,690,0),moveTime)
end
end
function this:OnShow()
if not this.turnEffect then
this.turnEffect=Timer.New(nil,1,-1,true)
end
end
function this:OnSortingOrderChange(_cursortingOrder)
cursortingOrder = _cursortingOrder
end
--界面关闭时调用(用于子类重写)
function this:OnClose()
if this.turnEffect then
this.turnEffect:Stop()
this.turnEffect=nil
end
end
--界面销毁时调用(用于子类重写)
function this:OnDestroy()
end
return XiaoYaoMapPanel

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 33118533f88730042a5a87aaecd49c7b
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -71,7 +71,7 @@ function this.SingleDataShow(go, data)
if not data.isUnLock then
PopupTipPanel.ShowTip("地图尚未开启!")
else
UIManager.OpenPanel(UIName.XiaoYaoMapPanel)
end
end)
Log("isUnLock值"..tostring(data.isUnLock))
@ -80,7 +80,7 @@ function this.SingleDataShow(go, data)
fightIcon.sprite=Util.LoadSprite(data.mapImage)
progress.fillAmount=data.curProgress/data.allProgress
progressVle.text=string.format("%u/%u",data.curProgress,data.allProgress)
_rewardObj:OnOpen(false, data.passReward, 0.9,false,false,false,cursortingOrder)
_rewardObj:OnOpen(false, data.passReward, 1,false,false,false,cursortingOrder)
end
function this:OnShow()