1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- 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.on(Node.EventType.TOUCH_END,()=>{
- if(this.mLeftCallBack!=null){
- this.mLeftCallBack()
- }
- })
- this.btn_down.on(Node.EventType.TOUCH_END,()=>{
- if(this.mRightCallBack!=null){
- this.mRightCallBack()
- }
- })
- this.btn_left.on(Node.EventType.TOUCH_END,()=>{
- if(this.mLeftCallBack!=null){
- this.mLeftCallBack()
- }
- })
- 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;
- }
- }
- }
|