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. private m_reward_number:number;
  21. private m_ordinary_call:any = null;
  22. private m_double_call:any = null;
  23. start() {
  24. let self = this;
  25. this.btn_ordinary.on(Node.EventType.TOUCH_START,()=>{
  26. if(this.m_ordinary_call!=null){
  27. this.m_ordinary_call(this)
  28. }
  29. },this);
  30. this.btn_double.on(Node.EventType.TOUCH_START,()=>{
  31. if(this.m_double_call!=null){
  32. this.m_double_call(this)
  33. }
  34. },this);
  35. this.btn_next_level.on(Node.EventType.TOUCH_START,()=>{
  36. if(this.m_ordinary_call!=null){
  37. this.m_ordinary_call(this)
  38. }
  39. },this);
  40. }
  41. public close(){
  42. this.node.removeFromParent();
  43. }
  44. public hideAllBtn(){
  45. this.btn_ordinary.active = false;
  46. this.btn_double.active = false;
  47. }
  48. public showDoubleCoin(doubel_reward,call_back){
  49. let reward = this.m_reward_number
  50. let obj = new Component
  51. gameManager.instance.addCoinNumber(obj,doubel_reward,this.lab_reward_number.getComponent(Label),reward,()=>{
  52. call_back()
  53. },"+ ")
  54. this.hideAllBtn()
  55. }
  56. public showView(reward:number,data:server_mei_nv_zhao_xi_jie_data_item,ordinary_call,double_call){
  57. this.bg.getComponent(UITransform).height = 374
  58. this.m_double_call = double_call;
  59. this.m_ordinary_call = ordinary_call;
  60. this.m_reward_number = reward;
  61. this.lab_reward_number.getComponent(Label).string = "+ " +reward+"";
  62. }
  63. public showJYLView(ordinary_call,categoryid){
  64. this.img_caidai.active = false
  65. this.bg.getComponent(UITransform).height = 280
  66. this.img_text.position = new Vec3(this.img_text.position.x, this.img_text.position.y - 40, this.img_text.position.z)
  67. this.btn_bg.position = new Vec3(this.btn_bg.position.x, this.btn_bg.position.y + 50, this.btn_bg.position.z)
  68. if(categoryid===config.PLAY_TYPE.DOU_DI_ZHU){
  69. this.bg.angle = -90;
  70. this.bg.position = new Vec3(this.bg.position.x,this.bg.position.y,this.bg.position.z)
  71. }else{
  72. }
  73. this.img_text.getComponent(Sprite).spriteFrame = this.sf_tailihaile;
  74. this.hideAllBtn()
  75. this.m_ordinary_call = ordinary_call;
  76. this.btn_next_level.active = true;
  77. this.lab_reward_number.active = false;
  78. this.lab_title_1.active = false;
  79. }
  80. public showVideoAddCoinView(reward:number,data:server_mei_nv_zhao_xi_jie_data_item,ordinary_call,double_call){
  81. this.m_double_call = double_call;
  82. this.m_ordinary_call = ordinary_call;
  83. this.m_reward_number = reward;
  84. // this.lab_title.active = false;
  85. // this.img_emote.getComponent(Sprite).spriteFrame = this.spr_reward_sf;
  86. this.lab_reward_number.getComponent(Label).string = "+ " +reward+"";
  87. }
  88. }