Beispiel #1
0
 private void OnEnterGameClick()
 {
     //MainRoot.Goto(MainRoot.UIStateName.Menu);
     MainRoot.Goto(MainRoot.UIStateName.Game);
     MainController.Instance.Execute(new Communication.UpperPart.StartChallenge
     {
         RoundTimeout = 999,
     });
 }
Beispiel #2
0
 void OnExitClick()
 {
     if (_hasChanged)
     {
         SystemSettings.SaveSettingsToHD();
     }
     OnConfirmClick();
     MainRoot.Goto(MainRoot.UIStateName.Entrance);
 }
Beispiel #3
0
        public void OnRealTimeFightingClick()
        {
            CommonData.RivalUser     = null;
            GameData.LastChallengeID = null;
            Requester.Instance.Send(new NewMatch());//发送消息
            MainRoot.Goto(MainRoot.UIStateName.Match);
            MatchUI.Instance.RefreshBeforeMatch();

            UMengPlugin.UMengEvent(EventId.HOME_MULTI, null);
        }
Beispiel #4
0
        IEnumerator GotoEndRoundUICoroutine(EndRound cmd)
        {
            yield return(new WaitForSeconds(2));

            MainRoot.Goto(MainRoot.UIStateName.EndRound);
            while (!EndRoundUI.Instance)
            {
                yield return(new WaitForEndOfFrame());
            }
            EndRoundUI.Instance.PlayEndRoundProcess(cmd);
        }
Beispiel #5
0
        IEnumerator GotoPlayingRealTimeCoroutine(float delay)
        {
            yield return(new WaitForSeconds(delay));

            MainRoot.Goto(MainRoot.UIStateName.Game);
            while (!GameManager.Instance)
            {
                yield return(new WaitForEndOfFrame());
            }
            GameManager.Instance.ResetAndRefreshBeforeRealTimeFighting();
            CandyBAPool.Instance.PrepareAllCandys();
        }
Beispiel #6
0
        public void OnConfirmClick()
        {
            if (_gotoNext)
            {
                Debug.LogError("出错了");
                return;

                MusicManager.Instance.CrossFadeIn();
                MainRoot.Goto(MainRoot.UIStateName.PushLevel);
            }
            else
            {
                _gotoNext = true;
            }
        }
Beispiel #7
0
        IEnumerator _ReturnToPushLevelUI()
        {
            MainRoot.Goto(MainRoot.UIStateName.PushLevel);
            while (!PushLevelUI.Instance)
            {
                yield return(new WaitForEndOfFrame());
            }
            var majorLevelUnlockInfo =
                CommonData.ChallengeUnlockInfoList.Find(x => x.MajorLevelId == GameData.LastChallengeMajorLevelID);

            if (majorLevelUnlockInfo != null)
            {
                PushLevelUI.Instance.EnterMajorLevel(majorLevelUnlockInfo);
            }
        }
Beispiel #8
0
        public void Execute(StartChallenge cmd)
        {
            GameData.FriendDataList  = cmd.FriendDataList;
            GameData.LastChallengeID = cmd.ChallengeId;

            MainRoot.Goto(MainRoot.UIStateName.Game);

            if (CommonData.MyUser != null)
            {
                CommonData.MyUserOld = CommonData.MyUser.GetDuplicate(); //备份旧的MyUser
            }
            StartCoroutine(GotoPlayingChallengeCoroutine(2));            //最好有倒计时

            MusicManager.Instance.CrossFadeOut();                        //音乐渐出

            CandyBAPool.Instance.PrepareAllCandys();                     //预加载所有糖果
        }
Beispiel #9
0
        IEnumerator GotoPlayingChallengeCoroutine(float delay)
        {
            var curT = Time.time;

            while (!GameManager.Instance)
            {
                yield return(new WaitForEndOfFrame());
            }
            GameManager.Instance.ResetAndRefreshBeforeChallengeFighting(2);
            while (Time.time - curT < delay)
            {
                yield return(new WaitForEndOfFrame());
            }

            State = new State.PlayingChallenge();     //切状态

            MainRoot.Goto(MainRoot.UIStateName.Game); //确保进入了GameUI,一般无用

            GameManager.Instance.StartChallengeRound();
        }
Beispiel #10
0
        public void Execute(RequestChallengeOk cmd)
        {
            GameData.LastChallengeMajorLevelID = cmd.MajorLevelId;
            GameData.LastChallengeSubLevelID   = cmd.SubLevelId;

            //为之后准备好SubLevelData
            var hasCorrectsubLevelData = false;
            var challengeLevelConfig   =
                ConfigManager.GetConfig(ConfigManager.ConfigType.ChallengeLevelConfig) as ChallengeLevelConfig;

            if (challengeLevelConfig != null)
            {
                var majorLevelData =
                    challengeLevelConfig.MajorLevelList.Find(x => x.MajorLevelId == GameData.LastChallengeMajorLevelID);
                if (majorLevelData != null)
                {
                    GameData.LastMajorLevelData = majorLevelData;
                    GameData.LastSubLevelData   =
                        majorLevelData.SubLevelList.Find(x => x.SubLevelId == GameData.LastChallengeSubLevelID);
                    hasCorrectsubLevelData = true;
                }
            }
            if (!hasCorrectsubLevelData)
            {
                GameData.LastMajorLevelData = null;
                GameData.LastSubLevelData   = null;
            }

            GameData.LastChallengeID = cmd.ChallengeId;
            GameData.FellowDataList  = cmd.FellowDataList;
            GameData.RivalBossData   = cmd.BossData;

            MainRoot.Goto(MainRoot.UIStateName.Match);
            if (MatchUI.Instance)
            {
                MatchUI.Instance.RefreshBeforeChallenge();
            }
        }
Beispiel #11
0
        IEnumerator _GotoPushLevel()
        {
            MainRoot.Goto(MainRoot.UIStateName.PushLevel);
            while (!PushLevelUI.Instance)
            {
                yield return(new WaitForEndOfFrame());
            }
            var unlocks = CommonData.ChallengeUnlockInfoList.Where(x => x.Unlocked);
            MajorLevelUnlockInfo max = null;

            foreach (var majorLevelUnlockInfo in unlocks)
            {
                if (max == null || majorLevelUnlockInfo.MajorLevelId > max.MajorLevelId)
                {
                    max = majorLevelUnlockInfo;
                }
            }
            //PushLevelUI.Instance.EnterMajorLevel(max);
            if (max != null && max.MajorLevelId > 1)
            {
                PushLevelUI.Instance.Planet.GoToIndex(max.MajorLevelId - 1);
            }
        }
Beispiel #12
0
 void OnGUI()
 {
     EditorGUILayout.LabelField("Time", Time.time.ToString());
     EditorGUILayout.BeginHorizontal();
     {
         Time.timeScale = EditorGUILayout.Slider("TimeScale", Time.timeScale, 0, 16);
         if (GUILayout.Button("1"))
         {
             Time.timeScale = 1;
         }
     }
     EditorGUILayout.EndHorizontal();
     EditorGUILayout.BeginHorizontal();
     {
         if (GUILayout.Button("StartRealTimeRound"))
         {
             GameManager.Instance.StartRealTimeRound();
         }
         if (GUILayout.Button("UploadChallengeOk"))
         {
             GameData.LastChallengeMajorLevelID = 1;
             CommonData.MyUser.ExpCeil          = 1000;
             CommonData.MyUser.Exp      = 550;
             CommonData.MyUser.ExpFloor = 0;
             MainRoot.Goto(MainRoot.UIStateName.EndRound);
             Responder.Instance.Execute(TestData.UploadChallengeOk0);
             EndRoundUI.Instance.PlayEndRoundProcess(TestData.UploadChallengeOk0);
         }
     }
     EditorGUILayout.EndHorizontal();
     EditorGUILayout.BeginHorizontal();
     {
         if (GUILayout.Button("Add Hp Prob"))
         {
             GameData.LastSubLevelData.HealthBottleProbability = 1000;
             GameData.LastSubLevelData.HealthBottleCapacity    = 50;
         }
         if (GUILayout.Button("Energy Bottle"))
         {
             GameManager.Instance.MyGrid.AddItemToQueue(new CandyInfo(Candy.CandyType.Item, 203));
         }
         if (GUILayout.Button("MoneySack"))
         {
             GameManager.Instance.MyGrid.AddItemToQueue(new CandyInfo(Candy.CandyType.Item, 204));
         }
         if (GUILayout.Button("Stone"))
         {
             GameManager.Instance.MyGrid.AddItemToQueue(new CandyInfo(Candy.CandyType.Stone, -1));
         }
         if (GUILayout.Button("Chest"))
         {
             GameManager.Instance.MyGrid.AddItemToQueue(new CandyInfo(Candy.CandyType.Chest, -1));
         }
     }
     EditorGUILayout.EndHorizontal();
     EditorGUILayout.BeginHorizontal();
     {
         if (GUILayout.Button("AllHints(10s)"))
         {
             GameManager.Instance.PlaySkillEffect_AllHints(10);
         }
         if (GUILayout.Button("HideGenre(20s)"))
         {
             GameManager.Instance.PlaySkillEffect_HideGenre(20);
         }
         if (GUILayout.Button("Shake(0.05, 5)"))
         {
             UIShake.ShakeAUI(GameUI.Instance.gameObject, 0.05f, 5);
         }
     }
     EditorGUILayout.EndHorizontal();
 }
Beispiel #13
0
        IEnumerator GuideCoroutine()
        {
            transform.localPosition = new Vector3(0, 0, -500);
            gameObject.layer        = 8;
            var boxCollider = GetComponent <BoxCollider>();

            if (!boxCollider)
            {
                boxCollider = gameObject.AddComponent <BoxCollider>();
            }
            boxCollider.size      = new Vector3(2000, 2000, 0);
            boxCollider.center    = Vector3.zero;
            boxCollider.isTrigger = true;

            //选择昵称
            boxCollider.enabled = false;
            SelectNicknamePanel.Load();
            while (!SelectNicknamePanel.NicknameSelectOk)
            {
                yield return(new WaitForEndOfFrame());
            }

            UMengPlugin.UMengEvent(EventId.NICKNAME_FINISH,
                                   new Dictionary <string, object>
            {
                { "random_times", SelectNicknamePanel.RandomTimes }
            });

            MusicManager.Instance.CrossFadeOut();

            //加载GameUI
            MainRoot.Goto(MainRoot.UIStateName.Game);
            while (!GameManager.Instance)
            {
                yield return(new WaitForEndOfFrame());
            }
            SelectNicknamePanel.UnloadInterface();//此时才能销毁SelectNicknamePanel,不然会突变
            GameUI.Instance.gameObject.SetActive(false);

            #region 故事板

            _next = false;

            var mangaPrefab = MorlnResources.Load("UI/FreshmanGuide/Prefabs/Manga") as GameObject;
            var manga       = PrefabHelper.InstantiateAndReset(mangaPrefab, transform);
            manga.transform.SetSortingLayer("Foreground");
            manga.GetComponentInChildren <Animator>().enabled = true;
            Destroy(manga, 24f);
            yield return(new WaitForSeconds(22.5f));

            _next = true;
            //while (!_next) yield return new WaitForEndOfFrame();

            #endregion

            UMengPlugin.UMengEvent(EventId.GUIDE_PROGRESS,
                                   new Dictionary <string, object>
            {
                { "state", "故事板完" }
            });

            GameUI.Instance.gameObject.SetActive(true);

            #region  消教学

            _next = false;
            boxCollider.enabled = false;

            GameData.RivalBossData = new DefenseData("鸡妈妈", 1, 90005, 100, 100);

            GameManager.Instance.ClearDefenserSetAIAndCameraAndTimeScale();

            var grid = GameManager.Instance.MyGrid;

            grid.ResetCells(5, 5, null);
            GameData.InitVegetableTypeCount = 4;
            //填入预设的蔬菜
            const string text = @"0 1 0 3 4
4 3 2 1 0
0 2 4 2 1
3 1 0 4 3
0 1 4 3 2";
            grid.CreateCandysAsPreset(text);

            GameManager.Instance.ResetAndRefreshAndStartFreshmanGuideRound();

            #region 母子对话

            yield return(new WaitForSeconds(1.5f));

            var lines        = new[] { new Line(false, "慢着,老娘我先陪你练练", 2.5f), new Line(true, "妈,我怕伤着你", 1.1f), new Line(false, "少废话,接招", 2f) };
            var bubblePrefab = MorlnResources.Load <GameObject>("UI/FreshmanGuide/Prefabs/Bubble");
            var bubbleGo     = PrefabHelper.InstantiateAndReset(bubblePrefab, transform);
            var bubbleSpr    = bubbleGo.GetComponentInChildren <UISprite>();
            var talkLabel    = bubbleGo.GetComponentInChildren <UILabel>();
            foreach (var line in lines)
            {
                bubbleSpr.transform.localScale = new Vector3(line.Left ? -1 : 1, 1, 1);
                talkLabel.text = line.Text;
                yield return(new WaitForSeconds(line.Length));
            }
            Destroy(bubbleGo);

            #endregion

            UMengPlugin.UMengEvent(EventId.GUIDE_PROGRESS,
                                   new Dictionary <string, object>
            {
                { "state", "母子对话完" }
            });

            //开始遮罩教学
            var        prefab = MorlnResources.Load <GameObject>("UI/FreshmanGuide/Prefabs/GuideMask-Sanxiao");
            GameObject go     = null;
            if (prefab)
            {
                go = PrefabHelper.InstantiateAndReset(prefab, MainRoot.Instance.transform);
            }
            else
            {
                Debug.LogError("不能没有这个Prefab!");
            }

            while (!_next)
            {
                //监测是否完成操作,完成则_next = true;
                if (GameData.MyEnergy > 0)
                {
                    _next = true;
                }
                yield return(new WaitForEndOfFrame());
            }
            Destroy(go);
            #endregion

            UMengPlugin.UMengEvent(EventId.GUIDE_PROGRESS,
                                   new Dictionary <string, object>
            {
                { "state", "三消教学完" }
            });

            #region 蓄力值

            _next = false;
            boxCollider.enabled = true;

            prefab = MorlnResources.Load <GameObject>("UI/FreshmanGuide/Prefabs/GuideMask-Energy");
            go     = null;
            if (prefab)
            {
                go = PrefabHelper.InstantiateAndReset(prefab, MainRoot.Instance.transform);
            }
            else
            {
                Debug.LogError("不能没有这个Prefab!");
            }

            while (!_next)
            {
                yield return(new WaitForEndOfFrame());
            }
            Destroy(go);

            #endregion

            UMengPlugin.UMengEvent(EventId.GUIDE_PROGRESS,
                                   new Dictionary <string, object>
            {
                { "state", "教蓄力值完" }
            });

            #region 使用技能

            while (true)
            {
                if (GameData.MyEnergy >= GameData.MyEnergyCapacity)
                {
                    break;
                }
                yield return(new WaitForEndOfFrame());
            }

            _next = false;
            boxCollider.enabled = false;

            prefab = MorlnResources.Load <GameObject>("UI/FreshmanGuide/Prefabs/GuideMask-UseSkill");
            go     = null;
            if (prefab)
            {
                go = PrefabHelper.InstantiateAndReset(prefab, MainRoot.Instance.transform);
            }
            else
            {
                Debug.LogError("不能没有这个Prefab!");
            }

            while (!_next)
            {
                if (GameData.MyEnergy < 120)
                {
                    _next = true;                         //证明使用过技能了
                }
                yield return(new WaitForEndOfFrame());
            }
            Destroy(go);

            #endregion

            UMengPlugin.UMengEvent(EventId.GUIDE_PROGRESS,
                                   new Dictionary <string, object>
            {
                { "state", "使用技能完" }
            });

            #region  成了伤害
            while (true)
            {
                if (GameData.RivalHealthList[1] <= 0)
                {
                    break;
                }
                yield return(new WaitForEndOfFrame());
            }

            _next = false;

            yield return(new WaitForSeconds(2));

            boxCollider.enabled = true;

            prefab = MorlnResources.Load <GameObject>("UI/FreshmanGuide/Prefabs/GuideMask-Damage");
            go     = null;
            if (prefab)
            {
                go = PrefabHelper.InstantiateAndReset(prefab, MainRoot.Instance.transform);
            }
            else
            {
                Debug.LogError("不能没有这个Prefab!");
            }

            while (!_next)
            {
                yield return(new WaitForEndOfFrame());
            }
            Destroy(go);

            #endregion

            UMengPlugin.UMengEvent(EventId.GUIDE_PROGRESS,
                                   new Dictionary <string, object>
            {
                { "state", "对战完" }
            });

            #region 结局
            _next = false;
            boxCollider.enabled = false;

            while (true)
            {
                if (GameData.RivalHealthList[0] <= 0 || _next)
                {
                    break;
                }
                yield return(new WaitForEndOfFrame());
            }

            yield return(new WaitForSeconds(2));

            GameData.LastRoundWin = true;

            MainRoot.Goto(MainRoot.UIStateName.EndRound);
            while (!EndRoundUI.Instance)
            {
                yield return(new WaitForEndOfFrame());
            }
            EndRoundUI.Instance.PlayEndRoundProcess_FreshmanGuide(3,
                                                                  new List <Currency>
            {
                new Currency((int)CurrencyType.Coin,
                             CommonData.MyUser.Money10),
                new Currency((int)CurrencyType.Diamond,
                             CommonData.MyUser.Money1)
            }, null);

            prefab = MorlnResources.Load <GameObject>("UI/FreshmanGuide/Prefabs/GuideMask-KillFellow");
            go     = null;
            if (prefab)
            {
                go = PrefabHelper.InstantiateAndReset(prefab, MainRoot.Instance.transform);
            }
            else
            {
                Debug.LogError("不能没有这个Prefab!");
            }

            while (!_next)
            {
                yield return(new WaitForEndOfFrame());
            }
            Destroy(go);

            #endregion

            UMengPlugin.UMengEvent(EventId.GUIDE_PROGRESS,
                                   new Dictionary <string, object>
            {
                { "state", "引导完" }
            });
        }
Beispiel #14
0
 public void OnReturnClick()
 {
     MainRoot.Goto(MainRoot.UIStateName.Menu);
 }
Beispiel #15
0
 public void GiveUpRealPersonRound()
 {
     State = new State.Shell();
     MusicManager.Instance.CrossFadeIn();
     MainRoot.Goto(MainRoot.UIStateName.Menu);
 }
Beispiel #16
0
        private IEnumerator EndRoundCoroutine()
        {
            //=====================共用控件=====================
            if (GameData.LastRoundWin)
            {
                Win.SetActive(true);
                Lose.SetActive(false);
                AudioManager.PlayOneShot(WinSound);
            }
            else
            {
                Win.SetActive(false);
                Lose.SetActive(true);
                AudioManager.PlayOneShot(LoseSound);
            }
            for (int i = 0; i < Stars.Length; i++)
            {
                Stars[i].SetActive(i < _starCount);//星星数量
            }
            BtnLevelUpReward.SetActive(false);
            BtnNext.SetActive(true);
            BadgeShadow.SetActive(false);

            WinLosePanel.SetActive(false);
            SettlementPanel.SetActive(false);
            SkillUnlockPanel.SetActive(false);
            VegetableUnlockPanel.SetActive(false);
            //=====================胜负面板=====================
            _gotoNext = false;
            EnterStage(WinLosePanel);
            BtnNext.SetActive(false);

            MyCharacter.CharacterCode = CommonData.MyUser.CharacterCode;
            MyCharacter.Refresh();
            var userCharacter = CommonData.CurUserCharacter;

            if (userCharacter == null)
            {
                MyCharacter.TakeOffAllEquip();
            }
            else
            {
                MyCharacter.WearEquip(userCharacter.WearEquipList);
            }

            if (GameData.LastRoundWin)
            {
                //WinLight.SetActive(true);
                LblOnButton.text = "查看战利品";
                MyCharacter.Cheer();
            }
            else
            {
                //WinLight.SetActive(false);
                LblOnButton.text = "再接再厉";
                MyCharacter.Cry();
            }
            yield return(new WaitForSeconds(DurationWinLose));

            BtnNext.SetActive(true);
            PlayTween.Play(true);

            while (!_gotoNext)
            {
                yield return(new WaitForEndOfFrame());
            }
            ExitStage(WinLosePanel);
            PlayTween.Play(false);

            //======================结算面板=====================
            if (GameData.LastRoundWin)
            {
                _gotoNext = false;
                EnterStage(SettlementPanel);
                BadgeShadow.SetActive(true);
                BtnLevelUpReward.SetActive(false);
                //BtnNext.SetActive(false);
                LblLevel.text   = CommonData.MyUser.Level.ToString(CultureInfo.InvariantCulture);
                LblExpRate.text = string.Format("{0}%",
                                                Mathf.RoundToInt(Mathf.InverseLerp(CommonData.MyUser.ExpFloor,
                                                                                   CommonData.MyUser.ExpCeil,
                                                                                   CommonData.MyUser.Exp)));
                var addExp       = _roundRewardList.Find(x => x.Type == (int)CurrencyType.Exp);
                var addExpAmount = addExp == null ? 0 : addExp.Amount;
                LblAddExp.text = "+" + addExpAmount;

                if (_unlockElement != null && _unlockElement.HasLevelUp)
                {
                    var energyCapUp = _unlockElement.HasEnergyCapacityUp
                                          ? (_unlockElement.EnergyCapacityUp.ToCapacity -
                                             _unlockElement.EnergyCapacityUp.FromCapacity)
                                          : 0;
                    if (energyCapUp == 0)
                    {
                        LblSettlementDescription.text = "恭喜您升级了!";
                    }
                    else
                    {
                        LblSettlementDescription.text = string.Format("恭喜您升级了!蓄力值上限增加[FFA000]{0}[-]点!", energyCapUp);
                    }
                    //LblAddDiamond.text = "+" + unlockElement.LevelUp.TODO:升级奖励的钻石在哪呢
                }
                else
                {
                    switch (_starCount)
                    {
                    case 0:
                        LblSettlementDescription.text = "下次一定能赢的!";
                        break;

                    case 1:
                        LblSettlementDescription.text = "表现不错哦!";
                        break;

                    case 2:
                        LblSettlementDescription.text = "干得漂亮!";
                        break;

                    case 3:
                        LblSettlementDescription.text = "精彩绝伦的战斗!";
                        break;

                    default:
                        LblSettlementDescription.text = "继续努力!";
                        break;
                    }
                }

                yield return(new WaitForSeconds(1.6f)); //1.6

                //经验条显示
                var maxValue1 = Mathf.InverseLerp(CommonData.MyUser.ExpFloor, CommonData.MyUser.ExpCeil,
                                                  CommonData.MyUser.Exp - addExpAmount);
                var maxValue2 = Mathf.InverseLerp(CommonData.MyUser.ExpFloor, CommonData.MyUser.ExpCeil,
                                                  CommonData.MyUser.Exp);
                var duration = 0.7f;
                for (float t = 0;;)
                {
                    if (t >= duration)
                    {
                        SldExp.value = maxValue1;
                        break;
                    }
                    SldExp.value = t / duration * maxValue1;
                    yield return(new WaitForEndOfFrame());

                    t += Time.deltaTime;
                }
                //2.3
                //经验Add增长
                duration = 1f;
                for (float t = 0;;)
                {
                    if (t >= duration)
                    {
                        LblAddExp.text = "+" + addExpAmount;
                        break;
                    }
                    LblAddExp.text = "+" + Mathf.RoundToInt(addExpAmount * t / duration);
                    yield return(new WaitForEndOfFrame());

                    t += Time.deltaTime;
                }
                //3.3
                //经验条增长
                duration = 0.8f;
                for (float t = 0;;)
                {
                    if (t >= duration)
                    {
                        t            = duration;
                        SldExp.value = maxValue2;
                        break;
                    }
                    SldExp.value = Mathf.Lerp(maxValue1, maxValue2, t / duration);
                    yield return(new WaitForEndOfFrame());

                    t += Time.deltaTime;
                }
                //4.1
                //奖励显现
                RewardTemplate.SetActive(true);
                yield return(new WaitForSeconds(0.8f));

                //4.9
                var addCoin       = _roundRewardList.Find(x => x.Type == (int)CurrencyType.Coin);
                var addCoinAmount = addCoin == null ? 0 : addCoin.Amount;
                duration = 1.6f;
                for (float t = 0;;)
                {
                    if (t >= duration)
                    {
                        LblAddCoin.text = "+" + addCoinAmount;
                        break;
                    }
                    LblAddCoin.text = "+" + Mathf.RoundToInt(addCoinAmount * t / duration);
                    yield return(new WaitForEndOfFrame());

                    t += Time.deltaTime;
                }
                AudioManager.PlayOneShot(AddCoinSound);
                //6.5

                yield return(new WaitForSeconds(DurationSettlement));

                if (_unlockElement != null && _unlockElement.HasLevelUp)
                {
                    BtnLevelUpReward.SetActive(true);
                    BtnNext.SetActive(false);
                }
                else
                {
                    BtnLevelUpReward.SetActive(false);
                    BtnNext.SetActive(true);
                }
                LblOnButton.text = "下一步";
                PlayTween.Play(true);

                while (!_gotoNext)
                {
                    yield return(new WaitForEndOfFrame());
                }
                ExitStage(SettlementPanel);
                PlayTween.Play(false);
            }
            //======================技能解锁面板=====================
            if (_unlockElement != null && _unlockElement.SkillUnlockList.Count > 0)
            {
                _gotoNext = false;
                EnterStage(SkillUnlockPanel);

                for (int i = 0; i < _unlockElement.SkillUnlockList.Count; i++)
                {
                    var go = PrefabHelper.InstantiateAndReset(UnlockSkillTemplate, GridUnlockSkill.transform);
                    go.name = i.ToString(CultureInfo.InvariantCulture);
                    go.SetActive(true);
                    var spriteName = string.Format("skillicon-{0}", (SkillEnum)_unlockElement.SkillUnlockList[i].SkillCode);
                    var spr        = go.GetComponentInChildren <UISprite>();
                    spr.spriteName = spriteName;
                    var skillDisplayName = SkillUtil.GetSkillDisplayName((SkillEnum)_unlockElement.SkillUnlockList[i].SkillCode);
                    var lbl = go.GetComponentInChildren <UILabel>();
                    if (lbl)
                    {
                        lbl.text = skillDisplayName;
                    }
                }
                GridUnlockSkill.repositionNow           = true;
                GridUnlockSkill.transform.localPosition =
                    GridUnlockSkill.transform.localPosition.SetV3X(-GridUnlockSkill.cellWidth *
                                                                   (_unlockElement.SkillUnlockList.Count - 1) * 0.5f);
                UnlockSkillTemplate.SetActive(false);

                yield return(new WaitForSeconds(DurationSkillUnlock));

                BtnNext.SetActive(true);
                PlayTween.Play(true);
                while (!_gotoNext)
                {
                    yield return(new WaitForEndOfFrame());
                }
                ExitStage(SkillUnlockPanel);
                PlayTween.Play(false);
            }

            //======================蔬菜解锁面板=====================
            if (_unlockElement != null && _unlockElement.VegetableUnlockList.Count > 0)
            {
                _gotoNext = false;
                EnterStage(VegetableUnlockPanel);

                for (int i = 0; i < _unlockElement.VegetableUnlockList.Count; i++)
                {
                    var go = PrefabHelper.InstantiateAndReset(UnlockVegetableTemplate, GridUnlockVegetable.transform);
                    go.name = i.ToString(CultureInfo.InvariantCulture);
                    go.SetActive(true);
                    var cs            = go.GetComponentInChildren <VegetableSlot>();
                    var userVegetable =
                        CommonData.MyVegetableList.Find(
                            x => x.VegetableCode == _unlockElement.VegetableUnlockList[i].VegetableCode);
                    if (userVegetable != null)
                    {
                        userVegetable.CurrentUpgradeLimit = _unlockElement.VegetableUnlockList[i].NewUpgradeLimit;
                        if (cs)
                        {
                            cs.SetAndRefresh(userVegetable);
                        }
                    }
                    else
                    {
                        Debug.LogError("竟然找不到UserVegetable.Code:" + _unlockElement.VegetableUnlockList[i].VegetableCode);
                    }
                }
                GridUnlockVegetable.repositionNow           = true;
                GridUnlockVegetable.transform.localPosition =
                    GridUnlockVegetable.transform.localPosition.SetV3X(-GridUnlockVegetable.cellWidth *
                                                                       (_unlockElement.VegetableUnlockList.Count - 1) * 0.5f);
                UnlockVegetableTemplate.SetActive(false);

                yield return(new WaitForSeconds(DurationVegetableUnlock));

                BtnNext.SetActive(true);
                PlayTween.Play(true);
                while (!_gotoNext)
                {
                    yield return(new WaitForEndOfFrame());
                }
                _gotoNext = false;
                PlayTween.Play(false);
            }

            //======================退出结局UI=====================
            MusicManager.Instance.CrossFadeIn();
            if (_gotoPushLevelWhenEnd)
            {
                MainRoot.Goto(MainRoot.UIStateName.PushLevel);
                while (!PushLevelUI.Instance)
                {
                    yield return(new WaitForEndOfFrame());
                }
                if (CommonData.JustUnlockedMajorLevelId == null)//未解锁大关
                {
                    var majorLevel =
                        CommonData.ChallengeUnlockInfoList.Find(
                            x => x.MajorLevelId == GameData.LastChallengeMajorLevelID);
                    if (majorLevel != null)
                    {
                        PushLevelUI.Instance.EnterMajorLevel(majorLevel);
                    }
                }
                else//解锁大关
                {
                    var majorLevel =
                        CommonData.ChallengeUnlockInfoList.Find(
                            x => x.MajorLevelId == CommonData.JustUnlockedMajorLevelId);
                    print("justunlock ml:" + majorLevel);
                    if (majorLevel != null)
                    {
                        PushLevelUI.Instance.EnterMajorLevel(majorLevel);
                    }
                }
            }
            else
            {
                MainRoot.Goto(MainRoot.UIStateName.Menu);
            }
        }
Beispiel #17
0
 public void OnCancelMatchClick()
 {
     Requester.Instance.Send(new CancelMatch());
     MainRoot.Goto(MainRoot.UIStateName.Menu);
     UMengPlugin.UMengEvent(EventId.CANCEL_MATCH, null);
 }
    void OnGUI()
    {
        EditorGUILayout.BeginHorizontal();
        {
            EditorGUILayout.LabelField("先进入Demo场景,然后点击按钮开始测试");
            if (GUILayout.Button("初始化"))
            {
                //GameData.LastChallengeMajorLevelID = cmd.MajorLevelId;
                //GameData.LastChallengeSubLevelID = cmd.SubLevelId;

                //为之后准备好SubLevelData
                var hasCorrectsubLevelData = false;
                var challengeLevelConfig   =
                    ConfigManager.GetConfig(ConfigManager.ConfigType.ChallengeLevelConfig) as ChallengeLevelConfig;
                if (challengeLevelConfig != null)
                {
                    var majorLevelData =
                        challengeLevelConfig.MajorLevelList.Find(
                            x => x.MajorLevelId == GameData.LastChallengeMajorLevelID);
                    if (majorLevelData != null)
                    {
                        GameData.LastMajorLevelData = majorLevelData;
                        GameData.LastSubLevelData   =
                            majorLevelData.SubLevelList.Find(x => x.SubLevelId == GameData.LastChallengeSubLevelID);
                        hasCorrectsubLevelData = true;
                    }
                }
                if (!hasCorrectsubLevelData)
                {
                    GameData.LastMajorLevelData = null;
                    GameData.LastSubLevelData   = null;
                }

                GameData.LastChallengeID = "04F3E163-1286-4657-B743-FAAB42096444";
                GameData.FellowDataList  = new List <TeamAdd> {
                    TestData.TeamAdd0, TestData.TeamAdd1
                };
                GameData.RivalBossData  = TestData.DefenseDataEmpty;
                GameData.FriendDataList = new List <TeamAdd> {
                    TestData.TeamAdd0, TestData.TeamAdd1
                };

                if (CommonData.MyUser != null)
                {
                    CommonData.MyUserOld = CommonData.MyUser.GetDuplicate(); //备份旧的MyUser
                }
                MusicManager.Instance.CrossFadeOut();                        //音乐渐出

                CandyBAPool.Instance.PrepareAllCandys();                     //预加载所有糖果
                MainRoot.Goto(MainRoot.UIStateName.Game);
                GameManager.Instance.ResetAndRefreshBeforeChallengeFighting(0);
                GameManager.Instance.StartChallengeRound();
            }
        }
        EditorGUILayout.EndHorizontal();
        Time.timeScale = EditorGUILayout.Slider("时间速度", Time.timeScale, 0, 1);
        EditorGUILayout.BeginHorizontal();
        {
            EditorGUILayout.LabelField("左", GUILayout.Width(20));
            _leftIndex = EditorGUILayout.IntSlider(_leftIndex, 0, 2, GUILayout.Width(140));
            EditorGUILayout.LabelField("右", GUILayout.Width(20));
            _rightIndex = EditorGUILayout.IntSlider(_rightIndex, 0, 2, GUILayout.Width(140));
        }
        EditorGUILayout.EndHorizontal();
        var skillEnums = Enum.GetValues(typeof(SkillEnum)) as SkillEnum[];

        foreach (var skillCode in skillEnums)
        {
            EditorGUILayout.BeginHorizontal();
            {
                EditorGUILayout.LabelField(skillCode.ToString(), GUILayout.Width(90));
                if (GUILayout.Button("己方施法"))
                {
                    GameManager.Instance.PlayUseSkill(new GameManager.UseSkillInfo(true, _leftIndex, skillCode,
                                                                                   new[] { 200, 50, 60 }));
                }
                if (GUILayout.Button("对方施法"))
                {
                    GameManager.Instance.PlayUseSkill(new GameManager.UseSkillInfo(false, _rightIndex, skillCode,
                                                                                   new[] { 200, 50, 60 }));
                }
            }
            EditorGUILayout.EndHorizontal();
        }
    }
Beispiel #19
0
 /// <summary>
 /// 推图挑战结束后,GameManager播放完慢镜头,然后调用该方法进入结局界面
 /// </summary>
 public void EndPushLevelRoundGotoEndRoundUI()
 {
     MainRoot.Goto(MainRoot.UIStateName.EndRound);
     StartCoroutine(_EndPushLevelRoundGotoEndRoundUI());
 }
Beispiel #20
0
        private void Start()
        {
            try
            {
                ConfigManager.ReadCacheAndLoadAllLargeConfigs(); //读取并加载大配置
            }
            catch (Exception e)
            {
                Debug.LogException(e);
            }

            //TODO:获取IP
            //TODO:连接服务器
            //TODO:登录

            if (!ClientInfoHolder.Instance)
            {
                Debug.LogError("没有ClientInfo Holder,必须检查");
                return;
            }

            MainRoot.Goto(MainRoot.UIStateName.Entrance);

            ImageResourcesManager.Init(7);

            #region GameCenter

            Debug.Log("Social:" + Social.Active);
            Social.localUser.Authenticate(success =>
            {
                if (success)
                {
                    Debug.Log("GameCenter登录成功");
                    var userInfo = "Username: "******"\nUser ID: " + Social.localUser.id +
                                   "\nIsUnderage: " + Social.localUser.underage;
                    Debug.Log(userInfo);
                    Social.localUser.LoadFriends(re =>
                    {
                        if (re)
                        {
                            Debug.Log("LoadFriends ok");
                            foreach (var userProfile in Social.localUser.friends)
                            {
                                Debug.Log("f:" + userProfile.id + ":" + userProfile.userName);
                            }
                        }
                        else
                        {
                            Debug.Log("LoadFriends fail");
                        }
                    });
                }
                else
                {
                    Debug.Log("Authentication failed");
                }
            });

            #endregion
        }
Beispiel #21
0
 public void QuitPushLevelRoundGotoPushLevelUI()
 {
     State = new State.Shell();
     MainRoot.Goto(MainRoot.UIStateName.Entrance);
 }