예제 #1
0
    void Awake()
    {
        InitChatNode();
        InitOption();
        audioSource      = gameObject.AddComponent <AudioSource>();
        audioSource.loop = true;
        OptionArea       = GameObject.Find("OptionArea");
        ExecuteState();
        //注册切换事件
        EventManager.AddEvent <ChatType, string, Sprite, string>(NodeEvent.Execute_schat.ToString(), Execute_schat);
        EventManager.AddEvent <int>(NodeEvent.ChangeSelectID.ToString(), ChangeSelectID);
        EventManager.AddEvent <string>(NodeEvent.GetOptionTitle.ToString(), GetOptionTitle);
        EventManager.AddEvent <float>(NodeEvent.AllDelay.ToString(), AllDelay);
        EventManager.AddEvent <ChatType, string>(NodeEvent.Exeute_Event.ToString(), Exeute_Event);
        EventManager.AddEvent <ChatType, float>(NodeEvent.ChatDelay.ToString(), ChatDelay);


        EventManager.AddEvent(NodeEvent.ChangeGraph.ToString(), ChangeGraph);
        DontDestroyOnLoad(this.gameObject);
        //获取初始Node,开始执行
        if (dialogueGraph)
        {
            currentNode = dialogueGraph.MoveNext(out current);
        }
    }