|
require("game.test.TestView")
|
|
|
|
TestForCat = TestForCat or BaseClass(BaseController)
|
|
|
|
function TestForCat:__init()
|
|
TestForCat.Instance = self
|
|
print("Cat:TestForCat [init]")
|
|
self.listen_tables = {}
|
|
end
|
|
|
|
function TestForCat:__delete()
|
|
if self.view_h then
|
|
self.view_h:Close()
|
|
self.view_h = nil
|
|
end
|
|
end
|
|
|
|
function TestForCat:OnKeyRelease()
|
|
GlobalEventSystem:Fire(EventName.ON_KEY_RELEASE)
|
|
if Input.GetKeyUp(KeyCode.F) then
|
|
self:OnKeyClick_F()
|
|
elseif Input.GetKeyUp(KeyCode.H) then
|
|
self:OnKeyClick_H()
|
|
elseif Input.GetKeyUp(KeyCode.T) then
|
|
self:TestAction()--测试Action
|
|
elseif Input.GetKeyUp(KeyCode.U) then
|
|
TestForCat.Instance.G_TestFlag = 1
|
|
-- elseif Input.GetKeyUp(KeyCode.C) then
|
|
--传闻
|
|
-- local chuan_str = "player_name, 101"
|
|
-- GlobalEventSystem:Fire(EventName.RECEIVE_CHUANWEN, 63501, Split(chuan_str,","))--传闻
|
|
--公告
|
|
-- ChatController.Instance:ReceiveGongGao(40001, ChatModel.CHANNEL_ENLIST, 0, Split("1,小泽,8001,1",","))
|
|
elseif Input.GetKeyUp(KeyCode.R) then
|
|
-- if KeyInput.Instance.test_key_class ~= nil then
|
|
-- KeyInput.Instance.test_key_class:DeleteMe()
|
|
-- KeyInput.Instance.test_key_class = nil
|
|
-- end
|
|
-- KeyInput.Instance.test_key_class = TestForCat.New()
|
|
-- LuaMemManager:getInstance():checkToReleaseMem(true, true)
|
|
-- --热更代码
|
|
-- if self.HU == nil then
|
|
-- self.HU = _G.originalRequire "luahotupdate"
|
|
-- self.HU.Init("hotupdatelist", {"I:\\Demon\\develop\\code\\u3d\\Lua"})
|
|
-- end
|
|
-- print("Cat:TestForCat [HotUpdate Lua] self.HU: ",self.HU)
|
|
-- self.HU.Update()
|
|
end
|
|
end
|
|
|
|
--专门用来快速打开界面用的
|
|
function TestForCat:OnKeyClick_F()
|
|
if self.view_h then
|
|
self.view_h:Close()
|
|
self.view_h = nil
|
|
end
|
|
self.open_data = nil
|
|
|
|
-- MainRoleModel:getInstance():Fire(MainRoleModel.OPEN_SHAPE_VIEW, 5)
|
|
self.view_h = BloodMainView.New()
|
|
-- self.view_h = MergeServerMainView.New()
|
|
-- GridWalkModel:GetInstance():Fire(GridWalkConst.Event.OpenGameView)
|
|
-- GlobalEventSystem:Fire(GodConst.Event.OpenGodMainView)
|
|
-- self.view_h = GodMainView.New()
|
|
-- self.open_data = GodConst.TabID.Info
|
|
-- self.view_h = SpriteAideFirstDressView.New()
|
|
-- self.open_data = 10000001
|
|
-- GlobalEventSystem:Fire(EventName.OPEN_GUILD_MAIN_VIEW, GuildConst.TabId.Depot)
|
|
-- GlobalEventSystem:Fire(EventName.OPEN_MARKET_VIEW, 1, 2)
|
|
-- OpenFun.Open(281, 0)--跨服1v1
|
|
-- GlobalEventSystem:Fire(EventName.OPEN_GUILD_MAIN_VIEW, {4, 2})
|
|
-- self.view_h = PkRankChallengeRewardView.New()
|
|
-- Message.show("OnKeyClick_F")
|
|
-- self:TestPkRankResultView()
|
|
-- OpenFun.Open(2)--锻造
|
|
-- self:BaseViewWrapper()
|
|
-- self.view_h = DailyMainView.New()
|
|
-- assert(false, "haha")
|
|
-- require("newgameui.ComboxView")
|
|
-- local view = ComboxView.New()
|
|
-- view:SetSize(100,300)
|
|
-- local on_click = function ( index )
|
|
-- print('Cat:TestForCat.lua[52]', index)
|
|
-- end
|
|
-- view:Open({"1", "2", "3"},on_click,nil,Vector3(0, 0, 0))
|
|
if self.view_h then
|
|
self.view_h:Open(self.open_data)
|
|
end
|
|
end
|
|
|
|
function TestForCat:OnKeyClick_H()
|
|
if self.view_h then
|
|
self.view_h:Close()
|
|
self.view_h = nil
|
|
end
|
|
-- print('Cat:TestForCat.lua[98]')
|
|
-- for i=1,1000000 do
|
|
-- print('Cat:TopPkController.lua[98]')
|
|
-- end
|
|
-- print('Cat:TestForCat.lua[102]')
|
|
|
|
TopPkModel:getInstance():Fire(TopPkModel.GAME_STAGE_CHANGED)
|
|
|
|
-- do
|
|
-- local tb = {}
|
|
-- tb.type = Config.ConfigMainIcon.TipType.come_bk_apply
|
|
-- tb.bind_data = {role_id=12345, name="hahaha"}
|
|
-- tb.is_same_func = function(a, b)
|
|
-- local aRoleID = a and a.bind_data and a.bind_data.role_id
|
|
-- local bRoleID = b and b.bind_data and b.bind_data.role_id
|
|
-- print('Cat:ComeBKGiftController.lua[53] aRoleID, bRoleID', aRoleID, bRoleID)
|
|
-- return aRoleID == bRoleID
|
|
-- end
|
|
-- MsgManager:getInstance():Add(tb)
|
|
-- end
|
|
-- do
|
|
-- --获取活动奖励
|
|
-- local info = CustomActivityModel:getInstance():getOneActRewardList(86, 1)
|
|
-- print("Cat:TestForCat [start:99] info: ", info)
|
|
-- PrintTable(info)
|
|
-- print("Cat:TestForCat [end]")
|
|
-- end
|
|
-- local isOpen, errorStr = GuildPVEModel:GetInstance():IsSysOpen()
|
|
-- print('Cat:DialogueController.lua[138] isOpen, errorStr', isOpen, errorStr)
|
|
-- GuildPVEModel:GetInstance():Fire(GuildPVEConst.Event.AckNotify, {gname="哈哈帮", hurt=12345})
|
|
-- GuildPVEResultView.New():Open({line_rank=2})
|
|
-- print("Cat:TestForCat [start:99] Scene.Instance.monster_list:", Scene.Instance.monster_list)
|
|
-- PrintTable(Scene.Instance.monster_list, nil, 2)
|
|
-- print("Cat:TestForCat [end]")
|
|
-- GuildPVEController.GetInstance():RunToPVENPC()
|
|
-- ActivityIconManager:getInstance():addIcon(19,-1)--温泉
|
|
-- ActivityIconManager:getInstance():addIcon(9,-1)--花火大会
|
|
-- ActivityIconManager:getInstance():addIcon(15,-1)--公会争霸
|
|
-- ActivityIconManager:getInstance():addIcon(30,-1)--精彩活动
|
|
-- ActivityIconManager:getInstance():addIcon(33,-1)--护送
|
|
-- ActivityIconManager:getInstance():addIcon(225070,-1)--合服活动
|
|
-- ActivityIconManager:getInstance():addIcon(600,-1)--虚空秘境
|
|
-- ActivityIconManager:getInstance():addIcon(281,-1)--巅峰竞技
|
|
-- ActivityIconManager:getInstance():addIcon(41,-1)--BOSS活动
|
|
-- ActivityIconManager:getInstance():addIcon(43,-1)--幸运转盘
|
|
-- ActivityIconManager:getInstance():addIcon(46,-1)--神秘限购
|
|
-- ActivityIconManager:getInstance():addIcon(604,-1)--勾玉擂台
|
|
|
|
-- ActivityIconManager:getInstance():deleteIcon(19)--温泉
|
|
-- ActivityIconManager:getInstance():deleteIcon(9)--花火大会
|
|
-- ActivityIconManager:getInstance():deleteIcon(15)--公会争霸
|
|
-- ActivityIconManager:getInstance():deleteIcon(30)--精彩活动
|
|
-- ActivityIconManager:getInstance():deleteIcon(33)--护送
|
|
|
|
-- OpenFun.Open(168, 4)
|
|
|
|
-- self.model = GuildModel:getInstance()
|
|
-- self.model:SetGuildActiveValue(100)
|
|
-- self.model:Fire(GuildModel.REQUEST_CCMD_EVENT, 40600) --请求公会活跃信息
|
|
|
|
-- self.model = GuildModel:getInstance()
|
|
-- for i,v in ipairs(self.model.active_task_info.actives) do
|
|
-- if v.id == 6 or v.id == 5 then
|
|
-- v.is_complete = false
|
|
-- end
|
|
-- end
|
|
-- self.model:UpdateActiveTask({
|
|
-- id = 6, type=6, progress = 1
|
|
-- })
|
|
-- self.model:UpdateActiveTask({
|
|
-- id = 5, type=5, progress = 1
|
|
-- })
|
|
-- self.model:Fire(GuildModel.REQUEST_CCMD_EVENT, 40600) --请求公会活跃信息
|
|
|
|
-- local mainRole = Scene:getInstance():GetMainRole()
|
|
-- if mainRole then
|
|
-- mainRole:ShowEffect()
|
|
-- print('Cat:TestForCat.lua[101] mainRole.direction', mainRole.direction)
|
|
-- end
|
|
-- local role = Scene:getInstance():GetRole(99999998)
|
|
-- print('Cat:TestForCat.lua[99] role', tostring(role))
|
|
-- self.view_h = AirCombatPictureBaseView.New()
|
|
|
|
-- OpenFun.Open(169, 4)
|
|
-- local reward_list = CustomActivityModel:getInstance():getOneActRewardList(32, 12)
|
|
-- print("Cat:TestForCat [start:97] reward_list:", reward_list)
|
|
-- PrintTable(reward_list)
|
|
-- print("Cat:TestForCat [end]")
|
|
-- --显示结算界面
|
|
-- local show_data = GridWalkModel:GetInstance():GetGameSumRewardList()
|
|
-- GiftModel:getInstance():SetShowGoodsInfo(show_data)
|
|
-- GiftModel:getInstance():Fire(GiftModel.OPEN_SHOW_GOODS_VIEW, nil, {title_down="title_get3"})
|
|
|
|
-- self.view_h = TestRadarView.New()
|
|
-- do
|
|
-- -- local show_data =
|
|
-- local show_data = GridWalkModel:GetInstance():GetGameSumRewardList()
|
|
-- print("Cat:TestForCat [start:97] show_data:", show_data)
|
|
-- PrintTable(show_data)
|
|
-- print("Cat:TestForCat [end]")
|
|
-- GiftModel:getInstance():SetShowGoodsInfo(show_data)
|
|
-- GiftModel:getInstance():Fire(GiftModel.OPEN_SHOW_GOODS_VIEW)
|
|
-- end
|
|
-- AchieveModel:getInstance():Fire(AchieveModel.REQ_SWPPEDAILY_CCMD, 2)
|
|
-- do
|
|
-- local function step_method( )
|
|
-- lua_settingM:SetFrameRate(math.random(5,35))--帧率
|
|
-- end
|
|
-- if not self.step_method_id then
|
|
-- self.step_method_id = GlobalTimerQuest:AddPeriodQuest(step_method, 1, -1)
|
|
-- end
|
|
-- step_method()
|
|
-- end
|
|
|
|
-- local guard_info = GodModel:GetInstance():GetGuardInfoByID(1, 2)
|
|
-- print("Cat:TestForCat [start:96] guard_info:", guard_info)
|
|
-- PrintTable(guard_info)
|
|
-- print("Cat:TestForCat [end]")
|
|
|
|
-- do
|
|
-- local npc_list = SceneManager:getInstance():GetNpcList()
|
|
-- local is_find = false
|
|
-- for k,v in pairs(npc_list) do
|
|
-- print('Cat:TaskController.lua[989] v.type_id', v.type_id)
|
|
-- if v.type_id == 150101 or v.type_id == 150201 or v.type_id == 150301 then --拿到目标npc的唯一id相同的npcVo
|
|
-- v:ChangeVar("task_icon", 0) --修改npc的顶部任务标识
|
|
-- is_find = true
|
|
-- break
|
|
-- end
|
|
-- end
|
|
-- if not is_find then
|
|
-- LogError("cannot find npc for csboss")
|
|
-- end
|
|
-- end
|
|
|
|
-- local show_data = {
|
|
-- type=2, award_list={}
|
|
-- }
|
|
-- for i=1,show_data.type==1 and 1 or 10 do
|
|
-- table.insert(show_data.award_list, {goods_id=100002, goods_num=i})
|
|
-- end
|
|
-- GodLotteryResultView.New():Open(show_data)
|
|
|
|
|
|
-- local filter_info = {exclude_types={GoodsConst.Type.LookChip}}
|
|
-- local bag_goods_list = GoodsModel:getInstance():GetBagGoodsList(filter_info)
|
|
-- print("Cat:TestForCat [start:96] bag_goods_list:", bag_goods_list)
|
|
-- PrintTable(bag_goods_list)
|
|
-- print("Cat:TestForCat [end]")
|
|
|
|
-- local abs_pos = Vector3.zero
|
|
-- local str = "<color='#1bbf00'>祝福值</color>奖励"
|
|
-- local offer_x = 120
|
|
-- local offer_y = -150
|
|
-- local data = {}
|
|
-- data = stringtotable([[ [{0,122001,60},{0,122001,60},{0,122001,60},{0,122001,60}] ]])
|
|
-- GlobalEventSystem:Fire(CompetingListModel.OPEN_COMPETING_LIST_TIP_VIEW,data,abs_pos.x,abs_pos.y,false,str,offer_x,offer_y)
|
|
|
|
-- OpenFun.Open(173, 6)
|
|
-- local view = nil
|
|
-- local goods_vo = GoodsModel:getInstance():GetGoodsBasicByTypeId(1010011)
|
|
-- print("Cat:GodEquipBagView [start:103] goods_vo:", goods_vo)
|
|
-- PrintTable(goods_vo)
|
|
-- print("Cat:GodEquipBagView [end]")
|
|
-- local getway = stringtotable(goods_vo.getway_url)
|
|
-- local conf = {
|
|
-- sub_view = GoodsGetWaySubView,
|
|
-- layer_name = "Activity",
|
|
-- data = getway,--如果SubView类有SetData函数就自动调用
|
|
-- -- background_alpha = 0,
|
|
-- -- load_callback = function(real_view)
|
|
-- -- real_view.Close = function( )
|
|
-- -- view:Close()
|
|
-- -- end
|
|
-- -- end,
|
|
-- }
|
|
-- view = BaseViewWrapper.New(conf)
|
|
-- view:Open()
|
|
|
|
-- OpenFun.Open(281, 0)
|
|
-- local task_info_list = TaskModel:getInstance():GetCSBossTaskData()
|
|
-- print('Cat:TestForCat.lua[95] #task_info_list', task_info_list[1].id)
|
|
-- TaskModel:getInstance():TaskClickFun(task_info_list[1])
|
|
|
|
-- local attr_list = GodModel:GetInstance():GetGodBaseAttr(1, 1, 0)
|
|
-- print("Cat:TestForCat [start:94] attr_list:", attr_list)
|
|
-- PrintTable(attr_list)
|
|
-- print("Cat:TestForCat [end]")
|
|
-- local attr_power = GetFighting(attr_list)
|
|
-- print('Cat:TestForCat.lua[98] attr_power', attr_power)
|
|
-- GlobalEventSystem:Fire(GodConst.Event.OpenGodMainView, GodConst.TabID.Info, {sub_tab_id=3, select_god_id=2})
|
|
|
|
-- local god_cfg = GodModel:GetInstance():GetGodCfg(2)
|
|
-- GodActiveView.New():Open(god_cfg)
|
|
-- local need_lv = GodModel:GetInstance():GetGodNextStar(1,0,true)
|
|
-- Message.show(need_lv)
|
|
-- local is_red = GodModel:GetInstance():IsNeedRed(2)
|
|
-- Message.show(tostring(is_red))
|
|
-- self.view_h = TestAwardItemView.New()
|
|
-- self.view_h = TestView.New()
|
|
-- local conf = {
|
|
-- sub_view = HorsePetSoulTipsView,
|
|
-- data = 1,--如果SubView类有SetData函数就自动调用
|
|
-- load_callback = function(real_view)
|
|
-- real_view:SetBtnsVisible(true)
|
|
-- end,
|
|
-- }
|
|
-- local view = BaseViewWrapper.New(conf)
|
|
-- view:Open()
|
|
|
|
-- MsgManager:getInstance():Add({type=Config.ConfigMainIcon.TipType.findback})--加找回小提示
|
|
-- for i,v in pairs(GoodsModel:getInstance().wear_equip_list) do
|
|
-- print('Cat:TestForCat.lua[166] v.goods_id', v.goods_id)
|
|
-- if v.goods_id == 4295481896 then
|
|
-- print('Cat:TestForCat.lua[168]')
|
|
-- end
|
|
-- end
|
|
-- OpenFun.Open(610, 3)
|
|
-- GlobalEventSystem:Fire(EventName.OPEN_STRENGTH_VIEW, true)
|
|
|
|
-- do --vip经验卡
|
|
-- if not self.view_h_1 then
|
|
-- self.view_h_1 = VipExpCardView.New()
|
|
-- end
|
|
-- if self.view_h_1 and self.view_h_1.isPop==false then
|
|
-- self.view_h_1:Open()
|
|
-- end
|
|
-- VipModel:getInstance().vip_info.vip_exp = VipModel:getInstance().vip_info.vip_exp+5
|
|
-- self.view_h_1:PlayAddExp(5)
|
|
-- end
|
|
-- do
|
|
-- local team_info_after_exit = {
|
|
-- activity_id = 2 ,
|
|
-- max_level = 999 ,
|
|
-- scene_id = 3106 ,
|
|
-- player_id_list =
|
|
-- {
|
|
-- 4294967351
|
|
-- } ,
|
|
-- min_level = 350 ,
|
|
-- subtype = 15 ,
|
|
-- }
|
|
-- local dun_type
|
|
-- local team_cfg = Config.Teamui[team_info_after_exit.activity_id.."@"..team_info_after_exit.subtype]
|
|
-- if team_cfg and team_cfg.dun_id and Config.Dungeoncfg[team_cfg.dun_id] then
|
|
-- dun_type = Config.Dungeoncfg[team_cfg.dun_id].type
|
|
-- local num = BaseDungeonModel:getInstance():GetDungeonHaveTimes(dun_type)
|
|
-- print('Cat:TeamModel.lua[1086] dun_type', dun_type, num)
|
|
-- -- if not num or num <= 0 then
|
|
-- -- --队长次数没有了就不提示了
|
|
-- -- return
|
|
-- -- end
|
|
-- end
|
|
-- 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)
|
|
-- --10秒后自动开始多人副本
|
|
-- TeamModel:getInstance():StartMultipAfterTime(10)
|
|
-- end
|
|
-- BaseDungeonModel:getInstance():Fire(BaseDungeonModel.REQUEST_CCMD_EVENT, 61001, 1000)
|
|
-- GlobalEventSystem:Fire(EventName.Go_DO_Task, TaskType.GUILD_LINE)
|
|
-- OpenFun.Open(610, 11)
|
|
-- OpenFun.Open(123, 0)--跨服帮战
|
|
-- OpenFun.Open(157, 1)
|
|
-- GuildCSWarGuideView.New():Open()
|
|
-- local show_rank = 3
|
|
-- local my_rank = 7
|
|
-- local award_num = PkRankRoleItem:GetBreakAward(show_rank, my_rank )
|
|
-- print('Cat:TestForCat.lua[169] award_num', award_num)
|
|
|
|
-- OpenFun.Open(409, 0)
|
|
|
|
-- UIToolTipMgr:getInstance():AppendEquipTips(12060442)
|
|
-- local str = WordManager:GetRoleLevel2(412,4,true,true)
|
|
-- print('Cat:TestForCat.lua[170] str', str)
|
|
-- local type_id = 12070342
|
|
-- local goods_vo = GoodsModel:getInstance():GetGoodsBasicByTypeId(type_id)
|
|
-- local target_config = Config.Equipattr[type_id]
|
|
-- local dynamic = {}
|
|
-- dynamic.type_id = type_id
|
|
-- dynamic.rating = target_config.base_rating
|
|
-- dynamic.equip_extra_attr = {}
|
|
-- dynamic.equip_type = goods_vo.equip_type
|
|
-- local target_pro = ErlangParser:GetInstance():Parse(target_config.recommend_attr)
|
|
-- for i, v in ipairs(target_pro) do
|
|
-- local attr = {}
|
|
-- attr.color = tonumber(v[2][1])
|
|
-- attr.attr_id = tonumber(v[2][2])
|
|
-- if #v[2] == 5 then
|
|
-- attr.type_id = 1
|
|
-- attr.plus_interval = tonumber(v[2][4])
|
|
-- attr.plus_unit = tonumber(v[2][5])
|
|
-- else
|
|
-- attr.type_id = 2
|
|
-- attr.attr_val = tonumber(v[2][3])
|
|
-- end
|
|
-- table.insert(dynamic.equip_extra_attr, attr)
|
|
-- end
|
|
-- self.dynamic = dynamic
|
|
-- UIToolTipMgr:getInstance():AppendEquipShowTips(self.dynamic, x, y)
|
|
|
|
-- UIToolTipMgr:getInstance():AppendEquipTips(10080710, nil, nil, goods_basic)
|
|
|
|
-- local vo = GoodsModel:getInstance():GetOneGoodsVoByTypeId(10000001)
|
|
-- print('Cat:TestForCat.lua[168] vo', vo)
|
|
-- GlobalEventSystem:Fire(EventName.OPEN_ITEM_USE_VIEW_TOP_EVER, vo)
|
|
|
|
-- PrintTable(MainCamera.getInstance().lock_target, nil, 2)
|
|
-- local list = Scene.Instance:GetMonsterList()
|
|
-- for k,v in pairs(list) do
|
|
-- print('Cat:TestForCat.lua[169] v.vo.', v.model_hide_flag, v.name)
|
|
-- end
|
|
-- UIToolTipMgr:getInstance():AppendGoodsTips(GoodsConst.ID.BindDiamond, nil, nil, nil, nil, true)
|
|
-- GlobalEventSystem:Fire(TaskEventType.SHOW_TASK_GUILD_ARROW, true)
|
|
-- Message.show("sss ", tostring(MainCamera.Instance.is_lock_camera))
|
|
-- local main_task_vo = TaskModel:getInstance():GetMainTask()
|
|
-- if main_task_vo and main_task_vo.id then
|
|
-- -- GlobalEventSystem:Fire(EventName.FORCE_STOP_DO_TASK)
|
|
-- local function delay_method( )
|
|
-- GlobalEventSystem:Fire(TaskEventType.SHOW_TASK_GUIDE_ARROW_EX, Config.ConfigTaskEffect.bountyTaskTipId, "做日常任务继续升级", 3, true, 2*60)
|
|
|
|
-- GlobalEventSystem:Fire(TaskEventType.SHOW_TASK_GUIDE_ARROW_EX, main_task_vo.id, "又有主线任务了", 15, 3, true, 2*60)
|
|
-- end
|
|
-- setTimeout(delay_method, 0.5)
|
|
-- end
|
|
-- local monster = Scene.Instance:GetMonsterByTypeId(10010204)
|
|
-- local findObj = FindVo.New()
|
|
-- findObj.sceneId = SceneManager.Instance:GetSceneId()
|
|
-- findObj.type = FindVo.POINT --不能用findVo.MONSTER,不然会去找最近的怪物的
|
|
-- findObj.x = monster:GetVo().pos_x/ SceneObj.LogicRealRatio.x
|
|
-- findObj.y = monster:GetVo().pos_y/ SceneObj.LogicRealRatio.y
|
|
-- local call_back = function ( )
|
|
-- Scene.Instance:MainRoleAttackMonster(monster)
|
|
-- GlobalEventSystem:Fire(EventName.STARTAUTOFIGHT)
|
|
-- end
|
|
-- findObj.call_back = call_back
|
|
-- GlobalEventSystem:Fire(EventName.FIND,findObj)
|
|
|
|
-- Scene.Instance:MainRoleAttackMonster(mon)
|
|
-- GlobalEventSystem:Fire(EventName.STARTAUTOFIGHT)
|
|
-- SceneManager.Instance:AddMonsterVo(mon.vo,true)
|
|
|
|
|
|
-- TaskModel:getInstance():SetCurTaskIDToMainTask()
|
|
|
|
-- print('Cat:TestForCat.lua[181] ItemUseModel:getInstance(), ItemUseModel:getInstance().goods_dic', ItemUseModel:getInstance(), ItemUseModel:getInstance().goods_dic)
|
|
-- ItemUseModel.Instance = self:ListenTableValueChange(ItemUseModel.Instance, "goods_dic", function()
|
|
-- print("Cat:TestForCat [90] : ", ItemUseModel:getInstance().goods_dic, debug.traceback())
|
|
-- end)
|
|
|
|
-- do
|
|
-- 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\"} ]]}"
|
|
-- local func = loadstring(test_str)
|
|
-- print('Cat:TestForCat.lua[172] func', func)
|
|
-- if func then
|
|
-- local result = func()
|
|
-- print("Cat:TestForCat [start:174] result:", result)
|
|
-- PrintTable(result)
|
|
-- print("Cat:TestForCat [end]")
|
|
-- end
|
|
-- return
|
|
-- end
|
|
-- GlobalEventSystem:Fire(EventName.OPEN_FORM_TEAM_VIEW)
|
|
|
|
-- local skill_cfg = ConfigItemMgr.Instance:GetSkillItem(415002)
|
|
-- local show_vos = {{
|
|
-- type = 2, is_out_res=true, outside_res = GameResPath.GetSkillIcon(415002),
|
|
-- saying = skill_cfg.name, ignore_fly=true, id=0,
|
|
-- }}
|
|
-- self.view_h = NewFuncOpenView.New()
|
|
-- self.data = show_vos
|
|
|
|
-- TopPkRewardView.New():Open()
|
|
-- OpenFun.Open(157, 2)
|
|
-- self.view_h = AdventureBookActiveView.New()
|
|
-- local cfg = Config.Adventurebook["1@2"]
|
|
-- self.data = cfg
|
|
-- GlobalEventSystem:Fire(EventName.OPEN_DESIGNATION_VIEW, 320000)
|
|
|
|
-- local on_ack = function ( self, vo )
|
|
-- print("Cat:TestForCat [start:83] vo:", vo)
|
|
-- PrintTable(vo)
|
|
-- print("Cat:TestForCat [end]")
|
|
-- end
|
|
-- GlobalEventSystem:Fire(EventName.REQ_ROLE_INFO, RoleManager.Instance.mainRoleInfo.role_id, on_ack, self)
|
|
|
|
-- self.view_h = GuildCSWarResultView.New()
|
|
-- self.data = {occupy_city={{city_id=1},{city_id=3},{city_id=2}}}
|
|
|
|
-- Scene:getInstance():CancelClickTarget()
|
|
-- GlobalEventSystem:Fire(EventName.STOPAUTOFIGHT)
|
|
-- GlobalEventSystem:Fire(EventName.STARTAUTOFIGHT)
|
|
|
|
|
|
-- if not self.notify_view then
|
|
-- self.notify_view = GuildCSWarNotifyView.New()
|
|
-- self.notify_view:Open()
|
|
-- end
|
|
-- local function delay_method( )
|
|
-- GuildCSWarModel:GetInstance():Fire(GuildCSWarConst.Event.ShowWarNotify, {show_type=GuildCSWarConst.NotifyID.RunToCommand, city_id=2})
|
|
-- end
|
|
-- setTimeout(delay_method, 1)
|
|
|
|
-- PokerModel:GetInstance():Fire(PokerConst.OPEN_POKER_VIEW)
|
|
-- self:TestParticleEffect()
|
|
-- self:TestNameBoardGuildName()
|
|
|
|
-- local isAutoSwitchSprite = lua_settingM.blockSet["spriteAide"]
|
|
-- print('Cat:TestForCat.lua[66] isAutoSwitchSprite', isAutoSwitchSprite)
|
|
-- self:ShowTopPkResultView()
|
|
-- GuildAskUseFireGoodsView.New():Open()
|
|
-- GuildModel:getInstance():Fire(EventName.OPEN_GUILD_FEAST_SCENE_VIEW, false)
|
|
-- GuildModel:getInstance():Fire(EventName.OPEN_GUILD_FEAST_SCENE_VIEW, true)
|
|
|
|
-- TeamModel:getInstance():SetIsAutoMatch(true)
|
|
-- self.view_h = TeamMatchingView.New()
|
|
-- self.view_h = SpriteAideView.New()
|
|
-- print("next goods_id : ", EquipModel:getInstance():GetNextSpriteGoodsID())
|
|
------------------
|
|
-- local test = {}
|
|
-- UpdateVisibleByJury(test, true, "Test")
|
|
-- UpdateVisibleByJury(test, false, "JustLike")
|
|
|
|
-- self:ChangeRolePosToCameraPos()
|
|
-- self:DropItem()
|
|
|
|
-- self.views = {MainUIConst.ViewID.Task}
|
|
-- MainUIModel:GetInstance():Fire(MainUIConst.UpdateViewsVisible, self.views, false, MainUIConst.VisibleReason.Dialogue)
|
|
|
|
-- MainUIModel:GetInstance():Fire(MainUIConst.UpdateViewsVisible, MainUIConst.ViewID, true, MainUIConst.VisibleReason.Dialogue)
|
|
|
|
-- require("game.test.TestController")
|
|
-- self.view_h = TestMainView.New()
|
|
------------------
|
|
if self.view_h then
|
|
self.view_h:Open(self.data)
|
|
end
|
|
end
|
|
|
|
function TestForCat:UpdateTableOperateListen( )
|
|
local is_can_open = Application.platform == RuntimePlatform.WindowsEditor or Application.platform == RuntimePlatform.WindowsPlayer
|
|
-- print('Cat:TestForCat.lua[UpdateTableOperateListen] is_can_open', is_can_open)
|
|
if self.origin_insert or not is_can_open then return end
|
|
|
|
self.origin_insert = table.insert
|
|
table.insert = function(tbl, arge1, arge2)
|
|
--因为table.insert的实现用的是rawset不会触发__newindex所以需要重写
|
|
if arge2==nil then
|
|
-- old_insert(tbl, arge1)
|
|
tbl[#tbl+1] = arge1
|
|
else
|
|
-- old_insert(tbl, arge1, arge2)
|
|
local insert_pos = arge1
|
|
local tbl_size = #tbl
|
|
if insert_pos>tbl_size then
|
|
tbl_size = insert_pos
|
|
elseif insert_pos==tbl_size then
|
|
tbl_size = insert_pos+1
|
|
end
|
|
for i=tbl_size,insert_pos+1,-1 do
|
|
print('Cat:TestForCat.lua[132] i, tbl_size, insert_pos, #tbl', i, tbl_size, insert_pos, #tbl)
|
|
tbl[i] = tbl[i-1]
|
|
end
|
|
tbl[insert_pos] = arge2
|
|
end
|
|
end
|
|
end
|
|
|
|
--tbl某值变更时触发监听函数,比如tbl.xx=1时就会触发,但注意tbl=xx时就监听无效了
|
|
function TestForCat:ListenTableValueChange( tbl, key, call_back )
|
|
local is_can_open = Application.platform == RuntimePlatform.WindowsEditor or Application.platform == RuntimePlatform.WindowsPlayer
|
|
-- print('Cat:TestForCat.lua[ListenTableValueChange] is_can_open', is_can_open)
|
|
if not is_can_open then return end
|
|
|
|
local old_tbl = tbl
|
|
if old_tbl[key] then
|
|
old_tbl[key] = self:ListenTableValueChange(old_tbl[key], nil, call_back)
|
|
end
|
|
|
|
local listen_tbl = {}
|
|
local meta_tbl = {
|
|
__newindex = function(write_tbl, write_key, write_value)
|
|
print('Cat:TestForCat.lua[86] write_key, write_value', write_tbl, write_key, write_value, "key :|"..tostring(key).."|")
|
|
old_tbl[write_key] = write_value
|
|
if key == nil then
|
|
--监听所有字段
|
|
call_back()
|
|
elseif key == write_key then
|
|
call_back()
|
|
if old_tbl[key] then
|
|
old_tbl[key] = self:ListenTableValueChange(old_tbl[key], nil, call_back)
|
|
end
|
|
end
|
|
end,
|
|
__index = function(write_tbl, write_key)
|
|
-- print('Cat:TestForCat.lua[89] write_key', write_key)
|
|
return old_tbl[write_key]
|
|
end,
|
|
__len = function (op)
|
|
print('Cat:TestForCat.lua[140] old_tbl', old_tbl, type(old_tbl))
|
|
if type(old_tbl) == "string" then
|
|
return strlen(old_tbl)
|
|
elseif type(old_tbl) == "table" then
|
|
return #old_tbl
|
|
else
|
|
print('Cat:TestForCat.lua[error145]')
|
|
end
|
|
end,
|
|
}
|
|
setmetatable(listen_tbl, meta_tbl)
|
|
self:UpdateTableOperateListen()
|
|
return listen_tbl
|
|
end
|
|
|
|
function TestForCat:TestAction( )
|
|
|
|
end
|
|
|
|
function TestForCat:TestNameBoardGuildName( )
|
|
local monster_list = Scene:getInstance():GetMonsterList()
|
|
for k,v in pairs(monster_list) do
|
|
local name_board = v:GetNameBoard()
|
|
if name_board then
|
|
name_board:SetGuildText("jhahahsde")
|
|
end
|
|
end
|
|
end
|
|
|
|
function TestForCat:TestParticleEffect( )
|
|
self.effect_ids = self.effect_ids or {}
|
|
if self.flag == nil then
|
|
self.flag = true
|
|
end
|
|
if self.flag then
|
|
local monster_list = Scene:getInstance():GetMonsterList()
|
|
for k,v in pairs(monster_list) do
|
|
self.effect_ids[v.compress_id] = ParticleManager:getInstance():AddTargetEffect("effect_xemlvup", v.compress_id, true, nil, nil, nil,call_back_func,nil,1)
|
|
end
|
|
else
|
|
for k,v in pairs(self.effect_ids) do
|
|
ParticleManager:getInstance():DelEffect(v)
|
|
end
|
|
end
|
|
self.flag = not self.flag
|
|
end
|
|
|
|
function TestForCat:ShowTopPkResultView( )
|
|
TopPkModel:getInstance().season_info = TopPkModel:getInstance().season_info or {}
|
|
TopPkModel:getInstance().season_info.star = 5
|
|
TopPkModel:getInstance().season_info.grade = 2
|
|
TopPkModel:getInstance().result_info = {
|
|
res = 1,
|
|
grade = 3,
|
|
star = 122,
|
|
win_num = 5,
|
|
score = 100,
|
|
war_score = 200,
|
|
}
|
|
TopPkResultView.New():Open()
|
|
end
|
|
|
|
function TestForCat:TestPkRankResultView( )
|
|
PkRankModel:getInstance().result_info = {
|
|
result = 1,
|
|
role_list={
|
|
{
|
|
role_id = RoleManager.Instance.mainRoleInfo.role_id,
|
|
before_rank = 123,
|
|
rank = 100,
|
|
}
|
|
},
|
|
reward_list = {
|
|
{type=16, type_id=0, num=1}, {type=5, type_id=0, num=2}
|
|
},
|
|
}
|
|
PkRankModel:getInstance():Fire(PkRankModel.OPEN_RESULT_VIEW)
|
|
end
|
|
|
|
function TestForCat:BaseViewWrapper( )
|
|
local basic = GoodsModel:getInstance():GetGoodsBasicByTypeId(110024)
|
|
local getway = ErlangParser:GetInstance():Parse(basic.getway_url)
|
|
local conf = {
|
|
sub_view = GoodsGetWaySubView,
|
|
data = getway,--如果SubView类有SetData函数就自动调用
|
|
}
|
|
local view = BaseViewWrapper.New(conf)
|
|
view:Open()
|
|
end
|
|
|
|
function TestForCat:ChangeRolePosToCameraPos( )
|
|
local role = Scene:getInstance():GetMainRole()
|
|
if role then
|
|
local trans = role.transform:Find("model_clothe_1200")
|
|
local role_old_pos_x, role_old_pos_y, role_old_pos_z = GetLocalPositionX(trans), GetLocalPositionY(trans), GetLocalPositionZ(trans)
|
|
SetLocalPosition(trans, 0,0,0)
|
|
local role_pos_x = GetGlobalPositionX(trans)
|
|
local role_pos_y = GetGlobalPositionY(trans)
|
|
local pos = MainCamera.Instance.camera:WorldToViewportPoint(Vector3.New(role_pos_x, role_pos_y, GetGlobalPositionZ(trans)))
|
|
local camera_pos = MainCamera.Instance.camera.transform.position
|
|
print("Cat:TestForCat [49] pos, camera_pos: ",pos, camera_pos)
|
|
local camera_size = 3.96*2
|
|
pos.x = (camera_size*(16/9))*(pos.x-0.5)+camera_pos.x
|
|
pos.y = (camera_size)*(pos.y-0.5)+camera_pos.y
|
|
print("Cat:TestForCat [47] pos: ", pos)
|
|
role:SetRealPos(pos.x*MainCamera.PixelsToUnits, pos.y*MainCamera.PixelsToUnits)
|
|
SetLocalPosition(trans, role_old_pos_x, role_old_pos_y, role_old_pos_z)
|
|
end
|
|
end
|
|
|
|
local function GetPosByIndex( index )
|
|
-- index从1开始
|
|
local offset_map = {
|
|
[1] = {x=0, y=1},
|
|
[2] = {x=2, y=1},
|
|
[3] = {x=3, y=0},
|
|
[4] = {x=2, y=-1},
|
|
[5] = {x=0, y=-1},
|
|
[6] = {x=-2, y=-1},
|
|
[7] = {x=-3, y=0},
|
|
[8] = {x=-2, y=1},
|
|
}
|
|
-- local ring = (index-1)/8+1--第几圈,从1开始
|
|
-- local num_in_ring = (index-1)%8+1--该圈的第几个,范围1至8
|
|
return offset_map[index]
|
|
end
|
|
|
|
function TestForCat:DropItem( )
|
|
print('Cat:TestForCat.lua[DropItem]')
|
|
local base_x = RoleManager.Instance.mainRoleInfo.pos_x
|
|
local base_y = RoleManager.Instance.mainRoleInfo.pos_y
|
|
local x_offset_per_item = 30
|
|
local y_offset_per_item = 30
|
|
local drop_list = {}
|
|
for i = 1,8 do
|
|
local offset_pos = GetPosByIndex(i)
|
|
vo2 = {
|
|
drop_id = i,
|
|
drop_type = 0,--非绑定
|
|
type_id = 11030241,
|
|
drop_num = i,
|
|
role_id = RoleManager.Instance.mainRoleInfo.role_id,
|
|
pos_x = base_x+offset_pos.x*x_offset_per_item,
|
|
pos_y = base_y+offset_pos.y*y_offset_per_item,
|
|
effect = 0,
|
|
drop_icon = 5
|
|
}
|
|
table.insert(drop_list,vo2)
|
|
end
|
|
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}
|
|
GlobalEventSystem:Fire(SceneEventType.BROADCAST_SCENE_DROP_LIST, vo)
|
|
end
|