源战役客户端
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

743 linhas
28 KiB

4 semanas atrás
  1. require("game.test.TestView")
  2. TestForCat = TestForCat or BaseClass(BaseController)
  3. function TestForCat:__init()
  4. TestForCat.Instance = self
  5. print("Cat:TestForCat [init]")
  6. self.listen_tables = {}
  7. end
  8. function TestForCat:__delete()
  9. if self.view_h then
  10. self.view_h:Close()
  11. self.view_h = nil
  12. end
  13. end
  14. function TestForCat:OnKeyRelease()
  15. GlobalEventSystem:Fire(EventName.ON_KEY_RELEASE)
  16. if Input.GetKeyUp(KeyCode.F) then
  17. self:OnKeyClick_F()
  18. elseif Input.GetKeyUp(KeyCode.H) then
  19. self:OnKeyClick_H()
  20. elseif Input.GetKeyUp(KeyCode.T) then
  21. self:TestAction()--测试Action
  22. elseif Input.GetKeyUp(KeyCode.U) then
  23. TestForCat.Instance.G_TestFlag = 1
  24. -- elseif Input.GetKeyUp(KeyCode.C) then
  25. --传闻
  26. -- local chuan_str = "player_name, 101"
  27. -- GlobalEventSystem:Fire(EventName.RECEIVE_CHUANWEN, 63501, Split(chuan_str,","))--传闻
  28. --公告
  29. -- ChatController.Instance:ReceiveGongGao(40001, ChatModel.CHANNEL_ENLIST, 0, Split("1,小泽,8001,1",","))
  30. elseif Input.GetKeyUp(KeyCode.R) then
  31. -- if KeyInput.Instance.test_key_class ~= nil then
  32. -- KeyInput.Instance.test_key_class:DeleteMe()
  33. -- KeyInput.Instance.test_key_class = nil
  34. -- end
  35. -- KeyInput.Instance.test_key_class = TestForCat.New()
  36. -- LuaMemManager:getInstance():checkToReleaseMem(true, true)
  37. -- --热更代码
  38. -- if self.HU == nil then
  39. -- self.HU = _G.originalRequire "luahotupdate"
  40. -- self.HU.Init("hotupdatelist", {"I:\\Demon\\develop\\code\\u3d\\Lua"})
  41. -- end
  42. -- print("Cat:TestForCat [HotUpdate Lua] self.HU: ",self.HU)
  43. -- self.HU.Update()
  44. end
  45. end
  46. --专门用来快速打开界面用的
  47. function TestForCat:OnKeyClick_F()
  48. if self.view_h then
  49. self.view_h:Close()
  50. self.view_h = nil
  51. end
  52. self.open_data = nil
  53. -- MainRoleModel:getInstance():Fire(MainRoleModel.OPEN_SHAPE_VIEW, 5)
  54. self.view_h = BloodMainView.New()
  55. -- self.view_h = MergeServerMainView.New()
  56. -- GridWalkModel:GetInstance():Fire(GridWalkConst.Event.OpenGameView)
  57. -- GlobalEventSystem:Fire(GodConst.Event.OpenGodMainView)
  58. -- self.view_h = GodMainView.New()
  59. -- self.open_data = GodConst.TabID.Info
  60. -- self.view_h = SpriteAideFirstDressView.New()
  61. -- self.open_data = 10000001
  62. -- GlobalEventSystem:Fire(EventName.OPEN_GUILD_MAIN_VIEW, GuildConst.TabId.Depot)
  63. -- GlobalEventSystem:Fire(EventName.OPEN_MARKET_VIEW, 1, 2)
  64. -- OpenFun.Open(281, 0)--跨服1v1
  65. -- GlobalEventSystem:Fire(EventName.OPEN_GUILD_MAIN_VIEW, {4, 2})
  66. -- self.view_h = PkRankChallengeRewardView.New()
  67. -- Message.show("OnKeyClick_F")
  68. -- self:TestPkRankResultView()
  69. -- OpenFun.Open(2)--锻造
  70. -- self:BaseViewWrapper()
  71. -- self.view_h = DailyMainView.New()
  72. -- assert(false, "haha")
  73. -- require("newgameui.ComboxView")
  74. -- local view = ComboxView.New()
  75. -- view:SetSize(100,300)
  76. -- local on_click = function ( index )
  77. -- print('Cat:TestForCat.lua[52]', index)
  78. -- end
  79. -- view:Open({"1", "2", "3"},on_click,nil,Vector3(0, 0, 0))
  80. if self.view_h then
  81. self.view_h:Open(self.open_data)
  82. end
  83. end
  84. function TestForCat:OnKeyClick_H()
  85. if self.view_h then
  86. self.view_h:Close()
  87. self.view_h = nil
  88. end
  89. -- print('Cat:TestForCat.lua[98]')
  90. -- for i=1,1000000 do
  91. -- print('Cat:TopPkController.lua[98]')
  92. -- end
  93. -- print('Cat:TestForCat.lua[102]')
  94. TopPkModel:getInstance():Fire(TopPkModel.GAME_STAGE_CHANGED)
  95. -- do
  96. -- local tb = {}
  97. -- tb.type = Config.ConfigMainIcon.TipType.come_bk_apply
  98. -- tb.bind_data = {role_id=12345, name="hahaha"}
  99. -- tb.is_same_func = function(a, b)
  100. -- local aRoleID = a and a.bind_data and a.bind_data.role_id
  101. -- local bRoleID = b and b.bind_data and b.bind_data.role_id
  102. -- print('Cat:ComeBKGiftController.lua[53] aRoleID, bRoleID', aRoleID, bRoleID)
  103. -- return aRoleID == bRoleID
  104. -- end
  105. -- MsgManager:getInstance():Add(tb)
  106. -- end
  107. -- do
  108. -- --获取活动奖励
  109. -- local info = CustomActivityModel:getInstance():getOneActRewardList(86, 1)
  110. -- print("Cat:TestForCat [start:99] info: ", info)
  111. -- PrintTable(info)
  112. -- print("Cat:TestForCat [end]")
  113. -- end
  114. -- local isOpen, errorStr = GuildPVEModel:GetInstance():IsSysOpen()
  115. -- print('Cat:DialogueController.lua[138] isOpen, errorStr', isOpen, errorStr)
  116. -- GuildPVEModel:GetInstance():Fire(GuildPVEConst.Event.AckNotify, {gname="哈哈帮", hurt=12345})
  117. -- GuildPVEResultView.New():Open({line_rank=2})
  118. -- print("Cat:TestForCat [start:99] Scene.Instance.monster_list:", Scene.Instance.monster_list)
  119. -- PrintTable(Scene.Instance.monster_list, nil, 2)
  120. -- print("Cat:TestForCat [end]")
  121. -- GuildPVEController.GetInstance():RunToPVENPC()
  122. -- ActivityIconManager:getInstance():addIcon(19,-1)--温泉
  123. -- ActivityIconManager:getInstance():addIcon(9,-1)--花火大会
  124. -- ActivityIconManager:getInstance():addIcon(15,-1)--公会争霸
  125. -- ActivityIconManager:getInstance():addIcon(30,-1)--精彩活动
  126. -- ActivityIconManager:getInstance():addIcon(33,-1)--护送
  127. -- ActivityIconManager:getInstance():addIcon(225070,-1)--合服活动
  128. -- ActivityIconManager:getInstance():addIcon(600,-1)--虚空秘境
  129. -- ActivityIconManager:getInstance():addIcon(281,-1)--巅峰竞技
  130. -- ActivityIconManager:getInstance():addIcon(41,-1)--BOSS活动
  131. -- ActivityIconManager:getInstance():addIcon(43,-1)--幸运转盘
  132. -- ActivityIconManager:getInstance():addIcon(46,-1)--神秘限购
  133. -- ActivityIconManager:getInstance():addIcon(604,-1)--勾玉擂台
  134. -- ActivityIconManager:getInstance():deleteIcon(19)--温泉
  135. -- ActivityIconManager:getInstance():deleteIcon(9)--花火大会
  136. -- ActivityIconManager:getInstance():deleteIcon(15)--公会争霸
  137. -- ActivityIconManager:getInstance():deleteIcon(30)--精彩活动
  138. -- ActivityIconManager:getInstance():deleteIcon(33)--护送
  139. -- OpenFun.Open(168, 4)
  140. -- self.model = GuildModel:getInstance()
  141. -- self.model:SetGuildActiveValue(100)
  142. -- self.model:Fire(GuildModel.REQUEST_CCMD_EVENT, 40600) --请求公会活跃信息
  143. -- self.model = GuildModel:getInstance()
  144. -- for i,v in ipairs(self.model.active_task_info.actives) do
  145. -- if v.id == 6 or v.id == 5 then
  146. -- v.is_complete = false
  147. -- end
  148. -- end
  149. -- self.model:UpdateActiveTask({
  150. -- id = 6, type=6, progress = 1
  151. -- })
  152. -- self.model:UpdateActiveTask({
  153. -- id = 5, type=5, progress = 1
  154. -- })
  155. -- self.model:Fire(GuildModel.REQUEST_CCMD_EVENT, 40600) --请求公会活跃信息
  156. -- local mainRole = Scene:getInstance():GetMainRole()
  157. -- if mainRole then
  158. -- mainRole:ShowEffect()
  159. -- print('Cat:TestForCat.lua[101] mainRole.direction', mainRole.direction)
  160. -- end
  161. -- local role = Scene:getInstance():GetRole(99999998)
  162. -- print('Cat:TestForCat.lua[99] role', tostring(role))
  163. -- self.view_h = AirCombatPictureBaseView.New()
  164. -- OpenFun.Open(169, 4)
  165. -- local reward_list = CustomActivityModel:getInstance():getOneActRewardList(32, 12)
  166. -- print("Cat:TestForCat [start:97] reward_list:", reward_list)
  167. -- PrintTable(reward_list)
  168. -- print("Cat:TestForCat [end]")
  169. -- --显示结算界面
  170. -- local show_data = GridWalkModel:GetInstance():GetGameSumRewardList()
  171. -- GiftModel:getInstance():SetShowGoodsInfo(show_data)
  172. -- GiftModel:getInstance():Fire(GiftModel.OPEN_SHOW_GOODS_VIEW, nil, {title_down="title_get3"})
  173. -- self.view_h = TestRadarView.New()
  174. -- do
  175. -- -- local show_data =
  176. -- local show_data = GridWalkModel:GetInstance():GetGameSumRewardList()
  177. -- print("Cat:TestForCat [start:97] show_data:", show_data)
  178. -- PrintTable(show_data)
  179. -- print("Cat:TestForCat [end]")
  180. -- GiftModel:getInstance():SetShowGoodsInfo(show_data)
  181. -- GiftModel:getInstance():Fire(GiftModel.OPEN_SHOW_GOODS_VIEW)
  182. -- end
  183. -- AchieveModel:getInstance():Fire(AchieveModel.REQ_SWPPEDAILY_CCMD, 2)
  184. -- do
  185. -- local function step_method( )
  186. -- lua_settingM:SetFrameRate(math.random(5,35))--帧率
  187. -- end
  188. -- if not self.step_method_id then
  189. -- self.step_method_id = GlobalTimerQuest:AddPeriodQuest(step_method, 1, -1)
  190. -- end
  191. -- step_method()
  192. -- end
  193. -- local guard_info = GodModel:GetInstance():GetGuardInfoByID(1, 2)
  194. -- print("Cat:TestForCat [start:96] guard_info:", guard_info)
  195. -- PrintTable(guard_info)
  196. -- print("Cat:TestForCat [end]")
  197. -- do
  198. -- local npc_list = SceneManager:getInstance():GetNpcList()
  199. -- local is_find = false
  200. -- for k,v in pairs(npc_list) do
  201. -- print('Cat:TaskController.lua[989] v.type_id', v.type_id)
  202. -- if v.type_id == 150101 or v.type_id == 150201 or v.type_id == 150301 then --拿到目标npc的唯一id相同的npcVo
  203. -- v:ChangeVar("task_icon", 0) --修改npc的顶部任务标识
  204. -- is_find = true
  205. -- break
  206. -- end
  207. -- end
  208. -- if not is_find then
  209. -- LogError("cannot find npc for csboss")
  210. -- end
  211. -- end
  212. -- local show_data = {
  213. -- type=2, award_list={}
  214. -- }
  215. -- for i=1,show_data.type==1 and 1 or 10 do
  216. -- table.insert(show_data.award_list, {goods_id=100002, goods_num=i})
  217. -- end
  218. -- GodLotteryResultView.New():Open(show_data)
  219. -- local filter_info = {exclude_types={GoodsConst.Type.LookChip}}
  220. -- local bag_goods_list = GoodsModel:getInstance():GetBagGoodsList(filter_info)
  221. -- print("Cat:TestForCat [start:96] bag_goods_list:", bag_goods_list)
  222. -- PrintTable(bag_goods_list)
  223. -- print("Cat:TestForCat [end]")
  224. -- local abs_pos = Vector3.zero
  225. -- local str = "<color='#1bbf00'>祝福值</color>奖励"
  226. -- local offer_x = 120
  227. -- local offer_y = -150
  228. -- local data = {}
  229. -- data = stringtotable([[ [{0,122001,60},{0,122001,60},{0,122001,60},{0,122001,60}] ]])
  230. -- GlobalEventSystem:Fire(CompetingListModel.OPEN_COMPETING_LIST_TIP_VIEW,data,abs_pos.x,abs_pos.y,false,str,offer_x,offer_y)
  231. -- OpenFun.Open(173, 6)
  232. -- local view = nil
  233. -- local goods_vo = GoodsModel:getInstance():GetGoodsBasicByTypeId(1010011)
  234. -- print("Cat:GodEquipBagView [start:103] goods_vo:", goods_vo)
  235. -- PrintTable(goods_vo)
  236. -- print("Cat:GodEquipBagView [end]")
  237. -- local getway = stringtotable(goods_vo.getway_url)
  238. -- local conf = {
  239. -- sub_view = GoodsGetWaySubView,
  240. -- layer_name = "Activity",
  241. -- data = getway,--如果SubView类有SetData函数就自动调用
  242. -- -- background_alpha = 0,
  243. -- -- load_callback = function(real_view)
  244. -- -- real_view.Close = function( )
  245. -- -- view:Close()
  246. -- -- end
  247. -- -- end,
  248. -- }
  249. -- view = BaseViewWrapper.New(conf)
  250. -- view:Open()
  251. -- OpenFun.Open(281, 0)
  252. -- local task_info_list = TaskModel:getInstance():GetCSBossTaskData()
  253. -- print('Cat:TestForCat.lua[95] #task_info_list', task_info_list[1].id)
  254. -- TaskModel:getInstance():TaskClickFun(task_info_list[1])
  255. -- local attr_list = GodModel:GetInstance():GetGodBaseAttr(1, 1, 0)
  256. -- print("Cat:TestForCat [start:94] attr_list:", attr_list)
  257. -- PrintTable(attr_list)
  258. -- print("Cat:TestForCat [end]")
  259. -- local attr_power = GetFighting(attr_list)
  260. -- print('Cat:TestForCat.lua[98] attr_power', attr_power)
  261. -- GlobalEventSystem:Fire(GodConst.Event.OpenGodMainView, GodConst.TabID.Info, {sub_tab_id=3, select_god_id=2})
  262. -- local god_cfg = GodModel:GetInstance():GetGodCfg(2)
  263. -- GodActiveView.New():Open(god_cfg)
  264. -- local need_lv = GodModel:GetInstance():GetGodNextStar(1,0,true)
  265. -- Message.show(need_lv)
  266. -- local is_red = GodModel:GetInstance():IsNeedRed(2)
  267. -- Message.show(tostring(is_red))
  268. -- self.view_h = TestAwardItemView.New()
  269. -- self.view_h = TestView.New()
  270. -- local conf = {
  271. -- sub_view = HorsePetSoulTipsView,
  272. -- data = 1,--如果SubView类有SetData函数就自动调用
  273. -- load_callback = function(real_view)
  274. -- real_view:SetBtnsVisible(true)
  275. -- end,
  276. -- }
  277. -- local view = BaseViewWrapper.New(conf)
  278. -- view:Open()
  279. -- MsgManager:getInstance():Add({type=Config.ConfigMainIcon.TipType.findback})--加找回小提示
  280. -- for i,v in pairs(GoodsModel:getInstance().wear_equip_list) do
  281. -- print('Cat:TestForCat.lua[166] v.goods_id', v.goods_id)
  282. -- if v.goods_id == 4295481896 then
  283. -- print('Cat:TestForCat.lua[168]')
  284. -- end
  285. -- end
  286. -- OpenFun.Open(610, 3)
  287. -- GlobalEventSystem:Fire(EventName.OPEN_STRENGTH_VIEW, true)
  288. -- do --vip经验卡
  289. -- if not self.view_h_1 then
  290. -- self.view_h_1 = VipExpCardView.New()
  291. -- end
  292. -- if self.view_h_1 and self.view_h_1.isPop==false then
  293. -- self.view_h_1:Open()
  294. -- end
  295. -- VipModel:getInstance().vip_info.vip_exp = VipModel:getInstance().vip_info.vip_exp+5
  296. -- self.view_h_1:PlayAddExp(5)
  297. -- end
  298. -- do
  299. -- local team_info_after_exit = {
  300. -- activity_id = 2 ,
  301. -- max_level = 999 ,
  302. -- scene_id = 3106 ,
  303. -- player_id_list =
  304. -- {
  305. -- 4294967351
  306. -- } ,
  307. -- min_level = 350 ,
  308. -- subtype = 15 ,
  309. -- }
  310. -- local dun_type
  311. -- local team_cfg = Config.Teamui[team_info_after_exit.activity_id.."@"..team_info_after_exit.subtype]
  312. -- if team_cfg and team_cfg.dun_id and Config.Dungeoncfg[team_cfg.dun_id] then
  313. -- dun_type = Config.Dungeoncfg[team_cfg.dun_id].type
  314. -- local num = BaseDungeonModel:getInstance():GetDungeonHaveTimes(dun_type)
  315. -- print('Cat:TeamModel.lua[1086] dun_type', dun_type, num)
  316. -- -- if not num or num <= 0 then
  317. -- -- --队长次数没有了就不提示了
  318. -- -- return
  319. -- -- end
  320. -- end
  321. -- GlobalEventSystem:Fire(TeamModel.INVITE_PLAYER, team_info_after_exit.player_id_list, team_info_after_exit.activity_id,team_info_after_exit.subtype,team_info_after_exit.scene_id,team_info_after_exit.min_level,team_info_after_exit.max_level)
  322. -- --10秒后自动开始多人副本
  323. -- TeamModel:getInstance():StartMultipAfterTime(10)
  324. -- end
  325. -- BaseDungeonModel:getInstance():Fire(BaseDungeonModel.REQUEST_CCMD_EVENT, 61001, 1000)
  326. -- GlobalEventSystem:Fire(EventName.Go_DO_Task, TaskType.GUILD_LINE)
  327. -- OpenFun.Open(610, 11)
  328. -- OpenFun.Open(123, 0)--跨服帮战
  329. -- OpenFun.Open(157, 1)
  330. -- GuildCSWarGuideView.New():Open()
  331. -- local show_rank = 3
  332. -- local my_rank = 7
  333. -- local award_num = PkRankRoleItem:GetBreakAward(show_rank, my_rank )
  334. -- print('Cat:TestForCat.lua[169] award_num', award_num)
  335. -- OpenFun.Open(409, 0)
  336. -- UIToolTipMgr:getInstance():AppendEquipTips(12060442)
  337. -- local str = WordManager:GetRoleLevel2(412,4,true,true)
  338. -- print('Cat:TestForCat.lua[170] str', str)
  339. -- local type_id = 12070342
  340. -- local goods_vo = GoodsModel:getInstance():GetGoodsBasicByTypeId(type_id)
  341. -- local target_config = Config.Equipattr[type_id]
  342. -- local dynamic = {}
  343. -- dynamic.type_id = type_id
  344. -- dynamic.rating = target_config.base_rating
  345. -- dynamic.equip_extra_attr = {}
  346. -- dynamic.equip_type = goods_vo.equip_type
  347. -- local target_pro = ErlangParser:GetInstance():Parse(target_config.recommend_attr)
  348. -- for i, v in ipairs(target_pro) do
  349. -- local attr = {}
  350. -- attr.color = tonumber(v[2][1])
  351. -- attr.attr_id = tonumber(v[2][2])
  352. -- if #v[2] == 5 then
  353. -- attr.type_id = 1
  354. -- attr.plus_interval = tonumber(v[2][4])
  355. -- attr.plus_unit = tonumber(v[2][5])
  356. -- else
  357. -- attr.type_id = 2
  358. -- attr.attr_val = tonumber(v[2][3])
  359. -- end
  360. -- table.insert(dynamic.equip_extra_attr, attr)
  361. -- end
  362. -- self.dynamic = dynamic
  363. -- UIToolTipMgr:getInstance():AppendEquipShowTips(self.dynamic, x, y)
  364. -- UIToolTipMgr:getInstance():AppendEquipTips(10080710, nil, nil, goods_basic)
  365. -- local vo = GoodsModel:getInstance():GetOneGoodsVoByTypeId(10000001)
  366. -- print('Cat:TestForCat.lua[168] vo', vo)
  367. -- GlobalEventSystem:Fire(EventName.OPEN_ITEM_USE_VIEW_TOP_EVER, vo)
  368. -- PrintTable(MainCamera.getInstance().lock_target, nil, 2)
  369. -- local list = Scene.Instance:GetMonsterList()
  370. -- for k,v in pairs(list) do
  371. -- print('Cat:TestForCat.lua[169] v.vo.', v.model_hide_flag, v.name)
  372. -- end
  373. -- UIToolTipMgr:getInstance():AppendGoodsTips(GoodsConst.ID.BindDiamond, nil, nil, nil, nil, true)
  374. -- GlobalEventSystem:Fire(TaskEventType.SHOW_TASK_GUILD_ARROW, true)
  375. -- Message.show("sss ", tostring(MainCamera.Instance.is_lock_camera))
  376. -- local main_task_vo = TaskModel:getInstance():GetMainTask()
  377. -- if main_task_vo and main_task_vo.id then
  378. -- -- GlobalEventSystem:Fire(EventName.FORCE_STOP_DO_TASK)
  379. -- local function delay_method( )
  380. -- GlobalEventSystem:Fire(TaskEventType.SHOW_TASK_GUIDE_ARROW_EX, Config.ConfigTaskEffect.bountyTaskTipId, "做日常任务继续升级", 3, true, 2*60)
  381. -- GlobalEventSystem:Fire(TaskEventType.SHOW_TASK_GUIDE_ARROW_EX, main_task_vo.id, "又有主线任务了", 15, 3, true, 2*60)
  382. -- end
  383. -- setTimeout(delay_method, 0.5)
  384. -- end
  385. -- local monster = Scene.Instance:GetMonsterByTypeId(10010204)
  386. -- local findObj = FindVo.New()
  387. -- findObj.sceneId = SceneManager.Instance:GetSceneId()
  388. -- findObj.type = FindVo.POINT --不能用findVo.MONSTER,不然会去找最近的怪物的
  389. -- findObj.x = monster:GetVo().pos_x/ SceneObj.LogicRealRatio.x
  390. -- findObj.y = monster:GetVo().pos_y/ SceneObj.LogicRealRatio.y
  391. -- local call_back = function ( )
  392. -- Scene.Instance:MainRoleAttackMonster(monster)
  393. -- GlobalEventSystem:Fire(EventName.STARTAUTOFIGHT)
  394. -- end
  395. -- findObj.call_back = call_back
  396. -- GlobalEventSystem:Fire(EventName.FIND,findObj)
  397. -- Scene.Instance:MainRoleAttackMonster(mon)
  398. -- GlobalEventSystem:Fire(EventName.STARTAUTOFIGHT)
  399. -- SceneManager.Instance:AddMonsterVo(mon.vo,true)
  400. -- TaskModel:getInstance():SetCurTaskIDToMainTask()
  401. -- print('Cat:TestForCat.lua[181] ItemUseModel:getInstance(), ItemUseModel:getInstance().goods_dic', ItemUseModel:getInstance(), ItemUseModel:getInstance().goods_dic)
  402. -- ItemUseModel.Instance = self:ListenTableValueChange(ItemUseModel.Instance, "goods_dic", function()
  403. -- print("Cat:TestForCat [90] : ", ItemUseModel:getInstance().goods_dic, debug.traceback())
  404. -- end)
  405. -- do
  406. -- local test_str = "return {type_id = 110045,goods_name = [[ 世界首领疲劳药水 ]],intro = [[ 使用后可消除一点当天的<color=#1bbf00>【世界Boss疲劳度】</color> ]],getway = [[ 【消除世界Boss疲劳】 ]],getway_url = [[ [{225,0}] ]],bind = 1,trade = 0,sell = 1,type = 38,subtype = 16,sell_category = 0,sell_subcategory = 0,equip_type = 0,goods_icon = 110045,career_id = 0,level = 1,max_overlap = 99999,color = 2,expire_time = 0,trade_price = [[ [] ]],lock_time = 0,compose = 0,quick_use = 0,base_attrlist = [[ [] ]],addition = [[ [] ]],model_id = 0,sex = 0,turn = 0,bag_location = 4,num_use = 0,give = 0,use_intro = [[ 太好了(哭唧唧…),又能多打一只Boss了! ]],use_way = [[ y ]],use_tip_flag = [[ {[2]=true,[1]=\"sss\"} ]]}"
  407. -- local func = loadstring(test_str)
  408. -- print('Cat:TestForCat.lua[172] func', func)
  409. -- if func then
  410. -- local result = func()
  411. -- print("Cat:TestForCat [start:174] result:", result)
  412. -- PrintTable(result)
  413. -- print("Cat:TestForCat [end]")
  414. -- end
  415. -- return
  416. -- end
  417. -- GlobalEventSystem:Fire(EventName.OPEN_FORM_TEAM_VIEW)
  418. -- local skill_cfg = ConfigItemMgr.Instance:GetSkillItem(415002)
  419. -- local show_vos = {{
  420. -- type = 2, is_out_res=true, outside_res = GameResPath.GetSkillIcon(415002),
  421. -- saying = skill_cfg.name, ignore_fly=true, id=0,
  422. -- }}
  423. -- self.view_h = NewFuncOpenView.New()
  424. -- self.data = show_vos
  425. -- TopPkRewardView.New():Open()
  426. -- OpenFun.Open(157, 2)
  427. -- self.view_h = AdventureBookActiveView.New()
  428. -- local cfg = Config.Adventurebook["1@2"]
  429. -- self.data = cfg
  430. -- GlobalEventSystem:Fire(EventName.OPEN_DESIGNATION_VIEW, 320000)
  431. -- local on_ack = function ( self, vo )
  432. -- print("Cat:TestForCat [start:83] vo:", vo)
  433. -- PrintTable(vo)
  434. -- print("Cat:TestForCat [end]")
  435. -- end
  436. -- GlobalEventSystem:Fire(EventName.REQ_ROLE_INFO, RoleManager.Instance.mainRoleInfo.role_id, on_ack, self)
  437. -- self.view_h = GuildCSWarResultView.New()
  438. -- self.data = {occupy_city={{city_id=1},{city_id=3},{city_id=2}}}
  439. -- Scene:getInstance():CancelClickTarget()
  440. -- GlobalEventSystem:Fire(EventName.STOPAUTOFIGHT)
  441. -- GlobalEventSystem:Fire(EventName.STARTAUTOFIGHT)
  442. -- if not self.notify_view then
  443. -- self.notify_view = GuildCSWarNotifyView.New()
  444. -- self.notify_view:Open()
  445. -- end
  446. -- local function delay_method( )
  447. -- GuildCSWarModel:GetInstance():Fire(GuildCSWarConst.Event.ShowWarNotify, {show_type=GuildCSWarConst.NotifyID.RunToCommand, city_id=2})
  448. -- end
  449. -- setTimeout(delay_method, 1)
  450. -- PokerModel:GetInstance():Fire(PokerConst.OPEN_POKER_VIEW)
  451. -- self:TestParticleEffect()
  452. -- self:TestNameBoardGuildName()
  453. -- local isAutoSwitchSprite = lua_settingM.blockSet["spriteAide"]
  454. -- print('Cat:TestForCat.lua[66] isAutoSwitchSprite', isAutoSwitchSprite)
  455. -- self:ShowTopPkResultView()
  456. -- GuildAskUseFireGoodsView.New():Open()
  457. -- GuildModel:getInstance():Fire(EventName.OPEN_GUILD_FEAST_SCENE_VIEW, false)
  458. -- GuildModel:getInstance():Fire(EventName.OPEN_GUILD_FEAST_SCENE_VIEW, true)
  459. -- TeamModel:getInstance():SetIsAutoMatch(true)
  460. -- self.view_h = TeamMatchingView.New()
  461. -- self.view_h = SpriteAideView.New()
  462. -- print("next goods_id : ", EquipModel:getInstance():GetNextSpriteGoodsID())
  463. ------------------
  464. -- local test = {}
  465. -- UpdateVisibleByJury(test, true, "Test")
  466. -- UpdateVisibleByJury(test, false, "JustLike")
  467. -- self:ChangeRolePosToCameraPos()
  468. -- self:DropItem()
  469. -- self.views = {MainUIConst.ViewID.Task}
  470. -- MainUIModel:GetInstance():Fire(MainUIConst.UpdateViewsVisible, self.views, false, MainUIConst.VisibleReason.Dialogue)
  471. -- MainUIModel:GetInstance():Fire(MainUIConst.UpdateViewsVisible, MainUIConst.ViewID, true, MainUIConst.VisibleReason.Dialogue)
  472. -- require("game.test.TestController")
  473. -- self.view_h = TestMainView.New()
  474. ------------------
  475. if self.view_h then
  476. self.view_h:Open(self.data)
  477. end
  478. end
  479. function TestForCat:UpdateTableOperateListen( )
  480. local is_can_open = Application.platform == RuntimePlatform.WindowsEditor or Application.platform == RuntimePlatform.WindowsPlayer
  481. -- print('Cat:TestForCat.lua[UpdateTableOperateListen] is_can_open', is_can_open)
  482. if self.origin_insert or not is_can_open then return end
  483. self.origin_insert = table.insert
  484. table.insert = function(tbl, arge1, arge2)
  485. --因为table.insert的实现用的是rawset不会触发__newindex所以需要重写
  486. if arge2==nil then
  487. -- old_insert(tbl, arge1)
  488. tbl[#tbl+1] = arge1
  489. else
  490. -- old_insert(tbl, arge1, arge2)
  491. local insert_pos = arge1
  492. local tbl_size = #tbl
  493. if insert_pos>tbl_size then
  494. tbl_size = insert_pos
  495. elseif insert_pos==tbl_size then
  496. tbl_size = insert_pos+1
  497. end
  498. for i=tbl_size,insert_pos+1,-1 do
  499. print('Cat:TestForCat.lua[132] i, tbl_size, insert_pos, #tbl', i, tbl_size, insert_pos, #tbl)
  500. tbl[i] = tbl[i-1]
  501. end
  502. tbl[insert_pos] = arge2
  503. end
  504. end
  505. end
  506. --tbl某值变更时触发监听函数,比如tbl.xx=1时就会触发,但注意tbl=xx时就监听无效了
  507. function TestForCat:ListenTableValueChange( tbl, key, call_back )
  508. local is_can_open = Application.platform == RuntimePlatform.WindowsEditor or Application.platform == RuntimePlatform.WindowsPlayer
  509. -- print('Cat:TestForCat.lua[ListenTableValueChange] is_can_open', is_can_open)
  510. if not is_can_open then return end
  511. local old_tbl = tbl
  512. if old_tbl[key] then
  513. old_tbl[key] = self:ListenTableValueChange(old_tbl[key], nil, call_back)
  514. end
  515. local listen_tbl = {}
  516. local meta_tbl = {
  517. __newindex = function(write_tbl, write_key, write_value)
  518. print('Cat:TestForCat.lua[86] write_key, write_value', write_tbl, write_key, write_value, "key :|"..tostring(key).."|")
  519. old_tbl[write_key] = write_value
  520. if key == nil then
  521. --监听所有字段
  522. call_back()
  523. elseif key == write_key then
  524. call_back()
  525. if old_tbl[key] then
  526. old_tbl[key] = self:ListenTableValueChange(old_tbl[key], nil, call_back)
  527. end
  528. end
  529. end,
  530. __index = function(write_tbl, write_key)
  531. -- print('Cat:TestForCat.lua[89] write_key', write_key)
  532. return old_tbl[write_key]
  533. end,
  534. __len = function (op)
  535. print('Cat:TestForCat.lua[140] old_tbl', old_tbl, type(old_tbl))
  536. if type(old_tbl) == "string" then
  537. return strlen(old_tbl)
  538. elseif type(old_tbl) == "table" then
  539. return #old_tbl
  540. else
  541. print('Cat:TestForCat.lua[error145]')
  542. end
  543. end,
  544. }
  545. setmetatable(listen_tbl, meta_tbl)
  546. self:UpdateTableOperateListen()
  547. return listen_tbl
  548. end
  549. function TestForCat:TestAction( )
  550. end
  551. function TestForCat:TestNameBoardGuildName( )
  552. local monster_list = Scene:getInstance():GetMonsterList()
  553. for k,v in pairs(monster_list) do
  554. local name_board = v:GetNameBoard()
  555. if name_board then
  556. name_board:SetGuildText("jhahahsde")
  557. end
  558. end
  559. end
  560. function TestForCat:TestParticleEffect( )
  561. self.effect_ids = self.effect_ids or {}
  562. if self.flag == nil then
  563. self.flag = true
  564. end
  565. if self.flag then
  566. local monster_list = Scene:getInstance():GetMonsterList()
  567. for k,v in pairs(monster_list) do
  568. self.effect_ids[v.compress_id] = ParticleManager:getInstance():AddTargetEffect("effect_xemlvup", v.compress_id, true, nil, nil, nil,call_back_func,nil,1)
  569. end
  570. else
  571. for k,v in pairs(self.effect_ids) do
  572. ParticleManager:getInstance():DelEffect(v)
  573. end
  574. end
  575. self.flag = not self.flag
  576. end
  577. function TestForCat:ShowTopPkResultView( )
  578. TopPkModel:getInstance().season_info = TopPkModel:getInstance().season_info or {}
  579. TopPkModel:getInstance().season_info.star = 5
  580. TopPkModel:getInstance().season_info.grade = 2
  581. TopPkModel:getInstance().result_info = {
  582. res = 1,
  583. grade = 3,
  584. star = 122,
  585. win_num = 5,
  586. score = 100,
  587. war_score = 200,
  588. }
  589. TopPkResultView.New():Open()
  590. end
  591. function TestForCat:TestPkRankResultView( )
  592. PkRankModel:getInstance().result_info = {
  593. result = 1,
  594. role_list={
  595. {
  596. role_id = RoleManager.Instance.mainRoleInfo.role_id,
  597. before_rank = 123,
  598. rank = 100,
  599. }
  600. },
  601. reward_list = {
  602. {type=16, type_id=0, num=1}, {type=5, type_id=0, num=2}
  603. },
  604. }
  605. PkRankModel:getInstance():Fire(PkRankModel.OPEN_RESULT_VIEW)
  606. end
  607. function TestForCat:BaseViewWrapper( )
  608. local basic = GoodsModel:getInstance():GetGoodsBasicByTypeId(110024)
  609. local getway = ErlangParser:GetInstance():Parse(basic.getway_url)
  610. local conf = {
  611. sub_view = GoodsGetWaySubView,
  612. data = getway,--如果SubView类有SetData函数就自动调用
  613. }
  614. local view = BaseViewWrapper.New(conf)
  615. view:Open()
  616. end
  617. function TestForCat:ChangeRolePosToCameraPos( )
  618. local role = Scene:getInstance():GetMainRole()
  619. if role then
  620. local trans = role.transform:Find("model_clothe_1200")
  621. local role_old_pos_x, role_old_pos_y, role_old_pos_z = GetLocalPositionX(trans), GetLocalPositionY(trans), GetLocalPositionZ(trans)
  622. SetLocalPosition(trans, 0,0,0)
  623. local role_pos_x = GetGlobalPositionX(trans)
  624. local role_pos_y = GetGlobalPositionY(trans)
  625. local pos = MainCamera.Instance.camera:WorldToViewportPoint(Vector3.New(role_pos_x, role_pos_y, GetGlobalPositionZ(trans)))
  626. local camera_pos = MainCamera.Instance.camera.transform.position
  627. print("Cat:TestForCat [49] pos, camera_pos: ",pos, camera_pos)
  628. local camera_size = 3.96*2
  629. pos.x = (camera_size*(16/9))*(pos.x-0.5)+camera_pos.x
  630. pos.y = (camera_size)*(pos.y-0.5)+camera_pos.y
  631. print("Cat:TestForCat [47] pos: ", pos)
  632. role:SetRealPos(pos.x*MainCamera.PixelsToUnits, pos.y*MainCamera.PixelsToUnits)
  633. SetLocalPosition(trans, role_old_pos_x, role_old_pos_y, role_old_pos_z)
  634. end
  635. end
  636. local function GetPosByIndex( index )
  637. -- index从1开始
  638. local offset_map = {
  639. [1] = {x=0, y=1},
  640. [2] = {x=2, y=1},
  641. [3] = {x=3, y=0},
  642. [4] = {x=2, y=-1},
  643. [5] = {x=0, y=-1},
  644. [6] = {x=-2, y=-1},
  645. [7] = {x=-3, y=0},
  646. [8] = {x=-2, y=1},
  647. }
  648. -- local ring = (index-1)/8+1--第几圈,从1开始
  649. -- local num_in_ring = (index-1)%8+1--该圈的第几个,范围1至8
  650. return offset_map[index]
  651. end
  652. function TestForCat:DropItem( )
  653. print('Cat:TestForCat.lua[DropItem]')
  654. local base_x = RoleManager.Instance.mainRoleInfo.pos_x
  655. local base_y = RoleManager.Instance.mainRoleInfo.pos_y
  656. local x_offset_per_item = 30
  657. local y_offset_per_item = 30
  658. local drop_list = {}
  659. for i = 1,8 do
  660. local offset_pos = GetPosByIndex(i)
  661. vo2 = {
  662. drop_id = i,
  663. drop_type = 0,--非绑定
  664. type_id = 11030241,
  665. drop_num = i,
  666. role_id = RoleManager.Instance.mainRoleInfo.role_id,
  667. pos_x = base_x+offset_pos.x*x_offset_per_item,
  668. pos_y = base_y+offset_pos.y*y_offset_per_item,
  669. effect = 0,
  670. drop_icon = 5
  671. }
  672. table.insert(drop_list,vo2)
  673. end
  674. local vo = {map_id = SceneManager:getInstance():GetSceneId(), drop_list=drop_list, display_time=123456, mon_id=123456, boss_type=1, pos_x=base_x, pos_y=base_y}
  675. GlobalEventSystem:Fire(SceneEventType.BROADCAST_SCENE_DROP_LIST, vo)
  676. end