源战役客户端
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

931 行
35 KiB

  1. FuncOpenModel = FuncOpenModel or BaseClass(BaseVo, true)
  2. FuncOpenModel.ModelTypeId = {
  3. Fashion = 1,--有人物模型类型
  4. Skin = 2,--普通单独模型类型
  5. Other = 3,--特殊类型
  6. }
  7. --称号/头像/气泡
  8. FuncOpenModel.DressTypeId = {
  9. Design = 1,
  10. Head = 2,--头像框
  11. Pupple = 3,
  12. RoleHead = 4,--人物头像
  13. }
  14. FuncOpenModel.TypeId = {
  15. --人物
  16. Clothes = 1,--衣服
  17. Weapon = 2,--武器
  18. Head = 3,--发型
  19. wing = 4,--背部
  20. Hat = 5,--头饰
  21. RoleLight = 8,--人物幻光
  22. --单独模型
  23. FHorse = 1001,--座驾
  24. FWing = 1002,--炫翼
  25. FPearl = 1003,--宝具
  26. FWeapon = 1004,--武器
  27. FJarvis = 1005,--AI娘
  28. FGun = 1006,--磁炮
  29. FCloud = 1007,--星翼
  30. FArmour = 1008,--幻甲
  31. Galaxy = 1009, --星辰
  32. Psionic = 1010,--灵能
  33. God = 1011,--神作
  34. Monster = 1101,--怪物1
  35. Pet = 1201,--宠物
  36. Light = 1301,--幻光
  37. Equip = 1401,--装备
  38. Evil = 1501,--守护
  39. Child = 1601,-- 孩子/宝宝
  40. WarSoul = 1701,--战魂
  41. OtherGoods = 1801,--其他模型
  42. ChildVehicle = 1901, -- 宝宝的载具
  43. ChildInVehicle = 2001, -- 宝宝的载具(有个宝宝骑乘)
  44. }
  45. function FuncOpenModel:__init()
  46. FuncOpenModel.Instance = self
  47. self.func_data_list = {} --触发功能数据
  48. --打开功能界面的条件,必须等到 RightBottom 跟ActivityIconManager 都发送完OPEN_FUNC_OPEN_VIEW 才符合条件
  49. self.open_condition_list = {}
  50. self.cur_down_load = 0--当前下载进度
  51. self.cookies_list = {} --功能开放
  52. end
  53. function FuncOpenModel:getInstance()
  54. if FuncOpenModel.Instance == nil then
  55. FuncOpenModel.New();
  56. end
  57. return FuncOpenModel.Instance;
  58. end
  59. --清除缓存数据
  60. function FuncOpenModel:ClearData()
  61. self.func_data_list = {} --触发功能数据
  62. self.open_condition_list = {}
  63. end
  64. --返回模型类型 2 是fashion 1 是skin
  65. function FuncOpenModel:ReturnModelType( fashion_type )
  66. if fashion_type <= 1000 then--代表有人物模型
  67. return FuncOpenModel.ModelTypeId.Fashion
  68. else
  69. return FuncOpenModel.ModelTypeId.Skin
  70. end
  71. end
  72. function FuncOpenModel:IsFosterType( fashion_type )
  73. if fashion_type >= 1001 and fashion_type <= 1008 then
  74. return true
  75. end
  76. return false
  77. end
  78. function FuncOpenModel:GetTempVo( )
  79. local temp_vo = {
  80. help_type = 0,
  81. ignore_fly = false,
  82. type = 0,
  83. id = 0,
  84. tabId = 0,
  85. model_res = 0,
  86. model_type = 0,
  87. desc = "",
  88. saying = "",
  89. winId = 0,
  90. subId = 0,
  91. }
  92. return temp_vo
  93. end
  94. --检测是否有前置条件
  95. function FuncOpenModel:DealWithFuncOpenHelperVo(helpVo)
  96. local voList = {}
  97. local tempTabId
  98. if helpVo then
  99. local vo
  100. local list = ErlangParser:GetInstance():Parse(helpVo.param)
  101. -- print("huangcong:FuncOpenModel [start:50] list:", list)
  102. -- PrintTable(list)
  103. -- print("huangcong:FuncOpenModel [end]")
  104. for index,value in ipairs(list) do
  105. vo = self:GetTempVo()
  106. vo.help_type = helpVo.help_type
  107. vo.ignore_fly = helpVo.ignore_fly
  108. vo.type = tonumber(value[1])
  109. vo.id = tonumber(value[2])
  110. vo.tabId = value[3] and tonumber(value[3]) or 0
  111. vo.fashion_type = value[4] and tonumber(value[4]) or 0
  112. vo.figure_id = value[5] and tonumber(value[5]) or 0
  113. vo.icon_res_name = helpVo.icon_res_name
  114. tempTabId = tempTabId or vo.tabId
  115. vo.desc = helpVo.desc or ""
  116. vo.saying = helpVo.saying or ""
  117. vo.winId = helpVo.winId
  118. vo.subId = helpVo.subId
  119. vo.sound = helpVo.sound and Config.ConfigSound.Tip[helpVo.sound] or ""
  120. vo.name = helpVo.name or ""
  121. table.insert(voList,vo)
  122. end
  123. end
  124. return voList, tempTabId
  125. end
  126. --检测是否有新功能开放 右上角
  127. function FuncOpenModel:HasNewTopFuncOpen(helpVo)
  128. if helpVo then
  129. local voList = self:DealWithFuncOpenHelperVo(helpVo)
  130. for k,vo in pairs(voList) do
  131. if vo.type == 1 then
  132. local cfg = ActivityIconManager:getInstance():getIconCfg(vo.id)
  133. if cfg then
  134. return true
  135. end
  136. end
  137. end
  138. end
  139. return false
  140. end
  141. --检测是否有新功能开放 左下角
  142. function FuncOpenModel:HasNewBottomFuncOpen(helpVo)
  143. if helpVo then
  144. local voList = self:DealWithFuncOpenHelperVo(helpVo)
  145. for k,vo in pairs(voList) do
  146. if vo.type == 4 then
  147. return true
  148. end
  149. if vo.type == 3 then
  150. local cfg = MainUIModel:getInstance():getFuncIconCfg(vo.id)
  151. if cfg then
  152. return true
  153. end
  154. end
  155. end
  156. end
  157. return false
  158. end
  159. --检测是否有新技能开放 技能
  160. function FuncOpenModel:HasNewSkillFuncOpen(helpVo)
  161. if helpVo then
  162. local voList = self:DealWithFuncOpenHelperVo(helpVo)
  163. for k,vo in pairs(voList) do
  164. if vo.type == 2 then
  165. return true
  166. end
  167. end
  168. end
  169. return false
  170. end
  171. --右上角需要隐藏图标
  172. function FuncOpenModel:TryNewHideTopFuncIcon(helpVo)
  173. local voList, tabId = self:DealWithFuncOpenHelperVo(helpVo)
  174. if not helpVo.ignore_hide_icon then
  175. GlobalEventSystem:Fire(EventName.HIDE_FUNC_OPEN_ICON,voList)
  176. end
  177. end
  178. --左下角需要隐藏图标
  179. function FuncOpenModel:TryNewHideBottomFuncIcon(helpVo)
  180. local voList, tabId = self:DealWithFuncOpenHelperVo(helpVo)
  181. if not helpVo.ignore_hide_icon then
  182. GlobalEventSystem:Fire(EventName.HIDE_FUNC_OPEN_ICON,voList)
  183. end
  184. end
  185. --技能需要隐藏图标
  186. function FuncOpenModel:TryNewHideSkillFuncIcon(helpVo)
  187. local voList = self:DealWithFuncOpenHelperVo(helpVo)
  188. GlobalEventSystem:Fire(EventName.HIDE_FUNC_OPEN_ICON,voList)
  189. end
  190. --添加功能开放数据
  191. function FuncOpenModel:AddFuncOpenDataVo(vo)
  192. if self.func_data_list then
  193. table.insert( self.func_data_list, vo)
  194. end
  195. end
  196. function FuncOpenModel:SetOpenCondition(key)
  197. if self.open_condition_list then
  198. self.open_condition_list[key] = true
  199. end
  200. end
  201. function FuncOpenModel:ClearOpenCondition()
  202. self.open_condition_list = {}
  203. end
  204. function FuncOpenModel:HasFuncOpenCondition()
  205. if self.open_condition_list then
  206. return self.open_condition_list["ActivityIconManager"] and self.open_condition_list["RightBottomView"]
  207. and self.open_condition_list["TaskTeamView"]
  208. end
  209. return false
  210. end
  211. function FuncOpenModel:ClearOpenFuncData()
  212. self.func_data_list = {}
  213. end
  214. --检测是否有结婚新功能开放
  215. function FuncOpenModel:HasNewMarriageFuncOpen(helpVo)
  216. if helpVo then
  217. local voList = self:DealWithFuncOpenHelperVo(helpVo)
  218. for k,vo in pairs(voList) do
  219. if vo.type == 4 then --结婚
  220. return true
  221. end
  222. end
  223. end
  224. return false
  225. end
  226. --得到图标需要飞的坐标
  227. function FuncOpenModel:GetFlyPos( curVo )
  228. local pos = Vector3.zero
  229. if curVo.type == 1 then--右上角图标位置
  230. if curVo.winId == 157 and curVo.subId == 0 then--主线任务,在经验副本下面
  231. pos = MainUIController:GetInstance():GetExpPos()
  232. pos.x = pos.x + 50
  233. pos.y = pos.y - 90
  234. elseif curVo.winId == 610 and curVo.subId == 2 then--经验快车在主界面左上角
  235. pos = MainUIController:GetInstance():GetExpPos()
  236. elseif curVo.winId == 145 and curVo.subId == 0 then--装备套装收集在背包
  237. pos = MainUIController:GetInstance():GetBagBtnWorldPos()
  238. elseif curVo.winId == 450 and curVo.subId == 22 then--装备套装收集在左上角
  239. if MainUIController.Instance.MainRoleHeadInfoView then
  240. pos = MainUIController.Instance.MainRoleHeadInfoView:GetRechargeBtnPos()
  241. end
  242. else
  243. pos = ActivityIconManager:getInstance():GetActivityIconPos(curVo.id)
  244. end
  245. elseif curVo.type == 2 then--普通技能
  246. pos = MainUIController:GetInstance():GetSkillBtnPos(curVo.id)
  247. elseif curVo.type == 3 then--右下角图标位置
  248. pos = MainUIController:GetInstance():GetRightButtonWorldPos(curVo.id)
  249. elseif curVo.type == 4 then--背包位置
  250. pos = MainUIController:GetInstance():GetBagBtnWorldPos()
  251. elseif curVo.type == 6 then--支线任务任务栏位置
  252. pos = MainUIController:GetInstance():GetTaskBranceLinePos()
  253. elseif curVo.type == 7 then--右上角幻魔位置
  254. pos = MainUIController:GetInstance():GetBossBtnPos(curVo.id)
  255. end
  256. return pos
  257. end
  258. --加载所有模型以下必传参数father_node, transform,fashion_type,【figure_id(怪物可不传)】
  259. --data.father_node[加载模型的父节点]
  260. --data.transform[加载模型的节点]
  261. --data.fashion_type--资源类型
  262. --data.figure_id[资源id]
  263. --data.scale[缩放]
  264. --data.position[坐标]
  265. --data.can_rotate[能否旋转]
  266. --data.rotate[旋转角度]
  267. --data.show_shadow[是否展示阴影]
  268. --data.use_bloom[使用泛光效果]
  269. --data.action_name_list[动作列表]
  270. --data.ui_model_type[使用哪种接口展示模型]
  271. --data.role_vo[是否使用别人玩家的数据]
  272. --data.fashion_color[时装变色]
  273. --data.clothe_res_id[怪物模型使用,如果不传figure_id则需要传clothe_res_id来做模型资源id]
  274. function FuncOpenModel:SetModelRes( res_data )
  275. if not self.mainVo then
  276. self.mainVo = RoleManager.Instance.mainRoleInfo
  277. end
  278. if not res_data or not res_data.transform then return end
  279. -------------------------
  280. --清除挂接的UI特效
  281. if res_data.father_node and res_data.transform then
  282. res_data.father_node:ClearUIEffect( res_data.transform )
  283. end
  284. -------------------------
  285. local model_type = self:ReturnModelType(res_data.fashion_type)
  286. if model_type == FuncOpenModel.ModelTypeId.Fashion then--人物模型类
  287. self:SetFashion(res_data)
  288. elseif model_type == FuncOpenModel.ModelTypeId.Skin then-- 单独模型
  289. self:UpdateSkin(res_data)
  290. end
  291. end
  292. --传入角色id,会向后端请求该角色的形象信息,以下参数一定要有!!!!其他参数支持自定义,具体参考上面方法注释
  293. --data.father_node[加载模型的父节点]
  294. --data.transform[加载模型的节点]
  295. --data.fashion_type--资源类型
  296. function FuncOpenModel:SetRoleModelByID(role_id, data)
  297. if role_id == RoleManager.Instance.mainRoleInfo.role_id then--自己的话就不用去拿数据了 直接照传data进去就好
  298. self:SetModelRes(data)
  299. else
  300. local call_back = function ( vo )
  301. data.role_vo = vo
  302. self:SetModelRes(data)
  303. end
  304. GlobalEventSystem:Fire(EventName.REQ_ROLE_INFO, role_id, call_back)
  305. end
  306. end
  307. function FuncOpenModel:SetFashion( res_data )
  308. --得到当前人物的时装和颜色
  309. local fashion_model_id, fashion_texture_id = self.mainVo:GetRoleClotheTextureId()
  310. local weapon_model_id, weapon_texture_id = self.mainVo:GetWeaponClotheId()
  311. local head_model_id,head_clothe_id = self.mainVo:GetRoleHeadId()
  312. local footmark_id = self.mainVo:GetRoleFootmarkId()
  313. local wing_id = self.mainVo:GetRoleWingId()
  314. local career = self.mainVo.career
  315. local clothe_res_id = self.mainVo:GetRoleClotheId()
  316. local hat_wear_id = self.mainVo:GetRoleHatId()
  317. local image_id = self.mainVo.image_id
  318. local light_id = res_data.light_id
  319. local talisman_id = res_data.talisman_id
  320. local ui_model_type = res_data.ui_model_type or UIModelCommon.ModelType.Model
  321. local free_param = res_data.free_param -- 人物模型带载具专用参数 res_data.type 同时需要改成SceneBaseType.Include_Horse
  322. local type_pos = FuncOpenModel.TypeId.Clothes
  323. if res_data.fashion_type == FuncOpenModel.TypeId.Clothes then --衣服
  324. type_pos = FashionPartPos.Clothe
  325. elseif res_data.fashion_type == FuncOpenModel.TypeId.Weapon then --武器
  326. type_pos = FashionPartPos.Weapon
  327. elseif res_data.fashion_type == FuncOpenModel.TypeId.Head then --头饰
  328. type_pos = FashionPartPos.Head
  329. elseif res_data.fashion_type == FuncOpenModel.TypeId.Footprint then --足迹
  330. type_pos = FashionPartPos.Footmark
  331. elseif res_data.fashion_type == FuncOpenModel.TypeId.wing then --背部
  332. type_pos = FashionPartPos.wing
  333. elseif res_data.fashion_type == FuncOpenModel.TypeId.Hat then--头套
  334. type_pos = FashionPartPos.Hat
  335. elseif res_data.fashion_type == FuncOpenModel.TypeId.RoleLight then--人物幻光
  336. type_pos = FashionPartPos.light
  337. end
  338. local sex = RoleManager.Instance.mainRoleInfo.sex
  339. if res_data.role_vo then
  340. wing_id = GetWingClotheId(res_data.role_vo)
  341. clothe_res_id = GetRoleClotheId(res_data.role_vo.level_model_list)
  342. fashion_model_id, fashion_texture_id = GetRoleClotheTextureId(res_data.role_vo)
  343. weapon_model_id, weapon_texture_id = GetWeaponClotheId(res_data.role_vo)
  344. head_model_id, head_clothe_id = GetRoleHeadId(res_data.role_vo)
  345. hat_model_id = GetRoleHatId(res_data.role_vo)
  346. -- footmark_id = GetRoleFootmarkId(res_data.role_vo)
  347. image_id = res_data.role_vo.image_id
  348. sex = res_data.role_vo.sex or sex
  349. hat_wear_id = GetRoleHatId(res_data.role_vo)
  350. end
  351. local color = res_data.figure_texture or fashion_texture_id
  352. local figure_id = res_data.figure_id and tonumber(res_data.figure_id) or fashion_model_id
  353. if figure_id then
  354. if type_pos ~= FashionPartPos.wing and type_pos ~= FashionPartPos.Hat and type_pos ~= FashionPartPos.light then
  355. if career then
  356. if (res_data.fashion_type == FuncOpenModel.TypeId.Clothes
  357. or res_data.fashion_type == FuncOpenModel.TypeId.Head) and figure_id > 100000 then --时装和头饰可以变色(判断id是否是大于10W的)
  358. figure_id = (math.floor(figure_id/100000) + career * 1000)..(figure_id%100000)
  359. else
  360. if figure_id < 1000 then
  361. figure_id = figure_id + career * 1000
  362. end
  363. end
  364. end
  365. else
  366. figure_id = figure_id
  367. end
  368. end
  369. if type_pos == FashionPartPos.Clothe then
  370. fashion_model_id = figure_id or fashion_model_id
  371. fashion_texture_id = color
  372. elseif type_pos == FashionPartPos.Weapon then
  373. weapon_model_id = figure_id or weapon_model_id
  374. weapon_texture_id = color
  375. elseif type_pos == FashionPartPos.Head then
  376. head_model_id = figure_id or head_model_id
  377. head_clothe_id = color
  378. elseif type_pos == FashionPartPos.wing then
  379. wing_id = figure_id
  380. elseif type_pos == FashionPartPos.light then
  381. light_id = figure_id
  382. elseif type_pos == FashionPartPos.Hat then
  383. hat_wear_id = figure_id
  384. end
  385. if res_data.weapon_res_id and res_data.weapon_res_id == "nil" then -- 空手
  386. weapon_model_id = nil
  387. end
  388. if res_data.wing_res_id and res_data.wing_res_id == "nil" then -- 空手
  389. wing_id = nil
  390. end
  391. res_data.career = career
  392. res_data.clothe_res_id = res_data.clothe_res_id or clothe_res_id
  393. res_data.weapon_res_id = res_data.weapon_res_id or weapon_model_id
  394. res_data.weapon_clothe_id = res_data.weapon_clothe_id or weapon_texture_id
  395. res_data.type = res_data.type and res_data.type == SceneBaseType.Include_Horse and res_data.type or SceneBaseType.MainRole
  396. res_data.fashion_model_id = res_data.fashion_model_id or fashion_model_id
  397. res_data.texture_id = res_data.texture_id or fashion_texture_id
  398. res_data.wing_id = res_data.wing_id or wing_id
  399. res_data.image_id = res_data.image_id or image_id
  400. res_data.head_wear_id = res_data.head_wear_id or head_model_id
  401. res_data.head_clothe_id = res_data.head_clothe_id or head_clothe_id
  402. res_data.light_id = res_data.light_id or light_id
  403. res_data.talisman_id = res_data.talisman_id or talisman_id
  404. res_data.hat_wear_id = res_data.hat_wear_id or hat_wear_id
  405. res_data.free_param = res_data.free_param or free_param
  406. local data = lua_resM:ModelDataDefineVar(res_data)
  407. -- print("huangcong:FuncOpenModel [start:388] res_data:", res_data)
  408. -- PrintTable(res_data)
  409. -- print("huangcong:FuncOpenModel [end]")
  410. -- 强制不显示翅膀(红装之路)
  411. if res_data.force_hide_wing then
  412. res_data.wing_id = nil
  413. end
  414. if ui_model_type == UIModelCommon.ModelType.RT then--是否使用rt
  415. data.wing_id = nil--翅膀特效暂时无法正常显示
  416. lua_resM:SetRoleModelByRT(res_data.father_node, res_data.transform, data)
  417. elseif ui_model_type == UIModelCommon.ModelType.BackModel then
  418. lua_resM:SetBackRoleModel(res_data.father_node, res_data.transform, data)
  419. else
  420. lua_resM:SetRoleModel(res_data.father_node, res_data.transform, data)
  421. end
  422. end
  423. function FuncOpenModel:UpdateSkin( res_data )
  424. local ui_model_type = res_data.ui_model_type or UIModelCommon.ModelType.Model
  425. figure_id = figure_id and tonumber(res_data.figure_id) or 1001
  426. local data = nil
  427. if self:IsFosterType(res_data.fashion_type) then--进阶模型
  428. data = self:GetFosterModelData(res_data)
  429. elseif res_data.fashion_type == FuncOpenModel.TypeId.Monster then -- 怪物模型
  430. data = self:GetMonsterModelData(res_data)
  431. elseif res_data.fashion_type == FuncOpenModel.TypeId.Light then -- 幻光模型
  432. self:ShowLightModel(res_data)
  433. return
  434. elseif res_data.fashion_type == FuncOpenModel.TypeId.Psionic then -- 灵能模型
  435. self:ShowPsionicModel(res_data)
  436. return
  437. elseif res_data.fashion_type == FuncOpenModel.TypeId.Pet then -- 宠物模型
  438. data = self:GetPetModelData(res_data)
  439. elseif res_data.fashion_type == FuncOpenModel.TypeId.Equip then--装备模型
  440. data = self:GetEquipModelData(res_data)
  441. elseif res_data.fashion_type == FuncOpenModel.TypeId.Evil then--守护模型
  442. data = self:GetEvilModelData(res_data)
  443. elseif res_data.fashion_type == FuncOpenModel.TypeId.Child then --宝宝模型
  444. data = self:GetChildModelData(res_data)
  445. elseif res_data.fashion_type == FuncOpenModel.TypeId.ChildVehicle then --宝宝载具
  446. data = self:GetChildVehicleModelData(res_data)
  447. elseif res_data.fashion_type == FuncOpenModel.TypeId.ChildInVehicle then --宝宝载具(有宝宝骑)
  448. data = self:GetChildInVehicleModelData(res_data)
  449. elseif res_data.fashion_type == FuncOpenModel.TypeId.WarSoul then --战魂模型
  450. data = self:GetWarSoulModelData(res_data)
  451. elseif res_data.fashion_type == FuncOpenModel.TypeId.Galaxy then --星辰
  452. data = self:GetGalaxyModelData(res_data)
  453. elseif res_data.fashion_type == FuncOpenModel.TypeId.God then --神座
  454. data = self:GetGodModelData(res_data)
  455. elseif res_data.fashion_type == FuncOpenModel.TypeId.OtherGoods then
  456. data = self:GetOtherGoodsModelData(res_data)
  457. end
  458. if not data then
  459. print("不存在数据:",res_data.fashion_type)
  460. return
  461. end
  462. -- 通用绿幕的添加
  463. data.use_green_screen = res_data.use_green_screen
  464. data.green_screen_camera_type = res_data.green_screen_camera_type
  465. -------------------------
  466. if ui_model_type == UIModelCommon.ModelType.RT then--是否使用rt
  467. lua_resM:SetRoleModelByRT(res_data.father_node, res_data.transform, data)
  468. elseif ui_model_type == UIModelCommon.ModelType.BackModel then
  469. lua_resM:SetBackRoleModel(res_data.father_node, res_data.transform, data)
  470. else
  471. lua_resM:SetRoleModel(res_data.father_node, res_data.transform, data)
  472. end
  473. end
  474. function FuncOpenModel:GetFosterModelData( res_data )
  475. if not res_data then return end
  476. local show_type = res_data.fashion_type - 1000
  477. local figure_id = res_data.figure_id
  478. if not res_data.action_name_list then
  479. if show_type == FosterConst.ModuleId.FWeapon then
  480. res_data.action_name_list = {"show3"}
  481. elseif show_type == FosterConst.ModuleId.FWing or show_type == FosterConst.ModuleId.FCloud
  482. or show_type == FosterConst.ModuleId.FGun or show_type == FosterConst.ModuleId.FArmour then
  483. res_data.action_name_list = {"show"}
  484. else
  485. res_data.action_name_list = {"show2","show"}
  486. end
  487. end
  488. -------------------------
  489. local show_conf = FosterConst.ModelShowConfig[show_type][figure_id] or FosterConst.ModelShowConfig[show_type][0]
  490. if show_type == FosterConst.ModuleId.FWeapon then
  491. --武器的比较特殊
  492. show_conf = FosterConst.ModelShowConfig[show_type][GameResPath:GetFWeaponResName( res_data.career,figure_id )] or FosterConst.ModelShowConfig[show_type][0]
  493. end
  494. -------------------------
  495. local data = lua_resM:ModelDataDefineVar(res_data)
  496. data.clothe_res_id = figure_id
  497. data.can_rotate = data.can_rotate == nil and show_type ~= FosterConst.ModuleId.FWeapon or data.can_rotate
  498. data.type = FosterConst.ModelMatch[show_type]
  499. data.rotate = data.rotate or Vector3(show_conf.rotate[1],show_conf.rotate[2],show_conf.rotate[3])
  500. data.raycast_size = data.raycast_size or Vector2(340,460)
  501. -------------------------
  502. if data.ui_model_type ~= UIModelCommon.ModelType.BackModel then
  503. if show_type == FosterConst.ModuleId.FHorse then
  504. if not (type(data.rotate) == "number") then--加个参数类型判断
  505. data.rotate.x = data.rotate.x + 15
  506. end
  507. end
  508. -------------------------
  509. if not data.scale then
  510. if FosterConst.ModelSpecialShowConfig[show_type] and FosterConst.ModelSpecialShowConfig[show_type][figure_id] then
  511. --部分需要特殊配置的
  512. local temp_conf = FosterConst.ModelSpecialShowConfig[show_type][figure_id]
  513. if temp_conf.scale then
  514. data.scale = temp_conf.scale
  515. end
  516. end
  517. end
  518. -------------------------
  519. if not data.position then
  520. if FosterConst.ModelSpecialShowConfig[show_type] and FosterConst.ModelSpecialShowConfig[show_type][figure_id] then
  521. --部分需要特殊配置的
  522. local temp_conf = FosterConst.ModelSpecialShowConfig[show_type][figure_id]
  523. if temp_conf.position then
  524. data.position = Vector3(temp_conf.position[1],temp_conf.position[2],temp_conf.position[3])
  525. end
  526. else
  527. data.position = Vector3(show_conf.position[1],show_conf.position[2],show_conf.position[3])
  528. end
  529. -------------------------
  530. --配置里面的坐标和尺寸,是backmodel下的,其它模式的话要转换一下吧
  531. data.position.z = -500
  532. local chang_y = -200
  533. if show_type == FosterConst.ModuleId.FPearl or show_type == FosterConst.ModuleId.FWeapon
  534. or show_type == FosterConst.ModuleId.FGun or show_type == FosterConst.ModuleId.FCloud then
  535. chang_y = -250
  536. elseif show_type == FosterConst.ModuleId.FArmour then
  537. chang_y = -250
  538. end
  539. local chang_x = 0
  540. local career = data.career or RoleManager.Instance.mainRoleInfo.career
  541. if show_type == FosterConst.ModuleId.FWeapon then
  542. if career == 2 or career == 1 then
  543. chang_x = -50
  544. end
  545. end
  546. data.position.y = data.position.y + chang_y
  547. data.position.x = data.position.x + chang_x
  548. end
  549. end
  550. data.position = data.position or Vector3(show_conf.position[1],show_conf.position[2],show_conf.position[3])
  551. data.scale = data.scale or show_conf.scale or 120
  552. -------------------------
  553. return data
  554. end
  555. --获得怪物模型数据
  556. function FuncOpenModel:GetMonsterModelData( res_data )
  557. if not res_data then return nil end
  558. local mon_cfg, model_id
  559. if res_data.figure_id then -- 如果传入了怪物id,则优先使用怪物id对应的模型资源id
  560. mon_cfg = ConfigItemMgr.Instance:GetMonsterDataItem(res_data.figure_id)
  561. model_id = mon_cfg.icon
  562. elseif res_data.clothe_res_id then
  563. model_id = res_data.clothe_res_id
  564. end
  565. if not model_id then
  566. print("Saber:FuncOpenModel [430] 不存在模型id: ",debug.traceback())
  567. end
  568. local data = lua_resM:ModelDataDefineVar(res_data)
  569. data.clothe_res_id = model_id
  570. data.type = SceneBaseType.Monster
  571. data.scale = res_data.scale or 120
  572. data.rotate = res_data.rotate or Vector2(0, 0)
  573. data.raycast_size = res_data.raycast_size or Vector2(340,460)
  574. data.position = res_data.position or Vector2(0, 100)
  575. return data
  576. end
  577. --获得宠物模型数据
  578. function FuncOpenModel:GetPetModelData(res_data)
  579. if not res_data then return nil end
  580. local data = lua_resM:ModelDataDefineVar(res_data)
  581. local show_conf = PetConst.ModelShowConfig[res_data.figure_id] or PetConst.ModelShowConfig[1001]
  582. data.clothe_res_id = res_data.figure_id
  583. data.type = SceneBaseType.Pokemon
  584. data.scale = res_data.scale or show_conf.scale
  585. data.rotate = res_data.rotate or Vector3(show_conf.rotate[1],show_conf.rotate[2],show_conf.rotate[3])
  586. data.raycast_size = res_data.raycast_size or Vector2(340,460)
  587. data.action_name_list = res_data.action_name_list or {"show2","show"}
  588. data.position = res_data.position or Vector3(show_conf.position[1],show_conf.position[2],show_conf.position[3])
  589. return data
  590. end
  591. function FuncOpenModel:GetOtherGoodsModelData(res_data)
  592. if not res_data then return nil end
  593. local data = lua_resM:ModelDataDefineVar(res_data)
  594. data.clothe_res_id = res_data.figure_id
  595. data.type = SceneBaseType.OtherGoods
  596. data.scale = res_data.scale or 150
  597. data.rotate = res_data.rotate or Vector3(0,0,0)
  598. data.raycast_size = res_data.raycast_size or Vector2(340,460)
  599. data.action_name_list = res_data.action_name_list or {"show"}
  600. data.position = res_data.position or Vector3(0,0,-500)
  601. return data
  602. end
  603. -- 获取宝宝模型数据
  604. function FuncOpenModel:GetChildModelData( res_data )
  605. if not res_data then return nil end
  606. local data = lua_resM:ModelDataDefineVar(res_data)
  607. local show_conf = ChildConst.ModelShowConfig[1011] -- 默认模型
  608. data.clothe_res_id = res_data.figure_id
  609. data.type = SceneBaseType.Baby
  610. data.scale = res_data.scale or show_conf.scale
  611. data.rotate = res_data.rotate or Vector3(show_conf.rotate[1],show_conf.rotate[2],show_conf.rotate[3])
  612. data.raycast_size = res_data.raycast_size or Vector2(340,460)
  613. data.action_name_list = res_data.action_name_list or {"show2","show"}
  614. data.position = res_data.position or Vector3(show_conf.position[1],show_conf.position[2],show_conf.position[3])
  615. return data
  616. end
  617. -- 获取宝宝载具数据
  618. function FuncOpenModel:GetChildVehicleModelData( res_data )
  619. if not res_data then return nil end
  620. local data = lua_resM:ModelDataDefineVar(res_data)
  621. local show_conf = ChildConst.VehicleConfig[1001] -- 默认模型
  622. data.clothe_res_id = res_data.figure_id
  623. data.type = SceneBaseType.Baby_Horse
  624. data.scale = res_data.scale or show_conf.scale
  625. data.rotate = res_data.rotate or Vector3(show_conf.rotate[1],show_conf.rotate[2],show_conf.rotate[3])
  626. data.raycast_size = res_data.raycast_size or Vector2(340,460)
  627. data.action_name_list = res_data.action_name_list or {"idle"}
  628. data.position = res_data.position or Vector3(show_conf.position[1],show_conf.position[2],show_conf.position[3])
  629. return data
  630. end
  631. -- 获取宝宝载具数据 (默认有个男娃在骑)
  632. function FuncOpenModel:GetChildInVehicleModelData( res_data )
  633. if not res_data then return nil end
  634. local data = lua_resM:ModelDataDefineVar(res_data)
  635. local show_conf = ChildConst.ModelInVehicle -- 默认数据
  636. data.free_param = res_data.figure_id
  637. data.clothe_res_id = res_data.clothe_res_id or 1021
  638. data.type = SceneBaseType.Baby_Include_Horse
  639. -- 比较特殊 scale不宜太大
  640. local scale = res_data.scale or show_conf.scale
  641. scale = Mathf.Clamp(scale, 5, 6)
  642. data.scale = scale
  643. data.rotate = res_data.rotate or -50
  644. data.raycast_size = res_data.raycast_size or Vector2(340,460)
  645. data.action_name_list = res_data.action_name_list or {"idle"}
  646. data.position = res_data.position or Vector3(show_conf.position[1],show_conf.position[2],show_conf.position[3])
  647. return data
  648. end
  649. --获得装备模型数据
  650. function FuncOpenModel:GetEquipModelData( res_data )
  651. if not res_data then return nil end
  652. local data = lua_resM:ModelDataDefineVar(res_data)
  653. data.clothe_res_id = res_data.figure_id
  654. data.type = SceneBaseType.Equip
  655. data.scale = res_data.scale or 120
  656. data.raycast_size = res_data.raycast_size or Vector2(340,460)
  657. data.action_name_list = res_data.action_name_list or {"show"}
  658. data.position = res_data.position or Vector3(0,100,0)
  659. return data
  660. end
  661. --获得战魂模型数据
  662. function FuncOpenModel:GetWarSoulModelData( res_data )
  663. if not res_data then return nil end
  664. local figure_id = res_data.figure_id
  665. local effect_id = nil
  666. if figure_id >= 1000000 then
  667. effect_id = figure_id - math.floor(figure_id/1000)*1000
  668. figure_id = math.floor(figure_id/1000)
  669. end
  670. local data = lua_resM:ModelDataDefineVar(res_data)
  671. data.clothe_res_id = figure_id
  672. local config = WarSoulConst.WarSoulModelPosCfg[figure_id]
  673. data.type = SceneBaseType.WarSoul
  674. data.scale = res_data.scale and (res_data.scale) or (config and config.scale or 120)
  675. data.raycast_size = res_data.raycast_size or Vector2(340,460)
  676. data.action_name_list = res_data.action_name_list or {"show"}
  677. data.position = res_data.position or (config and config.pos) or Vector3(0,0,0)
  678. if not res_data.warSoul_effect_res and effect_id then
  679. res_data.warSoul_effect_res = "effect_egg_00"..effect_id
  680. if effect_id < 10 then
  681. res_data.warSoul_effect_res = "effect_egg_000"..effect_id
  682. end
  683. end
  684. local effect_pos_cfg = WarSoulConst.WarSoulEffectPosCfg[res_data.warSoul_effect_res]
  685. if config and effect_pos_cfg and effect_pos_cfg then
  686. data.warSoul_effect_scale = effect_pos_cfg.scale or 1
  687. data.warSoul_effect_res = res_data.warSoul_effect_res
  688. data.warSoul_effect_pos = effect_pos_cfg.pos or Vector3.zero
  689. end
  690. return data
  691. end
  692. --获得星辰型数据
  693. function FuncOpenModel:GetGalaxyModelData( res_data )
  694. if not res_data then return nil end
  695. local data = lua_resM:ModelDataDefineVar(res_data)
  696. data.clothe_res_id = res_data.figure_id
  697. data.type = SceneBaseType.Galaxy
  698. data.scale = res_data.scale or 120
  699. data.raycast_size = res_data.raycast_size or Vector2(340,460)
  700. data.action_name_list = res_data.action_name_list or {"show"}
  701. data.position = res_data.position or Vector3(0,100,0)
  702. return data
  703. end
  704. --获得神作型数据
  705. function FuncOpenModel:GetGodModelData( res_data )
  706. if not res_data then return nil end
  707. local data = lua_resM:ModelDataDefineVar(res_data)
  708. data.clothe_res_id = res_data.figure_id
  709. data.type = SceneBaseType.God
  710. data.scale = res_data.scale or 120
  711. data.raycast_size = res_data.raycast_size or Vector2(340,460)
  712. data.action_name_list = res_data.action_name_list or {"show"}
  713. data.position = res_data.position or Vector3(0,100,0)
  714. if GodConst.Model_Param[res_data.figure_id] then
  715. local cfg = GodConst.Model_Param[res_data.figure_id]
  716. if cfg.pos_offset then
  717. local rate = data.scale / 100
  718. data.position = data.position + cfg.pos_offset * rate
  719. end
  720. end
  721. return data
  722. end
  723. --获得守护模型数据
  724. function FuncOpenModel:GetEvilModelData( res_data )
  725. if not res_data then return nil end
  726. local data = lua_resM:ModelDataDefineVar(res_data)
  727. data.clothe_res_id = res_data.figure_id
  728. data.type = SceneBaseType.Galaxy
  729. data.scale = res_data.scale or 150
  730. data.action_name_list = res_data.action_name_list or {"show"}
  731. data.position = res_data.position or Vector3(0,0,0)
  732. return data
  733. end
  734. --幻光比较特殊,只是一个特效
  735. function FuncOpenModel:ShowLightModel( res_data )
  736. if not res_data then return end
  737. local config = {
  738. uiTranform = res_data.transform,
  739. layer_name = res_data.layer_name,
  740. resname = LightModel:GetInstance():GetLightResById( (res_data.light_id) or (res_data.figure_id) ),
  741. scale = res_data.scale or 1.5,
  742. pos = res_data.position or Vector3.zero,
  743. is_loop = true,
  744. }
  745. if res_data.father_node and res_data.transform then
  746. local ref_info = lua_resM.role_mode_list[res_data.father_node] or {}--幻光这边要清一次模型
  747. local curr_roleModel = ref_info[res_data.transform]
  748. if curr_roleModel then
  749. curr_roleModel:DeleteMe()
  750. ref_info[res_data.transform] = nil
  751. end
  752. res_data.father_node:ClearUIEffect( res_data.transform )
  753. res_data.father_node:CreateUIEffect( config )
  754. end
  755. end
  756. --灵能比较特殊,只是一个特效
  757. function FuncOpenModel:ShowPsionicModel( res_data )
  758. if not res_data then return end
  759. local config = {
  760. uiTranform = res_data.transform,
  761. layer_name = res_data.layer_name,
  762. resname = PsionicModel:getInstance():GetPsionicEffectStageByid( res_data.figure_id or 1 ),
  763. scale = res_data.scale or 270,
  764. pos = res_data.position or Vector3.zero,
  765. is_loop = true,
  766. position = Vector3(0,-15,0),
  767. }
  768. print('Cat:FuncOpenModel.lua[702] data', res_data.father_node, res_data.transform)
  769. if res_data.father_node and res_data.transform then
  770. res_data.father_node:ClearUIEffect( res_data.transform )
  771. res_data.father_node:CreateUIEffect( config )
  772. end
  773. end
  774. function FuncOpenModel:SaveFightChange( old_fightNum ) -- 为战力提升界面先存储旧战力数字
  775. self.old_fightNum = old_fightNum
  776. end
  777. --通用展示称号--节点建议直接从KfActivityRushRankView复制过来
  778. --local data = {
  779. --parent = parent,
  780. --dress_id = dress_id,
  781. --designationImg = designationImg,
  782. --scale = scale,
  783. --}
  784. function FuncOpenModel:ShowDesign( data )
  785. if not data or not data.dress_id or not data.designationImg or not data.parent then
  786. print("huangcong:FuncOpenModel [start:761] 称号节点数据不完整:")
  787. return
  788. end
  789. local goods_id = data.dress_id or nil
  790. if not goods_id then return end
  791. local designation_id = DesignationModel:GetInstance():GetDesignationIdByGoodsId(goods_id)
  792. local dsgt_cfg = Config.Dsgt
  793. --这里构造称号需要的节点
  794. local parent = data.parent
  795. local designation_con = data.designation_con
  796. local designationImg = data.designationImg
  797. local designationImg_img = designationImg:GetComponent("Image")
  798. if parent.dynamic_image_obj then
  799. parent.dynamic_image_obj:SetActive(false)
  800. end
  801. local designation_scale = data.scale and data.scale or 1.5
  802. SetLocalScale(designationImg, designation_scale, designation_scale, designation_scale)
  803. cc.ActionManager:getInstance():removeAllActionsFromTarget(designationImg.transform)
  804. if dsgt_cfg[designation_id] then
  805. if dsgt_cfg[designation_id].type == 1 then--文字称号(文字称号也用图片了)
  806. designationImg.gameObject:SetActive(true)
  807. lua_resM:setOutsideImageSprite(parent, designationImg_img, GameResPath.GetDesignImage(dsgt_cfg[designation_id].id), true)
  808. elseif dsgt_cfg[designation_id].type == 2 then--图片称号
  809. designationImg.gameObject:SetActive(true)
  810. lua_resM:setOutsideImageSprite(parent, designationImg_img, GameResPath.GetDesignImage(dsgt_cfg[designation_id].id), true)
  811. elseif dsgt_cfg[designation_id].type == 3 then--特效称号
  812. if not parent.dynamic_image_obj then
  813. parent.dynamic_image_obj = UiFactory.createChild(designationImg, UIType.Image, "dynamic_image")
  814. dynamic_image_img = parent.dynamic_image_obj:GetComponent("Image")
  815. SetAnchoredPosition(parent.dynamic_image_obj.transform, 0, 0)
  816. else
  817. parent.dynamic_image_obj:SetActive(true)
  818. end
  819. designationImg.gameObject:SetActive(true)
  820. local data = DesignationModel:GetInstance():GetDynamicDesignationCFG(designation_id)
  821. local res = Split(data[1].res, "_")--分割出来配置 然后取文字
  822. local font_res = res[1] or ""
  823. lua_resM:setImageSprite(parent, dynamic_image_img, data[1].ab, font_res.."_font", true)
  824. local action = cc.Animation.New(data,0.15)
  825. cc.ActionManager:getInstance():addAction(cc.RepeatForever.New(action), designationImg.transform)
  826. end
  827. end
  828. end
  829. --通用展示气泡
  830. --节点建议直接从KfActivityRushRankView复制过来
  831. --local data = {
  832. --parent = parent,
  833. --dress_id = dress_id,
  834. --bubbleCon = bubbleCon,
  835. --}
  836. function FuncOpenModel:ShowBubble( data )
  837. if not data or not data.parent then return end
  838. if data.dress_id then
  839. lua_resM:setOutsideImageSprite(data.parent, data.bubbleCon:GetComponent("Image"), GameResPath.GetChatDressIcon(data.dress_id), false)
  840. end
  841. end
  842. --通用展示头像框
  843. --节点建议直接从KfActivityRushRankView复制过来
  844. --local data = {
  845. --parent = parent,
  846. --dress_id = dress_id,
  847. --mainRoleHeadItem = mainRoleHeadItem,
  848. --}
  849. function FuncOpenModel:ShowHead( data )
  850. if not data or not data.parent or not data.mainRoleHeadItem then return end
  851. local head_data = {
  852. vo = {id = RoleManager.Instance.mainRoleInfo.role_id, use_bg = 3, career = 0, sex = RoleManager.Instance.mainRoleInfo.sex, turn = RoleManager.Instance.mainRoleInfo.turn, dress_board_id = data.dress_id, profile_photo_id = RoleManager.Instance.mainRoleInfo.profile_photo_id},
  853. }
  854. data.mainRoleHeadItem:SetData(head_data)
  855. end
  856. --通用展示头像
  857. --节点建议直接从KfActivityRushRankView复制过来
  858. --local data = {
  859. --parent = parent,
  860. --dress_id = dress_id,
  861. --mainRoleHeadItem = mainRoleHeadItem,
  862. --}
  863. function FuncOpenModel:ShowRoleHead( data )
  864. if not data or not data.parent or not data.mainRoleHeadItem then return end
  865. local head_data = {
  866. vo = {id = RoleManager.Instance.mainRoleInfo.role_id, use_bg = 3, career = 0, sex = RoleManager.Instance.mainRoleInfo.sex, turn = RoleManager.Instance.mainRoleInfo.turn, dress_board_id = RoleManager.Instance.mainRoleInfo.dress_board, profile_photo_id = data.dress_id},
  867. }
  868. data.mainRoleHeadItem:SetData(head_data)
  869. end