コード例 #1
0
        /// <summary>
        /// Creates a NPCChatDialogViewNode as a child of this NPCChatDialogViewNode.
        /// </summary>
        /// <param name="response">The NPCChatResponseBase the child node will handle.</param>
        /// <returns>A NPCChatDialogViewNode as a child of this NPCChatDialogViewNode.</returns>
        NPCChatDialogViewNode CreateNode(NPCChatResponseBase response)
        {
            // Check if the node already exists
            var children = Nodes.OfType <NPCChatDialogViewNode>();
            var retNode  =
                children.FirstOrDefault(
                    x => x.ChatItemType == NPCChatDialogViewNodeItemType.Response && x.ChatItemAsResponse == response);

            if (retNode == null)
            {
                retNode = new NPCChatDialogViewNode(this, response);
            }

            return(retNode);
        }
コード例 #2
0
ファイル: NPCChatDialogForm.cs プロジェクト: wtfcolt/game
 public void UnsetResponse()
 {
     _response = null;
     Text = string.Empty;
 }
コード例 #3
0
ファイル: NPCChatDialogForm.cs プロジェクト: wtfcolt/game
            public void SetResponse(NPCChatResponseBase response, int index)
            {
                if (response == null)
                {
                    Debug.Fail("Parameter 'response' should never be null. Use UnsetResponse() instead.");
                    UnsetResponse();
                    return;
                }

                _response = response;
                Text = (index + 1) + ": " + Response.Text;
            }
コード例 #4
0
        /// <summary>
        /// Creates a NPCChatDialogViewNode as a child of this NPCChatDialogViewNode.
        /// </summary>
        /// <param name="response">The NPCChatResponseBase the child node will handle.</param>
        /// <returns>A NPCChatDialogViewNode as a child of this NPCChatDialogViewNode.</returns>
        NPCChatDialogViewNode CreateNode(NPCChatResponseBase response)
        {
            // Check if the node already exists
            var children = Nodes.OfType<NPCChatDialogViewNode>();
            var retNode =
                children.FirstOrDefault(
                    x => x.ChatItemType == NPCChatDialogViewNodeItemType.Response && x.ChatItemAsResponse == response);

            if (retNode == null)
                retNode = new NPCChatDialogViewNode(this, response);

            return retNode;
        }