author suo
  module FishingJoy { export class Master { private static _instance : Master = null ; public uid : number = - 1 ; public nickName : string = undefined ; public headURL : string = undefined ; public money : number = 0 ; public lastMoney : number = 0 ; public gender : string = undefined ; public baseInfo : game . UserInfo = null ; public seatID : number = - 1 ; public isAimShoot : boolean = false ; public isFastShoot : boolean = false ; public isAutoShoot : boolean = false ; public isAimShootCooling : boolean = false ; public isFastShootCooling : boolean = false ; public isAutoShootCooling : boolean = false ; public isFrozenShootCooling : boolean = false ; public isNormalShoot : boolean = true ; public aimFishServelID : number = NaN ; public isRotation : boolean = false ; public masterBattery : gameObject . Battery = null ; public prohibitShoot : boolean = false ; public constructor ( ) { game . RoomData . Instance . MainSeatChanged . add ( this . updatePlayerInfo , this ) ; EventManager . registerEvent ( EVENT_ID . CHANGE_SEAT , Handler . create ( this , this . _mainSeatChanged ) ) ; } /**
         * 获得单例
         */ public static get instance ( ) : Master { if ( this . _instance == null ) { this . _instance = new Master ( ) ; } return this . _instance ; } /**
         * 更新玩家数据
         */ public updatePlayerInfo ( value ) { if ( value == game . USerSeatState . SitDown ) { if ( game . PokerFunction . MainUser != null ) { this . uid = game . PokerFunction . MainUser . uid ; this . seatID = game . PokerFunction . MainSeatId ; if ( this . baseInfo == null ) { this . baseInfo = game . PokerFunction . MainUser ; this . baseInfo . nameChanged . add ( this . _nameChanged , this ) ; this . baseInfo . headUrlChanged . add ( this . _headChanged , this ) ; } } EventManager . fireEvent ( EVENT_ID . MASTER_SIT_DOWN , this . seatID ) ; } else if ( value == game . USerSeatState . StandUp ) { if ( this . seatID != - 1 ) { this . seatID = - 1 ; } if ( this . baseInfo != null ) { this . baseInfo . nameChanged . remove ( this . _nameChanged , this ) ; this . baseInfo . headUrlChanged . remove ( this . _headChanged , this ) ; this . baseInfo = null ; } } } /**
          * 主角座位改变
          */ private _mainSeatChanged ( ) { let mainSeat = game . PokerFunction . MainSeat ; if ( mainSeat == null ) return ; let seatId = mainSeat . seatId ; egret . log ( "玩家座位id为：" + seatId ) ; if ( seatId > 2 ) { this . isRotation = true ; let rotation = 180 ; FishingJoy . LayerManager . instance . setLayerRotation ( rotation , LAYER . Fish ) ; FishingJoy . LayerManager . instance . setLayerRotation ( rotation , LAYER . FishingNet ) ; FishingJoy . LayerManager . instance . setLayerRotation ( rotation , LAYER . Bullet ) ; FishingJoy . LayerManager . instance . setLayerRotation ( rotation , LAYER . ElectricEFF ) ; FishingJoy . LayerManager . instance . setLayerRotation ( rotation , LAYER . EFFECT_ROTATION ) ; let backGround0 = UICenter . instance . getManager ( commonUI . FishMainScene ) . getView ( FishingJoy . FishMainSceneView ) . backGround0 ; let batteryGroup = UICenter . instance . getManager ( commonUI . FishMainScene ) . getView ( FishingJoy . SeatView ) . batteryGroup ; let mainBattery = batteryGroup . get ( seatId ) ; if ( seatId == 3 ) { let changeBattery2 = batteryGroup . get ( 2 ) ; mainBattery . changeSeat ( changeBattery2 ) ; mainBattery . curRotation = 180 ; let changeBattery4 = batteryGroup . get ( 4 ) ; let changeBattery1 = batteryGroup . get ( 1 ) ; changeBattery4 . changeSeat ( changeBattery1 ) ; } else if ( seatId == 4 ) { let changeBattery = batteryGroup . get ( 1 ) ; mainBattery . changeSeat ( changeBattery ) ; let changeBattery2 = batteryGroup . get ( 2 ) ; let changeBattery3 = batteryGroup . get ( 3 ) ; mainBattery . curRotation = 180 ; changeBattery2 . changeSeat ( changeBattery3 ) ; } } } /**
         * 姓名被更改时
         */ private _nameChanged ( ) { this . nickName = this . baseInfo . nickName ; } /**
         * 头像变更
         */ private _headChanged ( ) { this . headURL = this . baseInfo . headUrl ; } /**
         * 释放
         */ public dispose ( ) { this . uid = - 1 ; this . nickName = undefined ; this . headURL = undefined ; this . money = - 1 ; this . gender = undefined ; if ( this . baseInfo != null ) { this . baseInfo . nameChanged . remove ( this . _nameChanged , this ) ; this . baseInfo . headUrlChanged . remove ( this . _headChanged , this ) ; this . baseInfo = null ; } game . RoomData . Instance . MainSeatChanged . remove ( this . updatePlayerInfo , this ) ; EventManager . unregisterEvent ( EVENT_ID . CHANGE_SEAT , this , this . _mainSeatChanged ) ; Master . _instance = null ; } } export enum SHOOT_TYPE { FAST , AIM , AUTO , NORMAL , FREEZE } }