public IEnumerator DisplayTip(int index, float waitTime, bool waiting = false) { if (waiting) { while (instance.runningDisplay != null) { yield return(new WaitForSeconds(0.1f)); } } else { DisablePreviousTip(); } instance.tipsArea = GetComponentInChildren <Canvas>(); PopUp tip = instance.tips[index]; //DisablePreviousTips(); //tip.gameObject.SetActive(true); // Showing tip tip.transform.parent = instance.tipsArea.transform; tip.Display(); instance.currentPopUp = tip; yield return(new WaitForSeconds(waitTime)); // Closing tip tip.Close(); tip.transform.parent = gameObject.transform; instance.currentPopUp = null; instance.runningDisplay = null; }
private PopUp GetFeaturesPopUp() { var size = new CGSize(300, 300); var popup = new PopUp(size); var closeButton = new UIButton(UIButtonType.System); closeButton.Frame = new CGRect(90, popup.Frame.Height - 60, 120, 60); closeButton.Font = Font; closeButton.SetTitle("Close", UIControlState.Normal); closeButton.SetTitleColor(UIColor.Red, UIControlState.Normal); closeButton.TouchUpInside += (object sender, EventArgs e) => { popup.Close(); }; var titleLabel = new UILabel() { Frame = new CGRect(10, 10, 290, 50), Text = "Hello in custom popups!", Font = UIFont.FromName("Futura", 25), TextColor = UIColor.Blue }; var descriptionLabel = new UILabel() { Frame = new CGRect(10, 90, 290, 120), Text = "All features and avaiblities are avaible on our Github", Font = Font, TextColor = UIColor.Black }; descriptionLabel.LineBreakMode = UILineBreakMode.TailTruncation; descriptionLabel.Lines = 0; popup.AddSubview(titleLabel); popup.AddSubview(descriptionLabel); popup.AddSubview(closeButton); popup.OnOpen += () => { Debug.WriteLine("[INFO] PopUp is here!"); }; return(popup); }
// HACK FUTURE // Display tip group which checks if its a tip group public IEnumerator DisplayTips(int start, int end, float betweenTime, bool waiting = false) { // When we want to display tip after one that is currently shown if (waiting) { while (instance.runningDisplay != null) { yield return(new WaitForSeconds(0.1f)); } } else { DisablePreviousTip(); } instance.tipsArea = GetComponentInChildren <Canvas>(); //DisablePreviousTips(); for (int i = start; i <= end; i++) { // Calculations for how long to display text PopUp tip = instance.tips[i]; int characters = tip.text.text.Length; float words = characters / 5; // Average number of characters in word float waitTime = words / 300 * 60; // Average reading speed, seconds in minute // Activation //tip.gameObject.SetActive(true); tip.transform.parent = instance.tipsArea.transform; instance.currentPopUp = tip; tip.Display(); yield return(new WaitForSeconds(waitTime)); // De-activation tip.Close(); tip.transform.parent = gameObject.transform; yield return(new WaitForSeconds(betweenTime)); } instance.currentPopUp = null; instance.runningDisplay = null; }
private void OnClicked() { if (isTalking) { displayLength = localizedMessage.Length; textObj.text = localizedMessage; } else { PopUp popUp = messageBoxBase.GetComponent <PopUp>(); popUp.Close(() => { //// Debug.Log("Clicked on MessageDialog!"); if (this.onClickCallback != null) { this.onClickCallback(1); } }); } }
// Disabling tips when changing from one tip to the next within the same scene // there really should only be one tip private void DisablePreviousTip() { //foreach (PopUp tip in instance.tips) //{ // if (tip.IsShowing()) // { // tip.Close(); // tip.transform.parent = gameObject.transform; // } //} if (instance.currentPopUp != null && instance.runningDisplay != null) { PopUp tip = instance.currentPopUp; tip.Close(); tip.transform.parent = gameObject.transform; instance.currentPopUp = null; StopCoroutine(instance.runningDisplay); instance.runningDisplay = null; } }
// Use this for initialization void Start() { popUp.Close(); CoinUpdate = CoinCollect.RenderEnable; }
// Use this for initialization void Start() { popUp.Close(); }
public void OpenAdventureSelectionWindow() { AdventureSelectionWindow.Open(); MyButtonsOverlay.Close(); MyPopUp.Close(); }