setting.ts 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import { _decorator, Component, Node, Toggle } from 'cc';
  2. import { uiManager } from '../../manager/uiManager';
  3. import { base_ui } from '../../fw/base_ui';
  4. const { ccclass, property } = _decorator;
  5. @ccclass('setting')
  6. export class setting extends base_ui {
  7. @property(Node) btn_close:Node = null
  8. @property(Node) yinyue_btn_on:Node = null;
  9. @property(Node) yinyue_btn_off:Node = null;
  10. @property(Node) shengyin_btn_on:Node = null;
  11. @property(Node) shengyin_btn_off:Node = null;
  12. @property(Node) zhendong_btn_on:Node = null;
  13. @property(Node) zhendong_btn_off:Node = null;
  14. protected init(): void {
  15. this.onButtonListen(this.yinyue_btn_on, ()=>{
  16. this.updateYinyueStatus(false)
  17. })
  18. this.onButtonListen(this.yinyue_btn_off, ()=>{
  19. this.updateYinyueStatus(true)
  20. })
  21. this.onButtonListen(this.shengyin_btn_on, ()=>{
  22. this.updateShengyinStatus(false)
  23. })
  24. this.onButtonListen(this.shengyin_btn_off, ()=>{
  25. this.updateShengyinStatus(true)
  26. })
  27. this.onButtonListen(this.zhendong_btn_on, ()=>{
  28. this.updateZhendongStatus(false)
  29. })
  30. this.onButtonListen(this.zhendong_btn_off, ()=>{
  31. this.updateZhendongStatus(true)
  32. })
  33. this.updateYinyueStatus(true)
  34. this.updateShengyinStatus(true)
  35. this.updateZhendongStatus(true)
  36. }
  37. updateYinyueStatus(open:boolean) {
  38. if(open) {
  39. this.yinyue_btn_on.active = true
  40. this.yinyue_btn_off.active = false
  41. } else {
  42. this.yinyue_btn_on.active = false
  43. this.yinyue_btn_off.active = true
  44. }
  45. }
  46. updateShengyinStatus(open:boolean) {
  47. if(open) {
  48. this.shengyin_btn_on.active = true
  49. this.shengyin_btn_off.active = false
  50. } else {
  51. this.shengyin_btn_on.active = false
  52. this.shengyin_btn_off.active = true
  53. }
  54. }
  55. updateZhendongStatus(open:boolean) {
  56. if(open) {
  57. this.zhendong_btn_on.active = true
  58. this.zhendong_btn_off.active = false
  59. } else {
  60. this.zhendong_btn_on.active = false
  61. this.zhendong_btn_off.active = true
  62. }
  63. }
  64. }