源战役客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

761 lines
25 KiB

пре 4 недеља
  1. KeyInput = KeyInput or BaseClass()
  2. function KeyInput:__init()
  3. self.isCtrl = false
  4. self.isShift = false
  5. self.enable = nil
  6. if RuntimePlatform then
  7. if Application.platform == RuntimePlatform.Android then
  8. self.enable = false
  9. elseif Application.platform == RuntimePlatform.IPhonePlayer then
  10. self.enable = false
  11. end
  12. end
  13. local game_start = function()
  14. if self.enable == nil then
  15. self.enable = true
  16. end
  17. end
  18. GlobalEventSystem:Bind(EventName.GAME_START,game_start)
  19. end
  20. function KeyInput:Update()
  21. self:key_release()
  22. self:key_press()
  23. self:mouse_press()
  24. self:scroll_update()
  25. end
  26. function KeyInput:IsCtrlPress()
  27. return self.isCtrl
  28. end
  29. function KeyInput:IsShiftPress()
  30. return self.isShift
  31. end
  32. function KeyInput:scroll_update()
  33. if not self.enable or not MainCamera or not MainCamera.Instance then
  34. return
  35. end
  36. --当前是竞技场,就不让拉伸摄像机了
  37. local scene_mgr = SceneManager.Instance
  38. if scene_mgr and scene_mgr:IsPkRankFightScene() and not scene_mgr:IsPkRankFightScene(scene_mgr:GetLastSceneId()) then
  39. return
  40. end
  41. if Input.GetAxis("Mouse ScrollWheel") < 0 then
  42. local new_size = MainCamera.Instance.camera_curr_size - 1
  43. if new_size < 10 then
  44. new_size = 10
  45. end
  46. MainCamera.Instance:SetBaseCameraSize(new_size)
  47. elseif Input.GetAxis("Mouse ScrollWheel") > 0 then
  48. local new_size = MainCamera.Instance.camera_curr_size + 1
  49. if new_size > 45 then
  50. new_size = 45
  51. end
  52. MainCamera.Instance:SetBaseCameraSize(new_size)
  53. end
  54. end
  55. function KeyInput:mouse_press()
  56. if not self.enable then
  57. return
  58. end
  59. end
  60. function KeyInput:key_release()
  61. if Input.GetKeyUp(KeyCode.Escape) and (CheatModel and CheatModel.Instance and not CheatModel:getInstance().is_open_cheat_view) then
  62. local exit_func = function()
  63. local function ok()
  64. Application.Quit()
  65. end
  66. Alert.show("是否退出游戏?",Alert.Type.Two,ok)
  67. end
  68. if ClientConfig.sdk_server then
  69. PlatformMgr:getInstance():ExitGame( exit_func )
  70. else
  71. exit_func()
  72. end
  73. GlobalEventSystem:Fire(LoginStateEvent.REQUEST_EXIT_GAME)
  74. end
  75. if not self.enable then
  76. return
  77. end
  78. if CheatModel and CheatModel.Instance and CheatModel:getInstance().is_open_cheat_view then--打开秘籍界面就忽略快捷键了
  79. if Input.GetKeyUp(KeyCode.Escape) then--快捷键关掉秘籍
  80. GlobalEventSystem:Fire(EventName.OPEN_CHEAT_INPUT_VIEW)
  81. elseif Input.GetKeyUp(KeyCode.Return) or Input.GetKeyUp(KeyCode.KeypadEnter) then--回车快捷输入秘籍
  82. CheatModel.Instance:Fire(CheatModel.CLICK_BTN_OK)
  83. end
  84. return
  85. end
  86. if Input.GetKeyUp(KeyCode.LeftControl) then
  87. self.isCtrl = false
  88. LuaProfiler.SwitchState()
  89. elseif Input.GetKeyUp(KeyCode.T) then
  90. GlobalEventSystem:Fire(TaskEvent.ANS_FINISHED_TASK_LIST,10200)
  91. -- OperateManager.Instance:StopMove()
  92. -- Scene.Instance.main_role:PlayAction("transfer")
  93. -- MainCamera.Instance:SetCameraSize(10,true)
  94. elseif Input.GetKeyUp(KeyCode.Y) then
  95. -- GlobalEventSystem:Fire(EscortConst.OPEN_ESCORT_VIEW, true)
  96. -- local args = {}
  97. -- args[1] = "1"
  98. -- args[2] = "4"
  99. -- args[3] = "0"
  100. -- IntrusionModel:getInstance():Fire(IntrusionModel.CHUANWEN,args)
  101. -- local curr_scene_id = SceneManager.Instance:GetSceneId()
  102. -- print("Test ",curr_scene_id)
  103. -- local scene_id = SceneManager.Instance:GetSceneId() -- 获取当前场景id
  104. -- local scene_info = SceneManager.Instance:GetSceneInfo(Scene_id)
  105. -- print(scene_info.SceneMap.window_minimap_width , scene_info.SceneMap.scene_width)
  106. -- -- print("Click TTTTTTT")
  107. -- -- MainCamera.Instance:SetCameraSize(40,true)
  108. -- local temp = MapModel:getInstance():GetNPCTargetInfoList()
  109. -- for k,v in pairs(temp) do
  110. -- print(v.x,v.y)
  111. -- local npc_config = ConfigItemMgr.Instance:GetNpcItem(v.id)
  112. -- for k3,v3 in pairs(npc_config) do
  113. -- print(k3,v3)
  114. -- end
  115. -- for k2,v2 in pairs(v) do
  116. -- print(k2,v2)
  117. -- end
  118. -- end
  119. -- BaseDungeonModel:getInstance():Fire(BaseDungeonModel.OPEN_DUNGEON_LOVE_SKILL_VIEW,true)
  120. --GlobalEventSystem:Fire(EventName.HIDE_ALL_UI,false)
  121. elseif Input.GetKeyUp(KeyCode.U) then
  122. -- EscortModel:getInstance():GoEscortNpc(3)
  123. -- EscortModel:getInstance():FlyToNpc()
  124. -- EscortModel:getInstance():Fire(EscortConst.OPEN_STAGE_ESCORT_RESULT_VIEW, true)
  125. -- DunManyModel.Instance:Fire(DunManyModel.OPEN_PASSWORD_VIEW)
  126. -- DunManyModel.Instance:Fire(DunManyModel.OPEN_SET_PASSWORD_VIEW)
  127. local function ok( ... )
  128. if self.money_type == 1 then
  129. OpenFun.Open(450,1)
  130. else
  131. OpenFun.Open(420,1)
  132. end
  133. end
  134. local ask_str = string.format("您的%s不足,是否前往%s?", desc, str)
  135. Alert.show(ask_str,Alert.Type.Two ,ok,nil,"确定","取消")
  136. -- EscortModel:getInstance():Fire(EscortConst.OPEN_ESCORT_RESULT_VIEW, true, {result = 1,object_id = 1001})
  137. -- self.try_collect_left_num = 6--采集物未创建的话,每隔一段时间尝试一下,6次就够了
  138. -- local try_to_collect = nil--必须这么写
  139. -- try_to_collect = function ( )
  140. -- local monster = Scene.Instance:FindNearestMonster(EscortConst.ESCORT_COLLECT_ID, false, true)
  141. -- if monster then
  142. -- local main_role = Scene.Instance.main_role
  143. -- if main_role then
  144. -- if self.task_collect_start_real_pos == nil then
  145. -- self.task_collect_start_real_pos = co.TableXY(main_role:GetRealPos())
  146. -- else
  147. -- self.task_collect_start_real_pos.x = main_role.real_pos.x
  148. -- self.task_collect_start_real_pos.y = main_role.real_pos.y
  149. -- end
  150. -- if self.task_collect_end_real_pos == nil then
  151. -- self.task_collect_end_real_pos = co.TableXY(monster:GetRealPos())
  152. -- else
  153. -- self.task_collect_end_real_pos.x = monster.real_pos.x
  154. -- self.task_collect_end_real_pos.y = monster.real_pos.y
  155. -- end
  156. -- main_role:SetDirection(self.task_collect_start_real_pos, self.task_collect_end_real_pos, false, true)
  157. -- end
  158. -- EventSystem.Fire(GlobalEventSystem,EventName.OPEN_COLLECT_VIEW, monster.id, monster:GetVo().type_id, monster:GetVo().pick_time)
  159. -- else
  160. -- self.try_collect_left_num = self.try_collect_left_num - 1
  161. -- --此时采集物可能还未创建,所以延迟一段时间再尝试
  162. -- if not self.delay_collect_id and self.try_collect_left_num >= 0 then
  163. -- self.delay_collect_id = GlobalTimerQuest:AddPeriodQuest(try_to_collect, 0.5, 1)
  164. -- end
  165. -- end
  166. -- end
  167. -- try_to_collect()
  168. elseif Input.GetKeyUp(KeyCode.LeftShift) then
  169. self.isShift = false
  170. elseif Input.GetKeyUp(KeyCode.Z) then --秘籍输入
  171. if Input.GetKey(KeyCode.LeftControl) then
  172. GlobalEventSystem:Fire(EventName.OPEN_CHEAT_CLIENT_VIEW) --客户端秘籍
  173. else
  174. GlobalEventSystem:Fire(EventName.OPEN_CHEAT_INPUT_VIEW)
  175. end
  176. elseif Input.GetKeyUp(KeyCode.J) then
  177. -- OpenFun.Open(153,2,2)
  178. -- ShopModel:GetInstance():Fire(ShopModel.JUMP_TO_SHOP_ITEM, 10404)
  179. -- GlobalEventSystem:Fire(EventName.OPEN_SHOP_VIEW, 1,3,10317)
  180. --StepPackModule:getInstance():Start()
  181. elseif Input.GetKeyUp(KeyCode.L) then
  182. -- 4294967312
  183. -- local data = EquipCollectModel.Instance:GetEquipCollectTipData(2)
  184. -- EquipCollectModel.Instance:Fire(EquipCollectConst.OPEN_EC_MAIN_VIEW, true)
  185. -- local data = {
  186. -- id = 1,
  187. -- sub_id = 1,
  188. -- goods_id = 24101021,
  189. -- }
  190. -- EquipCollectModel.Instance:SetEquipCollectNeedShowTipData(data)
  191. -- EquipCollectModel.Instance:Fire(EquipCollectConst.SHOW_EQUIP_COLLECT_TIP, data)
  192. -- EventSystem.Fire(GlobalEventSystem,EventName.OPEN_INSTRUCTION_VIEW, 60000)
  193. --StepPackModule:getInstance():SetPauseState(false)
  194. -- special_tip_data = {
  195. -- type = SpecialTipType.Timer1,
  196. -- sepeical_str = "社团跑马即将开始,%s开始",
  197. -- need_flash = false,
  198. -- show_time = 34,
  199. -- }
  200. -- CommonController.Instance:Fire(EventName.OPEN_SPECIALTIPVIEW, special_tip_data)
  201. -- GlobalEventSystem:Fire(EventName.OPEN_SHOP_VIEW, 1,2,24002091, true)
  202. local data = {
  203. role_vo_1 = role_vo, --我方
  204. role_vo_2 = role_vo, --敌方
  205. type = 2, --UI类型
  206. is_break = 2,
  207. desc = string.format("进入了%s", scene_info.name or "场景"), --描述
  208. max_num = 3, --同时显示最大数量
  209. }
  210. if SceneManager:getInstance():IsShowDynamicInfoScene() then
  211. GlobalEventSystem:Fire(EventName.SHOW_DYNAMIC_INFO_TIP, data)
  212. end
  213. elseif Input.GetKeyUp(KeyCode.K) then
  214. local fdata = {
  215. [1] =
  216. {
  217. type_id = 270002,
  218. goods_num = 1
  219. },
  220. [2] =
  221. {
  222. type_id = 270002,
  223. goods_num = 1
  224. },
  225. [3] =
  226. {
  227. type_id = 270002,
  228. goods_num = 1
  229. },
  230. [4] =
  231. {
  232. type_id = 270002,
  233. goods_num = 1
  234. },
  235. [5] =
  236. {
  237. type_id = 270002,
  238. goods_num = 1
  239. },
  240. [6] =
  241. {
  242. type_id = 270002,
  243. goods_num = 1
  244. },
  245. [7] =
  246. {
  247. type_id = 270002,
  248. goods_num = 1
  249. },
  250. [8] =
  251. {
  252. type_id = 270002,
  253. goods_num = 1
  254. },
  255. [9] =
  256. {
  257. type_id = 270002,
  258. goods_num = 1
  259. },
  260. [10] =
  261. {
  262. type_id = 270002,
  263. goods_num = 1
  264. },
  265. [11] =
  266. {
  267. type_id = 270002,
  268. goods_num = 1
  269. },
  270. }
  271. local data = {
  272. [1] =
  273. {
  274. goods_type_id = 270002,
  275. num = 1
  276. },
  277. [2] =
  278. {
  279. goods_type_id = 270002,
  280. num = 1
  281. },
  282. [3] =
  283. {
  284. goods_type_id = 270002,
  285. num = 1
  286. },
  287. [4] =
  288. {
  289. goods_type_id = 270002,
  290. num = 1
  291. },
  292. [5] =
  293. {
  294. goods_type_id = 270002,
  295. num = 1
  296. },
  297. [6] =
  298. {
  299. goods_type_id = 270002,
  300. num = 1
  301. },
  302. [7] =
  303. {
  304. goods_type_id = 270002,
  305. num = 1
  306. },
  307. [8] =
  308. {
  309. goods_type_id = 270002,
  310. num = 1
  311. },
  312. [9] =
  313. {
  314. goods_type_id = 270002,
  315. num = 1
  316. },
  317. [10] =
  318. {
  319. goods_type_id = 270002,
  320. num = 1
  321. },
  322. [11] =
  323. {
  324. goods_type_id = 270002,
  325. num = 1
  326. },
  327. }
  328. MainUIModel:getInstance():PlayGoodsFlyList(fdata)
  329. MainUIModel:getInstance():AddFloatInfo(data)
  330. -- local data = {
  331. -- room_id = 1,
  332. -- occupy_city =
  333. -- {
  334. -- [1] =
  335. -- {
  336. -- city_id = 5,
  337. -- },
  338. -- -- [2] =
  339. -- -- {
  340. -- -- city_id = 4,
  341. -- -- },
  342. -- -- [3] =
  343. -- -- {
  344. -- -- city_id = 3,
  345. -- -- },
  346. -- -- [4] =
  347. -- -- {
  348. -- -- city_id = 1,
  349. -- -- },
  350. -- -- [5] =
  351. -- -- {
  352. -- -- city_id = 2,
  353. -- -- },
  354. -- }
  355. -- }
  356. -- CSGWarModel:GetInstance():SetCSGWarResultInfo(data)
  357. -- CSGWarModel:GetInstance():Fire(CSGWarConst.OPEN_CSGWAR_RESULT_VIEW)
  358. -- CSGWarModel:GetInstance():Fire(CSGWarConst.OPEN_CSGWAR_SUPPORT_VIEW)
  359. -- CSGWarModel:GetInstance():Fire(CSGWarConst.OPEN_CSGWAR_RECORD_VIEW)
  360. -- local function callback( ... )
  361. -- GlobalEventSystem:Fire(GuildTVConst.OPEN_GUILDTV_MAIN_VIEW)
  362. -- end
  363. -- special_tip_data = {
  364. -- type = SpecialTipType.Timer1,
  365. -- sepeical_str = "社团跑马即将开始,<color=#0ce148>%s</color> 后开始",
  366. -- need_flash = false,
  367. -- show_time = 34,
  368. -- end_time_callback = callback
  369. -- }
  370. -- CommonController.Instance:Fire(EventName.OPEN_SPECIALTIPVIEW, special_tip_data)
  371. -- OpenFun.Open(500,0)
  372. elseif Input.GetKeyUp(KeyCode.W) then
  373. self.key_w_down = false
  374. self:UpdateKeyMove()
  375. elseif Input.GetKeyUp(KeyCode.S) then
  376. self.key_s_down = false
  377. self:UpdateKeyMove()
  378. elseif Input.GetKeyUp(KeyCode.A) then
  379. self.key_a_down = false
  380. self:UpdateKeyMove()
  381. elseif Input.GetKeyUp(KeyCode.D) then
  382. self.key_d_down = false
  383. self:UpdateKeyMove()
  384. elseif Input.GetKeyUp(KeyCode.H) then
  385. -- GlobalEventSystem:Fire(EventName.OPEN_SHOP_VIEW, 2)
  386. -- endless_result_view = EndlessResultView.New()
  387. -- endless_result_view:Open(self.cache_result_info)
  388. -- local vo = {
  389. -- killer = {
  390. -- role_id = 1,
  391. -- name = 1,
  392. -- sex = 1,
  393. -- career = 1,
  394. -- turn = 1, -- 转生次数
  395. -- vip_type = 1, -- vip类型(普通 or 至尊特权)
  396. -- vip_flag = 1, -- vip等级
  397. -- level = 1, --玩家等级
  398. -- fighting = 1, -- 战斗力
  399. -- picture = 1, -- 玩家上传的头像地址
  400. -- picture_ver = 1, -- 玩家上传的头像版本号(每次上传一个头像,自动加1
  401. -- profile_photo_id = 1, -- 本地头像图片id
  402. -- dress_id = 1, --头像装扮id
  403. -- sup_vip_type = 1, --是否是永久贵族 0|否 1|体验 2|永久
  404. -- },
  405. -- deader = {
  406. -- role_id = 1,
  407. -- name = 1,
  408. -- sex = 1,
  409. -- career = 1,
  410. -- turn = 1, -- 转生次数
  411. -- vip_type = 1, -- vip类型(普通 or 至尊特权)
  412. -- vip_flag = 1, -- vip等级
  413. -- level = 1, --玩家等级
  414. -- fighting = 1, -- 战斗力
  415. -- picture = 1, -- 玩家上传的头像地址
  416. -- picture_ver = 1, -- 玩家上传的头像版本号(每次上传一个头像,自动加1
  417. -- profile_photo_id = 1, -- 本地头像图片id
  418. -- dress_id = 1, --头像装扮id
  419. -- sup_vip_type = 1, --是否是永久贵族 0|否 1|体验 2|永久
  420. -- }
  421. -- }
  422. -- local data = {
  423. -- role_vo_1 = vo.killer, --我方
  424. -- role_vo_2 = vo.deader, --敌方
  425. -- type = 2, --UI类型
  426. -- desc = "",
  427. -- is_break = 2,
  428. -- max_num = 2, --同时显示最大数量
  429. -- need_cut_str = true,
  430. -- }
  431. -- if SceneManager:getInstance():IsShowDynamicInfoScene() then
  432. -- GlobalEventSystem:Fire(EventName.SHOW_DYNAMIC_INFO_TIP, data)
  433. -- end
  434. -- EndlessModel:getInstance():SetEndlessShutDownInfo(vo)
  435. -- EndlessModel:getInstance():Fire(EndlessConst.OPEN_ENDLESS_RANK_VIEW)
  436. -- local time = TimeUtil:getServerTime( )
  437. -- local id = math.random(100000,999999)
  438. -- local name_len = math.random(1,6)
  439. -- local text_len = math.random(1,20)
  440. -- local name_str = "玩家名字六字"
  441. -- local text_str = "一二三四五六七八九十一二三四五六七八九十"
  442. -- local data = {
  443. -- name = string.sub(name_str, name_len),
  444. -- id = id,
  445. -- time = time,
  446. -- }
  447. -- data.content = string.sub(text_str, text_len)
  448. -- GuildTVModel:GetInstance():AddGuildTVBarrageMessage(data)
  449. -- GuildTVModel:GetInstance():Fire(GuildTVConst.OPEN_GUILDTV_READY_VIEW)
  450. -- MarketModel:getInstance():SetHasGuildGoods(true)
  451. -- TreasureHouseModel:getInstance():Fire(TreasureHouseConst.OPEN_TREASURE_HOUSE_VIEW)
  452. EscortModel:getInstance():Fire(EscortConst.REQUEST_SCMD_EVENT, 50014)
  453. GlobalEventSystem:Fire(EventName.USE_FLY_SHOE, 1006, 7825 ,15190 , call_back, true, true)
  454. -- TreasureHouseModel:getInstance():Fire(TreasureHouseConst.OPEN_TREASURE_HOUSE_REWARD_VIEW)
  455. -- local data = GuildTVModel:GetInstance():GetGuildTVRunningInfo()
  456. -- GuildTVModel:GetInstance():SetGuildTVRunningInfo(data)
  457. -- OpenFun.Open(600,2)
  458. elseif Input.GetKeyUp(KeyCode.R) then
  459. LuaMemManager:getInstance():checkToReleaseMem(true, true)
  460. --热更代码
  461. if self.HU == nil then
  462. self.HU = _G.originalRequire "luahotupdate"
  463. self.HU.Init("hotupdatelist", {"G:\\fantacy_develop\\code\\u3d\\Lua"})
  464. end
  465. print("zensyue:YangziTest [HotUpdate Lua] self.HU: ",self.HU)
  466. self.HU.Update()
  467. Message.show("刷新成功")
  468. elseif Input.GetKeyUp(KeyCode.P) then
  469. if not self.is_hide then
  470. GlobalEventSystem:Fire(EventName.DO_MODULE_DEBUG_FUNC, "mapview", "hiderootall")
  471. self.is_hide = true
  472. else
  473. GlobalEventSystem:Fire(EventName.DO_MODULE_DEBUG_FUNC, "mapview", "showrootall")
  474. self.is_hide = false
  475. end
  476. -- local cfg, scmd = {subtype = ChatModel.CHANNEL_SYSTEM} ,{}
  477. -- if not self.index_index then
  478. -- self.index_index = 1
  479. -- else
  480. -- self.index_index = self.index_index + 1
  481. -- end
  482. -- GlobalEventSystem:Fire(EventName.SHOW_CHUANWEN, "测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试"..self.index_index , cfg, scmd)
  483. -- GlobalEventSystem:Fire(EventName.OPEN_PREVIEW_OBJ_VIEW)
  484. elseif Input.GetKeyUp(KeyCode.Q) then
  485. Message.show("我就想实时")
  486. -- GlobalEventSystem:Fire(GuildTVConst.OPEN_GUILDTV_MAIN_VIEW)
  487. -- GlobalEventSystem:Fire(EventName.OPEN_ARENA_VIEW)
  488. -- GlobalEventSystem:Fire(FuliConst.OPEN_FULI_MAIN_VIEW)
  489. -- GuildTVModel.Instance:Fire(GuildTVConst.OPEN_GUILDTV_READY_VIEW)
  490. -- FuliModel:getInstance().fuli_ai_info.duration_time = 0
  491. -- FuliModel:getInstance():Fire(FuliConst.START_HAND_ACTION)
  492. elseif Input.GetKeyUp(KeyCode.E) then
  493. -- self.tv_index = self.tv_index or 0
  494. -- self.tv_index = self.tv_index + 1
  495. -- local data = {
  496. -- name = "玩家"..self.tv_index,
  497. -- vip = self.tv_index % 8,
  498. -- time = TimeUtil:getServerTime()
  499. -- }
  500. -- GuildTVModel.Instance:AddGuildTVOneRecord(data)
  501. -- local data = {}
  502. -- for i=1,3 do
  503. -- data[i] = {
  504. -- rid = i,
  505. -- trust = self.tv_index * i *100
  506. -- }
  507. -- end
  508. -- GuildTVModel.Instance:SetGuildTVHotInfo(data)
  509. -- Time.timeScale =20
  510. -- StarSpiritModel:getInstance():Fire(StarSpiritModel.OPEN_FORMAT_VIEW)
  511. local random_list = {1,4}
  512. local end_list = {}
  513. local len = #random_list
  514. local random_ratio = 3
  515. local random_index = nil
  516. local temp_random = nil
  517. for i=1,random_ratio*len do
  518. temp_random = math.random(1,len)
  519. temp_random = temp_random == random_index and random_index + 1 or temp_random
  520. random_index = temp_random > len and 1 or temp_random
  521. end_list[i] = random_list[random_index]
  522. end
  523. print("HWR:KeyInput [start:418] end_list:", end_list)
  524. PrintTable(end_list)
  525. print("HWR:KeyInput [end]")
  526. elseif Input.GetKeyUp(KeyCode.F1) then
  527. LuaMemManager:getInstance():checkToReleaseMem(true, true)
  528. elseif Input.GetKeyUp(KeyCode.F2) then
  529. LuaMemManager:getInstance():ForceReload()
  530. elseif Input.GetKeyUp(KeyCode.F3) then
  531. --GlobalEventSystem:Fire(EventName.OPEN_SKY_WAR_JOIN_VIEW)
  532. elseif Input.GetKeyUp(KeyCode.M) then
  533. elseif Input.GetKeyUp(KeyCode.F4) then
  534. EquipModel:getInstance():Fire(EquipModel.OPEN_ACQUIRE_VIEW, EquipModel:getInstance():GetEquipInfo(), 101000)
  535. print("-----is_auto_mf-------:", AutoFightManager:getInstance():GetAutoFightState())
  536. print("-----GetFollowAttackId-------:", TeamModel:GetInstance():GetFollowAttackId())
  537. print("-----game_running-------:", AutoFightManager:getInstance().game_running)
  538. print("-----IsPlaying-------:", StoryModel:getInstance():IsPlaying())
  539. print("-----IsSceneStart-------:", SceneManager:getInstance():IsSceneStart())
  540. print("-----IsGameConnected-------:", UserMsgAdapter:getInstance():IsGameConnected())
  541. print("-----user_manul_moving-------:", Scene.Instance.user_manul_moving)
  542. print("-----can_auto_find_target-------:", Scene.Instance.can_auto_find_target)
  543. print("-----IsSafeScene-------:", SceneManager.Instance:IsSafeScene())
  544. print("-----isInRigidity-------:", SkillManager.Instance:isInRigidity())
  545. print("-----hp-------:", RoleManager.Instance.mainRoleInfo.hp, RoleManager.Instance.mainRoleInfo.ghost_mode, Scene.Instance.main_role:IsDead())
  546. print("-----isInRigidity-------:", SkillManager.Instance:isInRigidity())
  547. local real_pos_x, real_pos_y = Scene.Instance.main_role:GetRealPos()
  548. print("-----IsSafePos-------:", SceneManager:getInstance():IsSafePos(real_pos_x, real_pos_y))
  549. print("-----auto_find_way-------:", AutoFightManager:getInstance().auto_find_way)
  550. local cache_pos = AutoFightManager:getInstance().auto_fight_cache_pos
  551. print("------挂机位置------------:", cache_pos.x, cache_pos.y)
  552. local angle, pos = BaseDungeonModel:getInstance():FindNearestCanTriggerPosInfo()
  553. if pos and pos.x then
  554. print("-----FindNearestCanTriggerPosInfo-------:", pos.x, pos.y)
  555. end
  556. for k, vo in pairs(SceneManager.Instance.role_vo_list) do
  557. print("+++++++++++++role_vo_list-------:", vo.name)
  558. end
  559. for k, vo in pairs(SceneManager.Instance.monster_vo_list) do
  560. print("+++++++++++++monster_vo_list-------:", vo.name)
  561. end
  562. for k, vo in pairs(Scene.Instance.monster_list) do
  563. print("+++++++++++++monster_list-------:", vo.name)
  564. end
  565. elseif Input.GetKeyUp(KeyCode.F5) then
  566. --StarFightModel:getInstance():Fire(StarFightModel.OPEN_STAR_FIGHT_VIEW)
  567. -- AutoFightManager:getInstance().not_auto_fight_for_test = not AutoFightManager:getInstance().not_auto_fight_for_test
  568. elseif Input.GetKeyUp(KeyCode.F6) then
  569. local view_path = "root"
  570. local go = GameObject.Find(view_path)
  571. if go then
  572. go.transform:Find("Canvas").gameObject:SetActive(true)
  573. end
  574. -- UIToolTipMgr:getInstance():ShowGetWayTipsView(100001, nil, nil)
  575. -- GlobalEventSystem:Fire(TaskEventType.SHOW_TASK_GUILD_ARROW, true)
  576. -- GlobalEventSystem:Fire(EventName.MAIN_UI_LAYER_VISIBLE, false)
  577. -- local pos = co.TableXY(Scene.Instance.main_role:GetRealPos())
  578. -- print("-----------玩家此时的像素位置===:", pos.x, pos.y)
  579. -- local equip_info = EquipModel:getInstance():GetEquipInfo()
  580. -- equip_info = DeepCopy(equip_info)
  581. -- if Config.Equipconfig[101004] then
  582. -- local new_sit_grid=Config.Equipconfig[101004].pos
  583. -- if equip_info[new_sit_grid] then
  584. -- table.remove(equip_info, new_sit_grid)
  585. -- end
  586. -- end
  587. -- EquipModel:getInstance():Fire(EquipModel.FLY_EQUIP, equip_info, 101004)
  588. -- Message:show(GlobalErrorCode[102])
  589. -- local goods_list = {}
  590. -- for i = 1, 10 do
  591. -- local obj = {}
  592. -- obj.style = 0
  593. -- obj.typeId = 105001
  594. -- obj.count = 2
  595. -- table.insert(goods_list, obj)
  596. -- end
  597. -- GlobalEventSystem:Fire(EventName.REWARD_FLY, goods_list, {x = 0, y = -133}, 60, 0.1, {x = (ScreenWidth / 2 - 130 - 18), y = -(ScreenHeight / 2 - 370 - 30)}, 0.7)
  598. elseif Input.GetKeyUp(KeyCode.F7) then
  599. --StepPackModule:getInstance():SetPauseState(false)
  600. local view_path = "root"
  601. local go = GameObject.Find(view_path)
  602. if go then
  603. go.transform:Find("Canvas").gameObject:SetActive(false)
  604. end
  605. elseif Input.GetKeyUp(KeyCode.F8) then
  606. --local transform = Scene.Instance:GetMainRole().transform
  607. --MainCamera.Instance:AddScreenObj(transform)
  608. -- if NewMainRoleController.Instance.test_pattern then
  609. -- local data = CookieWrapper.Instance:GetCookie(CookieLevelType.Account, CookieKey.TEST_DETECT_PLAYER_ATTR)
  610. -- local str_list = {}
  611. -- local conbine_str = function(attr_list)
  612. -- local str = ""
  613. -- if attr_list then
  614. -- for k,v in pairs(attr_list) do
  615. -- str = str.."["..v.name.."-"..v.attr_val.."] "
  616. -- end
  617. -- end
  618. -- return str
  619. -- end
  620. -- if data and #data > 0 then
  621. -- local str = ""
  622. -- local title = "start_time,role_id,role_name,read_time,role_lv,attr_list&"
  623. -- str = str..title
  624. -- local file_name = ""
  625. -- for k,v in pairs(data) do
  626. -- str = str..v.start_time..","..v.role_id..","..v.role_name..","..v.read_time..","..v.role_lv..","..conbine_str(v.attr_list).."&"
  627. -- file_name = v.role_id..v.role_name
  628. -- end
  629. -- OutPutValue(file_name, str)
  630. -- Message.show("生成属性列表完成")
  631. -- end
  632. -- end
  633. elseif Input.GetKeyUp(KeyCode.F9) then
  634. --local transform = Scene.Instance:GetMainRole().transform
  635. --MainCamera.Instance:RemoveScreenObj(transform)
  636. PrintResList()
  637. elseif Input.GetKeyUp(KeyCode.F10) then
  638. print("tanar: KeyInput [332] =========== ")
  639. SceneObjHeight.Camera = 10
  640. MainCamera.Instance:SetUpdateCameraEnabled(true)
  641. elseif Input.GetKeyUp(KeyCode.F11) then
  642. CameraDistanceWithMainRole = 16
  643. MainCamera.Instance:SetUpdateCameraEnabled(true)
  644. elseif Input.GetKeyUp(KeyCode.F12) then
  645. SceneCameraRotate = 25
  646. MainCamera.Instance:SetUpdateCameraEnabled(true)
  647. end
  648. end
  649. function KeyInput:key_press()
  650. if not self.enable then return end
  651. if CheatModel:getInstance().is_open_cheat_view then
  652. return
  653. end
  654. -- local camPos = MainCamera.Instance:GetCameraPos()
  655. -- local cam_change = false
  656. if Input.GetKey(KeyCode.LeftControl) then
  657. self.isCtrl = true
  658. elseif Input.GetKey(KeyCode.LeftShift) then
  659. self.isShift = true
  660. elseif (Input.GetKey(KeyCode.X)) then
  661. elseif (Input.GetKey(KeyCode.Y)) then
  662. elseif (Input.GetKey(KeyCode.Return) or Input.GetKey(KeyCode.KeypadEnter)) then
  663. GlobalEventSystem:Fire(EventName.RETURN_KEY_PRESS)
  664. elseif SceneManager and SceneManager.Instance and SceneManager:getInstance():IsSceneStart() then
  665. if Input.GetKey(KeyCode.W) then
  666. self.key_w_down = true
  667. self:UpdateKeyMove()
  668. elseif Input.GetKey(KeyCode.S) then
  669. self.key_s_down = true
  670. self:UpdateKeyMove()
  671. elseif Input.GetKey(KeyCode.A) then
  672. self.key_a_down = true
  673. self:UpdateKeyMove()
  674. elseif Input.GetKey(KeyCode.D) then
  675. self.key_d_down = true
  676. self:UpdateKeyMove()
  677. end
  678. if Input.GetKeyDown(KeyCode.Space) then
  679. --GlobalEventSystem:Fire(EventName.HIDE_HORSE)
  680. GlobalEventSystem:Fire(SceneEventType.MAIN_ROLE_JUMP)
  681. end
  682. end
  683. end
  684. function KeyInput:UpdateKeyMove()
  685. --在竞技联赛不让移动
  686. if SceneManager.Instance:IsPkRankFightScene() then
  687. return
  688. end
  689. --如果本机钓鱼标识 标志正在钓鱼限制键盘输入控制移动
  690. if Scene and Scene.Instance and Scene.Instance:GetMainRole():IsFishingState() then
  691. return
  692. end
  693. local x, y = 0, 0
  694. if self.key_a_down and not self.key_d_down then
  695. x = -1
  696. elseif not self.key_a_down and self.key_d_down then
  697. x = 1
  698. end
  699. if self.key_w_down and not self.key_s_down then
  700. y = 1
  701. elseif not self.key_w_down and self.key_s_down then
  702. y = -1
  703. end
  704. if UIJoyStick then
  705. if self.lock then
  706. return
  707. end
  708. Scene.Instance.user_manul_moving = true
  709. Scene.Instance.user_manul_time = Status.NowTime
  710. GlobalEventSystem:Fire(EventName.CHANGE_TEMP_BTN)
  711. if x == 0 and y == 0 then
  712. Scene.Instance.user_manul_moving = false
  713. GlobalEventSystem:Fire(UIJoyStick.EVENT_TOUCH_END)
  714. else
  715. GlobalEventSystem:Fire(UIJoyStick.EVENT_DRAGGING, co.Vector2(x,y))
  716. end
  717. end
  718. end
  719. function KeyInput:EnableInput(bool)
  720. self.enable = bool
  721. end
  722. function KeyInput:key_back()
  723. end
  724. function KeyInput:__delete()
  725. end