ReChargePreView = ReChargePreView or BaseClass(BaseView)
|
|
local ReChargePreView = ReChargePreView
|
|
--首充预告
|
|
function ReChargePreView:__init(parent)
|
|
self.base_file = "guide"
|
|
self.layout_file = "ReChargePreView"
|
|
self.layer_name = "UI"
|
|
self.mainVo = RoleManager.Instance.mainRoleInfo
|
|
self.destroy_imm = true
|
|
self.hide_maincancas = false
|
|
self.diff_time = 15
|
|
self.close_mode = CloseMode.CloseVisible
|
|
self.change_scene_close = true
|
|
|
|
self.is_set_order_sorting = false
|
|
-- self.use_local_view = true
|
|
|
|
--回调方法
|
|
self.load_callback = function()
|
|
self:LoadSuccess()
|
|
self:InitEvent()
|
|
end
|
|
|
|
self.open_callback = function()
|
|
if self.is_pre_load then
|
|
return
|
|
end
|
|
self:UpdateView()
|
|
self.diff_time = 15
|
|
self:StopTimer()
|
|
self:StartTimer()
|
|
|
|
-- self:AddUIEffect("ui_meirishouchong", self.goEffect, self.layer_name, nil, {x=1,y=1}, true,false,nil,nil)
|
|
end
|
|
|
|
self.close_callback = function()
|
|
end
|
|
|
|
self.destroy_callback = function()
|
|
self:Clear()
|
|
end
|
|
end
|
|
|
|
function ReChargePreView:Open(bool)
|
|
self.is_pre_load = bool
|
|
BaseView.Open(self)
|
|
end
|
|
|
|
function ReChargePreView:LoadSuccess()
|
|
|
|
self.closeBtn,
|
|
self.combatLabel,
|
|
self.useBtn = self:GetChildGameObjects({
|
|
"CloseBtn",
|
|
"combatLabel",
|
|
"UseBtn"
|
|
})
|
|
|
|
self.itemCon,
|
|
self.goEffect,
|
|
self.otherCon = self:GetChildTransforms({
|
|
"itemCon",
|
|
"effect",
|
|
"otherItemCon",
|
|
})
|
|
|
|
self.roleCombat,
|
|
self.otherCombat
|
|
= GetChildTexts(self.transform,
|
|
{
|
|
"combatLabel",
|
|
"otherCombat",
|
|
})
|
|
|
|
self.bg = self:GetChildImages({
|
|
"Border",
|
|
})
|
|
|
|
local pos = ActivityIconManager.Instance:GetIconPos(7)
|
|
if pos then
|
|
self.transform.anchoredPosition = Vector2(pos.x--[[-190--]]+75, pos.y--[[-215--]]+445)
|
|
end
|
|
|
|
local config = OutSidePictureMgr.PreLoad.ReChargePreView_BG
|
|
if config then
|
|
lua_resM:setOutsideImageSprite(self, self.bg,GameResPath.GetImage(config.modele,config.res))
|
|
end
|
|
end
|
|
|
|
function ReChargePreView:InitEvent()
|
|
local function onClickHandler(target)
|
|
if target == self.closeBtn then
|
|
self:Close()
|
|
elseif target == self.useBtn then
|
|
RechargeActivityModel:getInstance():Fire(RechargeActivityModel.OPEN_FIRST_RECHARGE_VIEW)
|
|
self:Close()
|
|
end
|
|
end
|
|
AddClickEvent(self.useBtn,onClickHandler)
|
|
AddClickEvent(self.closeBtn,onClickHandler)
|
|
end
|
|
|
|
function ReChargePreView:UpdateView( )
|
|
local pos = ActivityIconManager.Instance:GetIconPos(7)
|
|
if pos then
|
|
self.transform.anchoredPosition = Vector2(pos.x--[[-190--]]+75, pos.y--[[-215--]]+445)
|
|
end
|
|
self:SetRoleModel()
|
|
end
|
|
|
|
function ReChargePreView:Clear( )
|
|
self:ClearUIEffect(self.goEffect)
|
|
self:StopTimer()
|
|
end
|
|
|
|
function ReChargePreView:StartTimer()
|
|
|
|
local function onTimer()
|
|
if self.diff_time < 1 then
|
|
self:Close()
|
|
else
|
|
self.diff_time = self.diff_time - 1
|
|
end
|
|
end
|
|
self.timer_id = GlobalTimerQuest:AddPeriodQuest(onTimer,1,-1)
|
|
end
|
|
|
|
function ReChargePreView:StopTimer()
|
|
if self.timer_id then
|
|
GlobalTimerQuest:CancelQuest(self.timer_id)
|
|
self.timer_id = nil
|
|
end
|
|
end
|
|
|
|
function ReChargePreView:SetRoleModel()
|
|
-- local angel = 0
|
|
-- local pos = Vector3(35,-110)
|
|
-- local scale = 100
|
|
-- local action = nil
|
|
-- local res_id = 158001
|
|
-- local data = {
|
|
-- clothe_res_id = res_id,
|
|
-- SceneBaseType.Horse,
|
|
-- layer_name = self.layer_name,
|
|
-- rotate = angel,
|
|
-- can_rotate = true,
|
|
-- scale = scale,
|
|
-- position = pos,
|
|
-- layout_file = self.layout_file
|
|
-- }
|
|
local cfg = Config.Rechargefirst["40@"..self.mainVo.career.."@1"] --直接拿第一个 因为只是显示模型而已 所以其他的也是相同的
|
|
if cfg then
|
|
local model_id, texture_id = self.mainVo:GetRoleClotheTextureId()
|
|
local weapon_model_id, weapon_texture_id = self.mainVo:GetWeaponClotheId()
|
|
local head_model_id, head_clothe_id = self.mainVo:GetRoleHeadId()
|
|
local fashion_model_id, fashion_texture_id = self.mainVo:GetRoleClotheTextureId()
|
|
local leftRes = ErlangParser:GetInstance():Parse(cfg.left_res)
|
|
|
|
if TableSize(leftRes) > 0 then
|
|
local pos_id, fashion_id, config
|
|
for _, v in ipairs(leftRes) do
|
|
pos_id = tonumber(v[1])
|
|
fashion_id = tonumber(v[2])
|
|
config = Config.Fashionmodel[pos_id .. "@" .. fashion_id .. "@" .. self.mainVo.career]
|
|
if config then
|
|
if pos_id == FashionPartPos.Clothe then
|
|
fashion_model_id = config.model_id
|
|
fashion_texture_id = config.color_id
|
|
elseif pos_id == FashionPartPos.Weapon then
|
|
weapon_model_id = config.model_id
|
|
weapon_texture_id = config.color_id
|
|
elseif pos_id == FashionPartPos.Head then
|
|
head_model_id = config.model_id
|
|
head_clothe_id = config.color_id
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
local data = {
|
|
career = self.mainVo.career,
|
|
sex = self.mainVo.sex,
|
|
clothe_res_id = self.mainVo:GetRoleClotheId(),
|
|
weapon_res_id = weapon_model_id,
|
|
weapon_clothe_id = weapon_texture_id,
|
|
type = SceneBaseType.Role,
|
|
layer_name = self.layer_name,
|
|
scale = 150,
|
|
position = Vector3(0,0,0),
|
|
fashion_model_id = fashion_model_id,
|
|
texture_id = fashion_texture_id,
|
|
-- wing_id = data.wing_id,
|
|
-- image_id = data.image_id,
|
|
head_wear_id = head_model_id,
|
|
head_clothe_id = head_clothe_id,
|
|
layout_file = self.layout_file
|
|
}
|
|
-- lua_resM:SetRoleModel(self, self.itemCon, data)
|
|
|
|
local rightRes = ErlangParser:GetInstance():Parse(cfg.right_res)
|
|
if TableSize(rightRes) > 0 then
|
|
-- local show_type = tonumber(rightRes[1] [1]) -- 1模型,2图片
|
|
-- self.rightImgObj.gameObject:SetActive(show_type == 2)
|
|
-- self.otherCon.gameObject:SetActive(show_type == 1)
|
|
local godweapon_id = rightRes[1][2]
|
|
local callBack = function()
|
|
self.curr_Model = lua_resM:GetPartModel(self, self.otherCon)
|
|
if self.curr_Model then
|
|
local body_pvo = {} --Config.SceneObjectParticle.Body[tonumber(godweapon_id)]
|
|
if body_pvo and body_pvo.always then
|
|
for bone_name,particle_vo in pairs(body_pvo.always) do
|
|
local bone = FindBone(self.curr_Model.transform, bone_name)
|
|
if bone then
|
|
local renders = bone:GetComponentsInChildren(typeof(UnityEngine.Renderer))
|
|
if renders then
|
|
for i = 0, renders.Length - 1 do
|
|
local render = renders[i]
|
|
render.sortingOrder = 600 + 1
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
local data = {
|
|
clothe_res_id = tonumber(godweapon_id),
|
|
type = SceneBaseType.Monster,
|
|
layer_name = self.layer_name,
|
|
scale = 150,
|
|
position = Vector3(0,0,0),
|
|
layout_file = self.layout_file,
|
|
callBack = callBack,
|
|
}
|
|
lua_resM:SetRoleModel(self, self.otherCon, data)
|
|
end
|
|
end
|
|
-- self.roleCombat.text = "战力+8888"
|
|
-- self.otherCombat.text = "战力23000+"
|
|
end
|