void Start() { ChapterCities chapterCityPrefab = m_ChapterRoot.transform.GetChild(0).GetComponent <ChapterCities>(); chapterCityPrefab.transform.SetParent(null); int i = 0; foreach (var v in ChapterConfiguration.chapterDictionary) { i++; ChapterInfo c = v.Value; ChapterCities chapterCity = SupportTools.AddChild <ChapterCities>(m_ChapterRoot.gameObject, chapterCityPrefab.gameObject); chapterCity.text.text = c.name; chapterCity.name = c.imageName.Substring(6); //imageName = Image_xxxxx we just wanna get the real name chapterCity.chapter = c.chapter; Sprite sprite = Resources.Load <Sprite>("UI/LaunchScene/MissionCards/" + c.imageName); if (sprite) { chapterCity.image.sprite = sprite; } bool b = c.chapter > ConstantData.LevelDatas.GetChapter(m_MissionProgress); chapterCity.lockMask.SetActive(b); int star = 0; if (!b) { star = ConstantData.missionRecords.GetChapterStars(v.Key); } chapterCity.process.text = string.Format(HOLocalizationConfiguration.GetValue(104), star, 60); } Destroy(chapterCityPrefab.gameObject); m_ChapterRoot.GetComponent <RectTransform>().sizeDelta = new Vector2(i * m_ChapterRoot.cellSize.x + i * m_ChapterRoot.spacing.x, m_ChapterRoot.cellSize.y); m_ChapterSnapElement.Initialize(); }
private void SetSound() { if (ConstantData.Sound) { m_SoundText.text = string.Format(HOLocalizationConfiguration.GetValue(161), HOLocalizationConfiguration.GetValue(421)); } else { m_SoundText.text = string.Format(HOLocalizationConfiguration.GetValue(161), HOLocalizationConfiguration.GetValue(422)); } HOAudioManager.SetSound(ConstantData.Sound); }
private void SetMusic() { if (ConstantData.Music) { m_MusicText.text = string.Format(HOLocalizationConfiguration.GetValue(160), HOLocalizationConfiguration.GetValue(421)); } else { m_MusicText.text = string.Format(HOLocalizationConfiguration.GetValue(160), HOLocalizationConfiguration.GetValue(422)); } HOAudioManager.SetMusic(ConstantData.Music); }
void Awake() { if (m_Instance == null) { m_Instance = this; DontDestroyOnLoad(gameObject); ParseTextAsset(); } else { Destroy(this); } }
protected override IEnumerator CheckResultAndChangeTurn(float time) { yield return(new WaitForSeconds(time)); if (m_PottedBallListThisRound.Count == 0) { m_Player.Combo = 0; } if (m_WhiteBallPotted) { m_Player.Score -= m_ScoreThisRound; BaseUIController.text.Show(string.Format(HOLocalizationConfiguration.GetValue(106), m_ScoreThisRound)); yield return(new WaitForSeconds(ConstantData.MissionFoulTimeWait)); for (int i = 0, count = m_PottedBallListThisRound.Count; i < count; i++) { m_PottedBallListThisRound[i].BackToPrevRoundState(); } } else { for (int i = 0, count = m_PottedBallListThisRound.Count; i < count; i++) { PoolBall pb = m_PottedBallListThisRound[i]; m_PottedBallList.Add(pb.GetBallID(), pb); } } m_PottedBallListThisRound.Clear(); if (CheckGameOver()) { State = GlobalState.GAMEOVER; if (onGameOver != null) { if (m_TargetBalls.Count == 0) { onGameOver(m_Player); } else if (m_Player.ShotsRemain == 0) { onGameOver(null); } } } else { TurnBegin(); } }
protected override bool HandleFouls() { //if cue ball enter the pocket if (m_WhiteBallPotted) { return(BaseUIController.text.Show(string.Format(HOLocalizationConfiguration.GetValue(409), CurrentPlayer.name))); } //time out if (m_TimeOut) { return(BaseUIController.text.Show(HOLocalizationConfiguration.GetValue(412))); } if (firstRound) { //if there is no at least 4 balls hit the wall if (m_HittingRailBallsCount < 4 && !m_CueBallHitRail && m_PottedBallListThisRound.Count == 0) { return(BaseUIController.text.Show(HOLocalizationConfiguration.GetValue(413))); } } else { //if (m_HittingRailBallsCount == 0 && m_PottedBallListThisRound.Count == 0 && m_WhiteHitBallType == BallType.NONE) return BaseUIController.text.Show("白球没到打到球"); //if cue ball desn't hit any balls after shotting if (!m_WhiteHitBall) { return(BaseUIController.text.Show(HOLocalizationConfiguration.GetValue(403))); } //if white ball doesn't hit the target type ball if ((m_WhiteHitBallType != CurrentPlayer.TargetBallType && CurrentPlayer.TargetBallType != BallType.NONE) || (CurrentPlayer.TargetBallType == BallType.NONE && m_WhiteHitBallType == BallType.BLACK)) { return(BaseUIController.text.Show(string.Format(HOLocalizationConfiguration.GetValue(408), CurrentPlayer.name))); } //it must be at least once that ball hitted the rail after first hitted if (m_WhiteHitBallType != BallType.NONE && m_HittingRailBallsCount == 0 && m_PottedBallListThisRound.Count == 0) { return(BaseUIController.text.Show(HOLocalizationConfiguration.GetValue(407))); } } return(false); }
public void AddCues(int cue, Vector3 position) { if (cue == 0) { return; } ShotsRemain += cue; Color c; string f = string.Format(HOLocalizationConfiguration.GetValue(113), cue); if (cue > 0) { c = Color.yellow; } else { m_PlayerData.Combo = 0; c = Color.red; } BaseUIController.GenerateTips(f, c, position); }
public void OnApplicationQuit() { m_Instance = null; }
void Start() { GetComponent <Text>().text = HOLocalizationConfiguration.GetValue(ID); }
public static void Show(int id) { Show(HOLocalizationConfiguration.GetValue(id)); }