setting.ts 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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 start(): void {
  15. this.onButtonListen(this.btn_close,()=>{
  16. this.close()
  17. })
  18. this.onButtonListen(this.yinyue_btn_on, ()=>{
  19. this.updateYinyueStatus(false)
  20. })
  21. this.onButtonListen(this.yinyue_btn_off, ()=>{
  22. this.updateYinyueStatus(true)
  23. })
  24. this.onButtonListen(this.shengyin_btn_on, ()=>{
  25. this.updateShengyinStatus(false)
  26. })
  27. this.onButtonListen(this.shengyin_btn_off, ()=>{
  28. this.updateShengyinStatus(true)
  29. })
  30. this.onButtonListen(this.zhendong_btn_on, ()=>{
  31. this.updateZhendongStatus(false)
  32. })
  33. this.onButtonListen(this.zhendong_btn_off, ()=>{
  34. this.updateZhendongStatus(true)
  35. })
  36. this.updateYinyueStatus(true)
  37. this.updateShengyinStatus(true)
  38. this.updateZhendongStatus(true)
  39. }
  40. updateYinyueStatus(open:boolean) {
  41. if(open) {
  42. this.yinyue_btn_on.active = true
  43. this.yinyue_btn_off.active = false
  44. } else {
  45. this.yinyue_btn_on.active = false
  46. this.yinyue_btn_off.active = true
  47. }
  48. }
  49. updateShengyinStatus(open:boolean) {
  50. if(open) {
  51. this.shengyin_btn_on.active = true
  52. this.shengyin_btn_off.active = false
  53. } else {
  54. this.shengyin_btn_on.active = false
  55. this.shengyin_btn_off.active = true
  56. }
  57. }
  58. updateZhendongStatus(open:boolean) {
  59. if(open) {
  60. this.zhendong_btn_on.active = true
  61. this.zhendong_btn_off.active = false
  62. } else {
  63. this.zhendong_btn_on.active = false
  64. this.zhendong_btn_off.active = true
  65. }
  66. }
  67. }