public QuestNode(StringField id, StringField internalName, QuestNodeType nodeType, bool isOptional = false) { m_id = id; m_internalName = internalName; m_nodeType = nodeType; m_isOptional = isOptional; }
public CallbackArgs(CallbackType callbackType, int clickedIndex, QuestNodeState newState) { this.callbackType = callbackType; this.clickedIndex = -1; this.questNodeType = QuestNodeType.Success; this.mousePosition = Vector2.zero; this.newState = newState; }
public CallbackArgs(CallbackType callbackType, QuestNodeType questNodeType, Vector2 mousePosition, int clickedIndex) { this.callbackType = callbackType; this.clickedIndex = clickedIndex; this.questNodeType = questNodeType; this.mousePosition = mousePosition; this.newState = QuestNodeState.Inactive; }
public static GUIStyle GetNodeBarGUIStyle(QuestNodeType questNodeType) { switch (questNodeType) { case QuestNodeType.Start: return(GetNodeGUIStyle(true, StartBarColor, ref m_startBarGuiStyle)); case QuestNodeType.Success: return(GetNodeGUIStyle(true, SuccessBarColor, ref m_successBarGuiStyle)); case QuestNodeType.Failure: return(GetNodeGUIStyle(true, FailureBarColor, ref m_failureBarGuiStyle)); default: return(GetNodeGUIStyle(true, DefaultBarColor, ref m_defaultBarGuiStyle)); } }
public void CopyFrom(QuestNode node) { if (node == null) { Debug.LogWarning("Quest Machine: QuestNodeProxy.CopyFrom source is null."); return; } id = StringField.GetStringValue(node.id); intName = StringField.GetStringValue(node.internalName); type = node.nodeType; optional = node.isOptional; state = node.GetState(); speaker = StringField.GetStringValue(node.speaker); states = QuestStateInfoProxy.NewArray(node.stateInfoList); conds = new QuestConditionSetProxy(node.conditionSet); tags = new TagDictionary(node.tagDictionary); childIdx = node.childIndexList.ToArray(); r = QuestProxy.includeCanvasRect ? ((int)node.canvasRect.x + ";" + (int)node.canvasRect.y + ";" + (int)node.canvasRect.width + ";" + (int)node.canvasRect.height) : string.Empty; }
public QuestNode AddNode(QuestNode parent, string id, string internalName, QuestNodeType nodeType, bool isOptional = false) { return(AddNode(parent, new StringField(id), new StringField(internalName), nodeType, isOptional)); }
public QuestNode AddNode(QuestNode parent, StringField id, StringField internalName, QuestNodeType nodeType, bool isOptional = false) { if (parent == null) { if (Debug.isDebugBuild) { Debug.LogWarning("Quest Machine: QuestBuilder.AddNode must be provided a valid parent node."); } return(null); } if (parent.childIndexList == null) { return(null); } parent.childIndexList.Add(quest.nodeList.Count); var node = new QuestNode(id, internalName, nodeType, isOptional); node.canvasRect = new Rect(parent.canvasRect.x, parent.canvasRect.y + 20 + QuestNode.DefaultNodeHeight, QuestNode.DefaultNodeWidth, QuestNode.DefaultNodeHeight); quest.nodeList.Add(node); QuestStateInfo.ValidateStateInfoListCount(node.stateInfoList); QuestStateInfo.ValidateCategorizedContentListCount(node.stateInfoList[(int)QuestNodeState.Active].categorizedContentList); QuestStateInfo.ValidateCategorizedContentListCount(node.stateInfoList[(int)QuestNodeState.Inactive].categorizedContentList); QuestStateInfo.ValidateCategorizedContentListCount(node.stateInfoList[(int)QuestNodeState.True].categorizedContentList); return(node); }
public QuestTokenElement(QuestNodeType tokenNodeType) : base(tokenNodeType) { }
private void AddNode(QuestNodeType questNodeType, Vector2 mousePosition, int parentIndex) { var parentNodeProperty = (parentIndex >= 0) ? m_nodeListProperty.GetArrayElementAtIndex(parentIndex) : null; m_nodeListProperty.arraySize++; QuestEditorWindow.selectedNodeListIndex = m_nodeListProperty.arraySize - 1; var childIndex = m_nodeListProperty.arraySize - 1; var nodeProperty = m_nodeListProperty.GetArrayElementAtIndex(childIndex); UnityEngine.Assertions.Assert.IsNotNull(nodeProperty, "Quest Machine: Internal error - node property is null in AddNode()."); if (nodeProperty == null) { return; } var idProperty = nodeProperty.FindPropertyRelative("m_id"); UnityEngine.Assertions.Assert.IsNotNull(idProperty, "Quest Machine: Internal error - m_id property is null in AddNode()."); if (idProperty == null) { return; } var internalNameProperty = nodeProperty.FindPropertyRelative("m_internalName"); UnityEngine.Assertions.Assert.IsNotNull(internalNameProperty, "Quest Machine: Internal error - m_internalName property is null in AddNode()."); if (internalNameProperty == null) { return; } var stateProperty = nodeProperty.FindPropertyRelative("m_state"); UnityEngine.Assertions.Assert.IsNotNull(stateProperty, "Quest Machine: Internal error - m_state property is null in AddNode()."); if (stateProperty == null) { return; } var nodeTypeProperty = nodeProperty.FindPropertyRelative("m_nodeType"); UnityEngine.Assertions.Assert.IsNotNull(nodeTypeProperty, "Quest Machine: Internal error - m_nodeType property is null in AddNode()."); if (nodeTypeProperty == null) { return; } var isOptionalProperty = nodeProperty.FindPropertyRelative("m_isOptional"); UnityEngine.Assertions.Assert.IsNotNull(isOptionalProperty, "Quest Machine: Internal error - m_isOptional property is null in AddNode()."); if (isOptionalProperty == null) { return; } var stateInfoListProperty = nodeProperty.FindPropertyRelative("m_stateInfoList"); UnityEngine.Assertions.Assert.IsNotNull(stateInfoListProperty, "Quest Machine: Internal error - m_stateInfoList property is null in AddNode()."); if (stateInfoListProperty == null) { return; } var conditionSetProperty = nodeProperty.FindPropertyRelative("m_conditionSet"); UnityEngine.Assertions.Assert.IsNotNull(conditionSetProperty, "Quest Machine: Internal error - m_conditionSet property is null in AddNode()."); if (conditionSetProperty == null) { return; } var conditionListProperty = conditionSetProperty.FindPropertyRelative("m_conditionList"); UnityEngine.Assertions.Assert.IsNotNull(conditionListProperty, "Quest Machine: Internal error - m_conditionList property is null in AddNode()."); if (conditionListProperty == null) { return; } var conditionCountModeProperty = conditionSetProperty.FindPropertyRelative("m_conditionCountMode"); UnityEngine.Assertions.Assert.IsNotNull(conditionCountModeProperty, "Quest Machine: Internal error - m_conditionCountMode property is null in AddNode()."); if (conditionCountModeProperty == null) { return; } var canvasRectProperty = nodeProperty.FindPropertyRelative("m_canvasRect"); UnityEngine.Assertions.Assert.IsNotNull(canvasRectProperty, "Quest Machine: Internal error - m_canvasRect property is null in AddNode()."); if (canvasRectProperty == null) { return; } var initialName = (questNodeType == QuestNodeType.Success) ? "Success" : ((questNodeType == QuestNodeType.Failure) ? "Failure" : questNodeType.ToString() + " " + (m_nodeListProperty.arraySize - 1)); StringFieldDrawer.SetStringFieldValue(idProperty, initialName); StringFieldDrawer.SetStringFieldValue(internalNameProperty, string.Empty); stateProperty.enumValueIndex = (int)QuestState.WaitingToStart; nodeTypeProperty.enumValueIndex = (int)questNodeType; isOptionalProperty.boolValue = false; stateInfoListProperty.ClearArray(); conditionListProperty.ClearArray(); conditionCountModeProperty.enumValueIndex = (int)ConditionCountMode.All; ClearConnections(nodeProperty); var height = (questNodeType == QuestNodeType.Success || questNodeType == QuestNodeType.Failure) ? QuestEditorStyles.shortNodeHeight : QuestEditorStyles.nodeHeight; var rect = (parentNodeProperty != null) ? GetRectForNewChild(parentNodeProperty, height) : new Rect(mousePosition.x, mousePosition.y, QuestEditorStyles.nodeWidth, height); canvasRectProperty.rectValue = rect; if (parentNodeProperty != null) { AddConnection(parentIndex, childIndex); } }