public static ResultView Show(Transform parent, TitleConstData titleConstData, int score, Action onClickReturn) { var view = Create(parent); view.Initialize(titleConstData, score, true, onClickReturn); return(view); }
void Initialize(TitleConstData titleConstData, int score, bool gameEnded, Action onClickReturn) { if (titleConstData != null) { this.tweetScoreFormat = titleConstData.TweetScoreFormat; this.tweetMessage = titleConstData.TweetMessage; } this.score = score; this.gameEnded = gameEnded; this.onClickReturn = onClickReturn; leaderboardView.gameObject.SetActive(false); tweetButton.SetActive(false); returnButton.SetActive(false); GetLeaderboard(); #if UNITY_ANDROID || UNITY_IOS if (gameEnded && Advertisement.IsReady()) { var options = new ShowOptions(); Advertisement.Show(options); } #endif }
public void StartGame(Level level, TitleConstData titleConstData) { this.level = level; this.titleConstData = titleConstData; scoreDisplay.Score = 0; gotCoinCount = 0; gotOneUpCount = 0; if (level == Level.Expert) { scoreDisplay.Score = titleConstData.ExpertInitialScore; gotCoinCount = titleConstData.ExpertInitialGotCoinCount; } foreach (var vertex in vertexes) { vertex.ResetColor(); } selectedVertex = null; balls = new List <Ball>(); AddNewBall(); if (wall != null) { Destroy(wall.gameObject); wall = null; } if (coin != null) { Destroy(coin.gameObject); coin = null; } if (oneUp != null) { Destroy(oneUp.gameObject); oneUp = null; } var startCountdownView = Instantiate(startCountdownViewPrefab, guideCanvas.transform); startCountdownView.Initialize(() => { balls[0].StartMove(FirstBallStartForce(), titleConstData.MaxVelocity); AudioManagerSingleton.Instance.PlayBgm(); }); }