Initial version - 1.2.0.60
EN: 1.2.0.60 CN: 1.2.0.61 JP: 1.2.0.63 KR: 1.2.0.67
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
local BasePrologueFloor = class("BasePrologueFloor")
|
||||
function BasePrologueFloor:ctor(parentData)
|
||||
self.parent = parentData
|
||||
end
|
||||
function BasePrologueFloor:Enter()
|
||||
self:_BindEventCallback()
|
||||
end
|
||||
function BasePrologueFloor:_BindEventCallback()
|
||||
if type(self._mapEventConfig) ~= "table" then
|
||||
return
|
||||
end
|
||||
for nEventId, sCallbackName in pairs(self._mapEventConfig) do
|
||||
local callback = self[sCallbackName]
|
||||
if type(callback) == "function" then
|
||||
EventManager.Add(nEventId, self, callback)
|
||||
end
|
||||
end
|
||||
end
|
||||
function BasePrologueFloor:_UnbindEventCallback()
|
||||
if type(self._mapEventConfig) ~= "table" then
|
||||
return
|
||||
end
|
||||
for nEventId, sCallbackName in pairs(self._mapEventConfig) do
|
||||
local callback = self[sCallbackName]
|
||||
if type(callback) == "function" then
|
||||
EventManager.Remove(nEventId, self, callback)
|
||||
end
|
||||
end
|
||||
end
|
||||
function BasePrologueFloor:Exit()
|
||||
self:_UnbindEventCallback()
|
||||
end
|
||||
return BasePrologueFloor
|
||||
@@ -0,0 +1,21 @@
|
||||
local BaseFloor = require("Game.Adventure.MainlineLevel.PrologueFloor.BasePrologueFloor")
|
||||
local BattleFloor = class("BattleFloor", BaseFloor)
|
||||
BattleFloor._mapEventConfig = {
|
||||
InteractiveNpc = "OnEvent_InteractiveNpc",
|
||||
InteractiveBoxGet = "OnEvent_InteractiveBoxGet"
|
||||
}
|
||||
function BattleFloor:OnEvent_InteractiveNpc(nNpcId, nNpcUid)
|
||||
local mapNpc = ConfigTable.GetData("NPC", nNpcId)
|
||||
if mapNpc == nil then
|
||||
print("NPC不存在" .. nNpcId)
|
||||
return
|
||||
end
|
||||
if mapNpc.type ~= GameEnum.npcType.PrologueReward then
|
||||
return
|
||||
end
|
||||
self.parent:GetRewardNpc(nNpcId, nNpcUid)
|
||||
end
|
||||
function BattleFloor:OnEvent_InteractiveBox(nBoxId, _, _, _)
|
||||
self.parent:GetRewardBox(nBoxId)
|
||||
end
|
||||
return BattleFloor
|
||||
@@ -0,0 +1,4 @@
|
||||
local BaseFloor = require("Game.Adventure.MainlineLevel.PrologueFloor.BasePrologueFloor")
|
||||
local DesertFloor = class("DesertFloor", BaseFloor)
|
||||
DesertFloor._mapEventConfig = {}
|
||||
return DesertFloor
|
||||
Reference in New Issue
Block a user