void OnGUI() { int padding = 20; int buttonHeight = 30; int buttonInterval = 50; int y = Screen.height / 2 - buttonHeight - buttonInterval / 2; GUI.color = Color.white; GUI.enabled = !needInit && !inited; if (GUI.Button(new Rect(padding, y, Screen.width - 2 * padding, buttonHeight), "Initialize")) { needInit = true; } y += buttonInterval + buttonHeight; GUI.enabled = MilkyFoxRewardedVideo.IsLoaded(); if (GUI.Button(new Rect(padding, y, Screen.width - 2 * padding, buttonHeight), "Show")) { MilkyFoxRewardedVideo.Show(); } y += buttonInterval + buttonHeight; GUI.enabled = true; GUI.color = Color.black; for (int i = messages.Count - 1; i >= 0 && i > (messages.Count - 10); i--) { GUI.Label(new Rect(padding, y, (Screen.width - 2 * padding), 20), (string)(messages[i])); y += 20; } }
void Update() { if (needInit) { needInit = false; inited = true; MilkyFoxRewardedVideo.Initialize(adUnit); MilkyFoxRewardedVideo.SetListener(this); } }