示例#1
0
    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);
            }
        }
    }
示例#2
0
 public void afterWait(WaitDialogInfo waitDialogInfo)
 {
     if (waitDialogInfo.state == DialogState.Cancel)
     {
         return;
     }
     closeDialog(waitDialogInfo.id);
     if (waitDialogInfo.afterWaitAction != null)
     {
         waitDialogInfo.afterWaitAction.Invoke();
     }
 }
示例#3
0
    public static int showWaitDialog(string text, int time, AfterWaitAction afterWaitAction, DialogOkAction cancelAction)
    {
        WaitDialogInfo w = new WaitDialogInfo();

        w.text            = text;
        w.time            = time;
        w.afterWaitAction = afterWaitAction;
        w.id           = Interlocked.Increment(ref id);
        w.cancelAction = cancelAction;
        lock (waitDialogQueue) {
            waitDialogQueue.Enqueue(w);
            dialogInfos.Add(w.id, w);
        }
        return(w.id);
    }