|
--贵族特权查看界面
|
|
SupremeVipFindRightView = SupremeVipFindRightView or BaseClass(BaseView)
|
|
local SupremeVipFindRightView = SupremeVipFindRightView
|
|
|
|
function SupremeVipFindRightView:__init()
|
|
self.base_file = "supremeVip"
|
|
self.layout_file = "SupremeVipFindRightView"
|
|
self.layer_name = "Activity"
|
|
self.destroy_imm = true
|
|
self.use_background = true
|
|
self.change_scene_close = true
|
|
self.hide_maincancas = false --是否隐藏主界面
|
|
self.append_to_ctl_queue = false --是否要添加进界面堆栈
|
|
self.need_show_money = false --是否要显示顶部的金钱栏
|
|
|
|
self.is_set_zdepth = true
|
|
|
|
self.choose_index = 1
|
|
|
|
self.model = SupremeVipModel:getInstance()
|
|
self.mainVo = RoleManager.Instance.mainRoleInfo
|
|
|
|
self.load_callback = function ()
|
|
self:LoadSuccess()
|
|
self:AddEvent()
|
|
end
|
|
self.open_callback = function ( )
|
|
self:UpdateView()
|
|
end
|
|
self.destroy_callback = function ( )
|
|
self:DestroySuccess()
|
|
end
|
|
end
|
|
|
|
function SupremeVipFindRightView:Open( )
|
|
--self.data = data
|
|
BaseView.Open(self)
|
|
end
|
|
|
|
function SupremeVipFindRightView:LoadSuccess()
|
|
local nodes = {
|
|
"sloganImg:img", "bg:raw",
|
|
"closeBtn:obj",
|
|
"rightTitle:tmp", "rightdes:tmp",
|
|
"rightBigIcon:img:obj",
|
|
"ScrollView", "ScrollView/Viewport/Content",
|
|
"tabCon/smallTab3:img", "tabCon/smallTab7:img", "tabCon/smallTab6:img", "tabCon/smallTab4:img", "tabCon/smallTab1:img", "tabCon/smallTab2:img", "tabCon/smallTab5:img",
|
|
"extraEffect",
|
|
"iconEffect",
|
|
}
|
|
self:GetChildren(nodes)
|
|
|
|
-- local function bg_back_func( ... )
|
|
-- if self.background_wnd and self.background_wnd:GetComponent("RawImageExtend") then
|
|
-- self:MoveUIToBack(self.background_wnd:GetComponent("RawImageExtend"))
|
|
-- end
|
|
-- self:MoveUIToBack(self.bg_raw)
|
|
-- end
|
|
-- if self.background_wnd then
|
|
-- bg_back_func()
|
|
-- else
|
|
-- self.bg_back_func = bg_back_func
|
|
-- end
|
|
|
|
-- self.icon_canvas = self.rightBigIcon:GetComponent(typeof(UnityEngine.Canvas))
|
|
-- self.icon_canvas.sortingOrder = self:GetCurrLayerDepth("Activity") + 40
|
|
|
|
-- -- self:AddUIEffect("ui_guizutequan", self.rightBigIcon, "Activity", Vector3(-4,-30.5,0), 1, false,nil,nil,nil,nil,nil,UIPartical.RenderingOther_List.UIBackward)
|
|
-- self:AddUIEffect("ui_guizutequan", self.iconEffect, "Activity", Vector3(-4,-30.5,0), 1, true)
|
|
|
|
lua_resM:setOutsideRawImage(self, self.bg_raw, GameResPath.GetViewBigBg("supremeVip_activate_view"))
|
|
lua_resM:setOutsideImageSprite(self, self.sloganImg_img, GameResPath.GetSupremeVipIcon("supremeVip_des_2_pointfilter"), true)
|
|
|
|
self.sup_vip_type = RoleManager.Instance.mainRoleInfo.sup_vip_type
|
|
|
|
SetAnchoredPositionY(self.rightBigIcon,30)
|
|
SetAnchoredPositionY(self.iconEffect,30)
|
|
if self.tween_id then
|
|
TweenLite.Stop(self.tween_id)
|
|
self.tween_id = nil
|
|
end
|
|
-- self.tween_id =TweenLite.to(self, self.rightBigIcon,TweenLite.UiAnimationType.ANCHORED_POSY,37, 1.8, nil,TweenFunc.PINGPONG,true)
|
|
end
|
|
|
|
function SupremeVipFindRightView:AddEvent()
|
|
local on_click = function ( click_obj )
|
|
if self.closeBtn_obj == click_obj then
|
|
self:Close()
|
|
end
|
|
end
|
|
AddClickEvent(self.closeBtn_obj, on_click,1)
|
|
end
|
|
|
|
function SupremeVipFindRightView:ChangeShowSupremeRight(index)
|
|
self.choose_index = index
|
|
self.rightTitle_tmp.text = string.format("特权%s:%s",index,SupremeVipConst.SupremeVipRight[index].name)
|
|
self.rightdes_tmp.text = SupremeVipConst.SupremeVipRight[index].des
|
|
|
|
-- if index == 1 then
|
|
-- lua_resM:setOutsideImageSprite(self, self.rightBigIcon_img, GameResPath.GetSkillIcon("109101"), true)
|
|
-- else
|
|
-- lua_resM:setOutsideImageSprite(self, self.rightBigIcon_img, GameResPath.GetSupremeVipIcon("supremeVip_right_big_icon_"..index), true)
|
|
-- end
|
|
|
|
if self.choose_index == 3 then
|
|
self:AddUIEffect("ui_guizutequan_godstone", self.extraEffect, "Activity", Vector3(-4,-30.5,0), 1, false,-1,nil,nil,nil,nil)
|
|
lua_resM:setImageSprite(self, self.rightBigIcon_img, "uiComponent_asset","com_empty")
|
|
elseif self.choose_index == 4 then
|
|
self:AddUIEffect("ui_guizutequan_nojump", self.extraEffect, "Activity", Vector3(-4,-30.5,0), 1, false,-1,nil,nil,nil,nil)
|
|
lua_resM:setImageSprite(self, self.rightBigIcon_img, "uiComponent_asset","com_empty")
|
|
else
|
|
self:ClearUIEffect(self.extraEffect)
|
|
lua_resM:setOutsideImageSprite(self, self.rightBigIcon_img, GameResPath.GetSupremeVipIcon("supremeVip_right_big_icon_"..index), true)
|
|
end
|
|
end
|
|
|
|
function SupremeVipFindRightView:UpdateView()
|
|
local click_callback = function(index)
|
|
self:ChangeShowSupremeRight(index)
|
|
self:UpdateRightItemPos(index)
|
|
self:AutoChangeIndex()
|
|
self:UpdateSmallTab()
|
|
end
|
|
if not self.item_list_com then
|
|
self.item_list_com = self:AddUIComponent(UI.ItemListCreator)
|
|
end
|
|
local info = {
|
|
data_list = {{},{},{},{},{},{},{}},
|
|
item_con = self.Content,
|
|
item_class = SupremeVipRightItem,
|
|
item_width = 162,
|
|
item_height = 46,
|
|
-- space_x = 0,
|
|
space_y = 8,
|
|
start_x = 116,
|
|
start_y = -33-8,
|
|
scroll_view = self.ScrollView,
|
|
-- create_frequency = 0.01,
|
|
reuse_item_num = 7,
|
|
on_update_item = function(item, i, v)
|
|
item:SetData(i,click_callback)
|
|
self.item_list_com:IterateItems(function( item, i )
|
|
item:OnClick(1)
|
|
end)
|
|
end,
|
|
final_callback = function()
|
|
self.item_list_com:IterateItems(function( item, i )
|
|
item:OnClick(1)
|
|
end)
|
|
end,
|
|
}
|
|
self.item_list_com:UpdateItems(info)
|
|
|
|
|
|
|
|
self.icon_canvas = self.rightBigIcon:GetComponent(typeof(UnityEngine.Canvas))
|
|
self.icon_canvas.sortingOrder = self:GetCurrLayerDepth("Activity") + 40
|
|
|
|
-- self:AddUIEffect("ui_guizutequan", self.rightBigIcon, "Activity", Vector3(-4,-30.5,0), 1, false,nil,nil,nil,nil,nil,UIPartical.RenderingOther_List.UIBackward)
|
|
self:AddUIEffect("ui_guizutequan", self.iconEffect, "Activity", Vector3(-4,-30.5,0), 1, true)
|
|
|
|
end
|
|
|
|
function SupremeVipFindRightView:UpdateRightItemPos(index)
|
|
if self.item_list_com then
|
|
self.item_list_com:IterateItems(function( item, i )
|
|
local pos_y = -33
|
|
if i < index then
|
|
pos_y = pos_y - (i-1)*(46+8)
|
|
elseif i == index then
|
|
pos_y = pos_y - (i-1)*(46+8) -8
|
|
elseif i > index then
|
|
pos_y = pos_y - (i-2)*(46+8) -8-8 -53
|
|
end
|
|
item:SetAnchoredPosition(116,pos_y)
|
|
end)
|
|
end
|
|
|
|
SetSizeDeltaY(self.Content,(46+5)*7+33-8+30)
|
|
-- SetAnchoredPositionY(self.Content,33+(index-1)*(46+22)+10)
|
|
end
|
|
|
|
function SupremeVipFindRightView:AutoChangeIndex()
|
|
if self.delay_handler then
|
|
TimerQuest.CancelQuest(GlobalTimerQuest, self.delay_handler)
|
|
self.delay_handler = nil
|
|
end
|
|
local function delay_method( )
|
|
local next_index = self.choose_index < 7 and self.choose_index+1 or 1
|
|
self.item_list_com:IterateItems(function( item, i )
|
|
item:OnClick(next_index)
|
|
end)
|
|
local pos_y = 0
|
|
if next_index == 6 then
|
|
pos_y = 32
|
|
elseif next_index == 7 then
|
|
pos_y = 32
|
|
end
|
|
|
|
SetAnchoredPositionY(self.Content,pos_y)
|
|
end
|
|
self.delay_handler = setTimeout(delay_method, 6)
|
|
end
|
|
|
|
function SupremeVipFindRightView:UpdateSmallTab( )
|
|
for i=1,7 do
|
|
if i == self.choose_index then
|
|
lua_resM:setImageSprite(self, self["smallTab"..i.."_img"], "supremeVip_asset","supremeVip_small_tab_2")
|
|
else
|
|
lua_resM:setImageSprite(self, self["smallTab"..i.."_img"], "supremeVip_asset","supremeVip_small_tab_1")
|
|
end
|
|
end
|
|
end
|
|
|
|
function SupremeVipFindRightView:DestroySuccess( )
|
|
if self.tween_id then
|
|
TweenLite.Stop(self.tween_id)
|
|
self.tween_id = nil
|
|
end
|
|
|
|
if self.delay_handler then
|
|
TimerQuest.CancelQuest(GlobalTimerQuest, self.delay_handler)
|
|
self.delay_handler = nil
|
|
end
|
|
|
|
self:ClearUIEffect(self.iconEffect)
|
|
self:ClearUIEffect(self.extraEffect)
|
|
end
|