123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- import { _decorator, Component, Node } from 'cc';
- import { scene_item_data } from '../../data/data';
- import { config } from '../config';
- const { ccclass, property } = _decorator;
- @ccclass('scene_page_dir')
- export class scene_page_dir extends Component {
- @property(Node) btn_left:Node = null;
- @property(Node) btn_right:Node = null;
- @property(Node) btn_up:Node = null;
- @property(Node) btn_down:Node = null;
- private mLeftCallBack = null;
- private mRightCallBack = null;
- private mType:number = 0;
- public initView(type:number,left_call,right_call){
- this.mLeftCallBack = left_call;
- this.mRightCallBack = right_call;
- this.btn_left.active = false;
- this.btn_right.active = false;
- this.btn_down.active = false;
- this.mType = type;
- this.btn_up.active = false;
-
- if(type===config.Scene_Type_List.single_screen){
- }else{
- if(type===config.Scene_Type_List.many_screen_switch_up_down){
- this.btn_down.active = true;
- this.btn_up.active = true;
- }else{
- this.btn_left.active = true;
- this.btn_right.active = true;
- }
- }
- this.btn_up.off(Node.EventType.TOUCH_END)
- this.btn_up.on(Node.EventType.TOUCH_END,()=>{
- if(this.mLeftCallBack!=null){
- this.mLeftCallBack()
- }
- })
- this.btn_down.off(Node.EventType.TOUCH_END)
- this.btn_down.on(Node.EventType.TOUCH_END,()=>{
- if(this.mRightCallBack!=null){
- this.mRightCallBack()
- }
- })
- this.btn_left.off(Node.EventType.TOUCH_END)
- this.btn_left.on(Node.EventType.TOUCH_END,()=>{
- if(this.mLeftCallBack!=null){
- this.mLeftCallBack()
- }
- })
- this.btn_right.off(Node.EventType.TOUCH_END)
- this.btn_right.on(Node.EventType.TOUCH_END,()=>{
- if(this.mRightCallBack!=null){
- this.mRightCallBack()
- }
- })
- }
- hideUpBtn(){
- this.btn_left.active = false;
- this.btn_up.active = false;
- }
- hideNextBtn(){
- this.btn_right.active = false;
- this.btn_down.active = false;
- }
- hideAllBtn(){
- this.hideUpBtn()
- this.hideNextBtn()
- }
- showAllBtn(){
- if(this.mType===config.Scene_Type_List.many_screen_switch_up_down){
- this.btn_down.active = true;
- this.btn_up.active = true;
- }else{
- this.btn_left.active = true;
- this.btn_right.active = true;
- }
- }
- }
|