增加客服

This commit is contained in:
衡凯 2026-06-28 01:22:23 +08:00
parent ca47c8e835
commit 631e459606
7 changed files with 157 additions and 4 deletions

View file

@ -208,7 +208,7 @@ function MainLineTaskOBJ:getTaskView(actor)
desc = task.doingDesc or desc
elseif status == self.STATUS_FINISH or (task and task.finish) then
statusText = "已完成"
desc = task.desc or "主线任务已完成。"
desc = task.desc or "联系客服:微信 ly8238791"
end
local rewardItems, rewardMoneys = self:getRewardView(task)
return {

View file

@ -37,6 +37,7 @@ CreateTopIconOBJ.cfg = {
{
icon = "a7",
name = "Service",
client_open = "ServiceOBJ",
},
{
icon = "a10",

View file

@ -0,0 +1,62 @@
local ui = {}
local _V = function(...) return SL:GetMetaValue(...) end
local FUNCQUEUE = {}
local TAGOBJ = {}
function ui.init(parent, __data__, __update__)
if __update__ then return ui.update(__data__) end
-- Create Layer
local Layer = GUI:Node_Create(parent, "Layer", 0, 0)
GUI:setTag(Layer, -1)
-- Create bg_close
local bg_close = GUI:Layout_Create(Layer, "bg_close", 0, 0, 0, 0, false)
GUI:Layout_setBackGroundColorType(bg_close, 1)
GUI:Layout_setBackGroundColor(bg_close, "#000000")
GUI:Layout_setBackGroundColorOpacity(bg_close, 0)
GUI:setAnchorPoint(bg_close, 0.00, 0.00)
GUI:setTouchEnabled(bg_close, true)
GUI:setTag(bg_close, -1)
-- Create nd_root
local nd_root = GUI:Node_Create(Layer, "nd_root", 0, 0)
GUI:setTag(nd_root, -1)
-- Create img_bg
local img_bg = GUI:Image_Create(nd_root, "img_bg", 0, 0, "res/custom/48/bg.png")
GUI:setAnchorPoint(img_bg, 0.50, 0.50)
GUI:setTouchEnabled(img_bg, true)
GUI:setTag(img_bg, -1)
-- Create btn_service
local btn_service = GUI:Button_Create(img_bg, "btn_service", 198, 58, "res/custom/48/btn.png")
GUI:Button_setTitleText(btn_service, [[]])
GUI:Button_setTitleColor(btn_service, "#ffffff")
GUI:Button_setTitleFontSize(btn_service, 16)
GUI:Button_titleEnableOutline(btn_service, "#000000", 1)
GUI:setAnchorPoint(btn_service, 0.50, 0.50)
GUI:setTouchEnabled(btn_service, true)
GUI:setTag(btn_service, -1)
-- Create btn_close
local btn_close = GUI:Button_Create(img_bg, "btn_close", 381, 329, "res/public/1900000510.png")
GUI:Button_loadTexturePressed(btn_close, "res/public/1900000511.png")
GUI:Button_setTitleText(btn_close, [[]])
GUI:Button_setTitleColor(btn_close, "#ffffff")
GUI:Button_setTitleFontSize(btn_close, 16)
GUI:Button_titleEnableOutline(btn_close, "#000000", 1)
GUI:setAnchorPoint(btn_close, 0.00, 0.00)
GUI:setTouchEnabled(btn_close, true)
GUI:setTag(btn_close, 0)
ui.update(__data__)
return Layer
end
function ui.update(data)
for _, func in pairs(FUNCQUEUE) do
if func then func(data) end
end
end
return ui

View file

@ -13,6 +13,9 @@ end
TaskShowOBJ.UIfile = getUifile()
TaskShowOBJ.mainLineData = nil
local CUSTOMER_WECHAT = "ly8238791"
local CUSTOMER_QRCODE = "res/custom/wxcode.png"
local CUSTOMER_QRCODE_SIZE = 78
local function canRouteMainLine(data)
return data ~= nil and tonumber(data.status or 0) == 0 and not data.finish
@ -21,7 +24,7 @@ end
local function getShortDesc(data)
local status = tonumber(data.status or 0) or 0
if data.finish then
return "主线任务已完成"
return "联系客服:"
end
if status == 1 then
return "任意地图击杀怪物"
@ -84,6 +87,44 @@ function TaskShowOBJ:updateMainLineTouch(data)
end
end
function TaskShowOBJ:updateMainLineLayout(isFinish)
if not self.ui then
return
end
if GUI:Win_IsNotNull(self.ui.TaskTitle_Text) then
GUI:setVisible(self.ui.TaskTitle_Text, not isFinish)
end
if GUI:Win_IsNotNull(self.ui.TaskStatus_Text) then
GUI:setVisible(self.ui.TaskStatus_Text, not isFinish)
end
if GUI:Win_IsNotNull(self.ui.TaskDesc_Text) then
GUI:setPosition(self.ui.TaskDesc_Text, 8, isFinish and 158 or 134)
end
if GUI:Win_IsNotNull(self.ui.TaskProgress_Text) then
GUI:setPosition(self.ui.TaskProgress_Text, 8, isFinish and 137 or 104)
end
if GUI:Win_IsNotNull(self.ui.TaskReward_Text) then
GUI:setPosition(self.ui.TaskReward_Text, 8, isFinish and 116 or 75)
end
if GUI:Win_IsNotNull(self.ui.RewardItems_Layout) then
GUI:setPosition(self.ui.RewardItems_Layout, 8, isFinish and 24 or 6)
GUI:setContentSize(self.ui.RewardItems_Layout, 186, isFinish and 84 or 58)
end
end
function TaskShowOBJ:renderCustomerService()
if not self.ui or GUI:Win_IsNull(self.ui.RewardItems_Layout) then
return
end
local qrX = 54
local qrY = 2
local CustomerQRCode_Image = GUI:Image_Create(self.ui.RewardItems_Layout, "CustomerQRCode_Image", qrX, qrY, CUSTOMER_QRCODE)
if GUI:Win_IsNotNull(CustomerQRCode_Image) then
GUI:setIgnoreContentAdaptWithSize(CustomerQRCode_Image, false)
GUI:setContentSize(CustomerQRCode_Image, CUSTOMER_QRCODE_SIZE, CUSTOMER_QRCODE_SIZE)
end
end
function TaskShowOBJ:main()
local parent = GUI:Win_FindParent(110)
if GUI:Win_IsNotNull(parent) then
@ -122,6 +163,7 @@ function TaskShowOBJ:renderMainLine(data)
self:updateMainLineTouch(nil)
return
end
self:updateMainLineLayout(data.finish)
if GUI:Win_IsNotNull(self.ui.TaskTitle_Text) then
GUI:Text_setString(self.ui.TaskTitle_Text, data.title or "[主线]任务")
end
@ -134,15 +176,22 @@ function TaskShowOBJ:renderMainLine(data)
if GUI:Win_IsNotNull(self.ui.TaskProgress_Text) then
local need = tonumber(data.need or 0) or 0
local progress = tonumber(data.progress or 0) or 0
local progressText = need > 0 and string.format("进度:%d/%d", progress, need) or "进度:已完成"
local progressText = "微信:" .. CUSTOMER_WECHAT
if not data.finish then
progressText = need > 0 and string.format("进度:%d/%d", progress, need) or "进度:已完成"
end
GUI:Text_setString(self.ui.TaskProgress_Text, progressText)
end
if GUI:Win_IsNotNull(self.ui.TaskReward_Text) then
GUI:Text_setString(self.ui.TaskReward_Text, "奖励:")
GUI:Text_setString(self.ui.TaskReward_Text, data.finish and "扫码联系客服:" or "奖励:")
end
self:updateMainLineTouch(data)
if GUI:Win_IsNotNull(self.ui.RewardItems_Layout) then
GUI:removeAllChildren(self.ui.RewardItems_Layout)
if data.finish then
self:renderCustomerService()
return
end
local items = getRewardItems(data)
if #items <= 0 then
local EmptyReward_Text = GUI:Text_Create(self.ui.RewardItems_Layout, "EmptyReward_Text", 0, 24, 12, "#ffd36a",

View file

@ -0,0 +1,41 @@
ServiceOBJ = {}
ServiceOBJ.__cname = "ServiceOBJ"
ServiceOBJ.UIfile = "game/Tongyong/ServiceUI"
function ServiceOBJ:main()
if GUI:Win_IsNotNull(self.__cname) then
GUI:Win_Close(self.__cname)
end
local parent = GUI:Win_Create(self.__cname, 0, 0, 0, 0, false, false, true, false)
if not parent then
return false
end
GUI:LoadExport(parent, self.UIfile)
self._parent = parent
self.ui = GUI:ui_delegate(parent)
ssrUIManager:OpenAlgin(self)
if GUI:Win_IsNotNull(self.ui.bg_close) then
GUI:addOnClickEvent(self.ui.bg_close, function()
GUI:Win_Close(self._parent)
end)
end
if GUI:Win_IsNotNull(self.ui.btn_close) then
GUI:addOnClickEvent(self.ui.btn_close, function()
GUI:Win_Close(self._parent)
end)
end
if GUI:Win_IsNotNull(self.ui.btn_service) then
GUI:addOnClickEvent(self.ui.btn_service, function()
SL:JumpTo(701)
end)
end
end
return ServiceOBJ

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB