1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- using UnityEngine;
- using System.Collections;
- public class UIRaceStart : MonoBehaviour {
- [SerializeField]
- private UIButton Ok;
- [SerializeField]
- private UIButton Cancel;
- [SerializeField]
- private UILabel Counter;
- public GameObject[] CountDown;
- //string _bannerAdUnitId = "58af783bbcd54f4a8586dff3b15eb4eb";
- //string _bannerAdUnitId = "1a553046db6a4cb2816f1f837c79fa19";
- string _bannerAdUnitId = "agltb3B1Yi1pbmNyDAsSBFNpdGUY6tERDA";
- internal void Start()
- {
- Ok.onClick.Add(new EventDelegate(OnOk));
- Cancel.onClick.Add(new EventDelegate(OnCancel));
- }
- private void OnOk()
- {
- if (!InstructionsHomeButtonHandler.FirstPlay)
- {
- InGameScriptCS.Instance.launchGame(); //start the gameplay
- //NGUIMenuScript.Instance.NGUIMenuScriptEnabled(false);
- }
- else
- {
- NGUIMenuScript.Instance.ShowMenu(NGUIMenuScript.NGUIMenus.InstructionsMenu);
- }
- NGUIMenuScript.Instance.CloseMenu(NGUIMenuScript.NGUIMenus.RaceStart);
- }
- private void OnCancel() { }
- public void OnShow()
- {
- if (AdwareRequest.HasAdware)
- {
- AdwareRequest.Show();
- StartCoroutine(EnableOK());
- Ok.gameObject.SetActive(false);
- }
- else
- {
- OnOk();
- }
- }
- private IEnumerator EnableOK()
- {
- var cntr = 3;
- while (cntr > 0)
- {
- cntr--;
- if (cntr < 0)
- {
- break;
- }
- else
- {
- for (int i = 0; i < 3; i++)
- {
- CountDown[i].SetActive(i == (cntr));
- }
- yield return new WaitForSeconds(1f);
- }
- }
- for (int i = 0; i < 3; i++)
- {
- CountDown[i].SetActive(false);
- }
- OnOk();
- //Ok.gameObject.SetActive(true);
- }
- }
|