|
|
GuideShowView = GuideShowView or BaseClass(BaseView)
|
|
local GuideShowView = GuideShowView
|
|
function GuideShowView:__init()
|
|
self.base_file = "guide"
|
|
self.layout_file = "GuideShowView"
|
|
self.layer_name = "Activity"
|
|
self.destroy_imm = true
|
|
self.change_scene_close = true
|
|
self.close_mode = CloseMode.CloseVisible
|
|
self.is_set_zdepth = true
|
|
self.sound_id = 0
|
|
self.mainVo = RoleManager.Instance.mainRoleInfo
|
|
self.is_set_order_sorting = true
|
|
-- self.use_local_view = true
|
|
|
|
self.load_callback = function ()
|
|
self:LoadSuccess()
|
|
self:InitEvent()
|
|
end
|
|
self.open_callback = function ()
|
|
if not self.params then
|
|
return
|
|
end
|
|
Scene.Instance:ChangeFogEnable(false)
|
|
|
|
self:LayoutUI()
|
|
self:PlaySound()
|
|
end
|
|
self.close_callback = function ()
|
|
if self.close_call then
|
|
self.close_call()
|
|
end
|
|
|
|
Scene.Instance:ChangeFogEnable(true)
|
|
self:ClearUIEffect(self.effect_con)
|
|
self:RemoveTimer()
|
|
self:StopAnim()
|
|
|
|
if self.show_figure_timer_id then
|
|
GlobalTimerQuest:CancelQuest(self.show_figure_timer_id)
|
|
self.show_figure_timer_id = nil
|
|
end
|
|
--坐骑后面有手指引导。所以不继续任务
|
|
if not self.stop_task and self.type ~= 3 then
|
|
GlobalEventSystem:Fire(EventName.START_AUTO_DO_TASK, true)
|
|
end
|
|
end
|
|
self.destroy_callback = function ()
|
|
self:Clear()
|
|
end
|
|
end
|
|
|
|
function GuideShowView:Open(params, saying, close_call,stop_task)
|
|
if params then
|
|
self.type = tonumber(params[1])
|
|
self.params = params
|
|
self.saying = saying
|
|
self.close_call = close_call
|
|
self.stop_task = stop_task
|
|
self.time_diff = 8
|
|
end
|
|
BaseView.Open(self)
|
|
end
|
|
|
|
function GuideShowView:Clear()
|
|
self:ClearUIEffect(self.effect_con)
|
|
self:RemoveTimer()
|
|
self:StopAnim()
|
|
end
|
|
|
|
function GuideShowView:Close()
|
|
-- self.downCon.localPosition = co.TableXYZ(0, -38, 0)
|
|
BaseView.Close(self)
|
|
end
|
|
|
|
function GuideShowView:LayoutUI()
|
|
|
|
self.roleCon.localRotation = Quaternion.Euler(0,0,0)
|
|
self.roleCon.localPosition = Vector3(-6,28,0)
|
|
|
|
self.expGet_tips1:SetActive(false)
|
|
self.expGet_tips2:SetActive(false)
|
|
|
|
local function load_end_func()
|
|
self:SetUIDepth(self.roleCon.gameObject)
|
|
end
|
|
self:AddUIEffect("ui_getobj_light", self.effect_con, self.layer_name, nil, 1, true, nil, nil, nil, load_end_func)
|
|
|
|
self:StopAnim()
|
|
|
|
if self.show_figure_timer_id then
|
|
GlobalTimerQuest:CancelQuest(self.show_figure_timer_id)
|
|
self.show_figure_timer_id = nil
|
|
end
|
|
local function timer_func()
|
|
if self.type == 1 then
|
|
self:DealWithSpecialWeapon()
|
|
elseif self.type == 2 then
|
|
self:DealWithPet()
|
|
elseif self.type == 3 then
|
|
self:DealWithHorse()
|
|
elseif self.type == 4 then
|
|
self:DealWithWing()
|
|
elseif self.type == 5 then
|
|
self:DealEMo()
|
|
elseif self.type == 6 then --星灵奖励
|
|
self:DealWithStarSoulReward()
|
|
end
|
|
end
|
|
self.show_figure_timer_id = GlobalTimerQuest:AddDelayQuest(timer_func, 0.08)
|
|
|
|
|
|
self:SetDesc(self.saying)
|
|
self:ShowTimer()
|
|
end
|
|
|
|
function GuideShowView:DealWithSpecialWeapon()
|
|
local career = RoleManager.Instance.mainRoleInfo.career
|
|
local cfg = {}
|
|
local name = ""
|
|
local pos_y = 0
|
|
local position, rotate = nil
|
|
local scale = 140
|
|
if career == 1 then
|
|
cfg.resource_id = 101000
|
|
name = "爆炎大剑"
|
|
pos_y = -100
|
|
position = co.TableXYZ(120, -80, 0)--[[Vector3.zero--]]
|
|
rotate = --[[nil--]]{x = 0, y = -180, z = -145}
|
|
scale = 110
|
|
elseif career == 2 then
|
|
cfg.resource_id = 102000
|
|
name = "龙牙长枪"
|
|
pos_y = 0
|
|
position = co.TableXYZ(50, 0, 0)--Vector3.zero
|
|
rotate = {x = 0, y = -180, z = -145}
|
|
scale = 100
|
|
elseif career == 3 then
|
|
cfg.resource_id = 103000
|
|
name = "龙牙长枪"
|
|
pos_y = 0
|
|
position = Vector3.zero
|
|
rotate = nil
|
|
elseif career == 4 then
|
|
cfg.resource_id = 104000
|
|
name = "魔力重炮"
|
|
pos_y = 0
|
|
position = Vector3(70, -53, 0)
|
|
rotate = {x = 0, y = 0, z = -45}
|
|
scale = 120
|
|
else
|
|
cfg.resource_id = 101000
|
|
name = "爆炎大剑"
|
|
pos_y = -100
|
|
position = Vector3.zero
|
|
rotate = nil
|
|
end
|
|
|
|
if Config.UIModelConfig[cfg.resource_id] then
|
|
local data = {
|
|
res_id = cfg.resource_id,
|
|
modelPartPos = Config.UIModelConfig[cfg.resource_id].pos,
|
|
type = Config.UIModelConfig[cfg.resource_id].type,
|
|
texture_size = Vector2(450, 270),
|
|
scale = scale,
|
|
layer_name = self.layer_name,
|
|
position = position,
|
|
rotate = rotate
|
|
}
|
|
lua_resM:NewSetPartModel(self, self.roleCon, data)
|
|
self:FloatUDAnima()
|
|
else
|
|
logWarn("[CultureViewItem:CreateModel] "..cfg.resource_id.."找不到配置")
|
|
end
|
|
self.roleCon.transform:Rotate(Vector3(0, 0, 90))
|
|
-- self.roleCon.localPosition = Vector3(-6,pos_y,0)
|
|
self:SetName(name)
|
|
end
|
|
|
|
--武器的上下浮动效果
|
|
function GuideShowView:FloatUDAnima()
|
|
self.tween_id3 = TweenLite.to(self, self.roleCon, TweenLite.UiAnimationType.POSY, 60, 1.5, call_fun, TweenFunc.PINGPONG, true)
|
|
end
|
|
|
|
function GuideShowView:StopAnim()
|
|
if self.tween_id3 then
|
|
TweenLite.Stop(self.tween_id3)
|
|
self.tween_id3 = nil
|
|
end
|
|
end
|
|
|
|
function GuideShowView:DealWithPet()
|
|
local id = tonumber(self.params[2])
|
|
local cfg = Config.Petstage[id]
|
|
if cfg then
|
|
local data = {
|
|
clothe_res_id = cfg.figure,
|
|
type = SceneBaseType.Horse,
|
|
layer_name = self.layer_name,
|
|
action_name_list = {"idle"},
|
|
can_rotate = true,
|
|
scale = 220,
|
|
position = Vector3(0, -57, 0),
|
|
}
|
|
lua_resM:SetRoleModel(self, self.roleCon, data)
|
|
self:SetDesc(cfg.name)
|
|
end
|
|
self.roleCon.localPosition = Vector3(0, -80, 0)
|
|
end
|
|
|
|
function GuideShowView:DealWithHorse()
|
|
local id = tonumber(self.params[2])
|
|
local cfg = Config.Mountstage[id]
|
|
if cfg then
|
|
local data = {
|
|
clothe_res_id = cfg.ride_figure,
|
|
type = SceneBaseType.Horse,
|
|
layer_name = self.layer_name,
|
|
rotate = -30,
|
|
action_name_list = {"idle"},
|
|
can_rotate = true,
|
|
scale = 140,
|
|
position = Vector3(-15, -155, 0),
|
|
}
|
|
lua_resM:SetRoleModel(self, self.roleCon, data)
|
|
self:SetName(Trim(cfg.name))
|
|
end
|
|
self.roleCon.localPosition = Vector3(0, 50, 0)
|
|
end
|
|
|
|
function GuideShowView:DealWithWing()
|
|
local career = RoleManager.Instance.mainRoleInfo.career
|
|
local type_id = tonumber(self.params[career + 1])
|
|
local goods_basic = GoodsModel:getInstance():GetGoodsBasicByTypeId(type_id)
|
|
if not goods_basic then
|
|
return
|
|
end
|
|
|
|
local data = {
|
|
clothe_res_id = goods_basic.model_id,
|
|
type = SceneBaseType.Horse,
|
|
layer_name = self.layer_name,
|
|
action_name_list = {"idle"},
|
|
can_rotate = true,
|
|
scale = 220,
|
|
position = Vector3(0, -15, 0),
|
|
}
|
|
lua_resM:SetRoleModel(self, self.roleCon, data)
|
|
self:SetName(Trim(goods_basic.goods_name))
|
|
end
|
|
|
|
function GuideShowView:DealEMo()
|
|
local data = {
|
|
clothe_res_id = 503001,
|
|
type = SceneBaseType.Horse,
|
|
layer_name = self.layer_name,
|
|
action_name_list = {"idle"},
|
|
can_rotate = true,
|
|
scale = 300,
|
|
position = Vector3(0, -350, 0),
|
|
}
|
|
lua_resM:SetRoleModel(self, self.roleCon, data)
|
|
self.expGet_tips1:SetActive(true)
|
|
self.expGet_tips2:SetActive(true)
|
|
self:SetName("经验馆主")
|
|
self.roleCon.localPosition = Vector3(0, 0, 0)
|
|
-- self.downCon.localPosition = co.TableXYZ(-6, -10, 0)
|
|
end
|
|
|
|
function GuideShowView:LoadSuccess()
|
|
self.info_con,
|
|
self.sure_btn,
|
|
self.mask_btn,
|
|
self.expGet_tips1,
|
|
self.expGet_tips2 = self:GetChildGameObjects({
|
|
"InfoCon",
|
|
"InfoCon/SureBtn",
|
|
"Mask",
|
|
"InfoCon/expGet_tips1",
|
|
"InfoCon/expGet_tips2",
|
|
})
|
|
|
|
self.name_txt,
|
|
self.desc_txt,
|
|
self.sure_btn_txt = self:GetChildTexts({
|
|
"InfoCon/Name/Text",
|
|
"InfoCon/Desc/Text",
|
|
"InfoCon/SureBtn/Text"
|
|
})
|
|
|
|
self.roleCon,
|
|
self.effect_con,
|
|
self.mask_bg,
|
|
self.downCon = self:GetChildTransforms({
|
|
"InfoCon/Texture",
|
|
"EffectCon",
|
|
"Mask",
|
|
"InfoCon/downCon",
|
|
})
|
|
lua_resM:setOutsideImageSprite(self, self.downCon:GetComponent("Image"), GameResPath.GetGuideImage("wgui_taizi"), false)
|
|
|
|
self.mask_bg.sizeDelta = Vector2(SrcScreenWidth, ScreenHeight)
|
|
end
|
|
|
|
function GuideShowView:SureBtnClickEvent()
|
|
local helpVo = GuideModel:getInstance():GetHelpVo(HelpType.TASK_ITEM_SHOW, 1) or GuideModel:getInstance():GetHelpVo(HelpType.TASK_ITEM_SHOW, 2)
|
|
or GuideModel:getInstance():GetHelpVo(HelpType.TASK_ITEM_SHOW, 3)
|
|
if helpVo then
|
|
GlobalEventSystem:Fire(EventName.FINISH_CURRENT_HELP_STEP, helpVo)
|
|
end
|
|
self:Close()
|
|
end
|
|
|
|
function GuideShowView:InitEvent()
|
|
local function onBtnClickHandler(target)
|
|
if target == self.sure_btn or target == self.mask_btn then
|
|
self:SureBtnClickEvent()
|
|
end
|
|
end
|
|
|
|
AddClickEvent(self.sure_btn, onBtnClickHandler)
|
|
AddClickEvent(self.mask_btn, onBtnClickHandler)
|
|
end
|
|
|
|
function GuideShowView:SetName(name)
|
|
self.name_txt.text = name
|
|
end
|
|
|
|
function GuideShowView:SetDesc(str)
|
|
self.desc_txt.text = str
|
|
end
|
|
|
|
function GuideShowView:PlaySound()
|
|
local helpVo = GuideModel:getInstance():GetHelpVo(HelpType.TASK_ITEM_SHOW, 1) or GuideModel:getInstance():GetHelpVo(HelpType.TASK_ITEM_SHOW, 2)
|
|
if helpVo then
|
|
lua_soundM:StopEffect(self, LuaSoundManager.SOUND_TYPE.FUNC, self.sound_id)
|
|
if helpVo.sound and Trim(helpVo.sound) ~= "" then
|
|
if lua_soundM then
|
|
self.sound_id = lua_soundM:PlayEffect(self, Trim(helpVo.sound), false, LuaSoundManager.SOUND_TYPE.FUNC)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
function GuideShowView:ShowTimer()
|
|
self:RemoveTimer()
|
|
self.sure_btn_txt.text = "确定(" .. self.time_diff .. "秒)"
|
|
local function onTimer()
|
|
self.time_diff = self.time_diff - 1
|
|
if self.time_diff > 0 then
|
|
self.sure_btn_txt.text = "确定(" .. self.time_diff .. "秒)"
|
|
else
|
|
self:RemoveTimer()
|
|
self:SureBtnClickEvent()
|
|
end
|
|
end
|
|
self.time_id = GlobalTimerQuest:AddPeriodQuest(onTimer, 1, -1)
|
|
end
|
|
|
|
function GuideShowView:RemoveTimer()
|
|
if self.time_id then
|
|
GlobalTimerQuest:CancelQuest(self.time_id)
|
|
self.time_id = nil
|
|
end
|
|
end
|
|
|
|
function GuideShowView:DealWithStarSoulReward()
|
|
local id = tonumber(self.params[2])
|
|
local data = {
|
|
clothe_res_id = id,
|
|
type = SceneBaseType.Partner,
|
|
layer_name = self.layer_name,
|
|
rotate = 0,
|
|
action_name_list = {"idle"},
|
|
can_rotate = true,
|
|
scale = 220,
|
|
position = Vector3(0, -170, 0),
|
|
layout_file = self.layout_file
|
|
}
|
|
lua_resM:SetRoleModel(self, self.roleCon, data)
|
|
self:SetName(self.params[3])
|
|
self.roleCon.localPosition = Vector3(0, 50, 0)
|
|
end
|