using System; using System.Collections.Generic; using System.StateSystem; using Cysharp.Threading.Tasks; using Framework.Audio; using Framework.UI; using Game; using Game.Component; using UnityEngine; using UnityEngine.UI; using IcecreamView; using MintAnimation.Runtime.Components.MintAnimation; using Script.Core.Utils.Extend; using StateSystem; using UnityEngine.Playables; using AudioType = Framework.Audio.AudioType; namespace Views{ public class HomePanel : IcecreamView.IC_AbstractModule { public Button _toGame; public Button _settingGame; public Button _aboutGame; public MintAnimBase _MintAnim; private PlayableDirector _playableDirector; public override async void OnOpenView(IC_ViewData parameters) { _toGame.gameObject.SetActive (false); string key = "CompleteCount"; await UniTask.Delay (1000); // !PlayerPrefs.HasKey ("toApp") && if ( PlayerPrefs.GetInt (key , 0) > 0) { //提醒玩家评论 UIManager.Instance.OpenTip ("本项目由" + "Taptap聚光灯GameJam@2024".ToColorString (new Color (1f, 0.38f, 0f)) + "活动在规定的21天时间完成制作\n你的评价将是对我们最大的支持!点击确认查看游戏详情页!" , () => { PlayerPrefs.SetInt ("toApp" , 1); LaunchAppUtils.ToTapTapTargetApp(GameGlobalConfig.Instance.TapAppUrl); } , () => { }); LaunchAppUtils.CheckTargetApp ("taptap.com"); } this._playableDirector = parameters.GetValue(); MapContent.Instance.Pathfinder.Scan (); MapContent.Instance.IsActiveGame = true; this._toGame.gameObject.SetActive (true); } public override void OnCloseView() { } public override void OnInitView () { this._toGame.onClick.AddListener (OnClickToGame , SeAudio.Btn_Click); this._aboutGame.onClick.AddListener(OnClickAboutGame , SeAudio.Btn_Click); this._settingGame.onClick.AddListener(OnClickSettingGame , SeAudio.Btn_Click); // this._achiveGame.onClick.AddListener(OnClickAchiveGame , SeAudio.Btn_Click); // this._changlleGame.onClick.AddListener(OnClickChanglleGame , SeAudio.Btn_Click); } private void OnClickChanglleGame() { UIManager.Instance.OpenPropTip("前面的区域,以后再来探索吧!"); } private void OnClickAchiveGame() { UIManager.Instance.OpenPropTip("成就".ToColorString("red")+"暂未开放!敬请期待!"); } public override void OnFocusActive() { this._aboutGame.gameObject.SetActive(true); this._settingGame.gameObject.SetActive(true); this._toGame.gameObject.SetActive(true); } public override void OnFocusInactive() { this._toGame.gameObject.SetActive(false); this._aboutGame.gameObject.SetActive(false); this._settingGame.gameObject.SetActive(false); } private void OnClickToGame() { this._toGame.gameObject.SetActive(false); this._aboutGame.gameObject.SetActive(false); this._settingGame.gameObject.SetActive(false); var mintPlayerBase = this._MintAnim.MintAnimation (); mintPlayerBase.TweenOptions.IsFlip = true; this._MintAnim.StartAnim(); this._playableDirector.stopped += ToGaming; this._playableDirector.initialTime = 0; this._playableDirector.Play (); AudioManager.Instance.StopPlayers (AudioType.BGM , 1f); } private void ToGaming (PlayableDirector playableDirector) { UIManager.Instance.OpenLoading (() => { this.ViewConnector.CloseView (); GameStateManager.Instance.OpenState (GameGlobalState.GameRoom); }); } private void OnClickSettingGame() { UIManager.Instance.OpenView (UIPanel.SettingPanel); } private void OnClickAboutGame() { UIManager.Instance.OpenView (UIPanel.AboutPanel); } } }