private void OnDisable()
        {
#if (UNITY_ANDROID) && (!UNITY_EDITOR)
            CupKeyEventHookStaticManager.removePowerKeyPressCallBack(PowerKeyPressUp);
#endif
            SoundPlayer.GetInstance().StopMusic();
        }
예제 #2
0
        private void OnDisable()
        {
#if (UNITY_ANDROID) && (!UNITY_EDITOR)
            CupKeyEventHookStaticManager.removePowerKeyPressCallBack(PowerKeyPressUp);
#endif
            this.uiNimBox.SetStatus(false);
            this.uiPropsBox.SetStatus(false);
        }
예제 #3
0
        /// <summary>
        /// 注册输入
        /// </summary>
        protected virtual void RegisterInput()
        {
            if (this.InputRegistered)
            {
                return;
            }
#if !UNITY_EDITOR && UNITY_ANDROID
            CupMotionManager.start();
            CupMotionManager.addShakeListener(this._CupShake);                             //摇晃
            CupMotionManager.addPoseChangeListener(this._CupPoseChanged);                  //姿势
            CupMotionManager.addTiltStatusChangeEventListener(this._CupTiltStatusChanged); //倾斜

            CupKeyEventHookStaticManager.addPowerKeyPressCallBack(this._PowerClick);
            if (!this.Registered)
            {
                CupKeyEventHookStaticManager.addPowerKeyLongPressCallBack(this._PowerHold);
            }

            TouchLeftStaticManager.start();
            TouchLeftStaticManager.addTapListener(this._CupTapLeft);
            TouchLeftStaticManager.addDoubleTapListener(this._CupDoubleTapLeft);
            TouchLeftStaticManager.addSwipeUpwardListener(this._CupLeftSwipeUp);
            TouchLeftStaticManager.addSwipeDownwardListener(this._CupLeftSwipeDown);
            TouchLeftStaticManager.addSwipeUpAndDownListener(this._CupLeftSwipeUpDown);

            TouchRightStaticManager.start();
            TouchRightStaticManager.addTapListener(this._CupTapRight);
            TouchRightStaticManager.addDoubleTapListener(this._CupDoubleTapRight);
            TouchRightStaticManager.addSwipeUpwardListener(this._CupRightSwipeUp);
            TouchRightStaticManager.addSwipeDownwardListener(this._CupRightSwipeDown);
            TouchRightStaticManager.addSwipeUpAndDownListener(this._CupRightSwipeUpDown);
#else
            dispatcher.UpdateListener(true, MainKeys.PowerClick, this._PowerClick);
            if (!this.Registered)
            {
                dispatcher.UpdateListener(true, MainKeys.PowerHold, this._PowerHold);
            }
            dispatcher.UpdateListener(true, MainKeys.CupShake, this._CupShake);
            dispatcher.UpdateListener(true, MainKeys.CupTiltLeft, this._CupTiltLeft);
            dispatcher.UpdateListener(true, MainKeys.CupTiltRight, this._CupTiltRight);
            dispatcher.UpdateListener(true, MainKeys.CupKeepFlat, this._CupKeepFlat);
            dispatcher.UpdateListener(true, MainKeys.CupTapLeft, this._CupTapLeft);
            dispatcher.UpdateListener(true, MainKeys.CupTapRight, this._CupTapRight);
            dispatcher.UpdateListener(true, MainKeys.CupDoubleTapLeft, this._CupDoubleTapLeft);
            dispatcher.UpdateListener(true, MainKeys.CupDoubleTapRight, this._CupDoubleTapRight);
            dispatcher.UpdateListener(true, MainKeys.CupLeftSwipeUp, this._CupLeftSwipeUp);
            dispatcher.UpdateListener(true, MainKeys.CupLeftSwipeDown, this._CupLeftSwipeDown);
            dispatcher.UpdateListener(true, MainKeys.CupLeftSwipeUpDown, this._CupLeftSwipeUpDown);
            dispatcher.UpdateListener(true, MainKeys.CupRightSwipeUp, this._CupRightSwipeUp);
            dispatcher.UpdateListener(true, MainKeys.CupRightSwipeDown, this._CupRightSwipeDown);
            dispatcher.UpdateListener(true, MainKeys.CupRightSwipeUpDown, this._CupRightSwipeUpDown);
#endif
            this.InputRegistered = true;
        }
예제 #4
0
        /// <summary>
        /// 取消注册输入
        /// </summary>
        protected virtual void UnregisterInput()
        {
#if !UNITY_EDITOR && UNITY_ANDROID
            CupMotionManager.removeShakeListener(this._CupShake);                             //摇晃
            CupMotionManager.removePoseChangeListener(this._CupPoseChanged);                  //姿势
            CupMotionManager.removeTiltStatusChangeEventListener(this._CupTiltStatusChanged); //倾斜

            CupKeyEventHookStaticManager.removePowerKeyPressCallBack(this._PowerClick);
            if (this.View != TopViewHelper.ETopView.eMainView)
            {
                CupKeyEventHookStaticManager.removePowerKeyLongPressCallBack(this._PowerHold);
            }

            TouchLeftStaticManager.removeTapListener(this._CupTapLeft);
            TouchLeftStaticManager.removeDoubleTapListener(this._CupDoubleTapLeft);
            TouchLeftStaticManager.removeSwipeUpwardListener(this._CupLeftSwipeUp);
            TouchLeftStaticManager.removeSwipeDownwardListener(this._CupLeftSwipeDown);
            TouchLeftStaticManager.removeSwipeUpAndDownListener(this._CupLeftSwipeUpDown);

            TouchRightStaticManager.removeTapListener(this._CupTapRight);
            TouchRightStaticManager.removeDoubleTapListener(this._CupDoubleTapRight);
            TouchRightStaticManager.removeSwipeUpwardListener(this._CupRightSwipeUp);
            TouchRightStaticManager.removeSwipeDownwardListener(this._CupRightSwipeDown);
            TouchRightStaticManager.removeSwipeUpAndDownListener(this._CupRightSwipeUpDown);
#else
            dispatcher.UpdateListener(false, MainKeys.PowerClick, this._PowerClick);
            if (this.View != TopViewHelper.ETopView.eMainView)
            {
                dispatcher.UpdateListener(false, MainKeys.PowerHold, this._PowerHold);
            }
            dispatcher.UpdateListener(false, MainKeys.CupShake, this._CupShake);
            dispatcher.UpdateListener(false, MainKeys.CupTiltLeft, this._CupTiltLeft);
            dispatcher.UpdateListener(false, MainKeys.CupTiltRight, this._CupTiltRight);
            dispatcher.UpdateListener(false, MainKeys.CupKeepFlat, this._CupKeepFlat);
            dispatcher.UpdateListener(false, MainKeys.CupTapLeft, this._CupTapLeft);
            dispatcher.UpdateListener(false, MainKeys.CupTapRight, this._CupTapRight);
            dispatcher.UpdateListener(false, MainKeys.CupDoubleTapLeft, this._CupDoubleTapLeft);
            dispatcher.UpdateListener(false, MainKeys.CupDoubleTapRight, this._CupDoubleTapRight);
            dispatcher.UpdateListener(false, MainKeys.CupLeftSwipeUp, this._CupLeftSwipeUp);
            dispatcher.UpdateListener(false, MainKeys.CupLeftSwipeDown, this._CupLeftSwipeDown);
            dispatcher.UpdateListener(false, MainKeys.CupLeftSwipeUpDown, this._CupLeftSwipeUpDown);
            dispatcher.UpdateListener(false, MainKeys.CupRightSwipeUp, this._CupRightSwipeUp);
            dispatcher.UpdateListener(false, MainKeys.CupRightSwipeDown, this._CupRightSwipeDown);
            dispatcher.UpdateListener(false, MainKeys.CupRightSwipeUpDown, this._CupRightSwipeUpDown);
#endif
            this.InputRegistered = false;
        }
예제 #5
0
        private void ShowLowBattery(BatteryStatus lowBattery)
        {
            myStatus = lowBattery;

            if (myStatus == BatteryStatus.LowBattery_10)
            {
                FlurryUtil.LogEvent("Petscreen_LowBattery_10_Ani_View");
            }
            else
            {
                FlurryUtil.LogEvent("Petscreen_LowBattery_20_Ani_View");
            }
            if (this.PlayerDataManager.LanguageInitialized())//设置过语言后才能播放此声音
            {
                SoundPlayer.GetInstance().PlaySoundType("system_charging_low_battery_in");
            }

            if (TopViewHelper.Instance.IsInGuideView())
            {
                ShowSmallBatteryIcon();
            }
            else
            {
                lowBatteryGp.AnimationState.ClearTracks();
                smallBattery.SetActive(false);
                backBtn.SetActive(true);
                backImg.gameObject.SetActive(true);
                backImg.DOFade(0.8f, 0.5f);
                lowBatteryGp.gameObject.SetActive(true);
                lowBatteryGp.AnimationState.SetAnimation(1, "enter_" + GetPostfixOfAnimation(), false);
                lowBatteryGp.AnimationState.Complete += delegate(TrackEntry trackEntry)
                {
                    if (trackEntry.trackIndex == 1)
                    {
                        lowBatteryGp.AnimationState.ClearTracks();
                        lowBatteryGp.AnimationState.SetAnimation(3, "idle_" + GetPostfixOfAnimation(), true);
#if (UNITY_ANDROID) && (!UNITY_EDITOR)
                        CupKeyEventHookStaticManager.addPowerKeyPressCallBack(PowerKeyPressUp);
#endif
                    }
                };
                TopViewHelper.Instance.AddTopView(TopViewHelper.ETopView.eLowBattary);
            }
        }
예제 #6
0
        private void ShowSmallBatteryIcon()
        {
#if (UNITY_ANDROID) && (!UNITY_EDITOR)
            CupKeyEventHookStaticManager.removePowerKeyPressCallBack(PowerKeyPressUp);
#endif
            backImg.DOFade(0, 3.33f);
            if (this.PlayerDataManager.LanguageInitialized())//设置过语言后才能播放此声音
            {
                SoundPlayer.GetInstance().PlaySoundType("system_charging_low_battery_out");
            }
            lowBatteryGp.AnimationState.ClearTracks();
            lowBatteryGp.AnimationState.SetAnimation(5, "shrink_" + GetPostfixOfAnimation(), false);
            lowBatteryGp.AnimationState.Complete += delegate(TrackEntry trackEntry)
            {
                if (trackEntry.trackIndex == 5)
                {
                    smallBattery.SetActive(true);
                    HideBackBtn();
                    backImg.gameObject.SetActive(false);
                    lowBatteryGp.AnimationState.ClearTracks();
                    lowBatteryGp.gameObject.SetActive(false);
                }
            };
        }
        private void OnDisable()
        {
#if (UNITY_ANDROID) && (!UNITY_EDITOR)
            CupKeyEventHookStaticManager.removePowerKeyPressCallBack(powerKeyPressUp);
#endif
        }
예제 #8
0
        private void OnEnable()
        {
#if (UNITY_ANDROID) && (!UNITY_EDITOR)
            CupKeyEventHookStaticManager.addPowerKeyPressCallBack(PowerKeyPressUp);
#endif
        }