【系统弹窗】提交

dev_chengFeng
ZhangBiao 2021-03-05 17:27:57 +08:00
parent 005e54b036
commit 9792e57e9b
8 changed files with 1388 additions and 8 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: a705d039295f961489acf83dd5c12898
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -368,6 +368,7 @@ UIName = {
HongMengEnvoyUnloadPanel = 375, -- 鸿蒙碑卸载弹窗
NiuZhuanQianKunPanel = 377,--牛转钱坤界面
BattleBossInfoPanel = 379,--战斗boss详情界面
SysPanel = 380,--系统消息弹窗
}
SubUIConfig = {

View File

@ -36,9 +36,9 @@ local update = function()
-- 临时退出游戏代码
if not AppConst.isSDK and Input.GetKeyDown(UnityEngine.KeyCode.Tab) then
-- MsgPanel.ShowTwo("您确定要重新登录?", nil, function()
SysPanel.ShowTwo("您确定要重新登录?", nil, function()
Game.Logout()
-- end)
end)
end
if Input.GetMouseButtonUp(0) then

View File

@ -77,6 +77,7 @@ end
function UIManager.InitCommonPanels()
require("Modules/Message/MsgPanel")
require("Modules/Message/SysPanel")
require("Modules/Message/RequestPanel")
require("Modules/Message/LoadingPanel")
require("Modules/Message/PopupTipPanel")

View File

@ -51,7 +51,7 @@ end
--异常断线--
function Network:OnException()
MsgPanel.ShowOne("网络异常,请重新登录!", function()
SysPanel.ShowOne("网络异常,请重新登录!", function()
Game.Logout()
end)
self.bIsStartListenHeartBeat = false
@ -116,14 +116,14 @@ end
function Network:OnConnectFail()
RequestPanel.Hide()
MsgPanel.ShowOne("服务器维护中,请稍后尝试")
SysPanel.ShowOne("服务器维护中,请稍后尝试")
end
--重连3次失败
function Network:OnReconnectFail()
-- 重连时间超过2分钟强制回到登录界面
if Time.time - self.ReconnectTime > 120 then
MsgPanel.ShowTwo("重连失败,请重新登录", function()
SysPanel.ShowTwo("重连失败,请重新登录", function()
Game.Logout()
end, "重新登录")
end
@ -131,7 +131,7 @@ function Network:OnReconnectFail()
self.re_resendTimes = self.re_resendTimes + 1
if self.re_resendTimes > self.re_maxResendTimes then
RequestPanel.Hide()
MsgPanel.ShowTwo("重连失败,是否尝试重连?", function()
SysPanel.ShowTwo("重连失败,是否尝试重连?", function()
Game.Logout()
end, function()
if self.isConnected then
@ -235,7 +235,7 @@ function Network:ReceiveErrorInfo(buffer)
PopupTipPanel.ShowTip(string.format(errorCfg.Desc, unpack(msg.errParams)))
elseif errorCfg.ShowType == 2 then --弹窗
local contexts = string.split(errorCfg.Desc, "#") --标题#内容
MsgPanel.ShowOne(string.format(contexts[2], unpack(msg.errParams)), nil, nil, contexts[1])
SysPanel.ShowOne(string.format(contexts[2], unpack(msg.errParams)), nil, nil, contexts[1])
else
PopupTipPanel.ShowTip(msg.errMsg)
end
@ -302,7 +302,7 @@ function Network:Update()
MyPCall(self.sendFunc)
elseif self.resendTimes == self.maxResendTimes then
RequestPanel.Hide()
MsgPanel.ShowTwo("请求失败,请再次尝试!", function()
SysPanel.ShowTwo("请求失败,请再次尝试!", function()
Game.Logout()
end, function()
-- if self:IsSending() then

View File

@ -0,0 +1,96 @@
require("Base/BasePanel")
SysPanel = Inherit(BasePanel)
local str1 = Language[10508]
local str2 = Language[11350]
local str3 = Language[11351]
--初始化组件(用于子类重写)
function SysPanel:InitComponent()
SysPanel.btn_Left = Util.GetGameObject (self.transform, "buttom/op/btnLeft")
SysPanel.txt_BtnLeft = Util.GetGameObject (SysPanel.btn_Left, "Text"):GetComponent("Text")
SysPanel.btn_Right = Util.GetGameObject (self.transform, "buttom/op/btnRight")
SysPanel.txt_BtnRight = Util.GetGameObject (SysPanel.btn_Right, "Text"):GetComponent("Text")
SysPanel.title = Util.GetGameObject (self.transform, "buttom/title"):GetComponent("Text")
SysPanel.tipLabel = Util.GetGameObject (self.transform, "buttom/content"):GetComponent("Text")
SysPanel._toggle= Util.GetGameObject (self.transform, "buttom/Toggle"):GetComponent("Toggle")
SysPanel._toggleText= Util.GetGameObject (self.transform, "buttom/Toggle/Text"):GetComponent("Text")
end
--绑定事件(用于子类重写)
function SysPanel:BindEvent()
Util.AddClick(SysPanel.btn_Left, SysPanel.OnLeftBtnClick)
Util.AddClick(SysPanel.btn_Right, SysPanel.OnRightBtnClick)
end
--界面关闭时调用(用于子类重写)
function SysPanel:OnClose()
end
--界面销毁时调用(用于子类重写)
function SysPanel:OnDestroy()
end
--左边按钮点击事件
function SysPanel.OnLeftBtnClick()
SysPanel.Hide()
if SysPanel.leftAction then
SysPanel.leftAction()
--SysPanel.leftAction = nil
end
end
--右边按钮点击事件
function SysPanel.OnRightBtnClick()
SysPanel.Hide()
if SysPanel.rightAction then
SysPanel.rightAction(SysPanel._toggle.isOn)
--SysPanel.rightAction = nil
end
end
--展示一个按钮
function SysPanel.ShowOne(msg, action, text, title)
UIManager.OpenPanel(UIName.SysPanel)
SysPanel.leftAction = action
SysPanel.txt_BtnLeft.text = text and text or str1
SysPanel.tipLabel.text = msg
SysPanel.title.text = title and title or str3
SysPanel.btn_Left.gameObject:SetActive(true)
SysPanel.btn_Right.gameObject:SetActive(false)
SysPanel._toggle.gameObject:SetActive(false)
end
--展示两个按钮
function SysPanel.ShowTwo(msg, leftAction, rightAction, leftText, rightText, title,isShowToggle,toggleText)
UIManager.OpenPanel(UIName.SysPanel)
SysPanel.leftAction = leftAction
SysPanel.rightAction = rightAction
SysPanel.txt_BtnLeft.text = leftText and leftText or str2
SysPanel.txt_BtnRight.text = rightText and rightText or str1
SysPanel.title.text = title and title or str3
SysPanel.tipLabel.text = msg;
SysPanel.btn_Left.gameObject:SetActive(true)
SysPanel.btn_Right.gameObject:SetActive(true)
if(isShowToggle) then
SysPanel._toggle.gameObject:SetActive(true)
if(toggleText) then
SysPanel._toggleText.text=toggleText
else
SysPanel._toggleText.text=Language[11352]
end
else
SysPanel._toggle.gameObject:SetActive(false)
end
end
function SysPanel.Hide()
SysPanel:ClosePanel()
end
return SysPanel

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 98c6bff80345fda4aa971928e2bb0e84
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: