win.ts 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. import { _decorator, Component, Label, Node, Sprite, SpriteFrame, 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) btn_back:Node;
  10. @property(Node) btn_ordinary:Node;
  11. @property(Node) btn_double:Node;
  12. @property(Node) lab_reward_number:Node;
  13. @property(Node) lab_title:Node;
  14. @property(Node) img_emote:Node;
  15. @property(Node) btn_next_level:Node;
  16. @property(Node) lab_title_1:Node;
  17. @property(Node) bg:Node;
  18. @property(SpriteFrame) spr_reward_sf:SpriteFrame;
  19. private m_reward_number:number;
  20. private m_ordinary_call:any = null;
  21. private m_double_call:any = null;
  22. start() {
  23. let self = this;
  24. this.btn_back.on(Node.EventType.TOUCH_START,()=>{
  25. self.close();
  26. },this);
  27. this.btn_ordinary.on(Node.EventType.TOUCH_START,()=>{
  28. if(this.m_ordinary_call!=null){
  29. this.m_ordinary_call(this)
  30. }
  31. },this);
  32. this.btn_double.on(Node.EventType.TOUCH_START,()=>{
  33. if(this.m_double_call!=null){
  34. this.m_double_call(this)
  35. }
  36. },this);
  37. this.btn_next_level.on(Node.EventType.TOUCH_START,()=>{
  38. if(this.m_ordinary_call!=null){
  39. this.m_ordinary_call(this)
  40. }
  41. },this);
  42. }
  43. public close(){
  44. this.node.removeFromParent();
  45. }
  46. public hideAllBtn(){
  47. this.btn_ordinary.active = false;
  48. this.btn_double.active = false;
  49. }
  50. public showDoubleCoin(doubel_reward,call_back){
  51. let reward = this.m_reward_number
  52. let obj = new Component
  53. gameManager.instance.addCoinNumber(obj,doubel_reward,this.lab_reward_number.getComponent(Label),reward,()=>{
  54. call_back()
  55. },"+ ")
  56. this.hideAllBtn()
  57. }
  58. public showView(reward:number,data:server_mei_nv_zhao_xi_jie_data_item,ordinary_call,double_call){
  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. if(categoryid===config.PLAY_TYPE.DOU_DI_ZHU){
  66. this.bg.angle = -90;
  67. this.bg.position = new Vec3(this.bg.position.x-40,this.bg.position.y,this.bg.position.z)
  68. }else{
  69. }
  70. this.hideAllBtn()
  71. this.m_ordinary_call = ordinary_call;
  72. this.btn_next_level.active = true;
  73. this.lab_reward_number.active = false;
  74. this.lab_title_1.active = false;
  75. }
  76. public showVideoAddCoinView(reward:number,data:server_mei_nv_zhao_xi_jie_data_item,ordinary_call,double_call){
  77. this.m_double_call = double_call;
  78. this.m_ordinary_call = ordinary_call;
  79. this.lab_title.active = false;
  80. this.m_reward_number = reward;
  81. this.img_emote.getComponent(Sprite).spriteFrame = this.spr_reward_sf;
  82. this.lab_reward_number.getComponent(Label).string = "+ " +reward+"";
  83. }
  84. }