-- int ADD_ITEM = 1;//添加道具 -- int ADD_CARD = 2; //添加卡牌 -- int SEND_MAIIL = 3;// 发送邮件 -- int HERO_STAR = 4;// 添加指定星级英雄 -- int OPEN_MAP = 5; // 开启到指定关卡 -- int ONE_KEY_ITEM_OR_HERO = 6; -- int USER_UP_LEVE = 7; // 玩家升级 -- int ADOPT_ALL_DIFFICULTY = 8; // 通过所有关卡 -- int ADOPT_FIGHT_BY_VALUE = 9; //开启对应的关卡 -- int TIME_INFO = 10; // 根据等级开启对应的关卡 -- int VIP_LEVEL = 11; // 根据等级开启对应的关卡 -- int RESET_USER_NAME = 12; -- int CREATE_INVADE = 13; //生成外敌 -- int SET_TOWER_NUMBER = 14;//设置试炼副本进入层数 -- int TREASURE_SCORE = 15;//生成孙龙宝藏积分 -- int MONSTER_JUMP = 16;//跳到兽潮层 -- int OUT_BLOODY_BATTLE = 17;//退出血战 -- int MISSION_LEAD = 18;//任务指引 -- int ESPECIAL_EQUIP = 19;//增加法宝,星级 -- int TREASURE_FINISH = 20;//戒灵秘宝一键完成 -- int FULL_OF = 21; //一键全满 -- int EXPEDITION_SCORE = 23;//天宫秘宝积分 -- int JOURNEY_GM = 24;//逍遥游GM操作 -- // int TECNOLOGY_MAX = 21;//科技树一键满级 -- // int POKEMAN_MAX = 22;//一键获得所有满级异妖 local GMType = { Player = 1, Function = 2, Battle = 3, } local GMSubType = { Server = 1, Func = 2, Chat = 3, } local _GMConfig = {} require("Base/BasePanel") GMPanel = Inherit(BasePanel) local this = GMPanel local heroList = { "4#10001#10","4#10002#10","4#10003#10","4#10004#10","4#10005#10","4#10006#10", "4#10007#10","4#10008#10","4#10009#10","4#10010#10","4#10011#10","4#10012#10", "4#10013#10","4#10014#10","4#10015#10","4#10016#10","4#10017#10","4#10018#10", "4#10019#10","4#10020#10","4#10021#10","4#10022#10","4#10023#10","4#10024#10", "4#10025#10","4#10026#10","4#10027#10","4#10028#10","4#10029#10","4#10030#10", "4#10031#10","4#10032#10","4#10033#10","4#10034#10","4#10035#10","4#10036#10", "4#10037#10","4#10038#10","4#10039#10","4#10041#10","4#10042#10","4#10043#10", "4#10044#10","4#10045#10","4#10046#10","4#10087#10","4#10088#10","4#10089#10", "4#10085#10","4#10040#10","4#10086#10","4#10001#11","4#10043#11","4#10011#11", "4#10013#11","4#10020#11","4#10087#11","4#10012#11","4#10015#11","4#10040#11", "4#10014#11","4#10009#11","4#10001#11","4#10022#11","4#10023#11","4#10086#11", "4#10089#11","4#10092#11","4#10006#11","4#10008#11","4#10085#11","4#10011#11", "4#10091#11","4#10090#11","4#10088#11","4#10041#11","4#10026#11","4#10016#11", "4#10017#11","4#10087#11","4#10021#11","4#10004#11","4#10007#11","4#10010#11", "4#10012#11","4#10015#11","4#10033#11","4#10020#11","4#10002#11","4#10003#11", "4#10005#11","4#10018#11","4#10019#11","4#10024#11","4#10042#11","4#10043#11","4#10013#11", } local baowuList = { "1#100001#40", "1#100002#40", "1#100003#40", "1#100004#40", "1#100005#40", "1#100006#40", "1#100007#40", "1#100008#40", "1#100009#40", "1#100010#40", "1#100011#40", "1#100012#40", "1#100013#40", "1#100014#40", "1#100015#40", "1#100016#40", "1#100017#40", "1#100018#40", "1#100019#40", "1#100020#40", "1#100021#40", "1#100022#40", "1#100023#40", "1#100024#40", "1#100025#40", "1#100026#40", "1#100027#40", "1#100028#40", "1#100029#40", "1#100030#40", "1#100031#40", "1#100032#40", "1#100033#40", "1#100034#40", "1#100035#40", "1#100036#40", "1#100037#40", "1#100038#40", "1#100039#40", "1#100040#40", "1#32#9999999", "1#29#9999999", } local equipeList = { "1#60001#6","1#60002#6","1#60034#6","1#60035#6","1#60067#6","1#60068#6","1#60069#6","1#60100#6","1#60101#6","1#60102#6","1#60103#6","1#60155#6","1#60156#6", "1#60157#6","1#60158#6","1#60159#6","1#60160#6","1#60016#6","1#60017#6","1#60049#6","1#60050#6","1#60082#6","1#60083#6","1#60084#6","1#60125#6","1#60126#6", "1#60127#6","1#60128#6","1#60180#6","1#60181#6","1#60182#6","1#60183#6","1#60184#6","1#60185#6","1#60022#6","1#60023#6","1#60055#6","1#60056#6","1#60088#6", "1#60089#6","1#60090#6","1#60135#6","1#60136#6","1#60137#6","1#60138#6","1#60190#6","1#60191#6","1#60192#6","1#60193#6","1#60194#6","1#60200#6","1#60025#6", "1#60026#6","1#60058#6","1#60059#6","1#60091#6","1#60092#6","1#60093#6","1#60140#6","1#60141#6","1#60142#6","1#60144#6","1#60195#6","1#60196#6","1#60197#6", "1#60198#6","1#60199#6","1#60201#6","1#60161#6","1#60162#6","1#60163#6","1#60164#6","1#60165#6","1#60166#6","1#60186#6","1#60187#6","1#60188#6","1#60189#6", "1#60178#6","1#60179#6","1#60202#6","1#60203#6","1#60204#6","1#60205#6","1#60206#6","1#60207#6","1#60208#6","1#60209#6","1#60210#6","1#60211#6","1#60212#6","1#60213#6", } local moneyList = {"1#14#100000000","1#16#100000000","1#4#100000000","1#19#100000000","1#20#100000000","1#21#100000000","1#23#100000000","1#26#100000000","1#29#100000000","1#32#100000000","1#66#100000000", "1#69#100000000","1#74#100000000","1#79#100000000","1#80#100000000","1#87#100000000","1#1001#100000000","1#1201#100000000","1#1202#100000000","1#1203#100000000","1#1204#100000000", "1#1205#100000000","1#1206#100000000","1#1207#100000000","1#1208#100000000","1#1210#100000000","1#1211#100000000","1#1220#100000000","1#1228#100000000" ,"1#1229#100000000","1#1230#100000000","1#1231#100000000","1#1232#100000000","1#1240#100000000","1#1241#100000000","1#1242#100000000","1#1273#100000000"} --初始化组件(用于子类重写) function GMPanel:InitComponent() this.spLoader = SpriteLoader.New() --- --- type 所属页签的类型 player 玩家页签 Function 功能类型 Battle 战斗相关 --- subType 类型 Server 直接向服务器请求的GM Func 回调某个方法的GM --- _GMConfig = { {type = GMType.Player, subType = GMSubType.Server, inputNum = 1, args = "12#0#%s", btnTip = "改名", inputTip = {"输入名称"}, callBack = nil}, {type = GMType.Player, subType = GMSubType.Server, inputNum = 1, args = "20#0#%s", btnTip = "完成", inputTip = {"输入任务ID"}, callBack = nil}, -- {type = GMType.Player, subType = GMSubType.Server, inputNum = 1, args = "13#%s#0", btnTip = "解锁", inputTip = {"外敌ID"}, callBack = nil}, {type = GMType.Player, subType = GMSubType.Server, inputNum = 1, args = "11#%s#0", btnTip = "确定", inputTip = {"输入Vip等级"}, callBack = this.SetVip}, {type = GMType.Player, subType = GMSubType.Func, inputNum = 1, args = "7#%s#0", btnTip = "角色升级",inputTip = {"输入等级"}, callBack = this.LVPlayer}, -- {type = GMType.Player, subType = GMSubType.Server, inputNum = 1, args = "10#4#%s", btnTip = "设置服务器时间", inputTip = {"例:20170801190000"}, callBack = nil}, -- {type = GMType.Player, subType = GMSubType.Server, inputNum = 1, args = "10#%s#0", btnTip = "搜索地图", inputTip = {"输入地图Id"}, callBack = nil}, {type = GMType.Player, subType = GMSubType.Server, inputNum = 1, args = "1#%s", btnTip = "生成道具", inputTip = {"道具ID#道具数量"}, callBack = nil}, {type = GMType.Player, subType = GMSubType.Func, inputNum = 1, args = "", btnTip = "批量生成道具", inputTip = {"道具ID#道具数量|..."}, callBack = this.GetManyItems}, {type = GMType.Player, subType = GMSubType.Server, inputNum = 1, args = "4#%s", btnTip = "生成英雄", inputTip = {"英雄ID#星级"}, callBack = nil}, {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 = 1, args = "27#%s", btnTip = "批量删除道具", inputTip = {"道具ID#道具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}, {type = GMType.Player, subType = GMSubType.Func, inputNum = 0, args = "", btnTip = "全10/11英雄", inputTip = {""}, callBack = this.FiveHero}, {type = GMType.Player, subType = GMSubType.Func, inputNum = 0, args = "", btnTip = "一键很多钱", inputTip = {""}, callBack = this.GetMoney}, {type = GMType.Player, subType = GMSubType.Func, inputNum = 0, args = "", btnTip = "生成魂灵宝和材料", inputTip = {""}, callBack = this.Baowu}, {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.Player, subType = GMSubType.Func, inputNum = 0, args = "", btnTip = "一键法宝碎片", inputTip = {""}, callBack = this.GetFaBaoSuiPian}, {type = GMType.Player, subType = GMSubType.Func, inputNum = 0, args = "", btnTip = "一键变身卡", inputTip = {""}, callBack = this.GetBianshenka}, {type = GMType.Player, subType = GMSubType.Func, inputNum = 0, args = "", btnTip = "一键命石", inputTip = {""}, callBack = this.GetGem}, {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.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}, {type = GMType.Function, subType = GMSubType.Func, inputNum = 1, args = "", btnTip = "剧情测试", inputTip = {"请输入剧情ID"}, callBack = this.TestStory}, {type = GMType.Function, subType = GMSubType.Func, inputNum = 0, args = "", btnTip = "红点Debug", inputTip = {""}, callBack = this.OpenRedDebug}, {type = GMType.Battle, subType = GMSubType.Func, inputNum = 0, args = "", btnTip = "战斗测试场景", inputTip = {""}, callBack = this.GoTestBattle}, {type = GMType.Battle, subType = GMSubType.Func, inputNum = 1, args = "", btnTip = "挑战怪物", inputTip = {"输入怪物组id"}, callBack = this.ChallengeMonster}, {type = GMType.Battle, subType = GMSubType.Func, inputNum = 1, args = "", btnTip = "测试假战斗", inputTip = {"输入假战斗id"}, callBack = this.RunFakeBattle}, {type = GMType.Battle, subType = GMSubType.Func, inputNum = 2, args = "", btnTip = "演算战斗数据", inputTip = {"战斗数据", "时间戳"}, callBack = this.RunBattleData}, {type = GMType.Battle, subType = GMSubType.Func, inputNum = 2, args = "", btnTip = "快速战斗数据", inputTip = {"战斗数据", "时间戳"}, callBack = this.QuickRunBattleData}, {type = GMType.Battle, subType = GMSubType.Func, inputNum = 2, args = "", btnTip = "演算后端战斗", inputTip = {"GM格式:IP地址:端口", "输入战斗id"}, callBack = this.RunServerBattle}, } this.BtnBack = Util.GetGameObject(self.transform, "btnBack") this.serverNowTimeText = Util.GetGameObject(self.gameObject, "TimeCtrl/Text (1)"):GetComponent("Text") this.serverOpenTimeText = Util.GetGameObject(self.gameObject, "TimeCtrl/Text (3)"):GetComponent("Text") this.serverCreateRoleTimeText = Util.GetGameObject(self.gameObject, "TimeCtrl/Text (5)"):GetComponent("Text") this.updateServerNowTimeText = Util.GetGameObject(self.gameObject, "TimeCtrl/InputField/Text"):GetComponent("Text") this.btnSureChange = Util.GetGameObject(self.transform, "TimeCtrl/Button") this.btnRefreshServerTime = Util.GetGameObject(self.transform, "TimeCtrl/Button2") this._GMItemList = {} this._GMItemRoot = {} this._GMTypeBtn = {} for _, type in pairs(GMType) do this._GMItemRoot[type] = Util.GetGameObject(self.gameObject, "list"..type) this._GMTypeBtn[type] = Util.GetGameObject(self.gameObject, "btn"..type) end this._GMItem = Util.GetGameObject(self.gameObject, "item") end function GMPanel.LVPlayer(lv) NetManager.GMEvent(string.format("7#%s#0",lv)) local cor = coroutine.start(function() coroutine.wait(1) Game.GlobalEvent:DispatchEvent(GameEvent.Player.OnLevelChange) --LogGreen("升级了") end) end --绑定事件(用于子类重写) function GMPanel:BindEvent() Util.AddClick(this.BtnBack, function() PlaySoundWithoutClick(SoundConfig.Sound_UICancel) self:ClosePanel() end) Util.AddClick(this.btnSureChange, function() NetManager.GMEvent("10#4#" .. this.updateServerNowTimeText.text) end) Util.AddClick(this.btnRefreshServerTime, function() this.RefreshServerTime() end) -- for _, type in pairs(GMType) do this._GMTypeBtn[type] = Util.GetGameObject(self.gameObject, "btn"..type) Util.AddOnceClick(this._GMTypeBtn[type], function() for _, type2 in pairs(GMType) do this._GMItemRoot[type2]:SetActive(type == type2) end end) end end function this.GetManyItems(text) if text == "一键装备" then local config = ConfigPairs(ConfigManager.GetConfig(ConfigName.EquipConfig)) local cor = coroutine.start(function() for k,v in (config) do if v.Position < 5 then local str = "1#" .. v.Id .."#" .. 1 NetManager.GMEvent(str) coroutine.wait(0.1) end end end) return end if text == "一键宝器" then local config = ConfigPairs(ConfigManager.GetConfig(ConfigName.JewelConfig)) local cor = coroutine.start(function() for k,v in (config) do local str = "1#" .. v.Id .."#" .. 10 NetManager.GMEvent(str) coroutine.wait(0.1) end end) return end if text == "一键魂印" then local config = ConfigPairs(ConfigManager.GetConfig(ConfigName.EquipConfig)) local cor = coroutine.start(function() for k,v in (config) do if v.Position == 5 then local str = "1#" .. v.Id .."#" .. 1 NetManager.GMEvent(str) coroutine.wait(0.1) end end end) return end if text == "一键灵兽" then local config = ConfigPairs(ConfigManager.GetConfig(ConfigName.SpiritAnimal)) local cor = coroutine.start(function() for k,v in (config) do local str = "1#" .. v.Id .."#" .. 1 NetManager.GMEvent(str) coroutine.wait(0.1) end end) return end if text == "一键法宝之灵" then local config = (ConfigManager.TryGetAllConfigsDataByKey(ConfigName.ItemConfig,"ItemType",ItemType.talismanSoulChip)) local cor = coroutine.start(function() for k,v in ipairs(config) do local str = "1#" .. v.Id .."#" .. 500 NetManager.GMEvent(str) coroutine.wait(0.1) end end) return end if text == "一键变身卡" then local config = (ConfigManager.TryGetAllConfigsDataByKey(ConfigName.ItemConfig,"ItemType",ItemType.Incarnation)) local cor = coroutine.start(function() for k,v in ipairs(config) do local str = "1#" .. v.Id .."#" .. 1 NetManager.GMEvent(str) coroutine.wait(0.1) end end) return end if text and text ~= "" then local list = string.split(text, "|") local cor = coroutine.start(function() for _, str in ipairs(list) do local item = string.split(str, "#") local itemid = tonumber(item[1]) if not itemid then local config = ConfigManager.GetConfigDataByKey(ConfigName.ItemConfig,"Name",item[1]) if config then itemid = config.Id else itemid = nil end end if itemid then local str1 = "1#" .. itemid .."#" .. item[2] NetManager.GMEvent(str1) coroutine.wait(0.1) end end --LogGreen("物品批量生成完成") end) end end function this.GetManyHeros(text) if text and text ~= "" then local list = string.split(text, "|") local cor = coroutine.start(function() for _, str in ipairs(list) do local item = string.split(str, "#") local itemid = tonumber(item[1]) if not itemid then local config = ConfigManager.GetConfigDataByKey(ConfigName.HeroConfig,"ReadingName",item[1]) if config then itemid = config.Id else itemid = 0 end end if itemid and itemid < 10 and itemid > 0 then for k,v in ConfigPairs(ConfigManager.GetConfig(ConfigName.HeroConfig)) do if v.PropertyName == itemid and v.MaxRank >= tonumber(item[2]) and v.Star <= tonumber(item[2]) then local str1 = "4#" .. v.Id .."#" .. item[2] NetManager.GMEvent(str1) coroutine.wait(0.1) end end elseif itemid and itemid > 0 then local str1 = "4#" .. itemid .."#" .. item[2] NetManager.GMEvent(str1) coroutine.wait(0.1) end end --LogGreen("英雄批量生成完成") end) end end function this.SendToXinPeng() NetManager.GMEvent("26") end -- 设置孙龙积分 function this.SetSunLongScroe(text) TreasureOfSomebodyManagerV2.SetCurrentLevel(tonumber(text)) end --设置vip function this.SetVip(text) VipManager.SetVipLevel(tonumber(text)) end -- 一键五个银熊 function this.FiveHero() for i=1, #heroList do NetManager.GMEvent(heroList[i]) end end -- 一键几个宝物 function this.Baowu() for i=1, #baowuList do NetManager.GMEvent(baowuList[i]) end end -- 一键顶级装备 function this.GetEquipe() for i=1, #equipeList do NetManager.GMEvent(equipeList[i]) end end -- 一键好多物品 function this.GetAllItems() local ic = ConfigManager.GetConfig(ConfigName.ItemConfig) local i = 0 coroutine.start(function() for id, value in ConfigPairs(ic) do i = i + 1 if i >= 100 then break end NetManager.GMEvent("1#"..id.."#1000000") coroutine.wait(0.01) end end) end -- 一键很多钱 function this.GetMoney() local index = 1 local time = Timer.New(function () NetManager.GMEvent(moneyList[index]) index = index + 1 end, 0.5, 10, true) time:Start() end -- 一键法宝碎片 function this.GetFaBaoSuiPian() local ic = ConfigManager.GetConfig(ConfigName.ItemConfig) local i = 0 coroutine.start(function() for _, configInfo in ConfigPairs(ConfigManager.GetConfig(ConfigName.ItemConfig)) do if ItemType.talismanSoulChip == configInfo.ItemType then NetManager.GMEvent("1#"..configInfo.Id.."#1000") coroutine.wait(0.01) end end end) end -- 一键变身卡 function this.GetBianshenka() local ic = ConfigManager.GetConfig(ConfigName.ItemConfig) local i = 0 coroutine.start(function() for _, configInfo in ConfigPairs(ConfigManager.GetConfig(ConfigName.ItemConfig)) do if ItemType.Incarnation == configInfo.ItemType then NetManager.GMEvent("1#"..configInfo.Id.."#1") coroutine.wait(0.01) end end end) end -- 一键命石 function this.GetGem() local ic = ConfigManager.GetConfig(ConfigName.ItemConfig) local i = 0 coroutine.start(function() for _, configInfo in ConfigPairs(ConfigManager.GetConfig(ConfigName.ItemConfig)) do if ItemType.Gem == configInfo.ItemType then NetManager.GMEvent("1#"..configInfo.Id.."#20") coroutine.wait(0.01) end end end) end -- 测试跳转 function this.TestJump(text) JumpManager.GoJump(tonumber(text)) end -- 测试功能引导 function this.TestFuncGuide(text, goType) local gid = tonumber(text) -- 判断要前往的界面 if goType == "1" then GuideManager.AddFuncGuide(gid) this:ClosePanel() elseif goType == "2" then GuideManager.AddFuncGuide(gid) UIManager.OpenPanel(UIName.FightPointPassMainPanel) else PopupTipPanel.ShowTip("请输入要前往的界面") end end -- function this.TestStory(text) StoryManager.EventTrigger(tonumber(text)) end -- 红点Debug function this.OpenRedDebug() UIManager.OpenPanel(UIName.RedpotDebugPanel) end -- 进入战斗测试场景 function this.GoTestBattle() UIManager.OpenPanel(UIName.BattleTestPanel) end -- 挑战怪物 function this.ChallengeMonster(text) local monsterId = tonumber(text) if #FormationManager.formationList[FormationManager.curFormationIndex].teamHeroInfos == 0 then PopupTipPanel.ShowTip("编队没人,请先上人!") else local MonsterGroup = ConfigManager.GetConfig(ConfigName.MonsterGroup) if not MonsterGroup[monsterId] then PopupTipPanel.ShowTip("怪物表id :" .. monsterId .. "不存在!") else UIManager.OpenPanel(UIName.BattlePanel, BattleManager.GetBattleData(1, monsterId), nil, nil, nil, monsterId, nil) end end end -- 假战斗数据 function this.RunFakeBattle(fakeId) fakeId = tonumber(fakeId) local fdata, fseed = BattleManager.GetFakeBattleData(fakeId) local testFightData = { fightData = fdata, fightSeed = fseed, fightType = 0, maxRound = 20 } UIManager.OpenPanel(UIName.BattlePanel, testFightData, BATTLE_TYPE.Test) end -- 请求服务器战斗数据 function this.RunServerBattle(serverUrl, fightId) BattleManager.RequestBattleDataByFightId(serverUrl, fightId, function(fightData) --LogGreen("战斗回调") UIManager.OpenPanel(UIName.BattlePanel, fightData, BATTLE_TYPE.Test) end) end -- 战斗数据 function this.RunBattleData(data, seed) data = loadstring("return "..data)() seed = tonumber(seed) require("Modules.Main.BattleData1") local fdata = (data and data ~= "") and data or testBattleData1 local fseed = (seed and seed ~= "") and seed or testBattleSeed if not fdata or not fseed then LogError("战斗数据错误") return end local testFightData = { fightData = fdata, fightSeed = fseed, fightType = 0, maxRound = 20 } UIManager.OpenPanel(UIName.BattlePanel, testFightData, BATTLE_TYPE.Test) end function this.QuickRunBattleData(data, seed) data = loadstring("return "..data)() seed = tonumber(seed) local fightMaxRound= 20 local seed = seed local battleType = 0 local fightData = data local userData = {} Random.SetSeed(seed) BattleLogic.Init(fightData, userData, fightMaxRound) BattleLogic.Type = battleType BattleLogic.StartOrder() while not BattleLogic.IsEnd do BattleLogic.Update() end LogRed("演算战斗结果:"..BattleLogic.Result) LogRed("战斗总帧数:"..BattleLogic.CurFrame()) LogRed("战斗总回合数:"..BattleLogic.GetCurRound()) local resultList = {} -- 第一位保存我方血量 resultList.myHpList = {} local arr = RoleManager.Query(function (r) return r.camp == 0 end, true) for i=1, #arr do local pos = arr[i].position resultList.myHpList[pos] = arr[i]:GetRoleData(RoleDataName.Hp) end -- 第二位保存地方血量 resultList.enemyHpList = {} local arr = RoleManager.Query(function (r) return r.camp == 1 end, true) for i=1, #arr do local pos = arr[i].position resultList.enemyHpList[pos] = arr[i]:GetRoleData(RoleDataName.Hp) end resultList.curRound = BattleLogic.GetCurRound() local allHeroDamage, allEnemyDamage = BattleLogic.GetAllDamage() resultList.allHeroDamage = allHeroDamage resultList.allEnemyDamage = allEnemyDamage resultList.duration = BattleLogic.CurFrame() / BattleLogic.GameFrameRate resultList.starRecord=BattleLogic.GetHardLevelStarRecord() LogRedTable(resultList) end -- 刷新服务器时间 function this.RefreshServerTime() NetManager.GMEvent("10#1#0", function(msg) this.serverNowTimeText.text = msg.info end) NetManager.GMEvent("10#2#0", function(msg) this.serverOpenTimeText.text = msg.info end) NetManager.GMEvent("10#3#0", function(msg) this.serverCreateRoleTimeText.text = msg.info end) end --添加事件监听(用于子类重写) function GMPanel:AddListener() end --移除事件监听(用于子类重写) function GMPanel:RemoveListener() end --界面打开时调用(用于子类重写) function GMPanel:OnOpen(...) -- 刷新时间 this.RefreshServerTime() -- 初始化界面显示 for id, config in ipairs(_GMConfig) do if not this._GMItemList[id] then local go = newObjToParent(this._GMItem, this._GMItemRoot[config.type]) this._GMItemList[id] = go local btn = Util.GetGameObject(go, "Button") local btnText = Util.GetGameObject(btn, "Text"):GetComponent("Text") btnText.text = config.btnTip local input = {} for i = 1, 2 do input[i] = Util.GetGameObject(go, "InputField"..i):GetComponent("InputField") input[i].gameObject:SetActive(config.inputNum >= i) Util.GetGameObject(input[i].gameObject, "Placeholder"):GetComponent("Text").text = config.inputTip[i] or "" end Util.AddClick(btn, function() -- 构建参数 local args = {} for i = 1, config.inputNum do if input[i].text == "" then PopupTipPanel.ShowTip("参数错误") return end table.insert(args, input[i].text) end -- if config.subType == GMSubType.Server then local gmstr = string.format(config.args, unpack(args)) NetManager.GMEvent(gmstr, function() if config.callBack then config.callBack(unpack(args)) end PopupTipPanel.ShowTip("GM应用成功") end) elseif config.subType == GMSubType.Func then if config.callBack then 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 -- 默认打开玩家相关GM for _, type in pairs(GMType) do this._GMItemRoot[type]:SetActive(type == GMType.Player) end end end --界面关闭时调用(用于子类重写) function GMPanel:OnClose() end --界面销毁时调用(用于子类重写) function GMPanel:OnDestroy() this.spLoader:Destroy() this._GMItemRoot = {} this._GMItemList = {} end return GMPanel