UIDialog.TriggerDialog C# (CSharp) Method

TriggerDialog() public method

public TriggerDialog ( int stageNum, DialogTriggerPos pos, WindowEffectFinished func ) : bool
stageNum int
pos DialogTriggerPos
func WindowEffectFinished
return bool
    public bool TriggerDialog(int stageNum, DialogTriggerPos pos, WindowEffectFinished func)                //尝试触发一个对话,返回值是是否成功触发了对话(失败是对话触发过了或者此处没对话)
    {
        DialogEvent dialogEvent;
        if (!m_dialogEventMap.TryGetValue(new KeyValuePair<int,DialogTriggerPos>(stageNum, pos), out dialogEvent))
        {
            if (func != null)
                func();
            return false;
        }
		
        //若出现过的开始对话就不再出现
		if(pos == DialogTriggerPos.StageStart)
		{
			if(PlayerPrefs.GetInt("StageStartDialogFinished") >= stageNum)
			{
                if (func != null)
                    func();
                return false;
            }
            else
            {
                PlayerPrefs.SetInt("StageStartDialogFinished", stageNum);
            }
		}

        if (pos == DialogTriggerPos.StageEnd)
        {
            if (PlayerPrefs.GetInt("StageEndDialogFinished") >= stageNum)
            {
				if (func != null)
                func();
                return false;
            }
            else
            {
                PlayerPrefs.SetInt("StageEndDialogFinished", stageNum);
            }
        }

        if (dialogEvent.backPic == "None")
        {
            m_backPic.gameObject.SetActive(false);
        }
        else
        {
            m_backPic.gameObject.SetActive(true);
            m_backPic.spriteName = dialogEvent.backPic;
        }

        m_backPic.gameObject.SetActive(false);
		
        OpenDialog(dialogEvent.dialogGroupNum);                                 //触发对话
        m_afterDialogFunc = func;
        return true;
    }