import { _decorator, Component, Label, Node } from 'cc'; const { ccclass, property } = _decorator; @ccclass('WallTextSwitch') export class WallTextSwitch extends Component { @property(Label) WallLb : Label = null!; isOnToggle: boolean = false; start () { this.WallLb.string = "Стены включены" } wallSwitch() { if (this.isOnToggle) { this.isOnToggle = false; this.WallLb.string = "Стены включены"; } else { this.isOnToggle = true; this.WallLb.string = "Стены выключены"; } } }