显示优化提交

jiaoyangna 2020-10-16 17:37:54 +08:00
parent 7498b4dc01
commit 2a5a23f3ed
6 changed files with 429 additions and 1845 deletions

View File

@ -927,7 +927,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 459.59998, y: -94}
m_AnchoredPosition: {x: -1539, y: -94}
m_SizeDelta: {x: 150, y: 150}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2771767497273165475
@ -1166,7 +1166,7 @@ RectTransform:
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: -1480, y: -5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 150, y: 150}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7049220849534455626
@ -1259,7 +1259,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3923347955883958669}
m_Enabled: 1
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:

View File

@ -44,7 +44,13 @@ end
--通过drop查找对应的NameIconNum
function this.IdToNameIconNum(_id,_num)
local id,num = _id,_num
local name = itemConfig[id].Name
local color = ""
if QualityTextDef[itemConfig[id].Quantity] then
color = QualityTextDef[itemConfig[id].Quantity]
else
color = "#F6934AFF"
end
local name ="<Color="..color..">" ..itemConfig[id].Name .. "</Color>"
local icon = artConfig[itemConfig[id].ResourceID].Name
local data = {
[1] = name,

View File

@ -64,11 +64,16 @@ function XiaoYaoLuckyBossPopup:OnOpen()
end
function XiaoYaoLuckyBossPopup:OnShow()
monsterGroup = XiaoYaoManager.GetMonsterDatas()
monsterGroup = XiaoYaoManager.GetMonsterDatas()
if not monsterGroup or #monsterGroup < 1 then
LogBlue("得到得怪物不存在")
this:ClosePanel()
end
fightBossIndex = XiaoYaoManager.fightBossIndex
for i = 1, #monsterGroup do
LogYellow("monster.monsterInDex:"..monsterGroup[i].monsterIndex)
end
fightBossIndex = XiaoYaoManager.fightBossIndex
LogYellow("fightBossIndex:"..fightBossIndex)
if fightBossIndex == 0 then
curMonsterGroup = monsterGroup[1]
else
@ -84,7 +89,7 @@ function XiaoYaoLuckyBossPopup:OnShow()
curMonsterGroup = monsterGroup[1]
end
end
LogYellow("curMonsterGroup.monsterInDex:"..curMonsterGroup.monsterIndex)
this:InitMonsterList()
this:SetSelectHero(curMonsterGroup)
end
@ -124,7 +129,7 @@ function this:InitMonsterList()
monsterGroupPrefabs[i] = newObjToParent(this.iconPre,this.heroList)
end
monsterGroupPrefabs[i].gameObject:SetActive(true)
this:SetSingleMonster(monsterGroupPrefabs[i],monsterGroup[1])
this:SetSingleMonster(monsterGroupPrefabs[i],monsterGroup[i])
end
end
@ -136,7 +141,7 @@ function XiaoYaoLuckyBossPopup:SetSingleMonster(go,data)
LogGreen("data.monsterId:"..data.monsterId.." "..MonsterGroup[data.monsterId].Contents[1][2])
local id = MonsterGroup[data.monsterId].Contents[1][2]
local _data = MonsterConfig[id]
frame.sprite = Util.LoadSprite(GetResourcePath(heroConfig[_data.MonsterId].Icon))
frame.sprite = Util.LoadSprite("r_hero_qingbao-jineng-002")
icon.sprite = Util.LoadSprite(GetResourcePath(heroConfig[_data.MonsterId].Icon))
lv.text = _data.Level
if data.monsterIndex == curMonsterGroup.monsterIndex then
@ -144,13 +149,16 @@ function XiaoYaoLuckyBossPopup:SetSingleMonster(go,data)
this.selectKuang:GetComponent("RectTransform").localPosition = Vector3.zero
end
Util.AddOnceClick(go,function()
if curMonsterGroup.monsterId == data.monsterId then
if curMonsterGroup.monsterIndex == data.monsterIndex then
else
curMonsterGroup = data
XiaoYaoManager.fightBossIndex = curMonsterGroup.monsterIndex
this.selectKuang.transform:SetParent(go.transform)
this.selectKuang:GetComponent("RectTransform").localPosition = Vector3.zero
poolManager:UnLoadLive(_LiveName, _LiveNode)
_LiveNode = nil
if _LiveNode then
poolManager:UnLoadLive(_LiveName, _LiveNode)
_LiveNode = nil
end
this:SetSelectHero(data)
end
end)
@ -169,7 +177,7 @@ function XiaoYaoLuckyBossPopup:SetSelectHero(monsterData)
this.e_name.text = _data.ReadingName
this.hp.fillAmount = monsterData.monsterHp/_data.Hp
if monsterData.attackNum > 0 then
if not cost[monsterData.attackNum] then
if not cost[monsterData.attackNum+1] then
costId = cost[#cost][1]
costNum = cost[#cost][2]
else

View File

@ -3,6 +3,7 @@ XiaoYaoLuckyTurnTablePopup = Inherit(BasePanel)
local this=XiaoYaoLuckyTurnTablePopup
local _itemsList = {}
local itemViewList = {}
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
local atrConfig = ConfigManager.GetConfig(ConfigName.ArtResourcesConfig)
local rewardGroup = ConfigManager.GetConfig(ConfigName.RewardGroup)
@ -33,9 +34,9 @@ function XiaoYaoLuckyTurnTablePopup:BindEvent()
XiaoYaoManager.GameOperate(function(msg)
--转起来
LogGreen("msg.location:"..msg.location.. " msg.drop.itemlist[1].itemId: "..msg.drop.itemlist[1].itemId.." msg.drop.itemlist[1].itemNum: "..msg.drop.itemlist[1].itemNum )
this.test(msg.location)
id = msg.drop.itemlist[1].itemId
num = msg.drop.itemlist[1].itemNum
this:test(msg.location)
end)
end)
end
@ -52,28 +53,27 @@ end
--界面打开时调用(用于子类重写)
function XiaoYaoLuckyTurnTablePopup:OnOpen(...)
this.titleText = "幸运转盘"
this.titleText.text = "幸运转盘"
end
function XiaoYaoLuckyTurnTablePopup:OnShow()
this.remainTimes.text = "剩余次数:"..XiaoYaoManager.luckyluckyTurnTableTimes
if XiaoYaoManager.luckyluckyTurnTableTimes < 1 then
if XiaoYaoManager.luckyluckyTurnTableTimes < 1 or XiaoYaoManager.luckyluckyTurnTableRemainTime - PlayerManager.serverTime < 1 then
this:ClosePanel()
end
this:TimerDown()
rewardDatas = {}
local rewardDataGroups = XiaoYaoManager.luckyTurnTableRewards
for i,v in ipairs(rewardDataGroups) do
table.insert(rewardDatas,rewardGroup[v].ShowItem[1])
end
LogGreen("rewardDatas:"..#rewardDatas)
for i,v in ipairs(rewardDatas) do
local item = _itemsList[i]
Util.GetGameObject(item,"Red"):SetActive(false)
local reward = Util.GetGameObject(item,"reward"):GetComponent("Image")
LogGreen("v[1]:"..v[1])
local Name = atrConfig[itemConfig[v[1]].ResourceID].Name--Index->奖励id->itemID->资源名字)
reward.sprite = Util.LoadSprite(Name)
local Num = Util.GetGameObject(item,"Num"):GetComponent("Text")
Num.text = v[2]
if not itemViewList[i] then
itemViewList[i] = SubUIManager.Open(SubUIConfig.ItemView,Util.GetGameObject(item,"reward").transform)
end
itemViewList[i]:OnOpen(false,{v[1],v[2]},1.15,false)
end
Util.GetGameObject(_itemsList[1],"Red"):SetActive(true)
end
@ -87,28 +87,24 @@ function XiaoYaoLuckyTurnTablePopup:test(itemId)
this.turnEffect2:Stop()
this.turnEffect2 = nil
end
if not this.turnEffect2 then
this.turnEffect2 = Timer.New(function()
this.tableTurnEffect(1/t)
t=t+5
end,0.2,10,true)
this.turnEffect2:Start()
end
this.turnEffect2 = Timer.New(function()
this:tableTurnEffect(1/t)
t=t+5
end,0.2,10,true)
this.turnEffect2:Start()
coroutine.wait(2)
--减速阶段
if this.turnEffect2 then
this.turnEffect2:Stop()
this.turnEffect2 = nil
end
if not this.turnEffect2 then
this.turnEffect2 = Timer.New(function()
this.tableTurnEffect(1/t)
t=t-3.3
end,0.2,10,true)
this.turnEffect2:Start()
end
this.turnEffect2 = Timer.New(function()
this:tableTurnEffect(1/t)
t=t-3.3
end,0.2,10,true)
this.turnEffect2:Start()
coroutine.wait(2)
this.tableTurnEffect(0.4,itemId)
this:tableTurnEffect(0.4,itemId)
end)
end
@ -119,32 +115,31 @@ function XiaoYaoLuckyTurnTablePopup:tableTurnEffect(speed,itemId)
this.turnEffect:Stop()
this.turnEffect = nil
end
if not this.turnEffect then
this.turnEffect = Timer.New(function()
local red = Util.GetGameObject(_itemsList[index],"Red")
red:SetActive(false)
if index == 12 then--t归零
index = 0
end
local redNext = Util.GetGameObject(_itemsList[index+1],"Red")
redNext:SetActive(true)
this.turnEffect = Timer.New(function()
local red = Util.GetGameObject(_itemsList[index],"Red")
red:SetActive(false)
if index == 12 then--t归零
index = 0
end
local redNext = Util.GetGameObject(_itemsList[index+1],"Red")
redNext:SetActive(true)
-- 音效
SoundManager.PlaySound(SoundConfig.Sound_zp)
index = index + 1
--检测最后的奖励
if index == itemId then
this.turnEffect:Stop()
--游戏结束显示掉落
Timer.New(function()
local data = TrialMiniGameManager.IdToNameIconNum(id,num)
PopupTipPanel.ShowColorTip(data[1],data[2],data[3])
this:OnShow()
end, 1,1,true):Start()
end
end,speed,-1,true)
this.turnEffect:Start()
end
SoundManager.PlaySound(SoundConfig.Sound_zp)
index = index + 1
LogGreen("index == "..index)
--检测最后的奖励
if itemId and index == itemId then
this.turnEffect:Stop()
--游戏结束显示掉落
Timer.New(function()
local data = TrialMiniGameManager.IdToNameIconNum(id,num)
this.btn:GetComponent("Button").interactable = true
PopupTipPanel.ShowColorTip(data[1],data[2],data[3])
this:OnShow()
end, 1,1,true):Start()
end
end,speed,-1,true)
this.turnEffect:Start()
end
function this:TimerDown()
if this.timer then
@ -155,6 +150,7 @@ function this:TimerDown()
this.remainTime.text = "剩余时间:"..TimeToHMS(timeDown)
this.timer = Timer.New(function()
if timeDown < 1 then
XiaoYaoManager.UpdateLuckyTurnTables()
this:ClosePanel()
return
end
@ -188,6 +184,9 @@ function XiaoYaoLuckyTurnTablePopup:OnDestroy()
this.timer:Stop()
this.timer = nil
end
itemViewList = {}
_itemsList = {}
rewardDatas = {}
end
return this

View File

@ -65,29 +65,37 @@ end
--初始化幸运转盘
function this.InitLuckyTurnTables(msg)
this.luckyTurnTableRewards = {}
if msg and msg.randomItem and #msg.randomItem > 0 then
for i = 1, #msg.randomItem do
table.insert(this.luckyTurnTableRewards,msg.randomItem[i])
if msg then
if msg.randomItem and #msg.randomItem > 0 then
for i = 1, #msg.randomItem do
table.insert(this.luckyTurnTableRewards,msg.randomItem[i])
end
this.luckyluckyTurnTableTimes = msg.randomNum
this.luckyluckyTurnTableRemainTime = msg.randomTime
elseif msg.random and #msg.random > 0 then
for i = 1, #msg.random do
table.insert(this.luckyTurnTableRewards,msg.random[i])
end
this.luckyluckyTurnTableTimes = this.luckyluckyTurnTableTimes + 1
this.luckyluckyTurnTableRemainTime = msg.overTime
elseif msg.nextRandom and #msg.nextRandom > 0 then
for i = 1, #msg.nextRandom do
table.insert(this.luckyTurnTableRewards,msg.nextRandom[i])
end
this.luckyluckyTurnTableTimes = this.luckyluckyTurnTableTimes - 1
end
this.luckyluckyTurnTableTimes = msg.randomNum
this.luckyluckyTurnTableRemainTime = msg.randomTime
elseif msg and msg.random and #msg.random > 0 then
for i = 1, #msg.random do
table.insert(this.luckyTurnTableRewards,msg.random[i])
end
this.luckyluckyTurnTableTimes = this.luckyluckyTurnTableTimes + 1
this.luckyluckyTurnTableRemainTime = msg.overTime
elseif msg and msg.nextRandom and #msg.nextRandom > 0 then
for i = 1, #msg.nextRandom do
table.insert(this.luckyTurnTableRewards,msg.nextRandom[i])
end
this.luckyluckyTurnTableTimes = msg.count
end
LogGreen("幸运转盘奖励个数:"..#this.luckyTurnTableRewards)
LogGreen("幸运转盘剩余次数:"..this.luckyluckyTurnTableTimes)
LogGreen("幸运转盘剩余时间:"..this.luckyluckyTurnTableRemainTime)
end
function this.UpdateLuckyTurnTables()
this.luckyTurnTableRewards = {}
this.luckyluckyTurnTableRemainTime = 0
this.luckyluckyTurnTableTimes = 0
end
-- type 1初始化 2添加 hero
function this.InitHeroData(goodsInfo,type)
if type == 1 then
@ -139,7 +147,7 @@ function this.InitHeroData(goodsInfo,type)
function this.InitMonsterData(BackMonsterDatas,type)
if type == 1 then
this.MonsterData = {}
for i= 1, #BackMonsterDatas do
for i = 1, #BackMonsterDatas do
local monster = {}
monster.monsterId = BackMonsterDatas[i].monsterId
monster.monsterIndex = BackMonsterDatas[i].monsterIndex
@ -147,12 +155,13 @@ function this.InitMonsterData(BackMonsterDatas,type)
monster.remainTime = BackMonsterDatas[i].remainTime
monster.attackNum = BackMonsterDatas[i].attackNum
monster.reward = BackMonsterDatas[i].rewardShow
LogGreen("monster.monsterId"..monster.monsterId)
LogGreen("monster.monsterIndex"..monster.monsterIndex)
LogGreen("monster.monsterHp"..monster.monsterHp)
LogGreen("monster.remainTime"..monster.remainTime)
LogGreen("monster.attackNum"..monster.attackNum)
LogGreen("monster.reward"..monster.reward)
LogGreen("---------------------------------------")
LogGreen("monster.monsterId"..BackMonsterDatas[i].monsterId)
LogGreen("monster.monsterIndex"..BackMonsterDatas[i].monsterIndex)
LogGreen("monster.monsterHp"..BackMonsterDatas[i].monsterHp)
LogGreen("monster.remainTime"..BackMonsterDatas[i].remainTime)
LogGreen("monster.attackNum"..BackMonsterDatas[i].attackNum)
LogGreen("monster.reward"..BackMonsterDatas[i].rewardShow)
table.insert(this.MonsterData,monster)
end
elseif type == 2 then
@ -163,16 +172,18 @@ function this.InitMonsterData(BackMonsterDatas,type)
monster.remainTime = BackMonsterDatas.remainTime
monster.attackNum = BackMonsterDatas.attackNum
monster.reward = BackMonsterDatas.rewardShow
LogGreen("monster.monsterId"..monster.monsterId)
LogGreen("monster.monsterIndex"..monster.monsterIndex)
LogGreen("monster.monsterHp"..monster.monsterHp)
LogGreen("monster.remainTime"..monster.remainTime)
LogGreen("monster.attackNum"..monster.attackNum)
--LogGreen("monster.reward"..monster.reward)
LogGreen("monster.reward"..monster.reward)
LogGreen("---------------------------------------")
LogGreen("monster.monsterId"..BackMonsterDatas.monsterId)
LogGreen("monster.monsterIndex"..BackMonsterDatas.monsterIndex)
LogGreen("monster.monsterHp"..BackMonsterDatas.monsterHp)
LogGreen("monster.remainTime"..BackMonsterDatas.remainTime)
LogGreen("monster.attackNum"..BackMonsterDatas.attackNum)
LogGreen("monster.reward"..BackMonsterDatas.rewardShow)
table.insert(this.MonsterData,monster)
end
for i = 1, #this.MonsterData do
LogYellow("monster.monsterId:"..this.MonsterData[i].monsterId)
end
LogGreen("boss个数"..#this.MonsterData)
end
@ -193,7 +204,7 @@ function this.InitMonsterData(BackMonsterDatas,type)
return nil
end
for i,v in ipairs(this.MonsterData) do
if v.remainTime - PlayerManager.serverTime < 1 then
if v.remainTime - PlayerManager.serverTime < 1 or v.monsterHp < 1 then
if v.monsterIndex == this.fightBossIndex then
this.fightBossIndex = 0
end
@ -238,10 +249,10 @@ function this.ExecuteFightBattle(id,func)
if func then
func()
end
UIManager.OpenPanel(UIName.BattlePanel, fightData, BATTLE_TYPE.Xuanyuan,function(result)
UIManager.OpenPanel(UIName.BattlePanel, fightData, BATTLE_TYPE.DAILY_CHALLENGE,function(result)
this.UpdateMonsterData(msg.monster,id)
this.OpenXiaoYaoMap(XiaoYaoManager.curMapId)
UIManager.OpenPanel(UIName.XiaoYaoLuckyBossPopup)
--UIManager.OpenPanel(UIName.XiaoYaoLuckyBossPopup)
if result.result == 1 then
this.fightBossIndex = 0
UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1,function() end)
@ -254,7 +265,7 @@ end
function this.GameOperate(func)
-- 初始化数据
NetManager.XiaoyaoyouTurnTableRequest(function(msg)
this.luckyTurnTableRewards = this.InitLuckyTurnTables(msg)
this.InitLuckyTurnTables(msg)
if func then
func(msg)
end