传奇996_53——后端ui窗口局部刷新
-- 模块名:富豪捐献
--个人封装函数
require("Envir/Market_Def/newfunction/util/myUseFunction.lua")
local zhi_fu_table = {
[1] = {
[1] = "zf0.png",
[2] = "zf1.png",
},
[2] = {
[1] = "hb0.png",
[2] = "hb1.png",
},
[3] = {
[1] = "wx0.png",
[2] = "wx1.png",
}
}
-- 主界面设置按钮,点击调用方法,方法最后返回到主界面,方法中给变量加值,主界面会加上这个值,但是如何刷新呢?
-- 点击弹窗中的按钮,做到刷新,点击按钮,更新值,并返回到主界面,前提是要更新值,直接返回主界面也行,如果这个主界面的choose !=null,说明值改变,说明要更新串窗口变量,但是这样战线有点长
-- 还是更新值再返回主界面吧,更合理
-- <Button|x=642.0|y=439.0|nimg=public_new/fhjx/2.png|submitInput=1|link=@fhjx_quick,]]..(choose or 0)..[[>
-- 不用win_flag参数传递,而是用变量传递判断窗口是否打开的原因是防止按钮可反复点击,但是仅仅使用变量,无法判断是否是第一次打开,这样第一次打开就会打开窗口,就是大退不知道怎么把该变量置为0,所以就之恩呢用local
-- 主界面函数
function fhjxshow(actor, win_flag)
win_flag = tonumber(win_flag) or 0
local msg = [[
<Img|x=-500.0|y=-500.0|width=2000|height=2000|img=public/1900000651_1.png>
<Img|img=public_new/fhjx/1.png|loadDelay=1|show=4|move=0|reset=1|bg=1>
<Button|x=828.0|y=71.0|nimg=public/1900000510.png|pimg=public/1900000511.png|link=@exit>
<Effect|x=-7.0|y=-36.0|scale=1|speed=1|dir=5|effectid=93121|effecttype=0|act=0>
<Effect|x=765.0|y=419.0|scale=1|speed=1|dir=5|effectid=93122|effecttype=0|act=0>
<RText|x=305.0|y=427.0|size=18|text=<RText/FCOLOR=255><灵符/FCOLOR=251>>
<Button|x=642.0|y=439.0|nimg=public_new/fhjx/2.png|submitInput=1|link=@fhjx_quick,]]..win_flag..[[>
<Input|inputid=1|x=589.0|y=365.0|width=220|height=30|color=249|type=3|size=18|maxcount=14|mincount=3|isChatInput=0|place=请输入金额>
]]
-- choose != null,说明要刷新界面
-- win_flag = tonumber(win_flag) or 0
if win_flag == 1 then
-- if getplaydef(actor, "N$窗口状态") == 1 then
msg = msg..getplaydef(actor,"S$充值界面")
end
release_print("==============",msg)
say(actor,msg)
end
-- 点击触发函数
function fhjx_quick(actor,win_flag)
if win_flag == "1" then
MessageUtil.sendItemWanning(actor,"请先完成当前支付")
return
end
-- if getplaydef(actor, "N$窗口状态") == 1 then
-- end
local num = parsetext("<$NPCINPUT(1)>", actor)
if num == nil or num == "" or tonumber(num) <= 0 then
MessageUtil.sendItemWanning(actor,"请输入正确金额!")
return
end
-- 拉起充值界面
open_chongzhi_ui(actor, 0, num)
-- setplaydef(actor, "S$充值类型","富豪捐献")
-- -- lualib:SetVar(player, "T202", "在线充值")
-- local itemid = ItemUtil.getItemIdByName("灵符")
-- pullpay(player, num, pay_type, itemid7)
-- return fhjxshow(actor,1)
end
-- 局部窗口变量函数
function open_chongzhi_ui(actor, choose, num)
local msg = [[
<Img|x=208.0|y=84.0|esc=0|bg=1|img=public/zxcz/zjm.png>
<Text|x=464.0|y=118.0|color=0|size=18|text=富豪捐献>
<Text|x=464.0|y=162.0|color=0|size=18|text=¥]]..num..[[>
<Text|x=464.0|y=200.0|color=22|size=18|text=¥]]..num..[[>
<Button|x=607.0|y=91.0|nimg=public_new/common/close.png|link=@fhjxshow,0>
]]
-- local
local zhifu_show
local zhifu_show_x = 246
choose = tonumber(choose) or 0
for i = 1, 3 do
if choose == i then
zhifu_show = zhi_fu_table[i][2]
else
zhifu_show = zhi_fu_table[i][1]
end
-- msg = msg..'<Button|x='..zhifu_show_x..'|y=301.0|color=255|size=18|nimg=public_new/common/'..zhifu_show..'|link=@update_win,'..i..'>'
msg = msg..'<Button|x='..zhifu_show_x..'|y=281.0|color=255|size=18|pimg=public_new/common/'..zhifu_show..'|nimg=public_new/common/'..zhifu_show..'|link=@open_chongzhi_ui,'..i..','..num..'>'
zhifu_show_x = zhifu_show_x + 124
end
setplaydef(actor, "S$充值界面",msg)
-- setplaydef(actor, "N$窗口状态",1)
return fhjxshow(actor, 1)
end