void Update() { if (dialogQueue.Count > 0 && !canvas.activeSelf) { ok.onClick.RemoveAllListeners(); lock (dialogQueue) { ok.transform.Find("Text").GetComponent <Text>().text = Message.getText("ok"); WarnDialogInfo w = dialogQueue.Dequeue(); showButton(true, w.hideClose?false:true); instance.text.text = w.text; // instance.okAction = w.okAction; ok.onClick.AddListener(delegate() { Sound.playSound(SoundType.Click); canvas.SetActive(false); if (w.okAction != null) { w.okAction.Invoke(); } }); panelTras.localPosition = new Vector3(w.deltaX, w.deltaY, 0); openDialog(); w.state = DialogState.Showing; } } if (waitDialogQueue.Count > 0 && !canvas.activeSelf) { ok.onClick.RemoveAllListeners(); lock (waitDialogQueue) { ok.transform.Find("Text").GetComponent <Text>().text = Message.getText("cancel"); showButton(true, false); WaitDialogInfo w = waitDialogQueue.Dequeue(); if (w.state == DialogState.Cancel) { return; } instance.text.text = w.text; // instance.okAction = w.afterWaitAction; ok.onClick.AddListener(delegate() { Sound.playSound(SoundType.Click); WarnDialog.closeWaitDialog(w.id); if (w.cancelAction != null) { w.cancelAction.Invoke(); } }); openDialog(); w.state = DialogState.Showing; Job.startJob(new MyDelegate(afterWait), w.time, w); } } }
public static void showWarnDialog(string text, DialogOkAction dialogOkAction, bool hideClose, float deltaX, float deltaY) { WarnDialogInfo w = new WarnDialogInfo(); w.text = text; w.okAction = dialogOkAction; w.hideClose = hideClose; w.deltaX = deltaX; w.deltaY = deltaY; lock (dialogQueue) { dialogQueue.Enqueue(w); } }