private void SeparateNovelsAt(int start, int count) { Node[] originalNodes = ((VisualNovel)target).nodes; Node endNode = originalNodes[originalNodes.Length - 1]; foreach (NodeJoint j in endNode.joints) { VisualNovelEditor.ResetNodeJoint(j); endNode.window = new Rect(400, 400, endNode.window.width, endNode.window.height); } Node[] newNodes = Splice(originalNodes, 0, count, endNode); Node[] otherNodes = Splice(originalNodes, start, originalNodes.Length - (start), null); Debug.Log("New: " + newNodes.Length + " Other: " + otherNodes.Length); CreateNovel(0, newNodes); CreateNovel(1, otherNodes); }
private void DrawChoiceNode(Node n) { DrawPageNode(n); GUILayout.BeginVertical(_styles[StyledElement.Box], GUILayout.ExpandHeight(false)); GUIStyle foldoutStyle = new GUIStyle(EditorStyles.foldout); n.choicesShown = EditorGUILayout.Foldout(n.choicesShown, "Choices", EditorGUILayoutExtensions.ChangeTextColor(foldoutStyle, Color.white)); if (n.choices == null) { n.choices = new Choice[n.choiceCount]; } else { if (n.choiceCount != n.oldChoiceCount) { n.oldChoiceCount = n.choiceCount; n.ResetSize(); } } if (n.choicesShown) { c_canResetSize = true; GUILayout.BeginHorizontal(); GUILayout.Space(8f); GUILayout.Label("Choice Count", _styles[StyledElement.Label]); n.choiceCount = EditorGUILayout.IntField(n.choiceCount, _styles[StyledElement.TextField], GUILayout.MaxWidth(30f)); n.choiceCount = Mathf.Clamp(n.choiceCount, 1, Node.ChoiceLimit); if (n.choiceCount != n.oldChoiceCount && n.oldChoiceCount != 0) { //Debug.Log("CHANGE FROM " + n.oldChoiceCount + " TO " + n.choiceCount); n.oldChoiceCount = n.choiceCount; NodeJoint[] lostJoints = n.CalculateLostChoices(); foreach (NodeJoint joint in lostJoints) { VisualNovelEditor.ResetNodeJoint(joint); } } else if (n.oldChoiceCount == 0) { n.oldChoiceCount = n.choiceCount; } GUILayout.EndHorizontal(); for (int i = 0; i < n.choiceCount; i++) { GUILayout.BeginHorizontal(); GUILayout.Space(8f); GUILayout.Label("Choice " + (i + 1), _styles[StyledElement.Label]); n.choices[i].choiceText = GUILayout.TextField(n.choices[i].choiceText ?? "", _styles[StyledElement.TextField], GUILayout.MaxWidth(100f), GUILayout.MaxHeight(_styles[StyledElement.TextField].fixedHeight)); if (n.choices[i].choiceText != n.choices[i].oldChoiceText) { n.choices[i].oldChoiceText = n.choices[i].choiceText; n.ResetSize(); } GUILayout.EndHorizontal(); } } else { if (c_canResetSize) { c_canResetSize = false; n.ResetSize(); } } GUILayout.EndVertical(); }