Update - 1.7.0.88
EN: 1.7.0.88 CN: 1.7.0.90 JP: 1.7.0.91 KR: 1.7.0.94
This commit is contained in:
@@ -2,7 +2,9 @@ local PenguinLevel = class("PenguinLevel")
|
||||
local PenguinCard = require("Game.UI.Play_PenguinCard.PenguinCard")
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local ConfigData = require("GameCore.Data.ConfigData")
|
||||
local GameState = {
|
||||
Start = 0,
|
||||
Prepare = 1,
|
||||
Dealing = 2,
|
||||
Flip = 3,
|
||||
@@ -18,6 +20,7 @@ function PenguinLevel:Init(nFloorId, nLevelId, nActId, tbStarScore)
|
||||
}
|
||||
self.nLevelId = nLevelId
|
||||
self.nActId = nActId
|
||||
self.bWarning = true
|
||||
self:ParseConfigData()
|
||||
self:ParseLocalData()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.PenguinCard, self)
|
||||
@@ -30,6 +33,7 @@ function PenguinLevel:ParseConfigData()
|
||||
self.tbRoundUpgradeCost = ConfigTable.GetConfigNumberArray("PenguinCardRoundUpgradeCost")
|
||||
self.tbSlotUpgradeCost = ConfigTable.GetConfigNumberArray("PenguinCardSlotUpgradeCost")
|
||||
self.tbBuyLimitUpgradeCost = ConfigTable.GetConfigNumberArray("PenguinCardBuyLimitUpgradeCost")
|
||||
self.nFireScore = ConfigTable.GetConfigNumber("PenguinCardFeverScore")
|
||||
self.mapBuyCost = {}
|
||||
local func_ForEach_Line = function(mapData)
|
||||
self.mapBuyCost[mapData.Count] = {
|
||||
@@ -44,15 +48,15 @@ function PenguinLevel:ParseConfigData()
|
||||
Id = mapData.Id,
|
||||
SuitCount = mapData.SuitCount,
|
||||
Value = mapData.Value,
|
||||
Ratio = mapData.Ratio
|
||||
Ratio = mapData.Ratio * ConfigData.IntFloatPrecision
|
||||
}
|
||||
end
|
||||
ForEachTableLine(DataTable.PenguinCardHandRank, func_ForEach_Rank)
|
||||
end
|
||||
function PenguinLevel:ParseLocalData()
|
||||
local bAuto = LocalData.GetLocalData("PenguinCard", "Auto")
|
||||
local bAuto = LocalData.GetPlayerLocalData("PenguinCardAuto")
|
||||
self.bAuto = bAuto == true
|
||||
local nSpeed = LocalData.GetLocalData("PenguinCard", "Speed")
|
||||
local nSpeed = LocalData.GetPlayerLocalData("PenguinCardSpeed")
|
||||
self.nSpeed = nSpeed or 1
|
||||
end
|
||||
function PenguinLevel:ParseLevelData(nFloorId)
|
||||
@@ -66,6 +70,7 @@ function PenguinLevel:ParseLevelData(nFloorId)
|
||||
self.nSlotCount = mapLevelCfg.InitialSlot
|
||||
self.nRoundLimit = mapLevelCfg.InitialRound
|
||||
self.nFixedTurnGroupId = mapLevelCfg.FixedTurn
|
||||
self.sLevelDesc = mapLevelCfg.Floortips
|
||||
self.nBuyLimit = mapLevelCfg.InitialBuyLimit
|
||||
self.nWeightGroupId = mapLevelCfg.WeightGroup
|
||||
local mapPoolCfg = ConfigTable.GetData("PenguinBaseCardPool", mapLevelCfg.PoolId)
|
||||
@@ -112,10 +117,21 @@ function PenguinLevel:StartGame()
|
||||
self:ParseLevelData(self.nFloorId)
|
||||
self:SwitchGameState()
|
||||
end
|
||||
function PenguinLevel:GiveupGame()
|
||||
self:QuitGameState()
|
||||
self.nGameState = GameState.Complete
|
||||
self:RunGameState()
|
||||
function PenguinLevel:CompleteGame()
|
||||
local nNextState = GameState.Complete
|
||||
self:SwitchNextGameState(nNextState, {bManual = true})
|
||||
end
|
||||
function PenguinLevel:RestartGame()
|
||||
local nNextState = GameState.Start
|
||||
local nWaitTime = self:QuitGameState(nNextState)
|
||||
if nWaitTime == 0 then
|
||||
self:StartGame()
|
||||
else
|
||||
TimerManager.Add(1, nWaitTime, self, function()
|
||||
self:StartGame()
|
||||
end, true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nWaitTime)
|
||||
end
|
||||
end
|
||||
function PenguinLevel:QuitGame(callback)
|
||||
local bAct = false
|
||||
@@ -135,18 +151,19 @@ function PenguinLevel:QuitGame(callback)
|
||||
end
|
||||
end
|
||||
if not bAct then
|
||||
callback()
|
||||
callback(true)
|
||||
end
|
||||
self:QuitGameState()
|
||||
self:ClearLevelData()
|
||||
end
|
||||
function PenguinLevel:SwitchGameState()
|
||||
self:QuitGameState()
|
||||
self:CheckNextGameState()
|
||||
self:RunGameState()
|
||||
local nNextState = self:CheckNextGameState()
|
||||
self:SwitchNextGameState(nNextState)
|
||||
end
|
||||
function PenguinLevel:RunGameState()
|
||||
if self.nGameState == GameState.Prepare then
|
||||
function PenguinLevel:RunGameState(mapParam)
|
||||
if self.nGameState == GameState.Start then
|
||||
self:RunState_Start()
|
||||
elseif self.nGameState == GameState.Prepare then
|
||||
self:RunState_Prepare()
|
||||
elseif self.nGameState == GameState.Dealing then
|
||||
self:RunState_Dealing()
|
||||
@@ -155,43 +172,70 @@ function PenguinLevel:RunGameState()
|
||||
elseif self.nGameState == GameState.Settlement then
|
||||
self:RunState_Settlement()
|
||||
elseif self.nGameState == GameState.Complete then
|
||||
self:RunState_Complete()
|
||||
self:RunState_Complete(mapParam)
|
||||
end
|
||||
end
|
||||
function PenguinLevel:QuitGameState()
|
||||
if self.nGameState == GameState.Prepare then
|
||||
self:QuitState_Prepare()
|
||||
function PenguinLevel:QuitGameState(nNextState)
|
||||
local nWaitTime = 0
|
||||
if self.nGameState == GameState.Start then
|
||||
nWaitTime = self:QuitState_Start()
|
||||
elseif self.nGameState == GameState.Prepare then
|
||||
nWaitTime = self:QuitState_Prepare(nNextState)
|
||||
elseif self.nGameState == GameState.Dealing then
|
||||
self:QuitState_Dealing()
|
||||
nWaitTime = self:QuitState_Dealing(nNextState)
|
||||
elseif self.nGameState == GameState.Flip then
|
||||
self:QuitState_Flip()
|
||||
nWaitTime = self:QuitState_Flip(nNextState)
|
||||
elseif self.nGameState == GameState.Settlement then
|
||||
self:QuitState_Settlement()
|
||||
nWaitTime = self:QuitState_Settlement(nNextState)
|
||||
elseif self.nGameState == GameState.Complete then
|
||||
self:QuitState_Complete()
|
||||
nWaitTime = self:QuitState_Complete()
|
||||
end
|
||||
return nWaitTime
|
||||
end
|
||||
function PenguinLevel:CheckNextGameState()
|
||||
if self.nGameState == nil then
|
||||
self.nGameState = GameState.Prepare
|
||||
return GameState.Start
|
||||
elseif self.nGameState == GameState.Start then
|
||||
return GameState.Prepare
|
||||
elseif self.nGameState == GameState.Prepare then
|
||||
self.nGameState = GameState.Dealing
|
||||
return GameState.Dealing
|
||||
elseif self.nGameState == GameState.Dealing then
|
||||
self.nGameState = GameState.Flip
|
||||
return GameState.Flip
|
||||
elseif self.nGameState == GameState.Flip then
|
||||
self.nGameState = GameState.Settlement
|
||||
return GameState.Settlement
|
||||
elseif self.nGameState == GameState.Settlement then
|
||||
if self.nCurRound >= self.nRoundLimit then
|
||||
if self.nCurTurn >= self.nMaxTurn then
|
||||
self.nGameState = GameState.Complete
|
||||
return GameState.Complete
|
||||
else
|
||||
self.nGameState = GameState.Prepare
|
||||
return GameState.Prepare
|
||||
end
|
||||
else
|
||||
self.nGameState = GameState.Dealing
|
||||
return GameState.Dealing
|
||||
end
|
||||
end
|
||||
end
|
||||
function PenguinLevel:SwitchNextGameState(nNextState, mapParam)
|
||||
local nWaitTime = self:QuitGameState(nNextState)
|
||||
if nWaitTime == 0 then
|
||||
self.nGameState = nNextState
|
||||
self:RunGameState(mapParam)
|
||||
else
|
||||
TimerManager.Add(1, nWaitTime, self, function()
|
||||
self.nGameState = nNextState
|
||||
self:RunGameState(mapParam)
|
||||
end, true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nWaitTime)
|
||||
end
|
||||
end
|
||||
function PenguinLevel:RunState_Start()
|
||||
EventManager.Hit("PenguinCard_RunState_Start")
|
||||
self:SwitchGameState()
|
||||
end
|
||||
function PenguinLevel:QuitState_Start()
|
||||
EventManager.Hit("PenguinCard_QuitState_Start")
|
||||
return 0
|
||||
end
|
||||
function PenguinLevel:RunState_Prepare()
|
||||
self.nCurTurn = self.nCurTurn + 1
|
||||
self.nCurRound = 0
|
||||
@@ -202,7 +246,7 @@ function PenguinLevel:RunState_Prepare()
|
||||
self:FreeRollPenguinCard()
|
||||
EventManager.Hit("PenguinCard_RunState_Prepare")
|
||||
end
|
||||
function PenguinLevel:QuitState_Prepare()
|
||||
function PenguinLevel:QuitState_Prepare(nNextState)
|
||||
for _, v in ipairs(self.tbPenguinCard) do
|
||||
if v ~= 0 then
|
||||
v:ResetTurnTrigger()
|
||||
@@ -212,68 +256,107 @@ function PenguinLevel:QuitState_Prepare()
|
||||
self.nTurnBuyCount = 0
|
||||
self.tbSelectablePenguinCard = {}
|
||||
self.bSelectedPenguinCard = false
|
||||
self.bPreTurnWin = false
|
||||
EventManager.Hit("PenguinCard_QuitState_Prepare", nNextState)
|
||||
local nWaitTime = 0
|
||||
if nNextState == GameState.Start then
|
||||
nWaitTime = 0.6
|
||||
elseif nNextState == GameState.Dealing then
|
||||
nWaitTime = 0.45
|
||||
elseif nNextState == GameState.Complete then
|
||||
nWaitTime = 0.6
|
||||
end
|
||||
return nWaitTime
|
||||
end
|
||||
function PenguinLevel:AddRound()
|
||||
if self.nRoundLimit == self.nMaxRound then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("PenguinCard_AddBtnMaxLevel"))
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
sSound = "Mode_Card_refresh_falied",
|
||||
sContent = ConfigTable.GetUIText("PenguinCard_AddBtnMaxLevel")
|
||||
})
|
||||
return
|
||||
end
|
||||
local nCost = self.tbRoundUpgradeCost[self.nRoundLimit + 1]
|
||||
if nCost > self.nScore then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("PenguinCard_NotEnoughScoreUpgrade"))
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
sSound = "Mode_Card_refresh_falied",
|
||||
sContent = ConfigTable.GetUIText("PenguinCard_NotEnoughScoreUpgrade")
|
||||
})
|
||||
return
|
||||
end
|
||||
self.nRoundLimit = self.nRoundLimit + 1
|
||||
self:ChangeScore(-1 * nCost)
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
bPositive = true,
|
||||
sContent = EventManager.Hit(EventId.OpenMessageBox, orderedFormat(ConfigTable.GetUIText("PenguinCard_AddRoundSuccess"), self.nRoundLimit))
|
||||
sSound = "Mode_Card_buy",
|
||||
sContent = orderedFormat(ConfigTable.GetUIText("PenguinCard_AddRoundSuccess"), self.nRoundLimit)
|
||||
})
|
||||
EventManager.Hit("PenguinCard_AddRound")
|
||||
end
|
||||
function PenguinLevel:AddSlot()
|
||||
if self.nSlotCount == self.nMaxSlot then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("PenguinCard_AddBtnMaxLevel"))
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
sSound = "Mode_Card_refresh_falied",
|
||||
sContent = ConfigTable.GetUIText("PenguinCard_AddBtnMaxLevel")
|
||||
})
|
||||
return
|
||||
end
|
||||
local nCost = self.tbSlotUpgradeCost[self.nSlotCount + 1]
|
||||
if nCost > self.nScore then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("PenguinCard_NotEnoughScoreUpgrade"))
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
sSound = "Mode_Card_refresh_falied",
|
||||
sContent = ConfigTable.GetUIText("PenguinCard_NotEnoughScoreUpgrade")
|
||||
})
|
||||
return
|
||||
end
|
||||
self.nSlotCount = self.nSlotCount + 1
|
||||
self:ChangeScore(-1 * nCost)
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
bPositive = true,
|
||||
sContent = EventManager.Hit(EventId.OpenMessageBox, orderedFormat(ConfigTable.GetUIText("PenguinCard_AddSlotSuccess"), self.nSlotCount))
|
||||
sSound = "Mode_Card_buy",
|
||||
sContent = orderedFormat(ConfigTable.GetUIText("PenguinCard_AddSlotSuccess"), self.nSlotCount)
|
||||
})
|
||||
EventManager.Hit("PenguinCard_AddSlot")
|
||||
end
|
||||
function PenguinLevel:AddRoll()
|
||||
if self.nBuyLimit == self.nMaxBuyLimit then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("PenguinCard_AddBtnMaxLevel"))
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
sSound = "Mode_Card_refresh_falied",
|
||||
sContent = ConfigTable.GetUIText("PenguinCard_AddBtnMaxLevel")
|
||||
})
|
||||
return
|
||||
end
|
||||
local nCost = self.tbBuyLimitUpgradeCost[self.nBuyLimit + 1]
|
||||
if nCost > self.nScore then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("PenguinCard_NotEnoughScoreUpgrade"))
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
sSound = "Mode_Card_refresh_falied",
|
||||
sContent = ConfigTable.GetUIText("PenguinCard_NotEnoughScoreUpgrade")
|
||||
})
|
||||
return
|
||||
end
|
||||
self.nBuyLimit = self.nBuyLimit + 1
|
||||
self:ChangeScore(-1 * nCost)
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
bPositive = true,
|
||||
sContent = EventManager.Hit(EventId.OpenMessageBox, orderedFormat(ConfigTable.GetUIText("PenguinCard_AddRollSuccess"), self.nBuyLimit))
|
||||
sSound = "Mode_Card_buy",
|
||||
sContent = orderedFormat(ConfigTable.GetUIText("PenguinCard_AddRollSuccess"), self.nBuyLimit)
|
||||
})
|
||||
EventManager.Hit("PenguinCard_AddRoll")
|
||||
end
|
||||
function PenguinLevel:FreeRollPenguinCard()
|
||||
local tbId = self:GetRollPenguinCardResult()
|
||||
if next(tbId) == nil then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("PenguinCard_Error_EmptyPenguinCard"))
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
sSound = "Mode_Card_refresh_falied",
|
||||
sContent = ConfigTable.GetUIText("PenguinCard_Error_EmptyPenguinCard")
|
||||
})
|
||||
return
|
||||
end
|
||||
self:ClearSelectablePenguinCard()
|
||||
@@ -285,17 +368,29 @@ function PenguinLevel:FreeRollPenguinCard()
|
||||
end
|
||||
function PenguinLevel:RollPenguinCard()
|
||||
if self.nTurnBuyCount >= self.nBuyLimit then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("PenguinCard_RollMax"))
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
sSound = "Mode_Card_refresh_falied",
|
||||
sContent = ConfigTable.GetUIText("PenguinCard_RollMax")
|
||||
})
|
||||
return
|
||||
end
|
||||
local nCost = self:GetRollPenguinCardCost()
|
||||
if nCost > self.nScore then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("PenguinCard_NotEnoughScoreRoll"))
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
sSound = "Mode_Card_refresh_falied",
|
||||
sContent = ConfigTable.GetUIText("PenguinCard_NotEnoughScoreRoll")
|
||||
})
|
||||
return
|
||||
end
|
||||
local tbId = self:GetRollPenguinCardResult()
|
||||
if next(tbId) == nil then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("PenguinCard_Error_EmptyPenguinCard"))
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
sSound = "Mode_Card_refresh_falied",
|
||||
sContent = ConfigTable.GetUIText("PenguinCard_Error_EmptyPenguinCard")
|
||||
})
|
||||
return
|
||||
end
|
||||
self.nTurnBuyCount = self.nTurnBuyCount + 1
|
||||
@@ -350,9 +445,10 @@ end
|
||||
function PenguinLevel:SalePenguinCard(nIndex)
|
||||
self:ChangeScore(self.tbPenguinCard[nIndex].nSoldPrice)
|
||||
local mapCard = self.tbPenguinCard[nIndex]
|
||||
local nGroupId = mapCard.nGroupId
|
||||
self:RecyclePenguinCard(mapCard)
|
||||
self.tbPenguinCard[nIndex] = 0
|
||||
EventManager.Hit("PenguinCard_SalePenguinCard", nIndex)
|
||||
EventManager.Hit("PenguinCard_SalePenguinCard", nIndex, nGroupId)
|
||||
end
|
||||
function PenguinLevel:GetRollPenguinCardCost()
|
||||
local findIntervalIndex = function(x, starts)
|
||||
@@ -426,7 +522,7 @@ function PenguinLevel:RunState_Dealing()
|
||||
self.nRoundScore = 0
|
||||
self.nRoundValue = 0
|
||||
self.nRoundRatio = 1
|
||||
self.nRoundMultiRatio = 1
|
||||
self.nRoundMultiRatio = 0
|
||||
self.mapCalBaseCardPool = clone(self.mapBaseCardPool)
|
||||
for _, v in ipairs(self.tbPenguinCard) do
|
||||
if v ~= 0 then
|
||||
@@ -449,14 +545,34 @@ function PenguinLevel:RunState_Dealing()
|
||||
EventManager.Hit("PenguinCard_RunState_Dealing")
|
||||
self:SwitchGameState()
|
||||
end
|
||||
function PenguinLevel:QuitState_Dealing()
|
||||
function PenguinLevel:QuitState_Dealing(nNextState)
|
||||
EventManager.Hit("PenguinCard_QuitState_Dealing", nNextState)
|
||||
local nWaitTime = 0
|
||||
if nNextState == GameState.Start then
|
||||
nWaitTime = 0.6
|
||||
elseif nNextState == GameState.Flip then
|
||||
nWaitTime = 0.85
|
||||
elseif nNextState == GameState.Complete then
|
||||
nWaitTime = 0.6
|
||||
end
|
||||
return nWaitTime
|
||||
end
|
||||
function PenguinLevel:RunState_Flip()
|
||||
EventManager.Hit("PenguinCard_RunState_Flip")
|
||||
self:PlayAuto()
|
||||
end
|
||||
function PenguinLevel:QuitState_Flip()
|
||||
function PenguinLevel:QuitState_Flip(nNextState)
|
||||
self:StopAuto()
|
||||
EventManager.Hit("PenguinCard_QuitState_Flip", nNextState)
|
||||
local nWaitTime = 0
|
||||
if nNextState == GameState.Start then
|
||||
nWaitTime = 0.6
|
||||
elseif nNextState == GameState.Settlement then
|
||||
nWaitTime = 1
|
||||
elseif nNextState == GameState.Complete then
|
||||
nWaitTime = 0.6
|
||||
end
|
||||
return nWaitTime
|
||||
end
|
||||
function PenguinLevel:ShowBaseCard(nIndex)
|
||||
local add = function(i)
|
||||
@@ -502,10 +618,7 @@ function PenguinLevel:ShowBaseCard(nIndex)
|
||||
local nShowed = self:GetShowedCardCount()
|
||||
if nShowed == self.nBaseCardCount then
|
||||
self:CheckHandRank()
|
||||
TimerManager.Add(1, 0.25, self, function()
|
||||
self:SwitchGameState()
|
||||
end, true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.25)
|
||||
self:SwitchGameState()
|
||||
end
|
||||
EventManager.Hit("PenguinCard_ShowBaseCard", nIndex)
|
||||
end
|
||||
@@ -535,12 +648,12 @@ function PenguinLevel:CheckHandRank()
|
||||
end
|
||||
if nAble == nType then
|
||||
self.nHandRankId = v.Id
|
||||
self:ChangeRoundScore(v.Value, v.Ratio, 0)
|
||||
self:ChangeRoundScore(v.Value, v.Ratio, 0, true)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
function PenguinLevel:ChangeRoundScore(nAddValue, nAddRatio, nAddMultiRatio)
|
||||
function PenguinLevel:ChangeRoundScore(nAddValue, nAddRatio, nAddMultiRatio, bFromHandRank)
|
||||
local nBeforeScore = self.nRoundScore
|
||||
local nBeforeBase = self.nRoundValue
|
||||
local nBeforeMultiRatio = self.nRoundMultiRatio
|
||||
@@ -548,7 +661,7 @@ function PenguinLevel:ChangeRoundScore(nAddValue, nAddRatio, nAddMultiRatio)
|
||||
self.nRoundValue = self.nRoundValue + nAddValue
|
||||
self.nRoundMultiRatio = self.nRoundMultiRatio + nAddMultiRatio
|
||||
self.nRoundRatio = self.nRoundRatio + nAddRatio
|
||||
self.nRoundScore = self.nRoundValue * self.nRoundRatio * self.nRoundMultiRatio
|
||||
self.nRoundScore = self.nRoundMultiRatio > 0 and self.nRoundValue * self.nRoundRatio * self.nRoundMultiRatio or self.nRoundValue * self.nRoundRatio
|
||||
local nAddScore = self.nRoundScore - nBeforeScore
|
||||
self.nTurnScore = self.nTurnScore + nAddScore
|
||||
if self.nTurnScore > self.nBestTurnScore then
|
||||
@@ -557,10 +670,14 @@ function PenguinLevel:ChangeRoundScore(nAddValue, nAddRatio, nAddMultiRatio)
|
||||
if self.nRoundScore > self.nBestRoundScore then
|
||||
self.nBestRoundScore = self.nRoundScore
|
||||
end
|
||||
EventManager.Hit("PenguinCard_ChangeRoundScore", nBeforeBase, nBeforeMultiRatio * nBeforeRatio, nBeforeScore)
|
||||
printLog("轮积分变化:" .. nAddScore .. " (" .. nBeforeScore .. " -> " .. self.nRoundScore .. ")")
|
||||
printLog("基础变化:" .. nAddValue .. " (" .. nBeforeBase .. " -> " .. self.nRoundValue .. ")")
|
||||
printLog("倍率变化:" .. self.nRoundRatio * self.nRoundMultiRatio - nBeforeMultiRatio * nBeforeRatio .. " (" .. nBeforeMultiRatio * nBeforeRatio .. " -> " .. self.nRoundRatio * self.nRoundMultiRatio .. ")")
|
||||
local nBeforeAllRatio = 0 < nBeforeMultiRatio and nBeforeMultiRatio * nBeforeRatio or nBeforeRatio
|
||||
local nAfterAllRatio = self.nRoundMultiRatio > 0 and self.nRoundRatio * self.nRoundMultiRatio or self.nRoundRatio
|
||||
EventManager.Hit("PenguinCard_ChangeRoundScore", nBeforeBase, nBeforeAllRatio, nBeforeScore, bFromHandRank)
|
||||
if NovaAPI.IsEditorPlatform() then
|
||||
printLog("轮积分变化:" .. nAddScore .. " (" .. nBeforeScore .. " -> " .. self.nRoundScore .. ")")
|
||||
printLog("基础变化:" .. nAddValue .. " (" .. nBeforeBase .. " -> " .. self.nRoundValue .. ")")
|
||||
printLog("倍率变化:" .. nAfterAllRatio - nBeforeAllRatio .. " (" .. nBeforeAllRatio .. " -> " .. nAfterAllRatio .. ")")
|
||||
end
|
||||
end
|
||||
function PenguinLevel:GetShowedCardCount()
|
||||
local nShowed = 0
|
||||
@@ -595,7 +712,7 @@ function PenguinLevel:RunState_Settlement()
|
||||
EventManager.Hit("PenguinCard_RunState_Settlement")
|
||||
self:PlayAuto()
|
||||
end
|
||||
function PenguinLevel:QuitState_Settlement()
|
||||
function PenguinLevel:QuitState_Settlement(nNextState)
|
||||
self:StopAuto()
|
||||
self:ChangeScore(self.nRoundScore)
|
||||
self.tbHandRank = {}
|
||||
@@ -604,8 +721,20 @@ function PenguinLevel:QuitState_Settlement()
|
||||
self.nRoundScore = 0
|
||||
self.nRoundValue = 0
|
||||
self.nRoundRatio = 1
|
||||
self.nRoundMultiRatio = 1
|
||||
self.nRoundMultiRatio = 0
|
||||
self.mapCalBaseCardPool = {}
|
||||
EventManager.Hit("PenguinCard_QuitState_Settlement", nNextState)
|
||||
local nWaitTime = 0
|
||||
if nNextState == GameState.Start then
|
||||
nWaitTime = 0.6
|
||||
elseif nNextState == GameState.Dealing then
|
||||
nWaitTime = 0.57
|
||||
elseif nNextState == GameState.Prepare then
|
||||
nWaitTime = 0.57
|
||||
elseif nNextState == GameState.Complete then
|
||||
nWaitTime = 0.6
|
||||
end
|
||||
return nWaitTime
|
||||
end
|
||||
function PenguinLevel:AddLog()
|
||||
if not self.mapLog[self.nCurTurn] then
|
||||
@@ -625,17 +754,74 @@ function PenguinLevel:AddLog()
|
||||
self.mapLog[self.nCurTurn].tbRound[self.nCurRound].tbHandRank = clone(self.tbHandRank)
|
||||
self.mapLog[self.nCurTurn].tbRound[self.nCurRound].nHandRankId = self.nHandRankId
|
||||
end
|
||||
function PenguinLevel:RunState_Complete()
|
||||
self.nStar = 0
|
||||
for i, v in ipairs(self.tbStarScore) do
|
||||
if v <= self.nScore then
|
||||
self.nStar = i
|
||||
end
|
||||
end
|
||||
function PenguinLevel:RunState_Complete(mapParam)
|
||||
self.nStar = self:GetStar()
|
||||
EventManager.Hit("PenguinCard_RunState_Complete")
|
||||
if self.nActId then
|
||||
local tab = {}
|
||||
table.insert(tab, {
|
||||
"role_id",
|
||||
tostring(PlayerData.Base._nPlayerId)
|
||||
})
|
||||
table.insert(tab, {
|
||||
"activity_id",
|
||||
tostring(self.nActId)
|
||||
})
|
||||
table.insert(tab, {
|
||||
"battle_id",
|
||||
tostring(self.nLevelId)
|
||||
})
|
||||
table.insert(tab, {
|
||||
"round",
|
||||
tostring(self.nCurTurn)
|
||||
})
|
||||
table.insert(tab, {
|
||||
"result",
|
||||
tostring(self.nStar == 0 and 2 or 1)
|
||||
})
|
||||
local nEnd = mapParam and mapParam.bManual == true and 2 or 1
|
||||
table.insert(tab, {
|
||||
"end_type",
|
||||
tostring(nEnd)
|
||||
})
|
||||
table.insert(tab, {
|
||||
"score",
|
||||
tostring(self.nScore)
|
||||
})
|
||||
table.insert(tab, {
|
||||
"star",
|
||||
tostring(self.nStar)
|
||||
})
|
||||
local sId = ""
|
||||
for i = 1, 6 do
|
||||
if self.tbPenguinCard[i] ~= 0 then
|
||||
if sId == "" then
|
||||
sId = sId .. self.tbPenguinCard[i].nId
|
||||
else
|
||||
sId = sId .. "," .. self.tbPenguinCard[i].nId
|
||||
end
|
||||
end
|
||||
end
|
||||
table.insert(tab, {"card_list", sId})
|
||||
table.insert(tab, {
|
||||
"skill_1",
|
||||
tostring(self.nRoundLimit)
|
||||
})
|
||||
table.insert(tab, {
|
||||
"skill_2",
|
||||
tostring(self.nSlotCount)
|
||||
})
|
||||
table.insert(tab, {
|
||||
"skill_3",
|
||||
tostring(self.nBuyLimit)
|
||||
})
|
||||
NovaAPI.UserEventUpload("minigame_PenguinCard", tab)
|
||||
end
|
||||
end
|
||||
function PenguinLevel:QuitState_Complete()
|
||||
self.nStar = 0
|
||||
EventManager.Hit("PenguinCard_QuitState_Complete")
|
||||
return 0
|
||||
end
|
||||
function PenguinLevel:GetMostHandRank()
|
||||
local nCount = 0
|
||||
@@ -672,18 +858,18 @@ function PenguinLevel:GetBestPenguinCard()
|
||||
end
|
||||
function PenguinLevel:SetAutoState(bAuto)
|
||||
self.bAuto = bAuto
|
||||
LocalData.SetLocalData("PenguinCard", "Auto", self.bAuto)
|
||||
LocalData.SetPlayerLocalData("PenguinCardAuto", self.bAuto)
|
||||
end
|
||||
function PenguinLevel:SetAutoSpeed(nSpeed)
|
||||
self.nSpeed = nSpeed
|
||||
LocalData.SetLocalData("PenguinCard", "Speed", self.nSpeed)
|
||||
LocalData.SetPlayerLocalData("PenguinCardSpeed", self.nSpeed)
|
||||
if self.sequence then
|
||||
self:StopAuto()
|
||||
self:PlayAuto()
|
||||
end
|
||||
end
|
||||
function PenguinLevel:PlayAuto(bClick)
|
||||
if not self.bAuto then
|
||||
if not self.bAuto or self.bPause then
|
||||
return
|
||||
end
|
||||
if self.nGameState == GameState.Flip then
|
||||
@@ -698,14 +884,19 @@ function PenguinLevel:PlayAuto(bClick)
|
||||
end
|
||||
self.sequence:SetUpdate(true)
|
||||
elseif self.nGameState == GameState.Settlement then
|
||||
if not PlayerData.Guide:CheckGuideFinishById(302) then
|
||||
local bKeep = not PlayerData.Guide:CheckGuideFinishById(302)
|
||||
if EditorSettings and EditorSettings.bJumpGuide then
|
||||
bKeep = false
|
||||
end
|
||||
if bKeep then
|
||||
return
|
||||
end
|
||||
self.sequence = DOTween.Sequence()
|
||||
if not bClick then
|
||||
self.sequence:AppendInterval(1 / self.nSpeed)
|
||||
self.sequence:AppendInterval((self.nRoundValue >= self.nFireScore and 7 or 5) / self.nSpeed)
|
||||
end
|
||||
self.sequence:AppendCallback(function()
|
||||
EventManager.Hit("PenguinCard_QuitScoreAni")
|
||||
if self.nRoundLimit == self.nCurRound and self.nCurTurn < self.nMaxTurn then
|
||||
local callback = function()
|
||||
self:SwitchGameState()
|
||||
@@ -725,16 +916,52 @@ function PenguinLevel:StopAuto()
|
||||
end
|
||||
end
|
||||
function PenguinLevel:Pause()
|
||||
self:StopAuto()
|
||||
self.bPause = true
|
||||
if self.sequence then
|
||||
self.sequence:Pause()
|
||||
end
|
||||
EventManager.Hit("PenguinCard_Pause")
|
||||
end
|
||||
function PenguinLevel:Resume()
|
||||
self:PlayAuto()
|
||||
self.bPause = false
|
||||
if self.sequence then
|
||||
self.sequence:Play()
|
||||
else
|
||||
self:PlayAuto()
|
||||
end
|
||||
EventManager.Hit("PenguinCard_Resume")
|
||||
end
|
||||
function PenguinLevel:ChangeScore(nChange)
|
||||
if not nChange or nChange == 0 then
|
||||
return
|
||||
end
|
||||
local nBefore = self.nScore
|
||||
self.nScore = self.nScore + nChange
|
||||
EventManager.Hit("PenguinCard_ChangeScore", nBefore)
|
||||
printLog("总积分变化:" .. nChange .. " (" .. nBefore .. " -> " .. self.nScore .. ")")
|
||||
local nBeforeStar, nStar = 0, 0
|
||||
for i, v in ipairs(self.tbStarScore) do
|
||||
if v <= nBefore then
|
||||
nBeforeStar = i
|
||||
end
|
||||
if v <= self.nScore then
|
||||
nStar = i
|
||||
end
|
||||
end
|
||||
if nBeforeStar < 3 and nStar == 3 and self.nGameState == GameState.Settlement then
|
||||
self.bPreTurnWin = true
|
||||
end
|
||||
EventManager.Hit("PenguinCard_ChangeScore", nBefore, nBeforeStar, nStar)
|
||||
if NovaAPI.IsEditorPlatform() then
|
||||
printLog("总积分变化:" .. nChange .. " (" .. nBefore .. " -> " .. self.nScore .. ")")
|
||||
end
|
||||
end
|
||||
function PenguinLevel:GetStar()
|
||||
local nStar = 0
|
||||
for i, v in ipairs(self.tbStarScore) do
|
||||
if v <= self.nScore then
|
||||
nStar = i
|
||||
end
|
||||
end
|
||||
return nStar
|
||||
end
|
||||
function PenguinLevel:WeightedRandom(tbId, tbWeight, n, tbExcludeGroupId, bDuplicate)
|
||||
if #tbId ~= #tbWeight then
|
||||
@@ -802,6 +1029,9 @@ function PenguinLevel:WeightedRandom(tbId, tbWeight, n, tbExcludeGroupId, bDupli
|
||||
end
|
||||
return result
|
||||
end
|
||||
function PenguinLevel:SetWarning(bAble)
|
||||
self.bWarning = bAble
|
||||
end
|
||||
function PenguinLevel:GetOwnPenguinCardCount()
|
||||
local nCount = 0
|
||||
for i = 1, 6 do
|
||||
|
||||
Reference in New Issue
Block a user