From b181f4bd55c49be8a411cd5595fc31ea1465dce1 Mon Sep 17 00:00:00 2001 From: gaoxin Date: Fri, 29 Oct 2021 12:08:40 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90GM=E3=80=91=E6=B7=BB=E5=8A=A0=E4=B8=80?= =?UTF-8?q?=E4=BA=9BGM=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../~Lua/Modules/Chat/ChatManager.lua | 6 ++-- .../~Lua/Modules/Main/GMPanel.lua | 29 +++++++++++++------ 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/Chat/ChatManager.lua b/Assets/ManagedResources/~Lua/Modules/Chat/ChatManager.lua index 0c46a4e43c..13cf4dbc25 100644 --- a/Assets/ManagedResources/~Lua/Modules/Chat/ChatManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Chat/ChatManager.lua @@ -214,13 +214,15 @@ function this.RequestSendChatMsg(channel, content, func) end -- -function this.RequestGMCommand(command) - +function this.RequestGMCommand(command, func) -- 世界发言消息特殊处理 local content = string.format("%d|%s", GLOBAL_CHAT_TYPE.COMMON, command) -- 请求发送 NetManager.RequestSendChatMsg(CHAT_CHANNEL.GLOBAL, content, 0, function(msg) PopupTipPanel.ShowTip(Language[10358]) + if func then + func() + end end) end diff --git a/Assets/ManagedResources/~Lua/Modules/Main/GMPanel.lua b/Assets/ManagedResources/~Lua/Modules/Main/GMPanel.lua index 60f9f8e9bf..af372098d2 100644 --- a/Assets/ManagedResources/~Lua/Modules/Main/GMPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Main/GMPanel.lua @@ -34,6 +34,7 @@ local GMType = { local GMSubType = { Server = 1, Func = 2, + Chat = 3, } local _GMConfig = {} @@ -79,6 +80,7 @@ function GMPanel:InitComponent() {type = GMType.Player, subType = GMSubType.Func, inputNum = 1, args = "", btnTip = "批量生成英雄", inputTip = {"英雄ID#星级|..."}, callBack = this.GetManyHeros}, {type = GMType.Player, subType = GMSubType.Server, inputNum = 1, args = "9#%s#0", btnTip = "通关关卡", inputTip = {"关卡id"}, callBack = nil}, {type = GMType.Player, subType = GMSubType.Server, inputNum = 1, args = "3#1#%s", btnTip = "发送邮件", inputTip = {"id,num|id,num..."}, callBack = nil}, + {type = GMType.Player, subType = GMSubType.Chat, inputNum = 1, args = "//soul %s", btnTip = "加宝物", inputTip = {"魂宝id#强化等级#精炼等级"}, callBack = nil}, {type = GMType.Player, subType = GMSubType.Server, inputNum = 0, args = "8#1#1", btnTip = "通关所有关卡", inputTip = {}, callBack = nil}, -- {type = GMType.Player, subType = GMSubType.Server, inputNum = 0, args = "6#0#0", btnTip = "一键物品", inputTip = {""}, callBack = nil}, -- {type = GMType.Player, subType = GMSubType.Server, inputNum = 0, args = "22#0#0", btnTip = "一键异妖", inputTip = {""}, callBack = nil}, @@ -88,13 +90,19 @@ function GMPanel:InitComponent() {type = GMType.Player, subType = GMSubType.Func, inputNum = 0, args = "", btnTip = "生成顶级装备", inputTip = {""}, callBack = this.GetEquipe}, {type = GMType.Player, subType = GMSubType.Func, inputNum = 0, args = "", btnTip = "生成很多物品", inputTip = {""}, callBack = this.GetAllItems}, {type = GMType.Player, subType = GMSubType.Func, inputNum = 0, args = "", btnTip = "鑫鹏的gm", inputTip = {""}, callBack = this.SendToXinPeng}, + {type = GMType.Function, subType = GMSubType.Server, inputNum = 1, args = "16#%s#0", btnTip = "跳转", inputTip = {"输入兽潮层数"}, callBack = nil}, {type = GMType.Function, subType = GMSubType.Server, inputNum = 1, args = "15#%s#0", btnTip = "获取", inputTip = {"孙龙秘宝积分"}, callBack = this.SetSunLongScroe}, {type = GMType.Function, subType = GMSubType.Server, inputNum = 1, args = "23#0#%s", btnTip = "获取", inputTip = {"天宫秘宝积分"}, callBack = nil}, {type = GMType.Function, subType = GMSubType.Server, inputNum = 1, args = "24#%s", btnTip = "逍遥游", inputTip = {"类型#mapId#bossId"}, callBack = nil}, {type = GMType.Function, subType = GMSubType.Server, inputNum = 1, args = "25#%s#1", btnTip = "山河社稷图", inputTip = {"小关卡ID"}, callBack = nil}, {type = GMType.Function, subType = GMSubType.Server, inputNum = 1, args = "14#%s#0", btnTip = "跳转", inputTip = {"试炼副本层数"}, callBack = nil}, - {type = GMType.Function, subType = GMSubType.Func, inputNum = 1, args = "", btnTip = "添加圣物", inputTip = {"输入圣物ID"}, callBack = this.AddHoly}, + {type = GMType.Function, subType = GMSubType.Chat, inputNum = 1, args = "//addholy %s", btnTip = "添加圣物", inputTip = {"输入圣物ID"}, callBack = nil}, + {type = GMType.Function, subType = GMSubType.Chat, inputNum = 1, args = "//fourspirit %s", btnTip = "四灵通关层数", inputTip = {"人#佛#妖#道"}, callBack = function() NetManager.GetFourElementGetInfo() end}, + {type = GMType.Function, subType = GMSubType.Chat, inputNum = 1, args = "//guildskilllevel %s", btnTip = "公会技能等级", inputTip = {"技能1#技能2#技能3#技能4"}, callBack = function() NetManager.GetAllGuildSkillData() end}, + {type = GMType.Function, subType = GMSubType.Chat, inputNum = 1, args = "//xiuxing %s", btnTip = "修行境界", inputTip = {"修行境界id"}, callBack = function(id) PracticeManager.UpdataFromServer(tonumber(id)) end}, + {type = GMType.Function, subType = GMSubType.Chat, inputNum = 1, args = "//godtree %s", btnTip = "建木神树等级", inputTip = {"神树等级"}, callBack = function(id) SacredTreeManager.treeLevel = tonumber(id) end}, + {type = GMType.Function, subType = GMSubType.Chat, inputNum = 1, args = "//xuanyuan %s", btnTip = "轩辕宝镜跳关", inputTip = {"副本类型#副本id"}, callBack = function() NetManager.GetSituationInfoRequest() end}, {type = GMType.Function, subType = GMSubType.Func, inputNum = 1, args = "", btnTip = "跳转测试", inputTip = {"输入跳转ID"}, callBack = this.TestJump}, {type = GMType.Function, subType = GMSubType.Func, inputNum = 2, args = "", btnTip = "功能引导测试", inputTip = {"请输入功能ID", "1去主界面2去挂机界面"}, callBack = this.TestFuncGuide}, @@ -351,14 +359,6 @@ end function this.OpenRedDebug() UIManager.OpenPanel(UIName.RedpotDebugPanel) end --- 添加圣物 -function this.AddHoly(text) - local command = "//addholy %s %s" - command = string.format(command, PlayerManager.uid, text) - Log(command) - ChatManager.RequestGMCommand(command) -end - -- 进入战斗测试场景 function this.GoTestBattle() UIManager.OpenPanel(UIName.BattleTestPanel) @@ -486,6 +486,17 @@ function GMPanel:OnOpen(...) config.callBack(unpack(args)) end PopupTipPanel.ShowTip("GM应用成功") + elseif config.subType == GMSubType.Chat then + -- 替换uid + local formatStr = string.gsub(config.args, "", PlayerManager.uid) + -- 参数赋值 + local gmstr = string.format(formatStr, unpack(args)) + ChatManager.RequestGMCommand(gmstr, function() + if config.callBack then + config.callBack(unpack(args)) + end + PopupTipPanel.ShowTip("GM应用成功") + end) end end) end