Пример #1
0
    private void Awake()
    {
        _live2DGraphic = transform.Find("CharacterContainer/Live2dGraphic").GetComponent <Live2dGraphic>();

        if ((float)Screen.height / Screen.width > 1.8f)
        {
            _live2DGraphic.GetComponent <RectTransform>().anchoredPosition = new Vector2(0, 0);
        }
        _bgImage = transform.Find("BG").GetComponent <RawImage>();
    }
Пример #2
0
    private void Awake()
    {
        _live2DGraphic = transform.Find("CharacterContainer/Live2dGraphic").GetComponent <Live2dGraphic>();
        if ((float)Screen.height / Screen.width > 1.8f)
        {
            _live2DGraphic.GetComponent <RectTransform>().anchoredPosition = new Vector2(0, 0);
        }

        _bgBG     = transform.Find("BG").GetComponent <RawImage>();
        _shareBtn = transform.Find("Btn/ShareBtn").GetComponent <Button>();
        _saveBtn  = transform.Find("Btn/SaveBtn").GetComponent <Button>();

        _shareBtn.onClick.AddListener(OnShareBtn);
        _saveBtn.onClick.AddListener(OnSaveBtn);



        _tabBar = transform.Find("TabBar");
        for (int i = 0; i < _tabBar.childCount; i++)
        {
            Toggle toggle = _tabBar.GetChild(i).GetComponent <Toggle>();
            toggle.onValueChanged.AddListener(OnTabChange);
        }



        _aniOnClickControl = transform.Find("AniOnClickControl").gameObject;
        PointerClickListener.Get(_aniOnClickControl).onClick = go =>
        {
            var slideContainers = transform.GetRectTransform("SlideContainers");
            _tabBar.GetRectTransform().DOAnchorPos(new Vector2(0, -329f), 0.5f);
            slideContainers.DOAnchorPosX(208, 0.5f);

            var btn = transform.GetRectTransform("Btn");
            btn.DOAnchorPosY(0, 0.5f);

            // _tabBar.GetChild(0).localPosition = new Vector2(0, _tabBar.GetChild(0).localPosition.y);
            //  _tabBar.GetChild(1).localPosition = new Vector2(0, _tabBar.GetChild(1).localPosition.y);
        };


        _clothHint = transform.Find("ClothHint");


        _clothHint.gameObject.Hide();



        _clothParent      = transform.Find("SlideContainers/ClothingList/Content");
        _backgroundParent = transform.Find("SlideContainers/BackgroundList/Content");

        SetShowShareBtn();
    }
Пример #3
0
	private void Awake()
	{
		_bgImage = transform.GetRawImage("Bg");
		_roleContent = transform.Find("RoleContent");
		_btnContent = transform.Find("BtnContent");
		_songContent = transform.Find("SongContent");
			
		_btnContent.GetButton("PlayBtn").onClick.AddListener(PlayBtn);
		_btnContent.GetButton("RankingBtn").onClick.AddListener(RankingBtn);
		_btnContent.GetButton("ExchangeShopBtn").onClick.AddListener(ExchangeShopBtn);

		_live2dGraphic = transform.Find("CharacterContainer/Live2dGraphic").GetComponent<Live2dGraphic>();
		
		if ((float) Screen.height / Screen.width > 1.8f)
		{
			_live2dGraphic.GetComponent<RectTransform>().anchoredPosition = new Vector2(0, 0);
		}
	}
Пример #4
0
    private void Awake()
    {
        _maxLevel     = GlobalData.FavorabilityMainModel.GetLatsFavorabilityLevelRulePB().Level;
        _redHeart     = transform.Find("Redheart");
        _level        = _redHeart.GetText("Image/LevelText");
        _progressBar  = _redHeart.Find("ProgressBar").GetComponent <ProgressBar>();
        _progressText = _redHeart.GetText("ProgressText");

        _live2DGraphic = transform.Find("CharacterContainer/Live2dGraphic").GetComponent <Live2dGraphic>();

        if ((float)Screen.height / Screen.width > 1.8f)
        {
            _live2DGraphic.GetComponent <RectTransform>().anchoredPosition = new Vector2(0, 0);
        }

        _bgImage    = transform.Find("BG").GetComponent <RawImage>();
        _btn        = transform.Find("Btn");
        _showinMain = transform.Find("Btn/ShowInMain").GetComponent <Button>();
        _cloth      = transform.Find("Btn/Cloth").GetComponent <Button>();
        _npcInfoBtn = transform.Find("Btn/NpcInfo").GetComponent <Button>();
        _sendGift   = transform.Find("Btn/SendGift").GetComponent <Button>();
        _showinMain.onClick.AddListener(ShowInMain);
        _cloth.onClick.AddListener(OnCloth);
        _npcInfoBtn.onClick.AddListener(PhoneEvent);
        _sendGift.onClick.AddListener(SendGift);
        _onClick = transform.Find("OnClick").gameObject;
        _onClick.Hide();


        GuideSet();

        _head = transform.Find("CharacterContainer/Live2dGraphic/Head");
        _body = transform.Find("CharacterContainer/Live2dGraphic/Body");

        PointerClickListener.Get(_head.gameObject).onClick = Live2dClickTigger;
        PointerClickListener.Get(_body.gameObject).onClick = Live2dClickTigger;

        _voice = transform.GetButton("Btn/VoiceCollect");
        _voice.onClick.AddListener(VoiceBtn);
    }
Пример #5
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);
        }
    }
Пример #6
0
    private void Awake()
    {
        _isArrowGoto = false;
        _touchArrow  = transform.Find("Buttons/StartBtn/TouchArrow");
        GuideArrow.DoAnimation(_touchArrow);

        _exchangeIntegralBar = transform.Find("TopBar/ExchangeIntegralBar");
        _visitPower          = transform.Find("TopBar/VisitPowerBar");
        _recolletionBar      = transform.Find("TopBar/RecolletionBar");

        _bgRawImage  = transform.Find("BackGround/Bg").GetComponent <RawImage>();
        _startButton = transform.Find("Buttons/StartBtn").GetComponent <Button>();
        _drawCardBtn = transform.Find("Buttons/RightBtnContent/DrawCardBtn").GetComponent <Button>();

        _supporterBtn   = transform.Find("StartPathBtnContainer/SupporterBtn").GetComponent <Button>();
        _missionBtn     = transform.Find("Buttons/RightBtnContent/MissionBtn").GetComponent <Button>();
        _achievementBtn = transform.Find("Buttons/RightBtnContent/AchievementBtn").GetComponent <Button>();
        _changeRoleBtn  = transform.Find("Buttons/LeftBtnContent/ChangeRoleBtn").GetComponent <Button>();

        _userInfoView   = transform.Find("UserInfoView");
        _fullviewBtn    = transform.Find("Buttons/LeftBtnContent/FullViewBtn").GetComponent <Button>();
        _stagingPostBtn = transform.Find("Buttons/LeftBtnContent/StagingPostBtn").GetComponent <Button>();

        _starActivityBtn = transform.GetButton("Buttons/RightBtnContent/StarActivityBtn");

        _birthdayBtn = transform.GetButton("Buttons/RightBtnContent/BirthdayBtn");

        _activityTemplateBtn        = transform.GetButton("Buttons/RightBtnContent/ActivityTemplateBtn");
        _activityCapsuleTemplateBtn = transform.GetButton("Buttons/RightBtnContent/ActivityCapsuleTemplateBtn");

        _activityMusicTemplateBtn = transform.GetButton("Buttons/RightBtnContent/ActivityMusicTemplateBtn");

        _animator = this.GetComponent <Animator>();
        _uiv      = _userInfoView.GetComponent <UserInfoView>();

        _backGround         = transform.Find("BackGround");
        _characterContainer = transform.Find("CharacterContainer");
        _live2dGraphic      = _characterContainer.Find("Live2dGraphic").GetComponent <Live2dGraphic>();
        if ((float)Screen.height / Screen.width > 1.8f)
        {
            _live2dGraphic.GetComponent <RectTransform>().anchoredPosition = new Vector2(0, 0);
        }

        _starLineBack  = _characterContainer.Find("StarLineBack");
        _starLineFront = _characterContainer.Find("StarLineFront");

        _phoneBtn = transform.Find("StartPathBtnContainer/PhoneBtn").GetComponent <Button>();
        _mailBtn  = transform.Find("StartPathBtnContainer/MailBtn").GetComponent <Button>();

        _cardBtn        = transform.Find("Buttons/CardBtn").GetComponent <Button>();
        _appointmentBtn = transform.Find("StartPathBtnContainer/AppointmentBtn").GetComponent <Button>();

        _firstRechargeBtn = transform.GetButton("Buttons/LeftBtnContent/FirstRecharge");
        _totalRechargeBtn = transform.GetButton("Buttons/LeftBtnContent/11");

        _topBar = transform.Find("TopBar");

        _powerBar = _topBar.Find("PowerBar");

        _powerIconImage = _powerBar.Find("powerIcon").GetComponent <Image>();
        _powerIcon      = _powerBar.Find("powerIcon/OnClick");
        _powerAddIcon   = _powerBar.Find("addIcon/OnClick");
        _powerAddImg    = _powerBar.Find("addIcon");

        _goldBar     = _topBar.Find("GoldBar");
        _goldAddIcon = _goldBar.Find("addIcon/OnClick");

        _gemBar = _topBar.Find("GemBar");

        _powerTxt      = _topBar.Find("PowerBar/Text").GetComponent <Text>();
        _goldTxt       = _topBar.Find("GoldBar/Text").GetComponent <Text>();
        _gemTxt        = _topBar.Find("GemBar/Text").GetComponent <Text>();
        _visitPowerTxt = _topBar.Find("VisitPowerBar/Text").GetComponent <Text>();

        _buttons = transform.Find("Buttons");

        _startPathBtnContainer = transform.Find("StartPathBtnContainer");


        _triggerGiftBtn  = transform.GetButton("Buttons/TriggerGiftBtn");
        _triggerGiftText = transform.GetText("Buttons/TriggerGiftBtn/TextBg/Text");

        _activityBar   = transform.Find("ActivityBar");
        _activityPanel = _activityBar.Find("Panel");
        _activityPage  = _activityBar.Find("PageNums");
        _drawCardBtn.onClick.AddListener(OnDrawCardBtn);
        _startButton.onClick.AddListener(OnStartBtn);
        _supporterBtn.onClick.AddListener(OnSupporterBtn);
        _missionBtn.onClick.AddListener(OnMissionBtn);
        _fullviewBtn.onClick.AddListener(OnFullViewBtn);
        _stagingPostBtn.onClick.AddListener(OnStagingPostBtn);
        _appointmentBtn.onClick.AddListener(OnAppointmentBtn);


        _phoneBtn.onClick.AddListener(OnPhoneBtn);

        _cardBtn.onClick.AddListener(OnCardBtn);
        _mailBtn.onClick.AddListener(OnMailBtn);
        _changeRoleBtn.onClick.AddListener(OnChangeRoleBtn);
        _achievementBtn.onClick.AddListener(OnAchievementBtn);

        _firstRechargeBtn.onClick.AddListener(OnFirstRechargeBtn);
        _totalRechargeBtn.onClick.AddListener(OntotalRechargeBtn);

        _starActivityBtn.onClick.AddListener(OnStarActivityBtn);

        _birthdayBtn.onClick.AddListener(OnBirthdayBtn);

        _activityTemplateBtn.onClick.AddListener(ActivityTemplateBtn);
        _activityCapsuleTemplateBtn.onClick.AddListener(ActivityCapsuleTemplateBtn);

        _activityMusicTemplateBtn.onClick.AddListener(ActivityMusicTemplateBtn);

        _triggerGiftBtn.onClick.AddListener(ShowTriggerGift);
        _triggerGiftBtn.gameObject.Hide();

        PointerClickListener.Get(_powerIcon.gameObject).onClick    = PowerHint; //点击体力图标
        PointerClickListener.Get(_powerAddIcon.gameObject).onClick = BuyPower;

        PointerClickListener.Get(_goldAddIcon.gameObject).onClick = BuyGold;

        PointerClickListener.Get(_gemBar.gameObject).onClick = BuyGem;


        PointerClickListener.Get(_userInfoView.gameObject).onClick = PopupUserInfo;
        //  PointerClickListener.Get(_live2dGraphic.gameObject).onClick = PlayDialog;
        // UIEventListener.Get(_live2dGraphic.gameObject).onUp = Live2dTigger;


        PointerClickListener.Get(_recolletionBar.Find("addIcon/OnClick").gameObject).onClick   = BuyRecolletionPower;
        PointerClickListener.Get(_recolletionBar.Find("powerIcon/OnClick").gameObject).onClick =
            BuyRecolletionPowerHint;



        PointerClickListener.Get(_visitPower.Find("addIcon/OnClick").gameObject).onClick   = BuySupporterPower;
        PointerClickListener.Get(_visitPower.Find("powerIcon/OnClick").gameObject).onClick = BuySupporterPowerHint;


        Transform headClick = transform.Find("CharacterContainer/Live2dGraphic/Head");
        Transform bodyClick = transform.Find("CharacterContainer/Live2dGraphic/Body");

        PointerClickListener.Get(headClick.gameObject).onClick = Live2dClickTigger;
        PointerClickListener.Get(bodyClick.gameObject).onClick = Live2dClickTigger;


        SetLive2dClickSize();

        HandleFunctionOpen();


        _countDownTra = transform.Find("UserInfoView/CountDown");
        PointerClickListener.Get(_countDownTra.gameObject).onClick = go =>
        {
            GalaAccountManager.Instance.ShowWallVisitorView();
        };

        //CheckDownLoadQueue();
    }