Exemplo n.º 1
0
	public void SetData(MusicInfoPB todaySongInfo,MusicInfoPB tomorrowSongInfo)
	{				
      _bgImage.texture = ResourceManager.Load<Texture>("TrainingRoom/background/"+todaySongInfo.MusicId);

      _songContent.GetRawImage("SongBg/SongCDBg/SongImage").texture = ResourceManager.Load<Texture>("TrainingRoom/cover1/"+todaySongInfo.MusicId);
      
      _songContent.GetText("SongBg/TomorrowSongName").text = "明日应援曲目:" +tomorrowSongInfo.MusicName;

      int id = int.Parse(todaySongInfo.MusicId.ToString()[0].ToString());
      if (id < 5)
      {
	      string[] live2dIds = {"12101", "12201", "12301", "12401"};
	      _live2dGraphic.LoadAnimationById(live2dIds[id-1]);
      }
      else
      {
	      _live2dGraphic.Hide();
      }
	}
Exemplo n.º 2
0
    public void ShowTopBar(MainMenuDisplayState state = MainMenuDisplayState.ShowTopBar)
    {
        _topBar.gameObject.SetActive(true);

        bool isPowerBar = state == MainMenuDisplayState.ShowTopBar;

        _topBar.Find("PowerBar").gameObject.SetActive(isPowerBar);


        if (isPowerBar)
        {
            _topBar.Find("VisitPowerBar").gameObject.SetActive(!isPowerBar);
            _recolletionBar.gameObject.SetActive(!isPowerBar);
            _exchangeIntegralBar.gameObject.SetActive(!isPowerBar);
        }
        else
        {
            switch (state)
            {
            case MainMenuDisplayState.ShowVisitTopBar:
                _topBar.Find("VisitPowerBar").gameObject.SetActive(false);
                _recolletionBar.gameObject.SetActive(false);
                _exchangeIntegralBar.gameObject.SetActive(false);
                break;

            case MainMenuDisplayState.ShowRecollectionTopBar:
                _topBar.Find("VisitPowerBar").gameObject.SetActive(false);
                _recolletionBar.gameObject.SetActive(true);
                _exchangeIntegralBar.gameObject.SetActive(false);
                break;

            case MainMenuDisplayState.ShowExchangeIntegralBar:
                _topBar.Find("VisitPowerBar").gameObject.SetActive(false);
                _recolletionBar.gameObject.SetActive(false);
                _exchangeIntegralBar.gameObject.SetActive(true);
                break;
            }
        }

        _userInfoView.gameObject.SetActive(false);
        _buttons.gameObject.SetActive(false);
        _activityBar.gameObject.SetActive(false);
        _startPathBtnContainer.gameObject.SetActive(false);

        _backGround.gameObject.Hide();
        _characterContainer.gameObject.Hide();
        _live2dGraphic.Hide();
    }
Exemplo n.º 3
0
    private void ShowPageStep2()
    {
        if (_lastBgId != null && _lastBgId != _currentDialogVo.BgImageId)
        {
            AssetManager.Instance.UnloadBundle(AssetLoader.GetStoryBgImage(_lastBgId));
            _storyLoader.BgImageCache.Remove(_lastBgId);
        }

        if (!string.IsNullOrEmpty(_currentDialogVo.BgMusicId) && _lastBgMusicId != _currentDialogVo.BgMusicId)
        {
            _lastBgMusicId = _currentDialogVo.BgMusicId;

            if (_lastBgMusicId.IndexOf("${mute}", StringComparison.Ordinal) != -1)
            {
                AudioManager.Instance.StopBackgroundMusic();
            }
            else
            {
                AudioManager.Instance.TweenVolumTo(AudioManager.Instance.BgMusicVolum, 2.5f);
                new AssetLoader().LoadAudio(AssetLoader.GetBackgrounMusicById(_lastBgMusicId),
                                            (clip, loader) => { AudioManager.Instance.PlayBackgroundMusic(clip); });
            }
        }

        if (!string.IsNullOrEmpty(_currentDialogVo.DubbingId))
        {
            AudioManager.Instance.TweenVolumTo(0.33f, 0);
            new AssetLoader().LoadAudio(AssetLoader.GetDubbingById(_currentDialogVo.DubbingId),
                                        (clip, loader) =>
            {
                if (clip == null)
                {
                    Debug.LogWarning("AssetLoader Error->" + loader.FilePath);
                    return;
                }
                ClientTimer.Instance.DelayCall(() =>
                {
                    _dialogFrame.SetAudioTime(clip.length);
                    AudioManager.Instance.PlayDubbing(clip);
                }, 0.5f);
            });
        }
        else
        {
            AudioManager.Instance.StopDubbing();
            AudioManager.Instance.TweenVolumTo(1f, 2.5f);
        }

        _lastBgMusicId = _currentDialogVo.BgMusicId;

        if (_lastBgId != _currentDialogVo.BgImageId)
        {
            _lastBgId        = _currentDialogVo.BgImageId;
            _bgImage.texture = _storyLoader.BgImageCache[_currentDialogVo.BgImageId];

            _bgImage.GetComponent <RectTransform>().sizeDelta =
                new Vector2(_currentDialogVo.Width, _currentDialogVo.Height);
            BackgroundSizeFitter fitter = _bgImage.GetComponent <BackgroundSizeFitter>();
            if (_currentDialogVo.Width > 1080)
            {
                fitter.FitType = FitType.Heigth;
            }
            else
            {
                fitter.FitType = FitType.Background;
            }

            fitter.Reset();
            fitter.DoFit();
        }

        _bgImage.color = Color.white;

        bool hasDialog = false;

        int roleIndex   = 0;
        int spineIndex  = 0;
        int live2dIndex = 0;

        _role1.gameObject.SetActive(false);
        _role2.gameObject.SetActive(false);

        int childIndex = 0;

        if (_currentDialogVo.EntityList.Count > 0)
        {
            for (int i = 0; i < _currentDialogVo.EntityList.Count; i++)
            {
                EntityVo      entity = _currentDialogVo.EntityList[i];
                RectTransform rt     = null;
                if (entity.type == EntityVo.EntityType.Role)
                {
                    roleIndex++;
                    childIndex++;
                    bool resetSprite = true;

                    if (roleIndex == 1)
                    {
                        if (_lastRoleId1 == entity.id)
                        {
                            resetSprite = false;
                        }

                        rt           = _role1.GetComponent <RectTransform>();
                        _lastRoleId1 = entity.id;
                    }
                    else
                    {
                        if (_lastRoleId2 == entity.id)
                        {
                            resetSprite = false;
                        }

                        rt           = _role2.GetComponent <RectTransform>();
                        _lastRoleId2 = entity.id;
                    }

                    RawImage img = rt.GetComponent <RawImage>();
                    if (resetSprite)
                    {
                        img.texture = _storyLoader.RoleImageCache[entity.id];
                    }

                    img.color = new Color(entity.color, entity.color, entity.color);

                    rt.gameObject.SetActive(true);
                    rt.anchoredPosition = new Vector3(entity.x, entity.y - _offsetY);
                    rt.sizeDelta        = new Vector2(entity.width, entity.height);

                    rt.SetSiblingIndex(childIndex);
                }
                else if (entity.type == EntityVo.EntityType.DialogFrame)
                {
                    hasDialog = true;

                    rt = _dialogFrame.GetComponent <RectTransform>();
                    rt.localPosition = new Vector3(0, -240 - _offsetY, 0);
                    rt.sizeDelta     = new Vector2(entity.width, entity.height);

                    float delayTime = _isDelayDialog ? 1.3f : 0.38f;
                    _dialogFrame.SetData(entity);
                    _dialogFrame.Show(delayTime);

                    SendMessage(new Message(MessageConst.CMD_STORY_RECODE_DIALOG, Message.MessageReciverType.DEFAULT, entity, entity.roleName));

                    if (!string.IsNullOrEmpty(entity.headId))
                    {
                        _dialogFrame.SetHeadTexture(_storyLoader.HeadImageCache[entity.headId]);
                    }
                }
                else if (entity.type == EntityVo.EntityType.Spine)
                {
                    spineIndex++;
                    CreateSpine(entity, spineIndex, ++childIndex);
                }
                else if (entity.type == EntityVo.EntityType.Live2D)
                {
                    live2dIndex++;
                    CreateLive2D(entity, live2dIndex, ++childIndex);
                }
            }
        }

        //3个跳转选项
        if (_currentIndex >= _dialogList.Count - 1 &&
            _currentDialogVo.Event != null &&
            _currentDialogVo.Event.EventType == EventType.Selection)
        {
            CreateSelection(_currentDialogVo.Event);
        }


        for (int i = _spineCache.Count - 1; i >= 0; i--)
        {
            if (i >= spineIndex)
            {
                SkeletonGraphic skg = _spineCache[i];
                DestroyImmediate(skg);
                _spineCache.RemoveAt(i);
            }
        }

        for (int i = _live2DCache.Count - 1; i >= 0; i--)
        {
            if (i >= live2dIndex)
            {
                Live2dGraphic l2g = _live2DCache[i];
                l2g.Hide();
            }
        }

        if (_isDelayDialog)
        {
            _dialogFrame.gameObject.SetActive(false);
            _isDelayDialog = false;
        }

        if (hasDialog == false)
        {
            ClientTimer.Instance.DelayCall(DoAutoPlay, 1.2f);
            _dialogFrame.gameObject.SetActive(false);
        }
    }
Exemplo n.º 4
0
 public void HideL2D()
 {
     ClientTimer.Instance.DelayCall(() => { _live2DGraphic.Hide(); }, 0.5f);
 }