require("game.proto.152.Require152") require("game.equip.EquipModel") require("game.equip.EquipConst") --装备主界面 require("game.equip.view.EquipBaseView") require("game.equip.view.EquipSuitTab") require("game.equip.view.EquipBaseTipsView")--装备精炼升星基础提示界面 --装备工坊主界面 require("game.equip.view.EquipBaseToolView") --精炼 require("game.equip.view.strengthen.EquipStrengthenView") require("game.equip.view.strengthen.EquipStrengthenItem") require("game.equip.view.strengthen.EquipStrengthenSuitViewNew") require("game.equip.view.strengthen.EquipStrengthenSuitItem") require("game.equip.view.strengthen.EquipStrengthenSuitAttrItem") require("game.equip.view.strengthen.EquipStrengthenSuitShowItem") --红装 require("game.equip.view.redEquip.EquipRedEquipView") require("game.equip.view.redEquip.EquipRedEquipItem") require("game.equip.view.redEquip.EquipRedEquipAttrItem") --升星 -- require("game.equip.view.evolution.EquipEvolutionView") require("game.equip.view.evolution.EquipEvolutionViewNew")--升星界面新 require("game.equip.view.evolution.EquipEvolutionExAttrItem")--升星界面属性item require("game.equip.view.evolution.EquipEvolutionItem") require("game.equip.view.evolution.EquipEvolutionAttrItem") require("game.equip.view.evolution.EquipEvolutionAwardTipView")--升星购买装备展示界面 require("game.equip.view.evolution.EquipStarSuitItem") require("game.equip.view.evolution.EquipStarSuitNewItem") require("game.equip.view.evolution.EquipStarSuitToolTipView") require("game.equip.view.evolution.EquipEvolutionChooseView")--升星装备选择界面 require("game.equip.view.evolution.EquipEvolutionTipView")--升星装备升星概率提示界面 require("game.equip.view.evolution.EquipEvolutionSuccessViewNew")--升星成功界面 require("game.equip.view.evolution.EquipEvolutionAttrFindView")--升星装备升星属性查找界面 --继承 require("game.equip.view.inherit.EquipInheritView") require("game.equip.view.inherit.EquipInheritItem") require("game.equip.view.inherit.EquipInheritTabItem") require("game.equip.view.inherit.EquipInheritTipView") require("game.equip.view.inherit.EquipInheritTipItem") require("game.equip.view.inherit.EquipInheritWearTipView")--装备继承穿戴界面 --刻印 require("game.equip.view.draconic.EquipDraconicView") require("game.equip.view.draconic.EquipDraconicItem") require("game.equip.view.draconic.EquipDraconicAttrItem") require("game.equip.view.draconic.EquipDraconicChooseView") require("game.equip.view.draconic.EquipDraconicChooseAttrItem") require("game.equip.view.draconic.EquipDraconicAttrShowView")--总刻印属性展示界面 require("game.equip.view.draconic.EquipDraconicAttrShowItem") require("game.equip.view.draconic.EquipDraconicEquipItem")--装备刻印装备item --宝石镶嵌 require("game.equip.view.gemstone.EquipGemstoneView") require("game.equip.view.gemstone.EquipGemstoneItem") require("game.equip.view.gemstone.EquipGemstoneSuitView")--宝石套装界面 require("game.equip.view.gemstone.EquipGemstoneSuitItem") require("game.equip.view.gemstone.EquipGemstoneSuitAttrItem") require("game.equip.view.gemstone.EquipGemstoneChooseView")--选择宝石界面 require("game.equip.view.gemstone.EquipGemstoneChooseItem") require("game.equip.view.gemstone.EquipGemstoneStateView")--宝石操作界面 require("game.equip.view.gemstone.EquipGemstoneAutoUpView")--宝石一键镶嵌界面 EquipController = EquipController or BaseClass(BaseController) EquipController.Is_Debug = false function EquipController:__init() EquipController.Instance = self self.model = EquipModel:getInstance() self.mainVo = RoleManager.Instance.mainRoleInfo self:EnableCheckoutClear() self:RegisterAllProtocals() self:AddAllEvents() self.is_delay_check = false--红点刷新防止重复刷新的键值 end function EquipController:__delete() end function EquipController:AddAllEvents() local function game_start_func() end GlobalEventSystem:Bind(EventName.GAME_START,game_start_func) -- local function CheckRedPoint( ... ) -- end -- GlobalEventSystem:Bind(GoodsModel.CHANGE_BAGLIST,game_start_func) local function onSceneStartHandler() end self:Bind(SceneEventType.SCENE_CHANGED, onSceneStartHandler) --15201 ccl 99 11 4294971653 --15201 ccl 0 11 4294971653 --请求协议 local function onRequestProtocal(...) local args = {...} if args[1] == 15201 then self:SendFmtToGame(args[1], "ccl", args[2],args[3],args[4]) elseif args[1] == 15202 then self:SendFmtToGame(args[1], "l", args[2]) elseif args[1] == 15203 then self:SendFmtToGame(args[1], "lcc", args[2],args[3],args[4]) elseif args[1] == 15205 then self:SendFmtToGame(args[1], "lclc", args[2],args[3],args[4],args[5]) elseif args[1] == 15209 then self:SendFmtToGame(args[1], "i", args[2]) elseif args[1] == 15222 or args[1] == 15224 or args[1] == 15206 then self:SendFmtToGame(args[1], "c", args[2]) elseif args[1] == 15210 or args[1] == 15214 or args[1] == 15225 then self:SendFmtToGame(args[1], "cc", args[2],args[3]) elseif args[1] == 15215 or args[1] == 15216 or args[1] == 15217 then self:SendFmtToGame(args[1], "cci", args[2],args[3],args[4]) elseif args[1] == 15212 then self:SendFmtToGame(args[1], "ich", args[2],args[3],args[4]) elseif args[1] == 15221 then self:SendFmtToGame(args[1], "lc", args[2],args[3]) elseif args[1] == 15204 then --装备升星 self:WriteBegin(15204) self:WriteFMT("l", args[2]) self:WriteFMT("c", args[3]) self:WriteFMT("h", TableSize(args[4])) for k, v in pairs(args[4]) do self:WriteFMT("l", v) end self:WriteFMT("h", TableSize(args[5])) for k, v in pairs(args[5]) do self:WriteFMT("l", v) end self:WriteFMT("c", args[6]) self:SendToGame() else self:SendFmtToGame(args[1]) end end self.model:Bind(EquipModel.REQUEST_CCMD_EVENT, onRequestProtocal) local function init_open_day( ... )--开服天数初始化 if self.mainVo.level >= Config.Modulesub["152@1"].open_lv then self.model:Fire(EquipModel.REQUEST_CCMD_EVENT,15200) end if self.mainVo.level >= Config.Modulesub["152@7"].open_lv then self.model:Fire(EquipModel.REQUEST_CCMD_EVENT,15213) self.model:Fire(EquipModel.REQUEST_CCMD_EVENT,15223) end self.model:Fire(EquipModel.REQUEST_CCMD_EVENT,15208) local function init_server_info( ... ) self.model:IsNeedRed(EquipModel.MainTab.Strengthen) self.model:IsNeedRed(EquipModel.MainTab.Evolution) self.model:IsNeedRed(EquipModel.MainTab.UpQuality) self.model:IsNeedRed(EquipModel.MainTab.Inherit) self.model:IsNeedRed(EquipModel.MainTab.RedEquip) self.model:IsNeedRed(EquipModel.MainTab.Draconic) self.model:IsNeedRed(EquipModel.MainTab.Gemstone) self.model:Fire(EquipModel.INFO_UPDATE) end setTimeout(init_server_info,3.5) self.model:Fire(EquipModel.REQUEST_CCMD_EVENT,15226) end GlobalEventSystem:Bind(EventName.OPEN_DAY_INIT,init_open_day) --升级 local function onLevelUp(level) if level == Config.Modulesub["152@1"].open_lv then--精炼 self.model:IsNeedRed(EquipModel.MainTab.Strengthen) elseif level == Config.Modulesub["152@2"].open_lv then--升星 self.model:IsNeedRed(EquipModel.MainTab.Evolution) elseif level == Config.Modulesub["152@3"].open_lv then--继承 self.model:IsNeedRed(EquipModel.MainTab.Inherit) elseif level == Config.Modulesub["152@4"].open_lv then--升品 self.model:IsNeedRed(EquipModel.MainTab.UpQuality) elseif level == Config.Modulesub["154@1"].open_lv then--红装 self.model:IsNeedRed(EquipModel.MainTab.RedEquip) elseif level == Config.Modulesub["154@2"].open_lv then--刻印 self.model:IsNeedRed(EquipModel.MainTab.Draconic) elseif level == Config.Modulesub["152@7"].open_lv then--宝石 self.model:IsNeedRed(EquipModel.MainTab.Gemstone) self.model:Fire(EquipModel.REQUEST_CCMD_EVENT,15223) end end RoleManager.Instance.mainRoleInfo:Bind(EventName.CHANGE_LEVEL, onLevelUp) --装备主界面 local function open_equip_main_view(tab_index,speaciel_data) if RoleManager.Instance.mainRoleInfo.level < Config.Moduleid[152].open_lv then Message.show("功能暂未开启","fault") return end tab_index = tonumber(tab_index) if self.EquipBaseView == nil then self.EquipBaseView = EquipBaseView.New() end if not self.EquipBaseView:HasOpen() then self.EquipBaseView:Open(tab_index, speaciel_data) end end GlobalEventSystem:Bind(EquipModel.OPEN_MAIN_VIEW,open_equip_main_view) --主界面关闭 local function close_equip_main_view() if self.EquipBaseView and self.EquipBaseView:HasOpen() then self.EquipBaseView:Close() end self.EquipBaseView = nil end GlobalEventSystem:Bind(EquipModel.CLOSE_MAIN_VIEW,close_equip_main_view) --装备工坊主界面 local function openEquipBaseToolView(tab_index,speaciel_data) if RoleManager.Instance.mainRoleInfo.level < Config.Moduleid[152].open_lv then Message.show("功能暂未开启","fault") return end tab_index = tonumber(tab_index) if self.EquipBaseToolView == nil then self.EquipBaseToolView = EquipBaseToolView.New() end if not self.EquipBaseToolView:HasOpen() then self.EquipBaseToolView:Open(tab_index, speaciel_data) end end GlobalEventSystem:Bind(EquipModel.OPEN_TOOL_MAIN_VIEW,openEquipBaseToolView) --主界面关闭 local function closeEquipBaseToolView() if self.EquipBaseToolView and self.EquipBaseToolView:HasOpen() then self.EquipBaseToolView:Close() end self.EquipBaseToolView = nil end GlobalEventSystem:Bind(EquipModel.CLOSE_MAIN_VIEW,closeEquipBaseToolView) local onOpenEquipStrengthenSuitViewNew = function (suit_id)--精炼套装界面 print("精炼套装界面 :", suit_id) if self.EquipStrengthenSuitViewNew == nil then self.EquipStrengthenSuitViewNew = EquipStrengthenSuitViewNew.New() end if self.EquipStrengthenSuitViewNew.isPop then self.EquipStrengthenSuitViewNew:UpdateView(suit_id) else self.EquipStrengthenSuitViewNew:Open(suit_id) end end GlobalEventSystem:Bind(EquipModel.OPEN_STRENGTH_SUIT_VIEW, onOpenEquipStrengthenSuitViewNew) local onOpenEquipStarSuitToolTipView = function (equip_star_cfg, x, y, offer_x, offer_y)--三星评分展示界面 print("星级套装Tip界面 :",equip_star_cfg) if self.EquipStarSuitToolTipView == nil then self.EquipStarSuitToolTipView = EquipStarSuitToolTipView.New() end if self.EquipStarSuitToolTipView:HasOpen() then self.EquipStarSuitToolTipView:UpdateView(equip_star_cfg, x, y, offer_x, offer_y) else self.EquipStarSuitToolTipView:Open(equip_star_cfg, x, y, offer_x, offer_y) end end GlobalEventSystem:Bind(EquipModel.OPEN_EQUIP_STAR_TIP_VIEW, onOpenEquipStarSuitToolTipView) local onOpenEquipInheritTipView = function ( goods_vo )--继承选择装备界面 if not goods_vo then Message.show("请先选择装备哦!","fault") return end print("继承选择装备界面 :") if self.EquipInheritTipView == nil then self.EquipInheritTipView = EquipInheritTipView.New() end if self.EquipInheritTipView:HasOpen() then self.EquipInheritTipView:UpdateView( ) else self.EquipInheritTipView:Open( goods_vo ) end end GlobalEventSystem:Bind(EquipModel.OPEN_EQUIP_INHERIT_TIP_VIEW, onOpenEquipInheritTipView) local onOpenEquipEvolutionAwardTipView = function ( data )--升星购买装备展示界面 print("升星购买装备展示界面 :") if self.EquipEvolutionAwardTipView == nil then self.EquipEvolutionAwardTipView = EquipEvolutionAwardTipView.New() end if self.EquipEvolutionAwardTipView:HasOpen() then self.EquipEvolutionAwardTipView:UpdateView( ) else self.EquipEvolutionAwardTipView:Open( data ) end end GlobalEventSystem:Bind(EquipModel.OPEN_EQUIP_EVOLUTION_AWARD_TIP_VIEW, onOpenEquipEvolutionAwardTipView) --打开宝石选择界面 local function openEquipGemstoneChooseView(data,x,y,pos_offer) if self.EquipGemstoneChooseView == nil then self.EquipGemstoneChooseView = EquipGemstoneChooseView.New() end if self.EquipGemstoneChooseView:HasOpen() then -- self.EquipGemstoneChooseView:UpdateView(data) else self.EquipGemstoneChooseView:Open(data,x,y,pos_offer) end end self.model:Bind(EquipModel.OPEN_GEMSTONES_CHOOSE_VIEW, openEquipGemstoneChooseView) --打开宝石操作界面 local function openEquipGemstoneStateView(data,x,y) if self.EquipGemstoneStateView == nil then self.EquipGemstoneStateView = EquipGemstoneStateView.New() end if self.EquipGemstoneStateView:HasOpen() then self.EquipGemstoneStateView:UpdateView(data,x,y) else self.EquipGemstoneStateView:Open(data,x,y) end end self.model:Bind(EquipModel.OPEN_GEMSTONES_STATE_VIEW, openEquipGemstoneStateView) local onOpenEquipGemstoneSuitView = function (suit_id)--宝石套装界面 print("宝石套装界面 :", suit_id) if self.EquipGemstoneSuitView == nil then self.EquipGemstoneSuitView = EquipGemstoneSuitView.New() end if self.EquipGemstoneSuitView:HasOpen() then self.EquipGemstoneSuitView:UpdateView(suit_id) else self.EquipGemstoneSuitView:Open(suit_id) end end self.model:Bind(EquipModel.OPEN_GEMSTONE_SUIT_VIEW, onOpenEquipGemstoneSuitView) local onOpenEquipGemstoneAutoUpView= function ()--宝石一键镶嵌表现界面 print("宝石一键镶嵌表现界面 :") if self.EquipGemstoneAutoUpView == nil then self.EquipGemstoneAutoUpView = EquipGemstoneAutoUpView.New() end if self.EquipGemstoneAutoUpView:HasOpen() then -- self.EquipGemstoneAutoUpView:UpdateView() else self.EquipGemstoneAutoUpView:Open() end end self.model:Bind(EquipModel.OPEN_GEMSTONE_AUTO_VIEW, onOpenEquipGemstoneAutoUpView) --打开升星装备选择界面 local function openEquipEvolutionChooseView(data) if self.EquipEvolutionChooseView == nil then self.EquipEvolutionChooseView = EquipEvolutionChooseView.New() end if self.EquipEvolutionChooseView:HasOpen() then self.EquipEvolutionChooseView:UpdateView(data) else self.EquipEvolutionChooseView:Open(data) end end self.model:Bind(EquipModel.OPEN_EVOLUSTION_CHOOSE_VIEW, openEquipEvolutionChooseView) --打开升星装备选择界面 local function openEquipEvolutionTipView(data) local evolution_view = EquipController.Instance:GetEquipViewClass(EquipModel.MainTab.Evolution) if not evolution_view then Message.show("未打开升星界面","fault") return end if self.EquipEvolutionTipView == nil then self.EquipEvolutionTipView = EquipEvolutionTipView.New() end if self.EquipEvolutionTipView:HasOpen() then self.EquipEvolutionTipView:UpdateView(data) else self.EquipEvolutionTipView:Open(data) end end self.model:Bind(EquipModel.OPEN_EVOLUSTION_TIP_VIEW, openEquipEvolutionTipView) --打开升星装备属性预览界面 local function openEquipEvolutionAttrFindView(attr_list) local evolution_view = EquipController.Instance:GetEquipViewClass(EquipModel.MainTab.Evolution) if not evolution_view then Message.show("未打开升星界面","fault") return end if self.EquipEvolutionAttrFindView == nil then self.EquipEvolutionAttrFindView = EquipEvolutionAttrFindView.New() end if self.EquipEvolutionAttrFindView:HasOpen() then self.EquipEvolutionAttrFindView:UpdateView(attr_list) else self.EquipEvolutionAttrFindView:Open(attr_list) end end self.model:Bind(EquipModel.OPEN_EVOLUSTION_ATTR_FIND_VIEW, openEquipEvolutionAttrFindView) --关闭升星装备选择界面 local function closeEquipEvolutionTipView() if self.EquipEvolutionTipView and self.EquipEvolutionTipView:HasOpen() then self.EquipEvolutionTipView:Close() end end self.model:Bind(EquipModel.CLOSE_EVOLUSTION_TIP_VIEW, closeEquipEvolutionTipView) --打开刻印切换界面 local function openEquipDraconicChooseView(pos) if self.EquipDraconicChooseView == nil then self.EquipDraconicChooseView = EquipDraconicChooseView.New() end if self.EquipDraconicChooseView:HasOpen() then self.EquipDraconicChooseView:UpdateView(pos) else self.EquipDraconicChooseView:Open(pos) end end self.model:Bind(EquipModel.OPEN_DRACONIC_CHOOSE_VIEW, openEquipDraconicChooseView) --打开刻印总属性展示界面 local function openEquipDraconicAttrShowView() local data = self.model:GetDraconicAttrData() if not data or TableSize(data) == 0 then Message.show("暂无刻印属性附加哦!","fault") return end if self.EquipDraconicAttrShowView == nil then self.EquipDraconicAttrShowView = EquipDraconicAttrShowView.New() end if self.EquipDraconicAttrShowView:HasOpen() then self.EquipDraconicAttrShowView:UpdateView(data) else self.EquipDraconicAttrShowView:Open(data) end end self.model:Bind(EquipModel.OPEN_DRACONIC_ATTR_SHOW_VIEW, openEquipDraconicAttrShowView) --打开装备继承预览界面 local function openEquipInheritWearTipView(data) if self.EquipInheritWearTipView == nil then self.EquipInheritWearTipView = EquipInheritWearTipView.New() end if self.EquipInheritWearTipView:HasOpen() then self.EquipInheritWearTipView:UpdateView(data) else self.EquipInheritWearTipView:Open(data) end end self.model:Bind(EquipModel.OPEN_EQUIP_INHERIT_WEAR_TIP_VIEW, openEquipInheritWearTipView) --打开升星成功界面 local function openEquipEvolutionSuccessViewNew() if self.EquipEvolutionSuccessViewNew == nil then self.EquipEvolutionSuccessViewNew = EquipEvolutionSuccessViewNew.New() end if self.EquipEvolutionSuccessViewNew:HasOpen() then self.EquipEvolutionSuccessViewNew:UpdateView() else self.EquipEvolutionSuccessViewNew:Open() end end self.model:Bind(EquipModel.OPEN_EVOLUTION_SCUCCESS_VIEW, openEquipEvolutionSuccessViewNew) --关闭升星成功界面 local function closeEquipEvolutionSuccessViewNew() if self.EquipEvolutionSuccessViewNew and self.EquipEvolutionSuccessViewNew:HasOpen() then self.EquipEvolutionSuccessViewNew:Close() end end self.model:Bind(EquipModel.CLOSE_EVOLUTION_SCUCCESS_VIEW, closeEquipEvolutionSuccessViewNew) local onOpenEquipBaseTipsView = function (tip_data)--装备精炼升星基础提示界面 do return end--2021.8.2鑫爷说屏蔽掉 print("装备精炼升星基础提示界面 :") if self.EquipBaseTipsView == nil then self.EquipBaseTipsView = EquipBaseTipsView.New() end if self.EquipBaseTipsView:HasOpen() then self.EquipBaseTipsView:ResetViewInfo(tip_data) else self.EquipBaseTipsView:Open(tip_data) end end self.model:Bind(EquipModel.OPEN_EQUIP_BASE_TIPS_VIEW, onOpenEquipBaseTipsView) local update_red_func = function () self.model.no_show_faker_evo = false--交易券变化了 就重置一下弱升星红点啦 self:OnEvolutionUpdate() end self.change_tong_id = self.mainVo:BindOne("tong", update_red_func) end --获得装备界面类 有些界面内部数据复杂 直接调用内部数据的方法目前只有(EquipEvolutionTipView用到) function EquipController:GetEquipViewClass( id ) if self.EquipBaseView then return self.EquipBaseView:GetEquipViewClass(id) end end --背包每次获得一件装备就要更新 function EquipController:EquipGoodsUpdate( ) -- GoodsModel:getInstance():UpdateEquipState() BagModel.Instance:Fire(BagModel.UPDATE_EQUIP_GOODS) self.model.no_show_faker_evo = false--来装备了 就重置一下弱升星红点啦 self:OnEvolutionUpdate() local function delay_fun( ... ) self.model:IsNeedRed(EquipModel.MainTab.Strengthen) self.model:IsNeedRed(EquipModel.MainTab.UpQuality) end TimeManager.GetInstance():StartTime("15017CheckEquipQualityUpdate",0.15,delay_fun) end --精炼道具变化更新要刷新红点 function EquipController:OnStrengthGoodsUpdate( ) local function delay_fun( ... ) self.model:IsNeedRed(EquipModel.MainTab.Strengthen) self.model:IsNeedRed(EquipModel.MainTab.UpQuality) self.model:Fire(EquipModel.INFO_UPDATE) end TimeManager.GetInstance():StartTime("15017CheckEquipUpdate",0.35,delay_fun) end --升星道具变化更新要刷新红点 function EquipController:OnEvolutionUpdate( ) local delay_fun = function() self.model.no_show_faker_evo = false--来道具了 就重置一下弱升星红点啦 self.model:IsNeedRed(EquipModel.MainTab.Evolution) self.model:Fire(EquipModel.INFO_UPDATE) end TimeManager.GetInstance():StartDalayTime("15017EvolutionUpdate",0.35,delay_fun) end --洗练道具变化更新要刷新红点 function EquipController:OnWashGoodsUpdate( ) end --红装道具变化更新 function EquipController:OnRedEquipUpdate( ) self.model:IsNeedRed(EquipModel.MainTab.RedEquip) end --刻印道具变化更新刻印红点 function EquipController:OnDraconicUpdate( ) self.model:IsNeedRed(EquipModel.MainTab.Draconic) end --宝石数量变化更新宝石红点 function EquipController:OnGemstoneUpdate( ) self.model:IsNeedRed(EquipModel.MainTab.Gemstone) end function EquipController:RegisterAllProtocals() self:RegisterProtocal(15200, "on15200")--装备信息 self:RegisterProtocal(15201, "on15201")--穿 self:RegisterProtocal(15202, "on15202")--卸 self:RegisterProtocal(15203, "on15203")--精炼装备 self:RegisterProtocal(15204, "on15204")--装备升星 self:RegisterProtocal(15205, "on15205")--装备继承 self:RegisterProtocal(15206, "on15206")--激活星级套装 self:RegisterProtocal(15207, "on15207")--激活装备代数 self:RegisterProtocal(15208, "on15208")--升品-升品信息 self:RegisterProtocal(15209, "on15209")--刻印上阵 self:RegisterProtocal(15210, "on15210")--红装升级 升品 self:RegisterProtocal(15211, "on15211")--装备系统战力变更 self:RegisterProtocal(15212, "on15212")--升星升星预览 self:RegisterProtocal(15213, "on15213")--宝石镶嵌信息 self:RegisterProtocal(15214, "on15214")--宝石镶嵌信息:单条更新 self:RegisterProtocal(15215, "on15215")--宝石镶嵌 self:RegisterProtocal(15216, "on15216")--宝石卸下 self:RegisterProtocal(15217, "on15217")--宝石合成升级:镶嵌在身上的合成,其他合成走通用合成协议 self:RegisterProtocal(15221, "on15221")--装备-跟随守护 self:RegisterProtocal(15222, "on15222")--宝石一键镶嵌 self:RegisterProtocal(15223, "on15223")--宝石套装:宝石套装信息 self:RegisterProtocal(15224, "on15224")--激活宝石套装 self:RegisterProtocal(15225, "on15225")--特殊装备成长属性信息 self:RegisterProtocal(15226, "on15226")--总战力 end -- ############## 装备信息 ############## -- protocol=15200 -- { -- c2s{ -- } -- s2c{ -- stars:int16 // 当前激活的星级数 -- series:int8 // 当前已经解锁的代数 -- stars_info:array{ -- id:int16 // 节点 -- choice:int8 // 选择 -- } -- } -- } function EquipController:on15200() local vo = SCMD15200.New(true) -- print("huangcong:EquipController [start:115] vo:", vo) -- PrintTable(vo) -- print("huangcong:EquipController [end]") self.model:SetEquipActiveStarNum(vo.stars) self.model.cur_max_series = vo.series EquipCollectModel:GetInstance():SetEquipExamSkillInfo(vo.stars_info) EquipCollectModel:GetInstance():Fire(EquipCollectConst.UPDATE_EQUIP_COLLECT_RED, EquipCollectConst.TAB_ID.UPGRADE) -- self.model.equip_sum_power = vo.power -- if vo and vo.pos_list then -- self.model:SetEquipPosInfoList(vo.pos_list) -- self.model:SetRedEquipPosList(vo.pos_list) -- self.model:Fire(EquipModel.UPDATE_RED_EQUIP_INFO) -- self:OnRedEquipUpdate( ) -- 最后一级升品道具协议发来在15200之前,所以红点会不起效 -- self.model:IsNeedRed(EquipModel.MainTab.Draconic) -- end self.model:IsNeedRed(EquipModel.MainTab.Evolution) self.model:Fire(EquipModel.INFO_UPDATE) end -- ############## 穿 ############## -- protocol=15201 -- { -- c2s{ -- series :int8 // 第几套装备 -- pos:int8 // 装备位置 -- goods_id :int64 // 物品id -- } -- s2c{ -- // 成功会推15017 -- res :int32 // 错误码 -- } -- } function EquipController:on15201() local scmd = SCMD15201.New(true) if scmd.res == 1 then Message.show("穿戴装备成功","success") GoodsModel:getInstance():Fire(GoodsModel.REQUEST_GOODS_DYNAMIC, scmd.goods_id) --再次请求该装备的动态属性 if scmd.old_goods_id ~= 0 then GoodsModel:getInstance():Fire(GoodsModel.REQUEST_GOODS_DYNAMIC, scmd.old_goods_id) --请求卸下的装备的动态属性 end local bag_cur_choose_suit = GoodsModel:getInstance():GetBagEquipChooseIndex() if bag_cur_choose_suit ~= scmd.series and scmd.series ~= 99 then GoodsModel:getInstance():SetBagEquipChooseIndex(scmd.series) GoodsModel:getInstance():Fire(GoodsModel.UPDATE_BAG_EQUIP_SUIT_CHOOSE) end else --需要提示玩家,能不能激活在穿装备 -- if scmd.res == 1520052 then -- local goods_vo = GoodsModel.getInstance():GetBagGoodsInfoById(scmd.goods_id) -- local can_active_series = self.model:GetCanActiveMaxSeries() -- if goods_vo and can_active_series >= scmd.series then -- local ok = function ( ) -- self.model:Fire(EquipModel.REQUEST_CCMD_EVENT,15207) -- self.model:WearEquip(goods_vo) -- end -- local s1 = HtmlColorTxt(string.format("%s代装备槽" , WordManager:getHanZiNumber(scmd.series)), ColorUtil.BLUE_DARK) -- local s2 = HtmlColorTxt("解锁" , ColorUtil.GREEN_DARK) -- local s3 = HtmlColorTxt("穿戴" , ColorUtil.GREEN_DARK) -- local str = string.format("您已经满足解锁%s条件,是否%s并%s?", s1,s2,s3) -- Alert.show(str, Alert.Type.Two, ok, invest_call_back, "确认", "取消") -- else -- ErrorCodeShow(scmd.res) -- end -- else ErrorCodeShow(scmd.res) --end end -- print("huangcong:EquipController [start:122] vo:", vo) -- PrintTable(scmd) -- print("huangcong:EquipController [end]") end -- ############## 卸 ############## -- protocol=15202 -- { -- c2s{ -- goods_id :int64 // 物品id -- } -- s2c{ -- // 成功会推15018 -- res :int32 // 错误码 -- } -- } function EquipController:on15202() local scmd = SCMD15202.New(true) if scmd.res == 1 then Message.show("装备卸下成功","success") GoodsModel:getInstance():Fire(GoodsModel.REQUEST_GOODS_DYNAMIC, scmd.goods_id) --再次请求该装备的动态属性 -- GoodsModel:getInstance():Fire(GoodsModel.FIGURE_ASK_EQUIPGOODS) -- GoodsModel:getInstance():Fire(GoodsModel.BROADCAST_EQUIP_USE,{goods_type_id = scmd.type_id,num = 1}) else ErrorCodeShow(scmd.res) end -- print("huangcong:EquipController [start:197] vo:", vo) -- PrintTable(scmd) -- print("huangcong:EquipController [end]") end -- ############## 精炼装备 ############## -- protocol=15203 -- { -- c2s{ -- goods_id :int64 // 物品id -- location :int8 // 物品所在位置,1身上|4背包 -- auto_buy :int8 // 是否自动购买 -- } -- s2c{ -- // 成功会推15017 -- res :int32 // 错误码 1成功|2失败|其他 -- lv :int16 // 新的精炼等级 -- } -- } function EquipController:on15203() local scmd = SCMD15203.New(true) -- print("huangcong:EquipController [start:135] vo:", vo) -- PrintTable(vo) -- print("huangcong:EquipController [end]") if scmd.res == 1 then Message.show("精炼成功","success") self.model.equip_force_strength = false--升级成功取消继续升级 elseif scmd.res == 2 then Message.show("精炼失败","fault") else self.model.equip_force_strength = false--其他原因取消继续升级 ErrorCodeShow(scmd.res) end -- self.model:IsNeedRed(EquipModel.MainTab.Strengthen)--goodModel15017会刷的 end -- ############## 装备升星 ############## -- protocol=15204 -- { -- c2s{ -- goods_id :int64 // 物品id -- location :int8 // 物品所在位置,1身上|2背包 背包位置,见后台配置 -- extra_cost:array{ -- cost_goods_id :int64 // 添加的物品id -- } -- market_buy:array{ -- id :int64 // 市场id -- } -- auto:int8 //1自动购买/0 -- } -- s2c{ -- // 成功会推15017 -- res :int32 // 错误码 1成功|2失败|其他 -- attr_id :int16 // 生成的属性id -- goods_id :int64 // 物品id -- } -- } function EquipController:on15204() local scmd = SCMD15204.New(true) -- print("huangcong:EquipController [start:277] vo:", vo) -- PrintTable(vo) -- print("huangcong:EquipController [end]") if scmd.res == 1 then--成功 self.model:Fire(EquipModel.EVOLUTION_SUCCUSCE,scmd) self.model:GetEquipCanStrength() elseif scmd.res == 2 then--失败 self.model:Fire(EquipModel.EVOLUTION_SUCCUSCE,scmd) else ErrorCodeShow(scmd.res) self.model:Fire(EquipModel.EVOLUTION_SUCCUSCE,scmd) --自动购买下钱不够就去充钱 if scmd.res == 10001 then local ok = function ( ) self.model.equip_force_strength = false end local qc_data = { close_callback = ok, } GlobalEventSystem:Fire(EventName.OPEN_RECHARGE_TIP_VIEW, true, qc_data) return end end -- self.model:IsNeedRed(EquipModel.MainTab.Evolution)--goodModel15017会刷的 end -- ############## 装备继承 ############## -- protocol=15205 -- { -- c2s{ -- from_goods_id :int64 // 被继承物品id -- from_location :int8 // 物品所在位置,1身上|2背包 背包位置,见后台配置 -- to_goods_id :int64 // 继承装备id -- to_location :int8 // 物品所在位置,1身上|2背包 背包位置,见后台配置 -- } -- s2c{ -- // 成功会推15017 -- res :int32 // 错误码 -- } -- } function EquipController:on15205() local scmd = SCMD15205.New(true) if scmd.res == 1 then Message.show("继承成功","fault") else ErrorCodeShow(scmd.res) end -- print("huangcong:EquipController [start:150] vo:", scmd) -- PrintTable(scmd) -- print("huangcong:EquipController [end]") end -- ############## 激活星级套装 ############## -- protocol=15206 -- { -- c2s{ -- } -- s2c{ -- res :int32 // 错误码 -- stars :int16 // 当前激活的星级数 -- } -- } function EquipController:on15206() local vo = SCMD15206.New(true) print("huangcong:EquipController [start:408] vo:", vo) PrintTable(vo) print("huangcong:EquipController [end]") if vo.res == 1 then self.model:SetEquipActiveStarNum(vo.stars) self.model:Fire(EquipModel.INFO_UPDATE) StrengthModel:getInstance():Fire(EventName.UPDATE_STRENGTH_MAIN_VIEW_SPECIAL) Message.show("共鸣属性激活成功") else ErrorCodeShow(vo.res) end end -- ############## 激活装备代数 ############## -- protocol=15207 -- { -- c2s{ -- } -- s2c{ -- res :int32 // 错误码 -- series :int16 // 激活装备代数 -- } -- } function EquipController:on15207() local vo = SCMD15207.New(true) if vo.res == 1 then --self.model.cur_max_series = vo.series self.model:Fire(EquipModel.UPDATE_EQUIP_MAX_SERIES, vo.series) BagModel.getInstance():UpdateBagEquipSuitActiveRedDot() else ErrorCodeShow(vo.res) end end -- ############## 升品-升品信息 ############## -- protocol=15208 -- { -- c2s{ -- } -- s2c{ -- series_list:array{ -- series:int8 // 套数 -- pos:int8 // 装备位置 -- lv:int8 // 升品等级 -- } -- } -- } function EquipController:on15208() local vo = SCMD15208.New(true) -- print("huangcong:EquipController [start:827] vo:", vo) -- PrintTable(vo) -- print("huangcong:EquipController [end]") self.model:SetRedEquipInfo(vo.series_list) self.model:IsNeedRed(EquipModel.MainTab.RedEquip) end -- ############## 印刻上阵 ############## -- protocol=15209 -- { -- c2s{ -- goods_type_id:int32 // 印刻物品类型id -- } -- s2c{ -- res :int32 // 错误码 -- // 成功推15200 -- } -- } function EquipController:on15209() local vo = SCMD15209.New(true) -- print("huangcong:EquipController [start:584] vo:", vo) -- PrintTable(vo) -- print("huangcong:EquipController [end]") if vo.res == 1 then Message.show("激活成功","success") else ErrorCodeShow(vo.res) end end -- ############## 升品升级 升品 ############## -- protocol=15210 -- { -- c2s{ -- series :int8 // 第几套装备 -- pos :int8 // 装备位置 -- } -- s2c{ -- res :int32 // 错误码 -- lv :int8 // 新的等级 -- // 成功会推15028 } -- } function EquipController:on15210() local vo = SCMD15210.New(true) -- print("huangcong:EquipController [start:366] vo:", vo) -- PrintTable(vo) -- print("huangcong:EquipController [end]") if vo.res == 1 then Message.show("升品成功","success") self.model:Fire(EquipModel.REQUEST_CCMD_EVENT,15200) else ErrorCodeShow(vo.res) end end -- ############## 装备系统战力变更:变更推送 ############## -- protocol=15211 -- { -- s2c{ -- power:int32 // 装备系统总战力 -- } -- } function EquipController:on15211() local vo = SCMD15211.New(true) -- print("huangcong:EquipController [start:420] vo:", vo) -- PrintTable(vo) -- print("huangcong:EquipController [end]") end -- ############## 升星升星 预览 ############## -- protocol=15212 -- { -- c2s{ -- goods_id :int32 // 装备物品类型id -- lv:int8 // 升星等级:目标等级 -- now_ratio:int16 // 当前概率 -- } -- s2c{ -- res :int32 // 错误码 -- lists:array{ // 装备增加的概率之和 >= need_ratio -- id:int64 // 商品id -- goods_id :int32 // 物品id -- price:int32 // 价格 -- 商品一口价 -- } -- } -- } function EquipController:on15212() local scmd = SCMD15212.New(true) -- print("huangcong:EquipController [start:470] scmd:", scmd) -- PrintTable(scmd) -- print("huangcong:EquipController [end]") if scmd.res == 1 then local extra_cost = self.model.evolution_extra_cost or {} local market_buy = {} local goods_vo = self.model.evolution_goods_vo local market_price = 0 for i,v in ipairs(scmd.lists) do if v.id ~= 0 then market_buy[#market_buy + 1] = {v.id,v.goods_id,v.price} market_price = market_price + v.price end end if #market_buy>1 then local sort_func = function ( a, b ) return a[3] < b[3] end table.sort(market_buy, sort_func) end self.model:SetEvolutionMarketBuy(market_buy) -- --成功 -- function ok_function( ... ) -- self.model:Fire(EquipModel.REQUEST_CCMD_EVENT,15204,goods_vo.goods_id,goods_vo.pos,extra_cost,market_buy,1) -- end -- local cost_price = market_price + self.model.evolution_cost_price local cost_price = market_price self.model:Fire(EquipModel.EVOLUTION_UPDATE_EQUIP_MARKET_COST,cost_price) -- --需要显示购买提示界面 -- local data = { -- titleText = "是否花费", -- price = cost_price, -- priceText = HtmlColorTxt(cost_price, "#ff6519").." 补全材料升星装备?", -- ok_callback = ok_function, -- awardList = scmd.lists, -- } -- GlobalEventSystem:Fire(EquipModel.OPEN_EQUIP_EVOLUTION_AWARD_TIP_VIEW, data) else print("huangcong:EquipController [start:980] :", scmd.res) if scmd.res == 1520045 and self.EquipEvolutionChooseView and self.EquipEvolutionChooseView:HasOpen() and not self.EquipEvolutionChooseView._use_delete_method then--市场商品不足 else ErrorCodeShow(scmd.res) end self.model:Fire(EquipModel.EVOLUTION_UPDATE_EQUIP_MARKET_COST,nil,true) end end -- ############## 宝石镶嵌信息 ############## -- protocol=15213 -- { -- c2s{ -- } -- s2c{ -- series_list:array{ -- series:int8 // 套数 -- pos:int8 // 装备位置 -- gems:array{ -- goods_id:int32 -- } -- } -- } -- } function EquipController:on15213() local scmd = SCMD15213.New(true) -- print("15213", scmd) -- PrintTable(scmd) self.model:SetGemstoneInfo(scmd.series_list) self.model:IsNeedRed(EquipModel.MainTab.Gemstone) end -- ############## 宝石镶嵌信息:单条更新 ############## -- protocol=15214 -- { -- c2s{ -- series:int8 // 套数 -- pos:int8 // 装备位置 -- } -- s2c{ -- series:int8 // 套数 -- pos:int8 // 装备位置 -- gems:array{ -- goods_id:int32 -- } -- } -- } function EquipController:on15214() local scmd = SCMD15214.New(true) print("15214", scmd) PrintTable(scmd) self.model:SetGemstoneOneInfo(scmd) self.model:IsNeedRed(EquipModel.MainTab.Gemstone) end -- ############## 宝石镶嵌 ############## -- protocol=15215 -- { -- c2s{ -- series :int8 // 第几套装备 -- pos :int8 // 装备位置 -- goods_type_id:int32 // 宝石id -- } -- s2c{ -- res :int32 // 错误码 -- // 成功推 15214 -- } -- } function EquipController:on15215() local scmd = SCMD15215.New(true) print("15215", scmd) PrintTable(scmd) if scmd.res == 1 then Message.show("镶嵌成功","success") self.model.gems_can_tip = true self.model:Fire(EquipModel.PLAY_GEMSTONE_EFFECT) -- self.model:IsNeedRed(EquipModel.MainTab.Gemstone) else ErrorCodeShow(scmd.res) end end -- ############## 宝石卸下 ############## -- protocol=15216 -- { -- c2s{ -- series :int8 // 第几套装备 -- pos :int8 // 装备位置 -- goods_type_id:int32 // 宝石id -- } -- s2c{ -- res :int32 // 错误码 -- // 成功推 15214 -- } -- } function EquipController:on15216() local scmd = SCMD15216.New(true) print("15216", scmd) PrintTable(scmd) if scmd.res == 1 then Message.show("卸下成功","success") -- self.model:IsNeedRed(EquipModel.MainTab.Gemstone) else ErrorCodeShow(scmd.res) end end -- ############## 宝石合成升级:镶嵌在身上的合成,其他合成走通用合成协议 ############## -- protocol=15217 -- { -- c2s{ -- series :int8 // 第几套装备 -- pos :int8 // 装备位置 -- goods_type_id:int32 // 宝石id -- } -- s2c{ -- res :int32 // 错误码 -- // 成功推 15214 -- } -- } function EquipController:on15217() local scmd = SCMD15217.New(true) print("15217", scmd) PrintTable(scmd) if scmd.res == 1 then Message.show("合成成功","success") self.model.gems_can_tip = true self.model:Fire(EquipModel.PLAY_GEMSTONE_EFFECT) -- self.model:IsNeedRed(EquipModel.MainTab.Gemstone) else ErrorCodeShow(scmd.res) end end function EquipController:on15221() local scmd = SCMD15221.New(true) if scmd.status == 0 then Message.show("取消跟随") RoleManager.Instance.mainRoleInfo.evil_type_id = 0 else --跟随成功 Message.show("跟随成功") local goods_vo = GoodsModel.getInstance():GetWearedEquipVo(scmd.id) RoleManager.Instance.mainRoleInfo.evil_type_id = goods_vo.type_id local role = Scene.Instance:GetMainRole() if role then role:CreateEvil() end end end -- ############## 宝石-一键镶嵌 ############## -- protocol=15222 -- { -- c2s{ -- series:int8 // 代数 -- } -- s2c{ -- res :int32 //1成功 错误码 -- pos_list:array{ // 变化的位置 -- pos:int8 -- } -- } -- } function EquipController:on15222() local scmd = SCMD15222.New(true) if scmd.res == 1 then self.model.gems_can_tip = true print("huangcong:EquipController [start:1108] 1111:", 1111) -- self.model:Fire(EquipModel.OPEN_GEMSTONE_AUTO_VIEW) local new_pos_list = {} if scmd.pos_list then for i,v in ipairs(scmd.pos_list) do new_pos_list[v.pos] = true end end self.model:Fire(EquipModel.PLAY_GEMSTONE_AUTO_EFFECT,new_pos_list) else ErrorCodeShow(scmd.res) end end -- ############## 宝石套装:宝石套装信息 ############## -- protocol=15223 -- { -- c2s{ -- } -- s2c{ -- gems_lv_list:array{// 当前激活的宝石等级列表 -- series:int8 // 代数 -- gems_lv:int16 // 当前代激活的宝石等级 -- } -- } -- } function EquipController:on15223() local vo = SCMD15223.New(true) -- print("huangcong:EquipController [start:1113] vo:", vo) -- PrintTable(vo) -- print("huangcong:EquipController [end]") self.model:SetEquipGemActiveList(vo) end -- ############## 宝石套装:激活 ############## -- protocol=15224 -- { -- c2s{ -- series:int8 // 代数 -- } -- s2c{ -- res :int32 // 错误码 -- gems_lv:int16 // 当前代激活的宝石等级 -- // 成功刷新15223 -- } -- } function EquipController:on15224() local vo = SCMD15224.New(true) -- print("huangcong:EquipController [start:1133] vo:", vo) -- PrintTable(vo) -- print("huangcong:EquipController [end]") if vo.res == 1 then self.model:Fire(EquipModel.UPDATE_STAR_SUIT_EFFECT,vo.gems_lv) Message.show("激活成功","success") else ErrorCodeShow(vo.res) end end -- ############## 特殊装备成长属性信息 ############## -- protocol=15225 -- { -- c2s{ -- series :int8 -- pos :int8 -- } -- s2c{ -- series :int8 -- pos :int8 -- lv :int16 -- exp :int32 -- } -- } function EquipController:on15225() local vo = SCMD15225.New(true) print("huangcong:特殊装备成长属性信息", vo) PrintTable(vo) self.model:Fire(EquipModel.UPDATE_EQUIP_TOOL_TIPS_EXP_LV,vo) end -- ############## 装备战力 ############## -- protocol=15226 -- { -- c2s{ -- } -- s2c{ -- power :int64 -- } -- } function EquipController:on15226() local vo = SCMD15226.New(true) self.model.equip_sum_power = vo.power self.model:Fire(EquipModel.UPDATE_EQUIP_POWER) end