win.ts 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. import { _decorator, Component, Label, Node, Sprite, SpriteFrame, UITransform, Vec3 } from 'cc';
  2. import { server_han_zi_zhao_bu_tong_data_item, server_mei_nv_zhao_xi_jie_data_item, server_shuang_tu_zhao_bu_tong_data_item } from '../data/server_play_list_data';
  3. import { Util } from '../framework/util';
  4. import { gameManager } from '../gameManager';
  5. import { config } from '../config';
  6. const { ccclass, property } = _decorator;
  7. @ccclass('win')
  8. export class win extends Component {
  9. @property(Node) bg:Node;
  10. @property(Node) img_caidai:Node;
  11. @property(Node) img_text:Node;
  12. @property(Node) lab_reward_number:Node;
  13. @property(Node) btn_bg:Node;
  14. @property(Node) btn_ordinary:Node;
  15. @property(Node) btn_double:Node;
  16. @property(Node) btn_next_level:Node;
  17. @property(Node) img_emote:Node;
  18. @property(Node) lab_title_1:Node;
  19. @property(SpriteFrame) sf_tailihaile:SpriteFrame;
  20. @property(SpriteFrame) sf_gongxi:SpriteFrame;
  21. private m_reward_number:number;
  22. private m_ordinary_call:any = null;
  23. private m_double_call:any = null;
  24. start() {
  25. let self = this;
  26. this.btn_ordinary.on(Node.EventType.TOUCH_START,()=>{
  27. if(this.m_ordinary_call!=null){
  28. this.m_ordinary_call(this)
  29. }
  30. },this);
  31. this.btn_double.on(Node.EventType.TOUCH_START,()=>{
  32. if(this.m_double_call!=null){
  33. this.m_double_call(this)
  34. }
  35. },this);
  36. this.btn_next_level.on(Node.EventType.TOUCH_START,()=>{
  37. if(this.m_ordinary_call!=null){
  38. this.m_ordinary_call(this)
  39. }
  40. },this);
  41. }
  42. public close(){
  43. this.node.removeFromParent();
  44. }
  45. public hideAllBtn(){
  46. this.btn_ordinary.active = false;
  47. this.btn_double.active = false;
  48. }
  49. public showDoubleCoin(doubel_reward,call_back){
  50. let reward = this.m_reward_number
  51. let obj = new Component
  52. gameManager.instance.addCoinNumber(obj,doubel_reward,this.lab_reward_number.getComponent(Label),reward,()=>{
  53. call_back()
  54. },"+ ")
  55. this.hideAllBtn()
  56. }
  57. public showView(reward:number,data:server_mei_nv_zhao_xi_jie_data_item,ordinary_call,double_call){
  58. this.bg.getComponent(UITransform).height = 374
  59. this.m_double_call = double_call;
  60. this.m_ordinary_call = ordinary_call;
  61. this.m_reward_number = reward;
  62. this.lab_reward_number.getComponent(Label).string = "+ " +reward+"";
  63. }
  64. public showJYLView(ordinary_call,categoryid){
  65. this.img_caidai.active = false
  66. this.bg.getComponent(UITransform).height = 280
  67. this.img_text.position = new Vec3(this.img_text.position.x, this.img_text.position.y - 40, this.img_text.position.z)
  68. this.btn_bg.position = new Vec3(this.btn_bg.position.x, this.btn_bg.position.y + 50, this.btn_bg.position.z)
  69. if(categoryid===config.PLAY_TYPE.DOU_DI_ZHU){
  70. this.bg.angle = -90;
  71. this.bg.position = new Vec3(this.bg.position.x,this.bg.position.y,this.bg.position.z)
  72. }else{
  73. }
  74. this.img_text.getComponent(Sprite).spriteFrame = this.sf_tailihaile;
  75. this.hideAllBtn()
  76. this.m_ordinary_call = ordinary_call;
  77. this.btn_next_level.active = true;
  78. this.lab_reward_number.active = false;
  79. this.lab_title_1.active = false;
  80. }
  81. public showVideoAddCoinView(reward:number,data:server_mei_nv_zhao_xi_jie_data_item,ordinary_call,double_call){
  82. this.m_double_call = double_call;
  83. this.m_ordinary_call = ordinary_call;
  84. this.m_reward_number = reward;
  85. this.img_text.getComponent(Sprite).spriteFrame = this.sf_gongxi
  86. this.lab_reward_number.getComponent(Label).string = "+ " +reward+"";
  87. }
  88. }