コード例 #1
0
    public void CreateNewConvesation()
    {
        //Create new conversation data class
        ConversationData conversationData = new ConversationData();

        conversationData.StepData = new List <StepData>();

        //Get an ID for conversation
        conversationData.ID = DataMart.GetConversationID();

        //Set any default values for the new conversation
        conversationData.NPCID = -1;

        //Set Conversation UI Field(s) with data from the new conversation
        ID.text    = conversationData.ID.ToString();
        NPCID.text = conversationData.NPCID.ToString();

        //Clear any old UI elements
        DestroyAllChildUIElements();

        //Clear listeners
        CreateStep.onClick.RemoveAllListeners();
        SaveButton.onClick.RemoveAllListeners();
        DeleteButton.onClick.RemoveAllListeners();

        //Setup Create Step button
        CreateStep.onClick.AddListener(delegate { CreateNewStep(conversationData); });

        //Setup Save button
        SaveButton.onClick.AddListener(delegate { SaveConversation(conversationData); });

        //Delete button
        DeleteButton.onClick.AddListener(delegate { DeleteConversation(conversationData); });
    }