|
|
- -- <*
- -- @Author: Saber
- -- @Description: 经验副本路线节点内波数节点
- -- *>
- ExpDunRouteWaveItem = ExpDunRouteWaveItem or BaseClass(BaseItem)
- local ExpDunRouteWaveItem = ExpDunRouteWaveItem
-
- function ExpDunRouteWaveItem:__init(parent_wnd,prefab_asset,layer_name)
- self.base_file = "expDun"
- self.layout_file = "ExpDunRouteWaveItem"
- self.parent_wnd = parent_wnd
- self.layer_name = layer_name
- self.show_light = false
- self.is_selected = false
- self.next_wave_exp_str = ""
- self.index = 1
- self.max_num = 1
- self.model = ExpDunModel:getInstance()
- self:Load()
- end
-
- function ExpDunRouteWaveItem:Load_callback()
- local nodes = {
- "selected:img", "selected/route_exp_bg:img", "selected/route_exp:tmp",
- "bg:img",
- "light:img",
- }
- self:GetChildren(nodes)
-
- self.ori_arrow_posy = 27
- self.up_arrow_posy = self.ori_arrow_posy + 5
- self.down_arrow_posy = self.ori_arrow_posy - 5
- SetAnchoredPositionY(self.selected, self.up_arrow_posy)
-
- self:ShowLight(self.show_light)
- self:SetSelected(self.is_selected, self.next_wave_exp_str)
- end
-
- function ExpDunRouteWaveItem:ShowLight(bool)
- self.show_light = bool
- if self.is_loaded then
- self.bg_img.enabled = not bool
- self.light_img.enabled = bool
- end
- end
-
- function ExpDunRouteWaveItem:SetSelected(bool, next_wave_exp_str)
- self.is_selected = bool
- self.next_wave_exp_str = next_wave_exp_str
- if self.is_loaded then
- self.selected_img.enabled = self.is_selected
- self.route_exp_bg_img.enabled = self.is_selected
- self.route_exp_tmp.text = self.is_selected and self.next_wave_exp_str or ""
- self:StartNextWaveArrowAnim(self.is_selected)
- end
- end
-
- function ExpDunRouteWaveItem:StartNextWaveArrowAnim(show)
- self:StopArrowAnim()
- if show then
- local move_up_func = function ()
- local function repeat_func()
- self:StartNextWaveArrowAnim(true)
- end
- self.arrow_move_up_id = TweenLite.to(self, self.selected, TweenLite.UiAnimationType.POSY, self.up_arrow_posy, 1.2, repeat_func)
- end
- self.arrow_con_move_down_id = TweenLite.to(self, self.selected, TweenLite.UiAnimationType.POSY, self.down_arrow_posy, 1.2, move_up_func)
- end
- end
-
- function ExpDunRouteWaveItem:StopArrowAnim()
- if self.arrow_con_move_down_id then
- TweenLite.Stop(self.arrow_con_move_down_id)
- self.arrow_con_move_down_id = nil
- end
- if self.arrow_move_up_id then
- TweenLite.Stop(self.arrow_move_up_id)
- self.arrow_move_up_id = nil
- end
- end
-
- function ExpDunRouteWaveItem:__delete( )
- self:StopArrowAnim()
- end
|