|
-- require("game.proto.422.Require422")
|
|
-- require("game.starMap.StarMapModel")
|
|
-- require("game.starMap.StarMapView")
|
|
-- require("game.starMap.StarMapPropItem")
|
|
-- require("game.starMap.StarPointItem")
|
|
-- require("game.starMap.StarMapStageView")
|
|
-- require("game.starMap.StarLineItem")
|
|
|
|
-- StarMapController = StarMapController or BaseClass(BaseController)
|
|
|
|
-- function StarMapController:__init()
|
|
-- StarMapController.Instance = self
|
|
-- self.model = StarMapModel:getInstance()
|
|
|
|
-- self:RegisterProtocals()
|
|
-- self:InitEvent()
|
|
-- end
|
|
|
|
-- function StarMapController:RegisterProtocals()
|
|
-- self:RegisterProtocal(42200,"Handler42200") --星图信息
|
|
-- self:RegisterProtocal(42201,"Handler42201") --点亮星点
|
|
-- end
|
|
|
|
-- function StarMapController:InitEvent()
|
|
-- local function open_starMap_view()
|
|
-- if self.starMapView == nil then
|
|
-- self.starMapView = StarMapView.New()
|
|
-- end
|
|
-- if not self.starMapView:HasOpen() then
|
|
-- self.starMapView:Open()
|
|
-- end
|
|
-- end
|
|
-- GlobalEventSystem:Bind(EventName.OPEN_STAR_MAP_VIEW,open_starMap_view)
|
|
|
|
-- local function open_stage_view(id,x,y)
|
|
-- if self.starMapStageView == nil then
|
|
-- self.starMapStageView = StarMapStageView.New()
|
|
-- end
|
|
-- if not self.starMapStageView:HasOpen() then
|
|
-- self.starMapStageView:Open(id,x,y)
|
|
-- end
|
|
-- end
|
|
-- self.model:Bind(StarMapModel.OPEN_STAGE_VIEW,open_stage_view)
|
|
|
|
-- local function onPointNumChange(data)
|
|
-- if data == nil or self.model.starMap_data == nil then return end
|
|
-- self.model:UpdateStarPower(data)
|
|
-- end
|
|
-- GoodsModel:getInstance():Bind(GoodsModel.UPDATE_SPECIAL_SCORE,onPointNumChange)
|
|
|
|
-- local function onRedChange()
|
|
-- local can_show = self.model:HaveRedPoint()
|
|
-- GlobalEventSystem:Fire(EventName.SHOW_FUNCTION_RED_POINT,14,can_show)
|
|
-- end
|
|
-- self.model:Bind(StarMapModel.UPDATE_RED_POINT,onRedChange)
|
|
|
|
-- ---------------------协议相关------------------------
|
|
-- local function onGameStart()
|
|
-- if RoleManager.Instance.mainRoleInfo.level >= Config.ConfigOpenLv.Other.starMap then
|
|
-- self:SendFmtToGame(42200)
|
|
-- end
|
|
-- end
|
|
-- GlobalEventSystem:Bind(EventName.GAME_START,onGameStart)
|
|
|
|
-- local function onRequestData()
|
|
-- self:SendFmtToGame(42200)
|
|
-- end
|
|
-- self.model:Bind(StarMapModel.REQUEST_STAR_MAP_DATA,onRequestData)
|
|
|
|
-- local function onUpgrate(id)
|
|
-- self:SendFmtToGame(42201,"i",id)
|
|
-- end
|
|
-- self.model:Bind(StarMapModel.LIGHT_STAR_POINT,onUpgrate)
|
|
-- end
|
|
|
|
-- function StarMapController:Handler42200()
|
|
-- local scmd = SCMD42200.New(true)
|
|
-- self.model:UpdateStarMapData(scmd)
|
|
-- --PrintTable(scmd)
|
|
-- end
|
|
|
|
-- function StarMapController:Handler42201()
|
|
-- local scmd = SCMD42201.New(true)
|
|
-- if scmd.res_code == 1 then
|
|
-- Message.show("点亮成功!")
|
|
-- else
|
|
-- Message.show("点亮失败!")
|
|
-- end
|
|
-- end
|