void Start() { OnStart(); Master.WaitAndDo(0.7f, () => { AdController.CheckAndShowAd(); }, this, true); }
public void ShowDialog(string dialogName, float duration = 0.4f, string[] agruments = null, System.Action onComplete = null, System.Action onCloseComplete = null, DialogController.ShowDialogType showDialogType = DialogController.ShowDialogType.FromTop, bool isBlockTouch = true, bool isTouchAnywhereToCloseDialog = false, bool isHightlight = true) { Master.WaitAndDo(0.7f, () => { AdController.CheckAndShowAd(); }, this, true); AdController.ShowBanner(); Dialog.root.SetActive(true); Dialog.blockTouch.SetActive(isBlockTouch); Dialog.blackPanel.SetActive(isHightlight); if (Dialog.listDialogShowing.Count > 0) { for (int i = 0; i < Dialog.listDialogShowing.Count; i++) { Dialog.listDialogShowing[i].GetComponent <UIPanel>().depth = 48 - i; } } GameObject pf_dialog = Master.GetGameObjectInPrefabs("UI/Dialogs/" + dialogName); GameObject dialog = NGUITools.AddChild(Dialog.root, pf_dialog); dialog.GetComponent <DialogController>().OnOpen(agruments, onCloseComplete); //dialog.SendMessage("OnOpen", agruments, SendMessageOptions.DontRequireReceiver); dialog.GetComponent <UIPanel>().alpha = 0; TweenAlpha.Begin(dialog, duration, 1); Dialog.listDialogShowing.Add(dialog); switch (showDialogType) { case DialogController.ShowDialogType.FromLeft: dialog.transform.position = pos[0].position; break; case DialogController.ShowDialogType.FromTop: dialog.transform.position = pos[1].position; break; case DialogController.ShowDialogType.FromRight: dialog.transform.position = pos[2].position; break; case DialogController.ShowDialogType.FromBottom: dialog.transform.position = pos[3].position; break; case DialogController.ShowDialogType.Center: dialog.transform.position = pos[4].position; break; } // dialog.transform.setUp dialog.transform.DOMove(pos[4].position, duration).SetUpdate(true).OnComplete(() => { //dialog.SendMessage("OnShowComplete", SendMessageOptions.DontRequireReceiver); dialog.GetComponent <DialogController>().OnShowComplete(); if (onComplete != null) { onComplete(); } }); }