IEnumerator _EnterMajorLevel(MajorLevelUnlockInfo majorLevelUnlockInfo) { yield return(new WaitForSeconds(0.5f)); Planet.GoToIndex(majorLevelUnlockInfo.MajorLevelId - 1); var island = Planet.MajorLevelSectorList[majorLevelUnlockInfo.MajorLevelId - 1].GetComponentInChildren <Island>(); if (CommonData.JustUnlockedMajorLevelId == majorLevelUnlockInfo.MajorLevelId) { island.IslandInfo.CloudsContainer.SetActive(true); yield return(new WaitForSeconds(0.5f)); island.IslandInfo.PlayUnlockEffect(); CommonData.JustUnlockedMajorLevelId = null; } else { TranslationPanel.GotoIslandView(Vector2.zero);//TODO:移动到新解锁小关上面 island.DidGotoThisIslandView(); if (CommonData.JustUnlockedSubLevelId != null && CommonData.JustUnlockedSubLevelId.Value.i == majorLevelUnlockInfo.MajorLevelId) { var subInd = CommonData.JustUnlockedSubLevelId.Value.j - 1; if (0 <= subInd && subInd < island.SubLevelPointList.Count) { yield return(new WaitForSeconds(0.5f)); island.SubLevelPointList[subInd].GetComponent <SubLevelPoint>().PlayUnlockEffect(); } CommonData.JustUnlockedSubLevelId = null; } } }
//public GameObject TweenParent; public void EnterMajorLevel(MajorLevelUnlockInfo majorLevelUnlockInfo) { //Debug.LogWarning("EML:"); //Planet.CurIndex = majorLevelUnlockInfo.MajorLevelId - 1; //Planet.TotalAngle = Planet.CurIndex*Planet.OffsetAngle; StartCoroutine(_EnterMajorLevel(majorLevelUnlockInfo)); }
public void SetAndRefresh(MajorLevelUnlockInfo majorLevelUnlockInfo) { if (majorLevelUnlockInfo == null) { Debug.LogError("刷新不能没有majorLevelUnlockInfo"); return; } _majorLevelUnlockInfo = majorLevelUnlockInfo; #region 显示文本信息 var challengeLevelConfig = ConfigManager.GetConfig(ConfigManager.ConfigType.ChallengeLevelConfig) as ChallengeLevelConfig; if (challengeLevelConfig != null) { var mlc = challengeLevelConfig.MajorLevelList.Find( x => x.MajorLevelId == _majorLevelUnlockInfo.MajorLevelId); if (mlc == null) { Debug.LogError("没有找到Major关卡文本配置:" + _majorLevelUnlockInfo.MajorLevelId); } else { //TODO:显示文本信息 #region 显示玩家进程 var totalStar = _majorLevelUnlockInfo.SubLevelUnlockInfoList.Sum(x => x.CurrentStar); LblStarCount.text = string.Format("{0}/{1}", totalStar, mlc.SubLevelList.Count * 3); #endregion } } #endregion }
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); } }
public void SetAndRefreshSub(MajorLevelUnlockInfo majorLevelUnlockInfo) { _majorLevelUnlockInfo = majorLevelUnlockInfo; while (_subLevelButtonList.Count < _majorLevelUnlockInfo.SubLevelUnlockInfoList.Count) { _subLevelButtonList.Add(null); } for (int i = 0; i < _majorLevelUnlockInfo.SubLevelUnlockInfoList.Count; i++) { if (_subLevelButtonList[i] == null) { _subLevelButtonList[i] = PrefabHelper.InstantiateAndReset <SubLevelButton>( SubLevelButtonTemplate.gameObject, SubGrid.transform); _subLevelButtonList[i].name = "SubLevelButton " + i; _subLevelButtonList[i].gameObject.SetActive(true); } _subLevelButtonList[i].SetAndRefresh(_majorLevelUnlockInfo.MajorLevelId, _majorLevelUnlockInfo.SubLevelUnlockInfoList[i]); } SubGrid.repositionNow = true; SubLevelButtonTemplate.gameObject.SetActive(false); }
/// <summary> /// 第一次调用时创建新的岛屿内容,之后调用不会再改动。 /// </summary> /// <param name="pushLevelUI"></param> /// <param name="majorLevelId"></param> /// <param name="majorLevel"></param> /// <param name="majorLevelData"></param> public void SetAndRefresh(PushLevelUI pushLevelUI, int majorLevelId, MajorLevelUnlockInfo majorLevel, MajorLevelData majorLevelData) { PushLevelUI = pushLevelUI; MajorLevelId = majorLevelId; _majorLevelUnlockInfo = majorLevel; _majorLevelData = majorLevelData; if (!_artContent) { var prefab = MorlnDownloadResources.Load <GameObject>("ResourcesForDownload/Island/Island" + (majorLevelId - 1)); _artContent = PrefabHelper.InstantiateAndReset(prefab, transform); //_artContent.transform.localScale = new Vector3(0.5f, 0.5f, 1); IslandInfo = _artContent.GetComponent <IslandInfo>(); if (IslandInfo) { IslandInfo.Island = this; IslandInfo.transform.SetSortingLayer("Planet"); } } if (!IslandInfo) { Debug.LogError("没有岛屿内容则不能玩游戏,请检查"); return; } if (_majorLevelData == null) { Debug.LogError("没有_majorLevelData。不用显示了,玩不了!"); return; } if (_majorLevelData.SubLevelList == null) { Debug.LogError("没有_majorLevelData.SubLevelList。不用显示了,玩不了!"); return; } while (SubLevelPointList.Count < _majorLevelData.SubLevelList.Count)//确保 小关点 数量足够 { var subLevelPoint = PrefabHelper.InstantiateAndReset <SubLevelPoint>(SubLevelPointTemplate, SubLevelPointContainer); subLevelPoint.name = "SubLevel " + SubLevelPointList.Count; SubLevelPointList.Add(subLevelPoint); } var subLevelPointPosList = Route.GetPointsUniformly(_majorLevelData.SubLevelList.Count); for (int subId = 1; subId <= SubLevelPointList.Count; subId++) { var pointI = subId - 1; var dataI = _majorLevelData != null ? _majorLevelData.SubLevelList.FindIndex(x => x.SubLevelId == subId) : -1; var unlockI = _majorLevelUnlockInfo != null ? _majorLevelUnlockInfo.SubLevelUnlockInfoList.FindIndex(x => x.SubLevelId == subId) : -1; if (dataI >= 0) //后者必然true,只为彻底保险 { var go = SubLevelPointList[pointI].gameObject; go.SetActive(true); go.transform.localPosition = subLevelPointPosList[pointI]; SubLevelPointList[pointI].SetAndRefresh(_majorLevelData.MajorLevelId, unlockI >= 0 ? _majorLevelUnlockInfo.SubLevelUnlockInfoList[unlockI] : null, dataI >= 0 ? _majorLevelData.SubLevelList[dataI] : null);//指数大于0则一定不为null,放心,别管波浪线 } else { SubLevelPointList[pointI].gameObject.SetActive(false); } } SubLevelPointTemplate.SetActive(false); var locked = _majorLevelUnlockInfo == null || !_majorLevelUnlockInfo.Unlocked; IslandInfo.CloudsContainer.SetActive(locked); }