|
|
GuidePromptView = GuidePromptView or BaseClass(BaseView)
|
|
local GuidePromptView = GuidePromptView
|
|
|
|
GuidePromptView.ArrowDir =
|
|
{
|
|
Right = 1,
|
|
Left = 2,
|
|
Bottom = 3,
|
|
Top = 4,
|
|
LeftBottom = 5,
|
|
RightBottom = 6,
|
|
LeftTop = 7,
|
|
RightTop = 8,
|
|
}
|
|
|
|
function GuidePromptView:__init()
|
|
self.base_file = "guide"
|
|
self.layout_file = "GuidePromptView"
|
|
self.layer_name = "Activity"
|
|
self.destroy_imm = true
|
|
self.use_background = false
|
|
self.append_to_ctl_queue = false
|
|
self.change_scene_close = true
|
|
self.open_wnd_anim = 0
|
|
self.force_no_ctl_queue = true
|
|
self.model = GuideModel:getInstance()
|
|
--self.use_local_view = true
|
|
|
|
self:AddPreLoadList("common", {"ArrowComponent"})
|
|
|
|
self.is_set_zdepth = true
|
|
self.is_show_prompt = true
|
|
|
|
self.x = 0
|
|
self.y = 0
|
|
self.w = 0
|
|
self.h = 0
|
|
|
|
self.alpha_value = 0.6
|
|
|
|
self.load_callback = function ()
|
|
self.gameObject:SetActive(false)
|
|
self:LoadSuccess()
|
|
self:InitEvent()
|
|
end
|
|
self.open_callback = function ()
|
|
if UnityEngine.Transform.Equals(self.attch_node,nil) then
|
|
return
|
|
end
|
|
|
|
self.model:SetPromptViewOpenState(true)
|
|
self:InitView()
|
|
|
|
if self.z_depth then
|
|
UIDepth.SetUIDepth(self.transform.gameObject,true, self.z_depth)
|
|
end
|
|
end
|
|
self.close_callback = function ()
|
|
self.model:SetPromptViewOpenState(false)
|
|
self:Clear()
|
|
end
|
|
self.destroy_callback = function ()
|
|
end
|
|
end
|
|
|
|
--attch_node 用于计算 挂载点的相对位置
|
|
--ui_attach_node 当前view的挂载点
|
|
function GuidePromptView:Open(attch_node,ui_attach_node,call_back,helpVo,view_layout_file,layer_name, z_depth)
|
|
if UnityEngine.Transform.Equals(attch_node,nil) then
|
|
return
|
|
end
|
|
self.time_diff = 10 --定时器时间
|
|
self.attch_node = attch_node
|
|
self.ui_attach_node = ui_attach_node
|
|
self.call_back = call_back
|
|
self.help_type = helpVo.help_type
|
|
self.step = helpVo.step
|
|
self.helpVo = helpVo
|
|
self.time_diff = helpVo.time_diff or self.time_diff
|
|
self.layer_name = layer_name or "Activity"
|
|
self.view_layout_file = view_layout_file
|
|
self.z_depth = z_depth
|
|
BaseView.Open(self)
|
|
end
|
|
|
|
function GuidePromptView:Clear()
|
|
if self.item_event_id then
|
|
GlobalEventSystem:UnBind(self.item_event_id)
|
|
self.item_event_id = nil
|
|
end
|
|
|
|
self:DeleteArrowTip()
|
|
self:StopTimer()
|
|
self:CancelLeaveTimer()
|
|
self:StopAnim()
|
|
end
|
|
|
|
function GuidePromptView:InitView()
|
|
|
|
self.transform:SetParent(self.ui_attach_node)
|
|
SetLocalScale(self.transform)
|
|
print("tanar: [GuidePromptView 84]=> self.help_type: ",self.help_type)
|
|
self:SetFocusPointMsg(self.attch_node)
|
|
self:DeleteArrowTip()
|
|
self:StopTimer()
|
|
|
|
if self.help_type == HelpType.DO_MAIN_TASK then
|
|
self:DoMainTaskPrompt()
|
|
elseif self.help_type == HelpType.TASK_SELECT then
|
|
self:TaskSelectPrompt()
|
|
elseif self.help_type == HelpType.TYPE_LIGHT then
|
|
self:TypeLightPrompt()
|
|
elseif self.help_type == HelpType.TYPE_SUIT_COLLECT then
|
|
self:TypeSuitCollectPrompt()
|
|
elseif self.help_type == HelpType.TYPE_HORSE then
|
|
self:TypeHorsePrompt()
|
|
elseif self.help_type == HelpType.TYPE_DUNGEON then
|
|
self:TypeDunGeonPrompt()
|
|
elseif self.help_type == HelpType.TYPE_PEARL then
|
|
self:TypePearlPrompt()
|
|
elseif self.help_type == HelpType.TYPE_EQUIP_STRENGTH then
|
|
self:TypeEquipStrengthlPrompt()
|
|
elseif self.help_type == HelpType.TYPE_JARVIS then
|
|
self:TypeJarvisPrompt()
|
|
elseif self.help_type == HelpType.TYPE_PKRANK then
|
|
self:TypePkrankPrompt()
|
|
elseif self.help_type == HelpType.TYPE_DAILY then
|
|
self:TypeDailyPrompt()
|
|
elseif self.help_type == HelpType.TYPE_EXP_DUNGEON then
|
|
self:TypeExpDungeonPrompt()
|
|
elseif self.help_type == HelpType.TYPE_EQUIP_SUIT_ACTIVE then
|
|
self:TypeEquipSuitActivePrompt()
|
|
elseif self.help_type == HelpType.OPEN_LIST_SHOW_PROMPT then
|
|
self:ListPrompt()
|
|
elseif self.help_type == HelpType.NEWER_TASK_AWARD_UNLOCK then
|
|
self:NewerTaskAwardPromt()
|
|
elseif self.help_type == HelpType.TYPE_SPECIAL_PEARL then
|
|
self:TypeSpecialPearlPrompt()
|
|
elseif self.help_type == HelpType.TYPE_TOWER then
|
|
self:TypeTowerPrompt()
|
|
elseif self.help_type == HelpType.TYPE_BOSS or self.help_type == HelpType.TYPE_MONEY_BOSS then
|
|
self:TypeBossPrompt()
|
|
elseif self.help_type == HelpType.TYPE_EXTENSION_LINE_TASK then
|
|
self:TypeExtensionLineTaskPrompt()
|
|
elseif self.help_type == HelpType.TYPE_EXTENSION_LINE_TASK_FINISH then
|
|
self:TypeExtensionLineTaskFinshPrompt()
|
|
elseif self.help_type == HelpType.TYPE_GUILD then
|
|
self:TypeGuildPrompt()
|
|
elseif self.help_type == HelpType.TYPE_WAR_SOUL then
|
|
self:TypeWarSoulPrompt()
|
|
elseif self.help_type == HelpType.TYPE_EQUIP_COLLECT_ONE then
|
|
self:TypeEquipCollectOnePrompt()
|
|
elseif self.help_type == HelpType.TYPE_EQUIP_COLLECT_TWO then
|
|
self:TypeEquipCollectTwoPrompt()
|
|
elseif self.help_type == HelpType.GUILD_CSGR_COLLECT then
|
|
self:TypeGuildCSGRCollect()
|
|
elseif self.help_type == HelpType.MATE_CHANGE_NAME then
|
|
self:TypeMateChangeName()
|
|
elseif self.help_type == HelpType.MONEY_BOSS_FIRST_IN then
|
|
self:TypeMoneyBossFirstIn()
|
|
elseif self.help_type == HelpType.TYPE_EQUIP_COLLECT_ONE_CLOSE then
|
|
self:TypeEquipCollectClosePrompt()
|
|
elseif self.help_type == HelpType.TYPE_NEW_MAIN_LINE_TASK then
|
|
self:TypeNewMainLinePrompt()
|
|
elseif self.help_type == HelpType.TYPE_PSIONIC then
|
|
self:TypePsionicPrompt()
|
|
elseif self.help_type == HelpType.VIP_ANGRY_SKILL_PLAY then
|
|
self:TypeVIPSkillPrompt()
|
|
elseif self.help_type == HelpType.TYPE_EQUIP_RED then
|
|
self:TypeEquipRedPrompt()
|
|
elseif self.help_type == HelpType.DESERTED_BOSS_MON then
|
|
self:TypeDesertecBoss()
|
|
elseif self.help_type == HelpType.BABYDUN_ACTIVATED_SKILL then
|
|
self:TypeBabydunActivatedSkill()
|
|
elseif self.help_type == HelpType.TYPE_CLOTHE_FACTORY then
|
|
self:TypeClotheFactory()
|
|
elseif self.help_type == HelpType.GUILD_SPEED_ACT_CLICK then--社团快速点击
|
|
self:TypeGuildSpeedAct()
|
|
elseif self.help_type == HelpType.TYPE_MAIN_LINE_DUNGEON then
|
|
self:TypeMainLineDungeonPrompt()
|
|
elseif self.help_type == HelpType.TYPE_MAIN_PLOT_DUNGEON_SWEEP_TIPS then
|
|
self:TypeMainPlotdungeonSweepPrompt()
|
|
elseif self.help_type == HelpType.LIFELONG_MARKET_OPEN_TYPE then
|
|
self:TypeMarketOpen()
|
|
elseif self.help_type == HelpType.LIFELONG_MARKET_SELL_TYPE then
|
|
self:TypeMarketSell()
|
|
elseif self.help_type == HelpType.LIFELONG_EQUIP_EVOLVE_TYPE then
|
|
self:TypeEquipEvolve()
|
|
elseif self.help_type == HelpType.TYPE_SHOW_FIGHT_UP_TIPS then
|
|
self:TypeShowFightUpTips()
|
|
elseif self.help_type == HelpType.LIFELONG_ELITE_ASSESS_TYPE then
|
|
self:TypeEliteAssess()
|
|
elseif self.help_type == HelpType.LIFELONG_SERVEN_TARGET_TYPE then
|
|
self:TypeServenTarget()
|
|
else
|
|
self:CommonPrompt()
|
|
end
|
|
end
|
|
|
|
|
|
function GuidePromptView:LoadSuccess()
|
|
self.contentCon,
|
|
self.border,
|
|
self.focus_point,
|
|
self.roleImage
|
|
= GetChildTransforms(self.transform,
|
|
{
|
|
"Border/Content",
|
|
"Border",
|
|
"FocusPoint",
|
|
"Border/RoleImage",
|
|
})
|
|
|
|
self.effect,
|
|
self.click_btn = self:GetChildGameObjects({
|
|
"Effect",
|
|
"Border/ClickBtn"
|
|
})
|
|
|
|
self.content = self:GetChild("Border/Content"):GetComponent("TMPro.TextMeshProUGUI")
|
|
self.sayer = self:GetChild("Border/Sayer"):GetComponent("TMPro.TextMeshProUGUI")
|
|
local nodes = {
|
|
"Border2/anim_root/Content2:tmp",
|
|
"Border:obj",
|
|
"Border2:obj",
|
|
"Border2/anim_root/ClickBtn2:obj",
|
|
"Border2/anim_root/arrow_dir_root:obj",
|
|
"Border2/anim_root",
|
|
}
|
|
self:GetChildren(nodes)
|
|
|
|
|
|
self.effect:SetActive(true)
|
|
end
|
|
|
|
|
|
function GuidePromptView:InitEvent()
|
|
local onItemDel = function ( item_name,layout_file)
|
|
if self._use_delete_method then return end
|
|
if not IsNull(self.ui_attach_node) and self.ui_attach_node.name and self.ui_attach_node.name==item_name then --有些BaseItem销毁了,但是没有先关闭此界面,导致报错
|
|
self:Close()
|
|
end
|
|
end
|
|
self.item_event_id = GlobalEventSystem:Bind(EventName.BASE_ITEM_DELETE, onItemDel)
|
|
|
|
local function clickFunc(target)
|
|
if target == self.click_btn or target == self.ClickBtn2_obj then
|
|
if self.call_back then
|
|
self.call_back()
|
|
end
|
|
end
|
|
end
|
|
AddClickEvent(self.click_btn,clickFunc)
|
|
AddClickEvent(self.ClickBtn2_obj,clickFunc)
|
|
|
|
end
|
|
|
|
function GuidePromptView:ShowArrow(dir,x,y,ignore_focus)
|
|
local show_type = self.helpVo.show_type == nil and 1 or 2
|
|
if self.arrow_tip == nil then
|
|
self.arrow_tip = ArrowComponent.New(self.transform)
|
|
self.arrow_tip:SetArrowType(show_type)
|
|
end
|
|
local depth = self:GetCurrLayerDepth("Top")
|
|
if ignore_focus then
|
|
self.arrow_tip:ShowArrow(dir,co.TableXY(x,y),depth)
|
|
else
|
|
self.arrow_tip:ShowArrow(dir,co.TableXY(self.x + x,self.y + y),depth)
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:ShowBubble(x,y,ignore_focus,size,pos,content, role_img_size, role_img_pos,content_sizeDelta, arrow_tip_dir)
|
|
|
|
local helpVo = self.helpVo
|
|
|
|
|
|
if helpVo.task_id == HelpType.SHOW_NEW_MAIN_LINE_TIP_ID then
|
|
local main_task = TaskModel.getInstance():GetMainTask()
|
|
if main_task and RoleManager.Instance.mainRoleInfo.level >= main_task.level then
|
|
helpVo.saying = "继续主线任务吧"
|
|
else
|
|
helpVo.saying = "推荐完成任务"
|
|
end
|
|
end
|
|
|
|
local sayer = Trim(helpVo.sayer) or ""
|
|
local saying = Trim(helpVo.saying) or ""
|
|
local show_type = helpVo.show_type == nil and 1 or 2
|
|
local show_focus = helpVo.show_focus == nil and true or helpVo.show_focus
|
|
local show_timer = helpVo.show_timer or false
|
|
local str = content or "(<color=#14e64a>%d秒</color>后自动继续)"
|
|
local delay_show = helpVo.delay_show
|
|
local effect_pos = helpVo.effect_pos and Vector3.New(helpVo.effect_pos.x, helpVo.effect_pos.y, helpVo.effect_pos.z or 0) or Vector3.New(0, 0, 0)
|
|
if show_focus then
|
|
local layer_name = self.layer_name
|
|
if layer_name == "Top" then
|
|
layer_name = "UpTop"
|
|
end
|
|
self:AddUIEffect("ui_jujiaodianji", self.attch_node.transform, layer_name, effect_pos, 1, true)
|
|
end
|
|
self.arrow_tip_dir = arrow_tip_dir
|
|
|
|
if show_type == 1 then
|
|
self.Border_obj:SetActive(true)
|
|
self.Border2_obj:SetActive(false)
|
|
|
|
elseif show_type == 2 then
|
|
self.Border_obj:SetActive(false)
|
|
self.Border2_obj:SetActive(true)
|
|
if ignore_focus then
|
|
self.Border2.localPosition = Vector3(x,y,0)
|
|
else
|
|
self.Border2.localPosition = Vector3(self.x + x,self.y + y,0)
|
|
end
|
|
local font_size = helpVo.font_size or 20
|
|
if saying ~= "" then
|
|
saying = string.gsub(saying, "@n@", "\n")
|
|
self.Content2_tmp.text = saying
|
|
else
|
|
self.Content2_tmp.text = "点击完成"
|
|
end
|
|
self.Content2_tmp.fontSize = font_size
|
|
else
|
|
self.Border_obj:SetActive(false)
|
|
self.Border2_obj:SetActive(false)
|
|
return
|
|
end
|
|
if saying ~= "" and show_type == 1 then
|
|
saying = string.gsub(saying, "@n@", "\n")
|
|
-- self.sayer.text = sayer
|
|
self.border.gameObject:SetActive(true)
|
|
if size then
|
|
self.border.sizeDelta = size
|
|
if role_img_size then
|
|
self.roleImage.sizeDelta = role_img_size
|
|
end
|
|
if role_img_pos then
|
|
self.roleImage.localPosition = role_img_pos
|
|
end
|
|
end
|
|
|
|
if content_sizeDelta then
|
|
self.content.transform.sizeDelta = content_sizeDelta
|
|
end
|
|
|
|
-- local hide_timer = "hide_timer" -- Trim(self.helpVo.param)
|
|
-- if hide_timer == "hide_timer" then
|
|
if show_timer then
|
|
self.content.text = saying .. string.format(str,self.time_diff)
|
|
self:StartTimer(content)
|
|
else
|
|
self.content.text = saying
|
|
end
|
|
|
|
local width = self.content.preferredWidth
|
|
local height = self.content.preferredHeight
|
|
local sizeDelta = self.border.sizeDelta
|
|
|
|
if ignore_focus then
|
|
self.border.localPosition = Vector3(x,y,0)
|
|
else
|
|
self.border.localPosition = Vector3(self.x + x,self.y + y,0)
|
|
end
|
|
if pos then
|
|
self.contentCon.localPosition = pos
|
|
else
|
|
--如果是一行 则居中显示
|
|
local x = width < 280 and (-width / 2 + 38) or -80
|
|
--self.contentCon.localPosition = Vector3(x ,height / 2 + sizeDelta.y / 2,0)
|
|
end
|
|
|
|
if not size then
|
|
if role_img_size then
|
|
self.roleImage.sizeDelta = role_img_size
|
|
end
|
|
if role_img_pos then
|
|
self.roleImage.localPosition = role_img_pos
|
|
end
|
|
end
|
|
else
|
|
self.border.gameObject:SetActive(false)
|
|
end
|
|
|
|
if self.delay_timer then
|
|
GlobalTimerQuest:CancelQuest(self.delay_timer)
|
|
self.delay_timer = nil
|
|
end
|
|
if delay_show then
|
|
local function delay_func( )
|
|
if not IsNull(self.gameObject) then
|
|
self.gameObject:SetActive(true)
|
|
end
|
|
end
|
|
if not self.delay_timer then
|
|
self.delay_timer = GlobalTimerQuest:AddDelayQuest(delay_func,delay_show)
|
|
end
|
|
end
|
|
if self.arrow_tip_dir then
|
|
self:StartAnim()
|
|
else
|
|
self:StopAnim()
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:ShowEffect(x,y,scale,effect_name)
|
|
x = x or 0
|
|
y = y or 0
|
|
local effect = newObject(self.effect)
|
|
effect.transform:SetParent(self.transform)
|
|
effect.transform.localScale = Vector3.one
|
|
effect.transform.localPosition = Vector3(x,y,0)
|
|
scale = scale or co.TableXY(1,1)
|
|
effect_name = effect_name or "ui_anniu_6"
|
|
local layer_name = self.layer_name
|
|
if layer_name == "Top" then
|
|
layer_name = "UpTop"
|
|
end
|
|
self:AddUIEffect(effect_name,effect.transform, layer_name, nil, scale, true, nil, nil,nil)
|
|
end
|
|
|
|
|
|
--获取聚焦点的信息
|
|
function GuidePromptView:SetFocusPointMsg(attch_node,w,h,x_offset,y_offset)
|
|
if UnityEngine.Transform.Equals(attch_node,nil) then
|
|
self:Close()
|
|
return
|
|
end
|
|
if attch_node == nil or self.transform==nil then
|
|
return
|
|
end
|
|
self.focus_point:SetParent(attch_node)
|
|
self.focus_point.localPosition = Vector3(0,0,0)
|
|
self.focus_point:SetParent(self.transform)
|
|
self.x = self.focus_point.localPosition.x + (x_offset or 0)
|
|
self.y = self.focus_point.localPosition.y + (y_offset or 0)
|
|
end
|
|
|
|
function GuidePromptView:SetDefaultFocusPoint()
|
|
self.x = 0
|
|
self.y = 0
|
|
self.w = 0
|
|
self.h = 0
|
|
end
|
|
|
|
function GuidePromptView:SetDepth(layer)
|
|
if self.transform and layer then
|
|
self.transform.gameObject:GetComponent("Canvas").sortingOrder = layer
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:CommonPrompt()
|
|
if self.step == 2 then
|
|
self:ShowArrow(1,-130,0)
|
|
self:ShowBubble(-460,-50)
|
|
elseif self.step == 3 then
|
|
self:ShowArrow(1,-130,0)
|
|
self:ShowBubble(-460,-50)
|
|
elseif self.step == 4 then
|
|
self:ShowArrow(1,-80,0)
|
|
self:ShowBubble(-252,-155)
|
|
end
|
|
end
|
|
function GuidePromptView:DoMainTaskPrompt( )
|
|
if self.step == 1 then
|
|
self:ShowBubble(-320,65)
|
|
self:ShowArrow(6,-100,50)
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:TaskSelectPrompt( )
|
|
if self.step == 1 then
|
|
self:ShowBubble(-220,50)
|
|
self:ShowArrow(6,0,10)
|
|
end
|
|
end
|
|
|
|
|
|
function GuidePromptView:TypeLightPrompt( )
|
|
if self.step == 3 then
|
|
self:ShowBubble(320,-200)
|
|
self:ShowArrow(7,80,-80)
|
|
elseif self.step == 4 then
|
|
self:ShowBubble(-280,60)
|
|
self:ShowArrow(6,-55,45)
|
|
elseif self.step == 5 then
|
|
self:ShowArrow(8,-50,-50)
|
|
self:ShowBubble()
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:TypeSuitCollectPrompt( )
|
|
if self.step == 3 then
|
|
self:ShowBubble(-300,-200)
|
|
self:ShowArrow(8,-60,-50)
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:TypeHorsePrompt( )
|
|
if self.step == 3 then
|
|
self:ShowBubble(-325,50)
|
|
self:ShowArrow(6,-100,45)
|
|
elseif self.step == 5 then
|
|
self:ShowArrow(8,-10,-40)
|
|
self:ShowBubble()
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:TypeDunGeonPrompt( )
|
|
if self.step == 3 then
|
|
self:ShowBubble(-1100,120)
|
|
self:ShowArrow(5,-1270,80)
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:TypePearlPrompt( )
|
|
if self.step == 3 then
|
|
self:ShowBubble(-325,50)
|
|
self:ShowArrow(6,-100,45)
|
|
elseif self.step == 4 then
|
|
self:ShowArrow(8,-10,-40)
|
|
self:ShowBubble()
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:TypeEquipStrengthlPrompt( )
|
|
if self.step == 3 then
|
|
self:ShowBubble(-330,60)
|
|
self:ShowArrow(6,-110,50)
|
|
elseif self.step == 4 then
|
|
self:ShowArrow(8,-10,-40)
|
|
self:ShowBubble()
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:TypeJarvisPrompt( )
|
|
if self.step == 3 then
|
|
self:ShowBubble(-325,50)
|
|
self:ShowArrow(6,-100,45)
|
|
elseif self.step == 4 then
|
|
self:ShowArrow(8,-10,-40)
|
|
self:ShowBubble()
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:TypePkrankPrompt( )
|
|
if self.step == 3 then
|
|
self:ShowBubble(-310,60)
|
|
self:ShowArrow(6,-100,50)
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:TypeDailyPrompt( )
|
|
if self.step == 3 then
|
|
self:ShowBubble(0,0)
|
|
self:ShowArrow(1,-100,0)
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:TypeExpDungeonPrompt( )
|
|
if self.step == 3 then
|
|
self:ShowBubble(15000,7000)
|
|
self:ShowArrow(5,6000,6000)
|
|
elseif self.step == 4 then
|
|
self:ShowBubble(-320,50)
|
|
self:ShowArrow(6,-100,40)
|
|
end
|
|
end
|
|
function GuidePromptView:TypeEquipSuitActivePrompt( )
|
|
if self.step == 3 then
|
|
self:ShowBubble(350,-130)
|
|
self:ShowArrow(2,110,-60)
|
|
elseif self.step == 4 then
|
|
self:ShowBubble(-9999,9999)
|
|
self:ShowArrow(5,-9999,9999)
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:NewerTaskAwardPromt( )
|
|
if self.step == 2 then
|
|
self:ShowBubble(163,-110)
|
|
self:ShowArrow(7,82,-45)
|
|
elseif self.step == 3 then
|
|
self:ShowBubble(0,-135)
|
|
self:ShowArrow(4,2,-40)
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:TypeSpecialPearlPrompt( )
|
|
if self.step == 3 then
|
|
self:ShowBubble(-325,50)
|
|
self:ShowArrow(6,-100,45)
|
|
elseif self.step == 5 then
|
|
self:ShowArrow(8,-10,-40)
|
|
self:ShowBubble()
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:TypeTowerPrompt( )
|
|
if self.step == 3 then
|
|
self:ShowBubble(-325,50)
|
|
self:ShowArrow(6,-100,45)
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:TypeBossPrompt( )
|
|
if self.step == 3 then
|
|
self:ShowBubble(-325,50)
|
|
self:ShowArrow(6,-100,45)
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:TypeGuildPrompt( )
|
|
if self.step == 3 then
|
|
self:ShowBubble(-425,250)
|
|
self:ShowArrow(6,-100,-1000)
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:TypeWarSoulPrompt( )
|
|
if self.step == 3 then
|
|
self:ShowBubble(250,70)
|
|
self:ShowArrow(5,70,50)
|
|
elseif self.step == 4 then
|
|
self:ShowBubble(310,-250)
|
|
self:ShowArrow(7,80,-80)
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:TypeEquipCollectOnePrompt( )
|
|
if self.step == 1 then
|
|
self:ShowBubble(-270,70)
|
|
self:ShowArrow(6,-70,50)
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:TypeEquipCollectTwoPrompt( )
|
|
if self.step == 1 then
|
|
self:ShowBubble(-270,70)
|
|
self:ShowArrow(6,-70,50)
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:TypeGuildCSGRCollect( )
|
|
if self.step == 1 then
|
|
self:ShowBubble(-290,-80)
|
|
self:ShowArrow(1,-60,0)
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:TypeMateChangeName( )
|
|
if self.step == 1 then
|
|
self:ShowBubble(-290,-80)
|
|
self:ShowArrow(1,-60,0)
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:TypeExtensionLineTaskPrompt( )
|
|
if self.step == 2 then
|
|
self:ShowBubble(300,-250)
|
|
self:ShowArrow(7,100,-100)
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:TypeExtensionLineTaskFinshPrompt( )
|
|
if self.step == 1 then
|
|
self:ShowBubble(205,-60,nil ,nil,nil,nil,nil,nil,nil,1)
|
|
-- self:ShowArrow(2,130,-30)
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:TypeNewMainLinePrompt( )
|
|
if self.step == 1 then
|
|
self:ShowBubble(205,-60,nil ,nil,nil,nil,nil,nil,nil,1)
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:TypePsionicPrompt( )
|
|
if self.step == 3 then
|
|
self:ShowArrow(1,-50,-30)
|
|
self:ShowBubble(-300,-120)
|
|
elseif self.step == 4 then
|
|
self:ShowArrow(1,9999,9999)
|
|
self:ShowBubble(9999,9999)
|
|
elseif self.step == 5 then
|
|
self:ShowArrow(1,-75,0)
|
|
self:ShowBubble(-320,-80)
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:TypeVIPSkillPrompt( )
|
|
if self.step == 1 then
|
|
self:ShowArrow(2,125,105)
|
|
self:ShowBubble(350,25)
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:TypeGuildSpeedAct( )
|
|
if self.step == 1 then
|
|
self:ShowArrow(3,0,75)
|
|
self:ShowBubble(-130,65)
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:TypeMainLineDungeonPrompt( )
|
|
if self.step == 3 then
|
|
self:ShowArrow(GuidePromptView.ArrowDir.RightBottom,-20,75)
|
|
self:ShowBubble(-170,85)
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:TypeMainPlotdungeonSweepPrompt( )
|
|
if self.step == 1 then
|
|
self:ShowArrow(GuidePromptView.ArrowDir.RightBottom,-200,75)
|
|
self:ShowBubble(-430,85)
|
|
elseif self.step == 2 then
|
|
self:ShowArrow(GuidePromptView.ArrowDir.RightTop,-10,-40)
|
|
self:ShowBubble()
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:TypeEquipRedPrompt( )
|
|
if self.step == 3 then
|
|
self:ShowArrow(5,20,20)
|
|
self:ShowBubble(220,20)
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:TypeMoneyBossFirstIn( )
|
|
if self.step == 1 then
|
|
local x,y = -75,-75
|
|
self:ShowBubble(-260+x,-200+y)
|
|
self:ShowArrow(8,-40+x,-35+y)
|
|
elseif self.step == 2 then
|
|
self:ShowBubble(270,-210)
|
|
self:ShowArrow(7,-40+100,-35-20)
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:TypeDesertecBoss( )
|
|
self:ShowBubble(270,-210+50)
|
|
self:ShowArrow(7,-40+100,-35-20+50)
|
|
end
|
|
|
|
function GuidePromptView:TypeBabydunActivatedSkill( )
|
|
if self.step == 1 then
|
|
self:ShowBubble(-290,-80)
|
|
self:ShowArrow(1,-60,0)
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:TypeClotheFactory( )
|
|
if self.step == 3 then
|
|
self:ShowBubble(-450,250)
|
|
self:ShowArrow(1,-210,330)
|
|
elseif self.step == 4 then
|
|
self:ShowBubble(-360,-80)
|
|
self:ShowArrow(1,-130,0)
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:TypeEquipCollectClosePrompt( )
|
|
if self.step == 1 then
|
|
local x,y = -75,-75
|
|
self:ShowBubble(-260+x,-200+y)
|
|
self:ShowArrow(8,-40+x,-35+y)
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:ListPrompt()
|
|
local param = Split(self.helpVo.param, ",")
|
|
if tonumber(param[1]) == 2 then --左下角
|
|
self:ShowArrow(9,-15,100)
|
|
self:ShowBubble(-315,90)
|
|
elseif tonumber(param[1]) == 1 then --右上角
|
|
self:ShowArrow(8,-40,-40)
|
|
self:ShowBubble(-260,-210)
|
|
end
|
|
UIDepth.SetUIDepth(self.gameObject,true,self:GetCurrLayerDepth("Main"))
|
|
UIDepth.SetUIDepth(self.arrow_tip.gameObject,true,self:GetCurrLayerDepth("Main"))
|
|
end
|
|
|
|
function GuidePromptView:TypeMarketOpen( )
|
|
self:ShowBubble(0,-110)
|
|
self:ShowArrow(4,0,-30)
|
|
UIDepth.SetUIDepth(self.gameObject,true,self:GetCurrLayerDepth("Main"))
|
|
UIDepth.SetUIDepth(self.arrow_tip.gameObject,true,self:GetCurrLayerDepth("Main"))
|
|
end
|
|
|
|
function GuidePromptView:TypeMarketSell( )
|
|
if self.step == 1 then
|
|
self:ShowBubble(0+40,-250)
|
|
self:ShowArrow(4,0+40,-70)
|
|
elseif self.step == 2 then
|
|
self:ShowBubble(0,70)
|
|
self:ShowArrow(3,0,70)
|
|
UIDepth.SetUIDepth(self.gameObject,true,self:GetCurrLayerDepth("Top")+1)
|
|
UIDepth.SetUIDepth(self.arrow_tip.gameObject,true,self:GetCurrLayerDepth("Top")+1)
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:TypeEquipEvolve( )
|
|
if self.step == 1 then
|
|
self:ShowBubble(-280-80-55-75+20,60-80-193-60+20)
|
|
self:ShowArrow(1,-55-80-55-25+5,45-80-80-10-25-5-10)
|
|
elseif self.step == 2 then
|
|
self:ShowBubble(0,70+40)
|
|
self:ShowArrow(3,0,70+40)
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:TypeShowFightUpTips( )
|
|
if self.step == 1 then
|
|
self:ShowBubble(-370,-30)
|
|
self:ShowArrow(GuidePromptView.ArrowDir.Right,-120,50)
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:TypeEliteAssess( )
|
|
self:ShowBubble(135,-30)
|
|
self:ShowArrow(2,47,0)
|
|
UIDepth.SetUIDepth(self.gameObject,true,self:GetCurrLayerDepth("Main"))
|
|
UIDepth.SetUIDepth(self.arrow_tip.gameObject,true,self:GetCurrLayerDepth("Main"))
|
|
end
|
|
|
|
function GuidePromptView:TypeServenTarget( )
|
|
self:ShowBubble(0,-110)
|
|
self:ShowArrow(4,0,-30)
|
|
UIDepth.SetUIDepth(self.gameObject,true,self:GetCurrLayerDepth("Main"))
|
|
UIDepth.SetUIDepth(self.arrow_tip.gameObject,true,self:GetCurrLayerDepth("Main"))
|
|
end
|
|
|
|
function GuidePromptView:DeleteArrowTip()
|
|
if self.helpVo.show_focus and not IsNull(self.attch_node) then
|
|
self:ClearUIEffect(self.attch_node.transform)
|
|
end
|
|
if self.arrow_tip then
|
|
self.arrow_tip:DeleteMe()
|
|
self.arrow_tip = nil
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:Show(bool)
|
|
self.gameObject:SetActive(bool)
|
|
end
|
|
|
|
function GuidePromptView:StartTimer(content)
|
|
|
|
local str = content or "(<color=#4EAE1AFF>%d秒</color>后自动继续)"
|
|
local show_timer = self.helpVo.show_timer or false
|
|
local saying = Trim(self.helpVo.saying) or ""
|
|
local function onTimer()
|
|
if UnityEngine.Transform.Equals(self.attch_node,nil) then
|
|
self:Close()
|
|
return
|
|
end
|
|
self.time_diff = self.time_diff - 1
|
|
if self.time_diff > 0 then
|
|
|
|
-- local hide_timer = "hide_timer" --Trim(self.helpVo.param)
|
|
-- if hide_timer == "hide_timer" then
|
|
if show_timer then
|
|
self.content.text = saying .. string.format(str,self.time_diff)
|
|
else
|
|
self.content.text = saying
|
|
end
|
|
else
|
|
self:StopTimer()
|
|
if self.call_back then
|
|
self.call_back()
|
|
end
|
|
end
|
|
end
|
|
if not self.timer_id then
|
|
self.timer_id = GlobalTimerQuest:AddPeriodQuest(onTimer, 1, -1)
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:StopTimer()
|
|
if self.timer_id then
|
|
GlobalTimerQuest:CancelQuest(self.timer_id)
|
|
self.timer_id = nil
|
|
end
|
|
if self.delay_timer then
|
|
GlobalTimerQuest:CancelQuest(self.delay_timer)
|
|
self.delay_timer = nil
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:ShowBlackMask(x,y,w,h)
|
|
--左上
|
|
self.C2 = UiFactory.createChild(self.transform,UIType.ImageExtend,"C2")
|
|
self.C2.transform.pivot = Vector2(0,1)
|
|
self.C2.transform:SetAsFirstSibling()
|
|
self.C2_Image = self.C2:GetComponent("ImageExtend")
|
|
self.C2_Image.color = Color(0,0,0,self.alpha_value)
|
|
lua_resM:setImageSprite(self,self.C2_Image,"common_asset","story_ui_2")
|
|
|
|
--左下
|
|
self.C4 = UiFactory.createChild(self.transform,UIType.ImageExtend,"C4")
|
|
self.C4.transform.pivot = Vector2(0,0)
|
|
self.C4.transform:SetAsFirstSibling()
|
|
self.C4_Image = self.C4:GetComponent("ImageExtend")
|
|
self.C4_Image.color = Color(0,0,0,self.alpha_value)
|
|
lua_resM:setImageSprite(self,self.C4_Image,"common_asset","story_ui_2")
|
|
|
|
--右上
|
|
self.C6 = UiFactory.createChild(self.transform,UIType.ImageExtend,"C6")
|
|
self.C6.transform.pivot = Vector2(1,1)
|
|
self.C6.transform:SetAsFirstSibling()
|
|
self.C6_Image = self.C6:GetComponent("ImageExtend")
|
|
self.C6_Image.color = Color(0,0,0,self.alpha_value)
|
|
lua_resM:setImageSprite(self,self.C6_Image,"common_asset","story_ui_2")
|
|
--右下
|
|
self.C8 = UiFactory.createChild(self.transform,UIType.ImageExtend,"C8")
|
|
self.C8.transform.pivot = Vector2(1,0)
|
|
self.C8.transform:SetAsFirstSibling()
|
|
self.C8_Image = self.C8:GetComponent("ImageExtend")
|
|
self.C8_Image.color = Color(0,0,0,self.alpha_value)
|
|
lua_resM:setImageSprite(self,self.C8_Image,"common_asset","story_ui_2")
|
|
|
|
|
|
self:UpdateRectMask(x,y,w,h)
|
|
end
|
|
|
|
|
|
--设置矩形遮罩的位置
|
|
function GuidePromptView:UpdateRectMask(x,y,w,h)
|
|
local width,height = nil
|
|
self.C2.transform.anchoredPosition = Vector3(-ScreenWidth/2,ScreenHeight/2,0)
|
|
width = ScreenWidth/2 + x - w / 2
|
|
height = ScreenHeight / 2 - y + h / 2
|
|
self.C2.transform.sizeDelta = Vector2(width,height)
|
|
|
|
self.C4.transform.anchoredPosition = Vector3(-ScreenWidth/2,-ScreenHeight/2,0)
|
|
width = ScreenWidth/2 + x + w / 2
|
|
height = ScreenHeight / 2 + y - h/2
|
|
self.C4.transform.sizeDelta = Vector2(width,height)
|
|
|
|
|
|
self.C6.transform.anchoredPosition = Vector3(ScreenWidth/2,ScreenHeight/2,0)
|
|
width = ScreenWidth/2 - x + w / 2
|
|
height = ScreenHeight / 2 - y - h/2
|
|
self.C6.transform.sizeDelta = Vector2(width,height)
|
|
|
|
|
|
self.C8.transform.anchoredPosition = Vector3(ScreenWidth/2,-ScreenHeight/2,0)
|
|
width = ScreenWidth/2 - x - w / 2
|
|
height = ScreenHeight / 2 + y + h/2
|
|
self.C8.transform.sizeDelta = Vector2(width,height)
|
|
end
|
|
|
|
|
|
--设置矩形遮罩的位置
|
|
function GuidePromptView:ShowLeaveTimer(x,y)
|
|
if not self.time_label then
|
|
self.time_label = UiFactory.createChild(self.attch_node, UIType.Label2)
|
|
self.time_label.transform.pivot = Vector2(0, 1)
|
|
self.time_label.transform.anchoredPosition = Vector2(x,y)
|
|
self.time_txt = self.time_label:GetComponent("Text")
|
|
end
|
|
|
|
self:CancelLeaveTimer()
|
|
local onUpdate = function ( )
|
|
if UnityEngine.Transform.Equals(self.attch_node,nil) then
|
|
self:Close()
|
|
return
|
|
end
|
|
|
|
self.time_diff = self.time_diff - 1
|
|
if self.time_diff <= 0 then
|
|
self.time_txt.text = ""
|
|
self:CancelLeaveTimer()
|
|
if self.call_back then
|
|
self.call_back()
|
|
end
|
|
return
|
|
end
|
|
self.time_txt.text = self.time_diff.."s后自动关闭"
|
|
end
|
|
self.time_txt.text = ""
|
|
if not self.leave_timer_id then
|
|
self.time_txt.text = self.time_diff.."s后自动关闭"
|
|
self.leave_timer_id = GlobalTimerQuest:AddPeriodQuest(onUpdate, 1, -1)
|
|
end
|
|
onUpdate()
|
|
end
|
|
|
|
function GuidePromptView:CancelLeaveTimer( )
|
|
if self.leave_timer_id then
|
|
GlobalTimerQuest:CancelQuest(self.leave_timer_id)
|
|
self.leave_timer_id = nil
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:GetAnimEndPos(i_type)
|
|
if not self.old_pos then
|
|
self.old_pos = Vector3(0,0,0)
|
|
end
|
|
local pos = Vector3(self.old_pos.x, self.old_pos.y, self.old_pos.z )
|
|
--目前就只有左右2个方向
|
|
if i_type == 1 or i_type == 2 then
|
|
pos = Vector3(-10 + self.old_pos.x , self.old_pos.y, self.old_pos.z )
|
|
end
|
|
return pos
|
|
end
|
|
|
|
function GuidePromptView:StopAnim()
|
|
if not IsNull(self.arrow_dir_root_obj) then
|
|
self.arrow_dir_root_obj:SetActive(false)
|
|
end
|
|
|
|
if self.tween_id then
|
|
TweenLite.Stop(self.tween_id)
|
|
self.tween_id = nil
|
|
end
|
|
if self.tween_id2 then
|
|
TweenLite.Stop(self.tween_id2)
|
|
self.tween_id2 = nil
|
|
end
|
|
if self.tween_id3 then
|
|
TweenLite.Stop(self.tween_id3)
|
|
self.tween_id3 = nil
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:StartAnim()
|
|
if self.arrow_tip_dir == 1 then
|
|
SetAnchoredPosition(self.arrow_dir_root, -90, 0 )
|
|
SetLocalScale(self.arrow_dir_root, -1, 1, 1)
|
|
else
|
|
SetAnchoredPosition(self.arrow_dir_root, 90, 0 )
|
|
SetLocalScale(self.arrow_dir_root, 1, 1, 1)
|
|
end
|
|
self.arrow_dir_root_obj:SetActive(true)
|
|
self.old_pos = self.anim_root.localPosition
|
|
if self.twenn_id == nil then
|
|
local function onCompleted()
|
|
self:ArrowAnimation()
|
|
end
|
|
self.tween_id = TweenLite.to(self, self.anim_root,TweenLite.UiAnimationType.POS, self:GetAnimEndPos(self.arrow_tip_dir) ,0.6,onCompleted,TweenFunc.EASE_IN_OUT)
|
|
end
|
|
end
|
|
|
|
function GuidePromptView:ArrowAnimation()
|
|
local call_fun = function ()
|
|
local function onCompleted()
|
|
self:ArrowAnimation()
|
|
end
|
|
self.tween_id3 =TweenLite.to(self, self.anim_root,TweenLite.UiAnimationType.POS, self:GetAnimEndPos(self.arrow_tip_dir) ,0.6,onCompleted,TweenFunc.EASE_IN_OUT)
|
|
end
|
|
self.tween_id2 =TweenLite.to(self, self.anim_root,TweenLite.UiAnimationType.POS,self:GetAnimEndPos(), 0.6, call_fun, TweenFunc.EASE_IN_OUT)
|
|
end
|