脚本預設提交

yuanshuai 2020-10-16 15:39:48 +08:00
parent a441b04d91
commit 7498b4dc01
2 changed files with 27 additions and 20 deletions

View File

@ -30,12 +30,12 @@ RectTransform:
m_Children:
- {fileID: 604031028}
- {fileID: 962210698}
m_Father: {fileID: 6594538752966121076}
m_RootOrder: 1
m_Father: {fileID: 7906550627918467978}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 339, y: -564.9}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &38005695
@ -1938,7 +1938,8 @@ RectTransform:
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_Children:
- {fileID: 38005694}
m_Father: {fileID: 6594538752966121076}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -2434,7 +2435,6 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 7906550627918467978}
- {fileID: 38005694}
m_Father: {fileID: 1553045991312230259}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

View File

@ -8,6 +8,7 @@ local allGridData={}
local isAuto=false
local priThread = nil
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
local saiNum=1 --骰子数量
--初始化组件(用于子类重写)
function this:InitComponent()
@ -24,7 +25,7 @@ function this:InitComponent()
this.mapParent=Util.GetGameObject(self.gameObject,"mapParent")
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.eventPoint=Util.GetGameObject(self.gameObject,"prefab/eventPoint")
this.startBtn=Util.GetGameObject(self.gameObject,"startBtn")
this.TT=Util.GetGameObject(self.gameObject,"mapParent/TT")
this.mapY=this.mapParent.transform.localPosition.y
@ -145,10 +146,7 @@ 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)
if _data.pathType==0 then --普通节点
@ -158,11 +156,8 @@ function this.EventTrigger(_data)
PopupTipPanel.ShowTip("奖励翻倍!")
elseif _data.pathType==3 then --额外骰子节点
PopupTipPanel.ShowTip("骰子x2")
saiNum=2
elseif _data.pathType==4 then --招募英雄节点
priThread = coroutine.start(function()
coroutine.wait(1)
end)
local temp = XiaoYaoManager.GetHeroDatas()
if temp and #temp > 0 then
this.shopBtn:SetActive(true)
@ -198,6 +193,14 @@ 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)
end
--界面打开时调用(用于子类重写)
function this:OnOpen(_mapData)
@ -228,10 +231,12 @@ function this:OnOpen(_mapData)
local obj=this.gridParent.transform:GetChild(i-1)
if i<dataCount then
obj.gameObject:SetActive(true)
obj.transform:DOAnchorPos(Vector3(allGridData[i].x,allGridData[i].y,0),0)
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
-- 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)
local rewardData=ConfigManager.GetConfigData(ConfigName.RewardGroup,allGridData[i].rewardId)
@ -242,6 +247,8 @@ function this:OnOpen(_mapData)
Util.GetGameObject(eventObj,"icon"):GetComponent("Image").sprite=Util.LoadSprite(allGridData[i].eventData.EventPointBg)
Util.GetGameObject(eventObj,"name"):GetComponent("Text").text=allGridData[i].eventData.Desc
end
else
eventObj:SetActive(false)
end
else
obj.gameObject:SetActive(false)
@ -266,7 +273,7 @@ end
--初始化地图事件显示
function this.InitShowEvent()
if mapData.diceNum>1 then --骰子x2
-- body
saiNum=mapData.diceNum
end
if XiaoYaoManager.luckyluckyTurnTableTimes > 0 and (XiaoYaoManager.luckyluckyTurnTableRemainTime - PlayerManager.serverTime > 0) then
this.rouleBtn:SetActive(true)