示例#1
0
        public void SetSelectDungeon(int dungeonID)
        {
            DungeonType dungeonType = DungeonData.GetDungeonDataByID(dungeonID).dungeonType;

            if (_currentSelectDungeonType != dungeonType)
            {
                ResetDifficulty(dungeonType);
            }
            DungeonButton dungeonButton = null;

            if (_easyDungeonButtonDic.ContainsKey(dungeonID))
            {
                _easyDungeonButtonDic.TryGetValue(dungeonID, out dungeonButton);
            }
            else if (_normalDungeonButtonDic.ContainsKey(dungeonID))
            {
                _normalDungeonButtonDic.TryGetValue(dungeonID, out dungeonButton);
            }
            else if (_hardDungeonButtonDic.ContainsKey(dungeonID))
            {
                _hardDungeonButtonDic.TryGetValue(dungeonID, out dungeonButton);
            }

            ChapterData chapterData = ChapterData.GetChapterDataContainsDungeon(dungeonID);

            MoveTo(chapterData);
        }
示例#2
0
        void Awake()
        {
            _commonTopBarView = CommonTopBarView.CreateNewAndAttachTo(core.transform);
            _commonTopBarView.SetAsCommonStyle(string.Empty, ClickCloseHandler, true, true, true, false);
            _commonTopBarView.transform.localPosition = new Vector3(_commonTopBarView.transform.localPosition.x, _commonTopBarView.transform.localPosition.y, -1000);

            Logic.UI.Chat.View.SystemNoticeView.Create(systemNoticeRoot);

            PlayerInfo playerInfo = GameProxy.instance.PlayerInfo;

            _characterEntity = CharacterEntity.CreatePlayerEntityAsUIElement(playerInfo, roleModelRootRectTransform, false, false);
            AnimatorUtil.SetBool(_characterEntity.anim, AnimatorUtil.RUN, true);

            chapterViewPrefab.gameObject.SetActive(true);
            List <ChapterInfo> chapterInfoList = ChapterProxy.instance.GetAllChapterInfos();
            int chapterInfoCount = chapterInfoList.Count;

            for (int i = 0; i < chapterInfoCount; i++)
            {
                ChapterInfo chapterInfo = chapterInfoList[i];
                ChapterView chapterView = GameObject.Instantiate <ChapterView>(chapterViewPrefab);
//                chapterView.SetChapterInfoAndType(chapterInfo);
                chapterView.transform.SetParent(chapterBGsRoot, false);
                chapterView.transform.localScale    = Vector3.one;
                chapterView.transform.localPosition = chapterInfo.chapterData.chapterPosition;
                _chapterViewList.Add(chapterView);
                _chapterViewsDictionary.Add(chapterInfo.chapterData.Id, chapterView);

                int dungeonsCount = chapterInfo.chapterData.easyDungeonIDList.Count;
                for (int dungeonIndex = 0; dungeonIndex < dungeonsCount; dungeonIndex++)
                {
                    int easyDungeonID   = chapterInfo.chapterData.easyDungeonIDList[dungeonIndex];
                    int normalDungeonID = chapterInfo.chapterData.normalDungeonIDList[dungeonIndex];
                    int hardDungeonID   = chapterInfo.chapterData.hardDungeonIDList[dungeonIndex];

                    DungeonButton dungeonButton = GameObject.Instantiate <DungeonButton>(dungeonButtonPrefab);
                    dungeonButton.transform.SetParent(dungeonButtonsRoot, false);
                    dungeonButton.transform.localPosition = chapterInfo.chapterData.chapterPosition + chapterInfo.chapterData.positions[dungeonIndex];
                    dungeonButton.SetDungeonInfo(DungeonProxy.instance.GetDungeonInfo(chapterInfo.chapterData.easyDungeonIDList[dungeonIndex]));
                    dungeonButton.name = string.Format("dungeon_button_{0}", dungeonButton.DungeonInfo.dungeonData.dungeonID);
                    dungeonButton.gameObject.SetActive(true);
                    _easyDungeonButtonDic.Add(easyDungeonID, dungeonButton);
                    _normalDungeonButtonDic.Add(normalDungeonID, dungeonButton);
                    _hardDungeonButtonDic.Add(hardDungeonID, dungeonButton);
                }
                dungeonButtonPrefab.gameObject.SetActive(false);
            }
            chapterViewPrefab.gameObject.SetActive(false);
            selectChapterScrollRect.content.sizeDelta    = RectTransformUtility.CalculateRelativeRectTransformBounds(chapterBGsRoot).size;
            selectChapterScrollRect.onEndDragDelegate   += OnMapEndDragHandler;
            selectChapterScrollRect.onDragLeftDelegate  += OnMapDragLeftHandler;
            selectChapterScrollRect.onDragRightDelegate += OnMapDragRightHandler;
            _chapterScrollViewportSize = selectChapterScrollRect.viewport.rect.size;
            AudioController.instance.PlayBGMusic(Logic.Audio.Controller.AudioController.SELECTDUNGEON);
            BindDelegate();
        }