Beispiel #1
0
 /// <summary>
 /// 水杯右侧上下来回滑动
 /// </summary>
 private void _CupRightSwipeUpDown()
 {
     if (!IsLockedKey(MainKeys.CupRightSwipeUpDown))
     {
         FlurryUtil.LogEvent(this.View, MainKeys.CupRightSwipeUpDown); this.CupRightSwipeUpDown();
     }
 }
Beispiel #2
0
        //加载场景
        private IEnumerator LoadScene()
        {
            int            loadSceneProgress = 0;
            AsyncOperation op = SceneManager.LoadSceneAsync(this.sceneName);

            op.allowSceneActivation = false;
            while (op.progress < 0.9f)
            {
                loadSceneProgress = (int)(op.progress * 100);
                Debug.LogFormat("<><MainSceneLoader.LoadScene>loading......[{0}]", op.progress.ToString());
                while (displayProgress < loadSceneProgress)
                {
                    ++displayProgress;
                    imageProgress.fillAmount = displayProgress / (float)100;
                    yield return(new WaitForEndOfFrame());
                }
            }

            loadSceneProgress = 100;
            while (this.displayProgress < loadSceneProgress)
            {
                GuLog.Debug("<><MainSceneLoader.LoadScene>In loading!");
                this.displayProgress    += 3;
                imageProgress.fillAmount = this.displayProgress / (float)100;
                yield return(new WaitForEndOfFrame());
            }
            FlurryUtil.LogEvent("Hank_Openani_View");
            GuLog.Debug("<><Preload>LoadOk!");
            this.objProgress.SetActive(false);
            this.videoPlayer.Play();
            this.bMovieEnd = false;
            yield return(new WaitUntil(() => bMovieEnd));

            op.allowSceneActivation = true;
        }
Beispiel #3
0
 /// <summary>
 /// 水杯左侧上划
 /// </summary>
 private void _CupLeftSwipeUp()
 {
     if (!IsLockedKey(MainKeys.CupLeftSwipeUp))
     {
         FlurryUtil.LogEvent(this.View, MainKeys.CupLeftSwipeUp); this.CupLeftSwipeUp();
     }
 }
        private void OnP2PSuccess(P2PInfo info)
        {
            FlurryUtil.LogEvent("Friending_Search_Success_Event");

            viewMainScene.MakeFriend(info.pet_type, (info.role == "1"));
            GuLog.Debug("<><MainSceneMediator><MakeFriend>_P2PSuccess!");
        }
        //轮询所有已购买的配饰
        private void GetPaidItems()
        {
            if (this.qrCodeView.IsOpen)
            {
                return;
            }
#if !UNITY_EDITOR && UNITY_ANDROID
            this.PetAccessoryUtils.GetPaidItems((getPaidItemsResponse) =>
            {
                if (getPaidItemsResponse != null)
                {
                    this.accessories.SetPaid(getPaidItemsResponse.acc_list.ToList(), (accessory) =>
                    {
                        if (accessory != null)
                        {
                            Debug.LogFormat("<><PetDressView.GetPaidItems>Got a new accessory: {0}_{1}", accessory.ID, accessory.Name);
                            this.PlayerDataManager.exp += accessory.Exp;
                            this.UIState.PushNewState(UIStateEnum.eExpIncrease, this.PlayerDataManager.GetExpPercent());
                            this.UpdateExpAndCoinSignal.Dispatch();
                            FlurryUtil.LogEventWithParam("mall_scene_purchase_rmb", "accessory_name", accessory.Name);
                        }
                    });
                }
            },
                                                (errorText) =>
            {
                Debug.LogErrorFormat("<><PetDressView.GetPaidItems>Error: {0}", errorText);
            });
#endif
        }
        public void powerKeyPressUp()
        {
            if (TopViewHelper.Instance.HasModulePageOpened())
            {
                return;
            }

            switch (crownIndex)
            {
            case 0:
            {
                FlurryUtil.LogEvent("Dailygoal_30_Exp_Collect_Click");
            }
            break;

            case 1:
            {
                FlurryUtil.LogEvent("Dailygoal_60_Exp_Collect_Click");
            }
            break;

            case 2:
            {
                FlurryUtil.LogEvent("Dailygoal_100_Exp_Collect_Click");
            }
            break;
            }

            uIStateCompleteSignal.Dispatch(GetStateEnum());
            if (dailyGoalBlur.activeInHierarchy && isIdle)
            {
                ExpDisappearAni();
            }
        }
        private bool MissionPercentProcess()
        {
            if (dataManager.missionPercent >= 1)
            {
                int expIncrease  = GetMissionCompleteExp();
                int coinIncrease = GetMissionCompleteCoin();
                this.FundDataManager.AddCoin(this.FundDataManager.GetCoinId(), coinIncrease);
                uiState.PushNewState(UIStateEnum.eRolePlayAction, "level_end");
                FlurryUtil.LogEvent("Mission_Finish_Petani_View");

                uiState.PushNewState(UIStateEnum.eMissionComplete, dataManager.missionId, expIncrease, true, coinIncrease);

                dataManager.exp += expIncrease;
                uiState.PushNewState(UIStateEnum.eExpIncrease, GetExpPercent());

                RefreshLevelAfterExpChange();

                missionDataManager.AddMissionState(dataManager.missionId, MissionState.eComplete);
                if (dataManager.IsMissionLimit())
                {
                    uiState.PushNewState(UIStateEnum.eMissionUpperLimitNotify);
                }
                else
                {
                    bool missionRetry = false;
                    dataManager.missionPercent = 0;
                    int sceneIndex    = missionConfig.GetSceneIndexByMissionID(dataManager.missionId);
                    int nextMissionId = missionConfig.GetNextMissionId(dataManager.missionId, true);
                    if (nextMissionId == -1)
                    {//如果已经到达此星球的最后一个关卡,则检查此星球是否为副本星球
                        WorldInfo worldInfo = this.missionConfig.GetWorldByStarID(this.dataManager.StarID);
                        if (worldInfo != null && worldInfo.Type == WorldInfo.WorldTypes.Duplicate)
                        {//副本星球的关卡是可以循环玩的,所以到达最后一个关卡后,再返回第一个关卡
                            missionRetry  = true;
                            nextMissionId = this.missionConfig.GetFirstMissionOfScene(this.dataManager.StarID, sceneIndex);
                            if (nextMissionId != -1)
                            {
                                this.missionDataManager.ClearAllMissionOfScene(this.dataManager.StarID, sceneIndex);//清除此星球当前地图的所有关卡记录
                            }
                        }
                    }

                    if (nextMissionId != -1)
                    {
                        FlurryUtil.LogEventWithParam("Mission_Finish_Event", "MissionID", dataManager.missionId.ToString());
                        missionDataManager.AddMissionState(nextMissionId, MissionState.eUnderway);
                        dataManager.missionId = nextMissionId;//这里要先把nextMissionId的eUnderWay状态记录下来,再改变dataManager的missionId,否则(eLock状态)写不进去
                        uiState.PushNewState(UIStateEnum.eNewMissionSwitch, dataManager.missionId);
                        uiState.PushNewState(UIStateEnum.eRolePlayAction, "level_start", 0, false);
                        if (missionRetry)
                        {
                            uiState.PushNewState(UIStateEnum.eMissionRetry, nextMissionId);
                        }
                    }
                }
                dataManager.TrySendPlayerData2Server();
                return(true);
            }
            return(false);
        }
        private void OnP2PFail()
        {
            FlurryUtil.LogEvent("Friending_Search_Failed_Event");

            viewMainScene.MakeFriendFail();
            GuLog.Debug("<><MainSceneMediator><MakeFriend>_P2PFail!");
        }
Beispiel #9
0
 /// <summary>
 /// 水杯右侧拍两下
 /// </summary>
 private void _CupDoubleTapRight()
 {
     if (!IsLockedKey(MainKeys.CupDoubleTapRight))
     {
         FlurryUtil.LogEvent(this.View, MainKeys.CupDoubleTapRight); this.CupDoubleTapRight();
     }
 }
Beispiel #10
0
 /// <summary>
 /// 水杯左侧拍一下
 /// </summary>
 private void _CupTapLeft()
 {
     if (!IsLockedKey(MainKeys.CupTapLeft))
     {
         FlurryUtil.LogEvent(this.View, MainKeys.CupTapLeft); this.CupTapLeft();
     }
 }
Beispiel #11
0
 /// <summary>
 /// 水杯摇晃
 /// </summary>
 private void _CupShake()
 {
     if (!IsLockedKey(MainKeys.CupShake))
     {
         FlurryUtil.LogEvent(this.View, MainKeys.CupShake); this.CupShake();
     }
 }
Beispiel #12
0
 /// <summary>
 /// 电源键长按
 /// </summary>
 private void _PowerHold()
 {
     if (!IsLockedKey(MainKeys.PowerHold))
     {
         FlurryUtil.LogEvent(this.View, MainKeys.PowerHold); this.PowerHold();
     }
 }
Beispiel #13
0
        //顺序5
        private void WaterRiseAnimation()
        {
            FlurryUtil.LogEvent("Drink_Exp_Collect_ani_View");

            if (this.IsNormalStatus())
            {
                SoundPlayer.GetInstance().PlaySoundType("water_raise");
                if (drinkCoin > 0)
                {
                    SoundPlayer.GetInstance().PlaySoundType("gain_coin");
                }
            }

            expBall.SetActive(true);
            Scale(expBall.gameObject);

            if (missionProcess > 0.84)
            {
                expBall.GetComponent <Image>().DOFade(1, 0.01f);
            }
            award.gameObject.SetActive(true);
            int textLength = Mathf.Max(drinkExp.ToString().Length, drinkCoin.ToString().Length);

            expWord.text  = "+" + drinkExp.ToString().PadLeft(textLength, ' ');
            coinWord.text = "+" + drinkCoin.ToString().PadLeft(textLength, ' ');
            Sequence sDropSeq = DOTween.Sequence();

            sDropSeq.Append(expBall.transform.DOLocalMove(this.waterLevel.localPosition + new Vector3(-300, 240, 0), 1.5f).SetEase(Ease.OutQuad))
            .Append(expBall.GetComponent <Image>().DOFade(0, 0.5f))
            .Append(expBall.transform.DOLocalMove(this.waterLevel.localPosition, 0.01f));

            sDropSeq.onComplete = delegate()
            {
                expShiny.Play("ExpShiny");
            };

            award.DOFade(0.5f, 0.8f).SetLoops(3);
            float dest_pos_y = exp_pos_y + 70;

            if (missionProcess < 0.7)
            {
                dest_pos_y = this.waterLevel.localPosition.y + 20;
            }

            award.transform.DOLocalMoveY(dest_pos_y, 2.4f).onComplete = delegate()
            {
                award.DOFade(0, 1.0f).onComplete = delegate()
                {
                    award.transform.DOMoveY(exp_pos_y, 0.5f);
                };
                drinkExp = 0;
                SetFinishAndOpenScreenSave(true);
                uIStateCompleteSignal.Dispatch(GetStateEnum());
            };

            sliderWave.DOValue(missionProcess, 1.0f).onComplete = delegate()
            {
            };
        }
Beispiel #14
0
        /************************************************Unity方法与事件***********************************************/

        /************************************************自 定 义 方 法************************************************/
        public override void OnRegister()
        {
            this.View = TopViewHelper.ETopView.eMainMenu;
            base.OnRegister();
            this.MainMenuView.Open();
            this.MainMenuView.ShowGuide();
            FlurryUtil.LogTimeEvent("navmenu_view");
        }
Beispiel #15
0
 //右拍
 public void TapRight()
 {
     if (IsNormalStatus())
     {
         rolePlayer.Play("right_tap");
         FlurryUtil.LogEvent("Petscreen_right_tap_event");
     }
 }
Beispiel #16
0
 //右侧上下划
 public void RightSwipeUpAndDown()
 {
     GuLog.Debug("<><MainSceneView>onRightSwipeUpAndDown");
     if (IsNormalStatus())
     {
         this.rolePlayer.Play("right_updown");
         FlurryUtil.LogEvent("Petscreen_right_updown_event");
     }
 }
        public void ScreenOn()
        {
            FlurryUtil.LogEvent("Screen_On_daily_count");

            if (myCoroutine != null)
            {
                StopCoroutine(myCoroutine);
                myCoroutine = null;
            }
            StartCheckDayChangeCoroutine();
            CheckNewDay();
        }
Beispiel #18
0
 /// <summary>
 /// 控制器取消注册(出口)
 /// </summary>
 public override void OnRemove()
 {
     base.OnRemove();
     this.UnregisterInput();
     if (this.registerView)
     {
         TopViewHelper.Instance.RemoveView(this.View);
     }
     TopViewHelper.Instance.RemoveListener(this.OnTopViewChanged);
     FlurryUtil.EndTimedEvent(this.View);
     this.dispatcher.UpdateListener(false, MainEvent.CloseView, this.OnReceiveCloseMessage);
     this.Registered = false;
 }
Beispiel #19
0
 /// <summary>
 /// 控制器注册(入口)
 /// </summary>
 public override void OnRegister()
 {
     base.OnRegister();
     this.RegisterInput();
     TopViewHelper.Instance.AddListener(this.OnTopViewChanged);
     if (registerView)
     {
         TopViewHelper.Instance.AddTopView(this.View);
     }
     FlurryUtil.LogTimeEvent(this.View);
     this.dispatcher.UpdateListener(true, MainEvent.CloseView, this.OnReceiveCloseMessage);
     this.Registered = true;
 }
Beispiel #20
0
        public override void Stop()
        {
            base.Stop();
            FlurryUtil.LogEvent("Nim_Chest_open_event");
            if (!TopViewHelper.Instance.HasModulePageOpened() || TopViewHelper.Instance.IsInGuideView())
            {
                SoundPlayer.GetInstance().PlaySoundType("nim_chest_get_nim");
            }

            this.missionBackground.PlayNimAnimation(treasureBoxIndex, missionId);
            bFinish = true;
            gameObject.SetActive(false);
        }
Beispiel #21
0
        //下划
        public void SwipeDown()
        {
            //GuLog.Debug("<><MainSceneView>onRightSwipeDown");
            //if (IsNormalStatus())
            //{
            //    rolePlayer.Play("right_down");
            //    FlurryUtil.LogEvent("Petscreen_right_swipedown_event");
            //}

            GuLog.Debug("<><MainSceneView>onRightSwipeDown");
            FlurryUtil.LogEvent("Petscreen_right_swipedown_event");
            this.Navigator.TurnRight();
        }
Beispiel #22
0
        public override void ProcessState(UIState state)
        {
            Debug.Log("<><SchoolMode><>----enter school mode");
            FlurryUtil.LogEvent("Petscreen_Schoolmode_enter_ani_View");
            bFinish = false;
            gameObject.SetActive(true);

            processBar.setAwardAndHandle(dataManager.percentOfDailyGoal);

            dataManager.SetVolumeZero();

            endTime = DateTime.Now.AddSeconds((float)state.value0);
            Debug.Log("<><SchoolMode><>EndTime: " + endTime.ToShortTimeString());
            this.SchoolModeTimeInSignal.Dispatch();
        }
 //当二维码页面关闭时
 private void OnQRCodeiewClosed(ViewResult viewResult)
 {
     if (viewResult == ViewResult.OK)
     {
         this.accessories.CurrentButton.Paid = true;
         this.AccessoryDataManager.AddItem(this.accessories.CurrentButton.Accessory.ID);//配饰添加到包裹
         SoundPlayer.GetInstance().StopAllSoundExceptMusic();
         SoundPlayer.GetInstance().PlaySoundInChannal("mall_purchase_qr_complete", this.audioPlayer, 0.2f);
         this.PutOn(this.accessories.CurrentButton.Accessory);
         ExpUI.Instance.Show(this.accessories.CurrentButton.Accessory.Exp, 0, -25, 25, GameObject.FindGameObjectWithTag("ExpUILayer").transform);
         this.PlayerDataManager.exp += this.accessories.CurrentButton.Accessory.Exp;
         this.UIState.PushNewState(UIStateEnum.eExpIncrease, this.PlayerDataManager.GetExpPercent());
         this.UpdateExpAndCoinSignal.Dispatch();
         FlurryUtil.LogEventWithParam("mall_scene_purchase_rmb", "accessory_name", this.accessories.CurrentButton.Accessory.Name);
     }
 }
        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);
            }
        }
Beispiel #25
0
        IEnumerator DelayOneFrameForEnd()
        {
            bFinish = true;
            FlurryUtil.LogEvent("Petscreen_Schoolmode_exit_ani_View");
            //Debug.Log("<><SchoolMode><>----exit school mode0");

            yield return(null);

            myCoroutine = null;
            gameObject.SetActive(false);
            Debug.Log("<><SchoolMode><>----exit school mode");

            dataManager.RecoverVolume();
            processFreshNewsSignal.Dispatch();

            if (!this.uiState.IsExistState(UIStateEnum.eRefreshMainByData))
            {
                this.uiState.PushNewState(UIStateEnum.eRefreshMainByData);
            }
        }
        public void PowerKeyPressUp()
        {
            if (TopViewHelper.Instance.HasModulePageOpened())
            {
                return;
            }

            FlurryUtil.LogEvent("Mission_Finish_Collectionpage_Click");
            if (is_loop)
            {
                this.missionComplete.AnimationState.ClearTracks();
                this.missionComplete.gameObject.SetActive(false);
                if (this.worldTypes == WorldInfo.WorldTypes.Normal)
                {
                    this.uiNormalMission.SetStatus(true);
                    this.uiNormalMission.RectTransform.DOLocalMoveY(0f, 0.5f).onComplete = delegate()
                    {
                        this.is_loop  = false;
                        this.can_hide = true;
                    };
                }
                else if (this.worldTypes == WorldInfo.WorldTypes.Duplicate)
                {
                    this.uiDuplicateMission.SetStatus(true);
                    this.uiDuplicateMission.RectTransform.DOLocalMoveY(0f, 0.5f).onComplete = delegate()
                    {
                        this.is_loop  = false;
                        this.can_hide = true;
                    };
                }
                SoundPlayer.GetInstance().PlaySoundType("mission_complete_board_fly_in");
            }
            if (this.can_hide)
            {
                this.can_hide = false;
                this.bFinish  = true;
                this.gameObject.SetActive(false);
                this.uiNormalMission.SetStatus(false);
                this.uiDuplicateMission.SetStatus(false);
            }
        }
        private void OnDrinkWater(int intake, long drinkDuration)
        {
            if (TopViewHelper.Instance.IsInGuideView() || TopViewHelper.Instance.IsOpenedView(TopViewHelper.ETopView.eLanguageSetting))
            {
                GuLog.Debug("<><MainSceneView>eNoviceGuide is top!");
                return;
            }

            if (DrinkUtils.isValidDrink(intake, drinkDuration))
            {
                GuLog.Debug("<><MainSceneMediator>DrinkWaterCallback intake:<><>" + intake + "   drinkDuration:" + drinkDuration);
                FlurryUtil.LogEvent("Drink_Daily_count");

                dataProcess.DrinkWater(intake);
                dataManager.TodayDrinkTimes += 1;
            }
            else
            {
                dataProcess.DrinkFail();
            }
            closeSystemMenuSignal.Dispatch();
        }
        //当配饰变化时
        private void OnAccessoryChanged(Accessory currentAccessory, Accessory lastAccessory)
        {
            RoleManager.Instance.ResetAccessoriesAndMates();
            RoleManager.Instance.CurrentRole.HideParticleEffect();
            RoleManager.Instance.Mates.ForEach(t => t.HideParticleEffect());
            //不管当前是什么配饰,都需要先脱掉与其相同类型或部位的配饰
            List <Accessory> accessories = this.LocalPetAccessoryAgent.GetAccessoriesByType(this.PlayerDataManager.CurrentPet, currentAccessory.Type);

            if (accessories != null && accessories.Count > 0)
            {
                foreach (var accessory in accessories.ToArray())
                {
                    this.TakeOff(accessory, false);
                }
            }

            if (currentAccessory.Suitable(this.PlayerDataManager.CurrentPet))
            {
                this.PutOn(currentAccessory, false);
            }
            FlurryUtil.LogEvent("mall_scene_switch_item_event");
        }
        private void saveData(RegisterResponseData info)
        {
            if (!string.IsNullOrEmpty(info.x_child_sn))
            {
                //Debug.LogFormat("--------SaveSN--------RegisterCupService.saveData: {0}", info.x_child_sn);
                mLocalChildInfoAgent.saveChildSN(info.x_child_sn);
                FlurryUtil.LogEvent("Pair_Get_Childsn_Sunccess_Event");
            }
            else
            {
                FlurryUtil.LogEvent("Pair_Get_Childsn_Fail_Event");
                GuLog.Warning("pair data childsn is null");
            }

            //删除本地数据
            this.LocalPetInfoAgent.Clear();
            GuLog.Debug("<><RegisterCupService>Clear currentPet");
            this.LocalUnlockedPetsAgent.Clear();
            GuLog.Debug("<><RegisterCupService>Clear unlockedPets");

            //保存网络数据
            //mLocalCupAgent.saveCupToken(CupBuild.getCupSn(), info.token);
            mNativeDataManager.saveToken(info.token);
            mLocalCupAgent.saveCupID(CupBuild.getCupSn(), info.x_cup_sn);
            LocalPetInfoAgent.saveCurrentPet(info.pet_model);
            //重新保存语言数据
            this.PlayerDataManager.SaveLanguage(this.PlayerDataManager.Language);

            if (info.timestamp > 0)
            {
                mTimeManager.setServerTime(info.timestamp * (1000L));
            }

            if (!string.IsNullOrEmpty(info.timezone))
            {
                mTimeManager.setTimeZone(info.timezone);
            }
        }
        void AddIntake(int intake)
        {
            if (TreasureBoxProcess())
            {
                bTrigger = true;
            }

            if (DailyGoalPercentProcess(intake))
            {
                bTrigger = true;
            }

            if (MissionPercentProcess())
            {
                bTrigger = true;
            }

            if (!bTrigger)
            {
                uiState.PushNewState(UIStateEnum.eRolePlayAction, "DrinkSuccess", 0, false);
                FlurryUtil.LogEvent("Drink_PET_ani_view");
            }
        }