|
|
- ServiceView = ServiceView or BaseClass(BaseItem)
-
- -- 客服界面
-
- function ServiceView:__init(parent)
- self.base_file = "setting"
- self.layout_file = "ServiceView"
- self.model = GameSettingModel:GetInstance()
-
- self.mainRoleVo = RoleManager.Instance.mainRoleInfo
-
- self.item_list = {}
- self:Load()
- end
-
- function ServiceView:Load_callback()
- self:LoadSuccess()
- self:InitEvent()
- end
-
- function ServiceView:LoadSuccess()
- -- self.qr_code = self:GetChild("qr_code"):GetComponent("Image")
- -- self.tipsContent = self:GetChild("tipsScrollView/Viewport/Content")
-
- -- lua_resM:setOutsideImageSprite(self,self.qr_code,GameResPath.GetSettingImage("qr_code"))
-
- local nodes = {
- "qr_code:img:obj",
- "copyBtn1:obj", "copyBtn2:obj",
- "copyRoleInfoBtn:obj", "changeRoleBtn:obj", "changeAccountBtn:obj",
- "headCon",
- "contact1:tmp", "contact2:tmp",
- "contact4:tmp", "contact5:tmp",
- "info3:tmp", "info1:tmp", "info2:tmp", "info4:tmp",
- }
- self:GetChildren(nodes)
-
- self.head_item = HeadRoleItem.New(self.headCon)
- self.head_item:SetItemSize(82, 82)
-
- self.service_data = VipModel:getInstance():GetServiceData()
-
-
- if self.need_refreshData then
- self:SetData()
- end
- end
-
- function ServiceView:InitEvent()
- local on_click = function ( click_obj )
- if self.copyBtn1_obj == click_obj then--拷贝公众号
- self:CopyInfo(1)
- elseif self.copyBtn2_obj == click_obj then--拷贝客服电话
- self:CopyInfo(2)
- elseif self.copyRoleInfoBtn_obj == click_obj then--拷贝角色信息
- self:CopyInfo(3)
- elseif self.changeRoleBtn_obj == click_obj then--切换角色
- if Scene.Instance.main_role:IsInState(PoseState.JUMP) or Scene.Instance.main_role:IsInState(PoseState.FLY)
- or Scene.Instance.main_role:IsInState(PoseState.JUMP_UP_HORSE) then
- return
- end
- local function ChangeRole()
- GlobalEventSystem:Fire(EventName.CHANGE_ROLE)
- end
- GlobalEventSystem:Fire(EventName.WANT_TO_CHANGE_ROLE)
- Alert.show("是否返回角色选择界面?",Alert.Type.Two,ChangeRole)
- elseif self.changeAccountBtn_obj == click_obj then--切换账号
- local function ChangeAccount()
- GlobalEventSystem:Fire(EventName.CHANGE_ACCOUNT)
- PlatformMgr:getInstance():LoginOut()
- end
- Alert.show("是否切换游戏账号?", Alert.Type.Two, ChangeAccount)
- end
- end
- AddClickEvent(self.copyBtn1_obj, on_click)
- AddClickEvent(self.copyBtn2_obj, on_click)
- AddClickEvent(self.copyRoleInfoBtn_obj, on_click)
- AddClickEvent(self.changeRoleBtn_obj, on_click)
- AddClickEvent(self.changeAccountBtn_obj, on_click)
-
- end
-
- function ServiceView:CopyInfo(copy_type)
- if copy_type == 1 then
- if not self.service_data then return end
- local str_list_1 = SplitByStr(self.service_data.link_info_1,'>')
- local final_str_list_1 = SplitByStr(str_list_1[2],'<')
- SetSystemClipboard(final_str_list_1[1])
- -- Optimizer.CopyOnPC(final_str_list_1[1])
- Message.show("复制成功,可前往粘贴~!")
- elseif copy_type == 2 then
- if not self.service_data then return end
- local str_list_2 = SplitByStr(self.service_data.link_info_2,'>')
- local final_str_list_2 = SplitByStr(str_list_2[2],'<')
- SetSystemClipboard(final_str_list_2[1])
- -- Optimizer.CopyOnPC(final_str_list_2[1])
- Message.show("复制成功,可前往粘贴~!")
- elseif copy_type == 3 then
- local str = ""
- local server_info = LoginController.Instance:GetPlatUserInfo()
- str = str.."区服信息:"..server_info.server_name.."\n"
- str = str.."角色名称:"..self.mainRoleVo.name.."\n"
- str = str.."角色ID:"..self.mainRoleVo.role_id.."\n"
- str = str.."账号:"..server_info.account
- SetSystemClipboard(str)
- -- Optimizer.CopyOnPC(str)
- Message.show("复制成功,可前往粘贴~!")
- end
- end
-
- function ServiceView:SetData()
- if self.is_loaded then
- self:UpdateView()
- else
- self.need_refreshData = true
- end
- end
-
- function ServiceView:UpdateView( )
- self:UpdateServiceInfo()
- self:UpdateRoleInfo()
- end
-
- function ServiceView:UpdateServiceInfo( )
- if not self.service_data then return end
-
- if not string.find(self.service_data.link_info_1,"@") then
- self.contact1_tmp.text = self.service_data.link_info_1
- else
- self.contact1_tmp.text = ChuanWenManager:FormatColorTag(self.service_data.link_info_1)
- end
-
- if not string.find(self.service_data.link_info_2,"@") then
- self.contact2_tmp.text = self.service_data.link_info_2
- else
- self.contact2_tmp.text = ChuanWenManager:FormatColorTag(self.service_data.link_info_2)
- end
-
- if not string.find(self.service_data.remark,"@") then
- self.contact4_tmp.text = self.service_data.remark
- else
- self.contact4_tmp.text = ChuanWenManager:FormatColorTag(self.service_data.remark)
- end
-
- self.contact5_tmp.text = string.format("客服每日<#2cf89a>%s</color>在线给您解答问题",self.service_data.work_time)
-
- if self.service_data.display_code == 1 then
- self.qr_code_obj:SetActive(true)
- lua_resM:setOutsideImageSprite(self,self.qr_code_img,GameResPath.GetSettingImage(Trim(self.service_data.code_path)))
- else
- self.qr_code_obj:SetActive(false)
- end
- end
-
- function ServiceView:UpdateRoleInfo( )
- local data = {
- id = RoleManager.Instance.mainRoleInfo.role_id,
- profile_photo_id = RoleManager.Instance.mainRoleInfo.profile_photo_id,
- level = RoleManager.Instance.mainRoleInfo.level,
- dress_board_id = RoleManager.Instance.mainRoleInfo.dress_board,
- }
- self.head_item:SetData(data)
-
- --区服信息
- local server_info = LoginController.Instance:GetPlatUserInfo()
- self.info1_tmp.text = string.format("区服信息:<#fdffc2>%s</color>",server_info.server_name)
- --账号
- self.info2_tmp.text = string.format("账号:<#fdffc2>%s</color>",server_info.account)
- --角色名称
- self.info3_tmp.text = string.format("角色名称:<#fdffc2>%s</color>",self.mainRoleVo.name)
- --角色ID
- self.info4_tmp.text = string.format("角色ID:<#fdffc2>%s</color>",self.mainRoleVo.role_id)
- end
-
- function ServiceView:__delete()
- for i, v in ipairs(self.item_list) do
- v:DeleteMe()
- end
- self.item_list = {}
- end
|