1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- ---@class KLHookPointMonsterItem:UIKmlLuaPanelBase
- ---@field view KLHookPointMonsterItemView
- local KLHookPointMonsterItem = class(UIKmlLuaPanelBase)
- local this =KLHookPointMonsterItem
- ---创建时调用一次
- function this:Init()
- SL:KeepOpenPanel("KLHookPointMonsterItemKml",true)
- end
- ---注册UI事件和服务器消息
- function this:RegistEvents()
- GUI:AddOnClickEvent(self.view.btnGo, self, self.OnBtnGoClicked)
-
- SL:RegisterLUAEvent(LUA_EVENT_UI_HOOK_POINTS_PANEL_HIDE, self.LUA_EVENT_UI_HOOK_POINTS_PANEL_HIDE, self)
- end
- function this:OnBtnGoClicked()
- GUI:UIPanel_Open("dev/outui/Hook/Panel/KLMapHookPoints/KLMapHookPointsPanel", _, _, {
- points = self.posData,
- kmlcontrol = self.view.btnGo,
- mapId = self.mapId
- })
- GUI:setVisible(self.view.imgArrow, true)
- end
- function this:LUA_EVENT_UI_HOOK_POINTS_PANEL_HIDE()
- GUI:setVisible(self.view.imgArrow, false)
- end
- ---创建或者刷新界面数据时调用
- function this:Refresh()
- local id = self.args.id
- local playerLv = self.args.level
- self.posData = self.args.posData
- self.mapId = self.args.mapId
- ---@type cfg_monster_column
- local cfg = SL:GetConfig("cfg_monster", id)
- GUI:Text_setString(self.view.txtName, cfg.name)
- local definse = SL:GetMetaValue("GET_ATTR_VALUE_BY_ID", EMUCharacterAttrType.armor)
- GUI:Text_setString(self.view.txtLevel, string.format( "<color=%s>LV.%s</color>",definse >= cfg.sword and "#C2C7CC" or "#CB1D1D", cfg.level))
- GUI:Text_setString(self.view.txtExp, string.format("经验%s/只", cfg.exp))
- GUI:Image_loadTexture(self.view.imgHead, cfg.icon,"Atlas/Monster_icon.spriteatlas")
- end
- function this:Close()
- SL:KeepOpenPanel("KLHookPointMonsterItemKml",false)
- end
- return this
|