33 行
876 B
TypeScript
33 行
876 B
TypeScript
import { _decorator, Component, Button, Toggle } from 'cc';
|
|
import { GameManager } from '../core/GameManager';
|
|
|
|
const { ccclass, property } = _decorator;
|
|
|
|
/**
|
|
* SettingScene 设置与信息偏好(信息流权重、遭遇静音等)。
|
|
*/
|
|
@ccclass('SettingScene')
|
|
export class SettingScene extends Component {
|
|
@property({ type: Button })
|
|
public backButton: Button | null = null;
|
|
|
|
@property({ type: Toggle })
|
|
public onlyRareEncounterToggle: Toggle | null = null;
|
|
|
|
onLoad() {
|
|
this.backButton?.node.on(Button.EventType.CLICK, this.onBack, this);
|
|
}
|
|
|
|
public onSavePreference() {
|
|
// TODO: 保存信息流偏好到本地与服务端
|
|
}
|
|
|
|
private onBack() {
|
|
GameManager.getInstance().switchScene('LobbyScene');
|
|
}
|
|
|
|
onDestroy() {
|
|
this.backButton?.node.off(Button.EventType.CLICK, this.onBack, this);
|
|
}
|
|
}
|