123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- import { _decorator, Component, Node, Label } from 'cc';
- import { ClientEvent } from '../clientEvent';
- import { Constant, privacy_select, privacy_type } from '../constant';
- import { GameMng } from '../GameMng';
- import { UIButton } from '../gcommon/UIButton';
- const { ccclass, property } = _decorator;
- @ccclass('check_view')
- export class check_view extends Component {
- @property(Node) tag_lab:Node = null
- @property(Node) check_1:Node = null
- @property(Node) check_2:Node = null
- @property(Node) check_3:Node = null
- @property(Node) check_1_lab:Node = null
- @property(Node) check_2_lab:Node = null
- @property(Node) check_3_lab:Node = null
- @property(Node) check_1_sp:Node = null
- @property(Node) check_2_sp:Node = null
- @property(Node) check_3_sp:Node = null
- private check_list:Node[] = []
- private curSelectType = 0;
- private curSelectPrivacyType:privacy_type;
- start() {
- UIButton.BindClick(this.check_1,()=>{
- if(this.curSelectType!=privacy_select.suo_you_ren){
- this.curSelectType = privacy_select.suo_you_ren
- this.updateSelectStatus(true)
- }
-
- },this);
- UIButton.BindClick(this.check_2,()=>{
- if(this.curSelectType != privacy_select.jin_hao_you){
- this.curSelectType = privacy_select.jin_hao_you
- this.updateSelectStatus(true)
- }
-
- },this);
- UIButton.BindClick(this.check_3,()=>{
- if(this.curSelectType != privacy_select.ju_jue){
- this.curSelectType = privacy_select.ju_jue
- this.updateSelectStatus(true)
- }
- },this);
- this.updateSelectStatus()
- }
- initCheckList(){
- if(this.check_list.length<=0){
- this.check_list.push(this.check_1_sp)
- this.check_list.push(this.check_2_sp)
- this.check_list.push(this.check_3_sp)
- }
- }
- show(type:privacy_type){
- this.curSelectPrivacyType = type
- let data = Constant.CHECK_PRIVACY[type]
- this.tag_lab.getComponent(Label).string = data.tag;
- this.check_1_lab.getComponent(Label).string = data.select_list[0]
- this.check_2_lab.getComponent(Label).string = data.select_list[1]
- this.check_3_lab.getComponent(Label).string = data.select_list[2]
-
- if(GameMng._userData.privacy===null||GameMng._userData.privacy===undefined){
- console.error("GameMng._userData.privacy error");
- return
- }
- switch(type)
- {
- case privacy_type.liu_yan:
- this.curSelectType = GameMng._userData.privacy.liuyan_type
- break;
- case privacy_type.zhan_ji:
- this.curSelectType = GameMng._userData.privacy.zhanji_type
- break;
- case privacy_type.yue_zhan:
- this.curSelectType = GameMng._userData.privacy.yuezhan_type
- break;
- }
- this.updateSelectStatus()
- }
- updateSelectStatus(change:boolean=false){
- this.initCheckList()
- for (let index = 0; index < this.check_list.length; index++) {
- const element = this.check_list[index];
- element.active = false;
- }
- this.check_list[this.curSelectType].active = true;
- switch( this.curSelectPrivacyType)
- {
- case privacy_type.liu_yan:
- GameMng._userData.privacy.liuyan_type =this.curSelectType
- break;
- case privacy_type.zhan_ji:
- GameMng._userData.privacy.zhanji_type = this.curSelectType
- break;
- case privacy_type.yue_zhan:
- GameMng._userData.privacy.yuezhan_type = this.curSelectType
- break;
- }
- if(change){
- ClientEvent.dispatchEvent(Constant.UI_EVENT.UI_MSG_UPDATE_PRIVACY)
- }
- }
-
- update(deltaTime: number) {
-
- }
- }
|