// TEXT ADVANCED private Rect drawTextPhaseAdvanced(DialogueEditorPhaseObject phase, int y, int width) { Rect baseRect = new Rect(phase.position.x + 5, phase.position.y + y, width - 10, 0); if(phase.advanced){ Rect advancedRect = new Rect(baseRect.x + 5, baseRect.y + baseRect.height, baseRect.width - 10, 26); Rect separatorBox = new Rect(baseRect.x, baseRect.y + 2, baseRect.width, 298); if(isPro){ DialogueEditorGUI.drawInsetRect(separatorBox, 4); }else{ GUI.Box(DialogueEditorGUI.getOutlineRect(separatorBox, 1), string.Empty, DialogueEditorGUI.gui.GetStyle("box_inset")); } Rect titleBox = new Rect(baseRect.x + 5, baseRect.y + 8, baseRect.width - 10, 24); if(isPro){ DialogueEditorGUI.drawShadowedRect(titleBox, 3); }else{ GUI.Box(titleBox, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset")); } GUI.Label(new Rect(titleBox.x + 4, titleBox.y + 4, titleBox.width - 10, 20), "Advanced"); Rect varBox = new Rect(baseRect.x + 5, titleBox.yMax + 5, baseRect.width - 10 - 210 - 5, 26); if(isPro){ DialogueEditorGUI.drawShadowedRect(varBox,2); }else{ GUI.Box(varBox, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset")); } GUI.Label(new Rect(varBox.x + 6, varBox.y + 5, varBox.width - 10, 20), "Variables"); Rect globalVariableStringsRect = new Rect(varBox.xMax + 5, varBox.y + 3, 210, varBox.height - 6); if(GUI.Button(new Rect(globalVariableStringsRect.x + ((globalVariableStringsRect.width/3) * 0), globalVariableStringsRect.y, globalVariableStringsRect.width/3, globalVariableStringsRect.height), "Boolean", DialogueEditorGUI.gui.GetStyle("toolbar_left"))){phase.text += "<"+PhaseVarSubStrings.GLOBAL + PhaseVarSubStrings.BOOLEAN+">" + "0" + "</"+PhaseVarSubStrings.GLOBAL + PhaseVarSubStrings.BOOLEAN+">";} if(GUI.Button(new Rect(globalVariableStringsRect.x + ((globalVariableStringsRect.width/3) * 1), globalVariableStringsRect.y, globalVariableStringsRect.width/3, globalVariableStringsRect.height), "Float", DialogueEditorGUI.gui.GetStyle("toolbar_center"))){phase.text += "<"+PhaseVarSubStrings.GLOBAL + PhaseVarSubStrings.FLOAT+">" + "0" + "</"+PhaseVarSubStrings.GLOBAL + PhaseVarSubStrings.FLOAT+">";} if(GUI.Button(new Rect(globalVariableStringsRect.x + ((globalVariableStringsRect.width/3) * 2), globalVariableStringsRect.y, globalVariableStringsRect.width/3, globalVariableStringsRect.height), "String", DialogueEditorGUI.gui.GetStyle("toolbar_right"))){phase.text += "<"+PhaseVarSubStrings.GLOBAL + PhaseVarSubStrings.STRING+">" + "0" + "</"+PhaseVarSubStrings.GLOBAL + PhaseVarSubStrings.STRING+">";} /* Rect themeBox = new Rect(baseRect.x + 5, varBox.yMax + 5, baseRect.width - 10, 26); if(isPro){ DialogueEditorGUI.drawShadowedRect(themeBox,2); }else{ GUI.Box(themeBox, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset")); } GUI.Label(new Rect(themeBox.x + 6, themeBox.y + 5, themeBox.width - 10, 20), "Theme"); string[] themes = DialogueEditorDataManager.data.getThemeNames(); Rect themeBoxPopupRect = new Rect(themeBox.x + 47 + 5, themeBox.y+5, themeBox.width - 10 - 47 - 90, 20); phase.theme = EditorGUI.Popup(themeBoxPopupRect, phase.theme, themes); Rect newWindowToggleRect = new Rect(themeBoxPopupRect.xMax + 5, themeBoxPopupRect.y - 2, themeBoxPopupRect.width, 26); phase.newWindow = GUI.Toggle(newWindowToggleRect, phase.newWindow, "New Window"); */ Rect themeBox = new Rect(baseRect.x + 5, varBox.yMax + 5, baseRect.width - 10, 26); if(isPro){ DialogueEditorGUI.drawShadowedRect(themeBox,2); }else{ GUI.Box(themeBox, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset")); } GUI.Label(new Rect(themeBox.x + 4, themeBox.y + 5, 100, 20), "Theme:"); Rect themeTextFieldRect = new Rect(themeBox.x + 65, themeBox.y + 5, themeBox.width - 65 - 5 - 90, themeBox.height - 10); if(isPro){ DialogueEditorGUI.drawHighlightRect(themeTextFieldRect, 1, 1); }else{ GUI.Box(DialogueEditorGUI.getOutlineRect(themeTextFieldRect,1), string.Empty, DialogueEditorGUI.gui.GetStyle("box_inset")); } if(phase.theme == null) phase.theme = string.Empty; phase.theme = GUI.TextField(themeTextFieldRect, phase.theme); Rect newWindowToggleRect = new Rect(themeTextFieldRect.xMax + 5, themeTextFieldRect.y, 90, 26); phase.newWindow = GUI.Toggle(newWindowToggleRect, phase.newWindow, "New Window"); Rect nameRect = new Rect(themeBox.x, themeBox.yMax + 5, themeBox.width, 26); if(isPro){ DialogueEditorGUI.drawShadowedRect(nameRect,2); }else{ GUI.Box(nameRect, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset")); } GUI.Label(new Rect(nameRect.x + 4, nameRect.y + 5, 100, 20), "Name:"); Rect nameTextFieldRect = new Rect(nameRect.x + 65, nameRect.y + 5, nameRect.width - 65 - 5, nameRect.height - 10); if(isPro){ DialogueEditorGUI.drawHighlightRect(nameTextFieldRect, 1, 1); }else{ GUI.Box(DialogueEditorGUI.getOutlineRect(nameTextFieldRect,1), string.Empty, DialogueEditorGUI.gui.GetStyle("box_inset")); } if(phase.name == null) phase.name = string.Empty; phase.name = GUI.TextField(nameTextFieldRect, phase.name); Rect portraitRect = new Rect(nameRect.x, nameRect.yMax + 5, nameRect.width, 26); if(isPro){ DialogueEditorGUI.drawShadowedRect(portraitRect,2); }else{ GUI.Box(portraitRect, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset")); } GUI.Label(new Rect(portraitRect.x + 4, portraitRect.y + 5, 100, 20), "Portrait:"); Rect portraitTextFieldRect = new Rect(portraitRect.x + 65, portraitRect.y + 5, portraitRect.width - 65 - 5, portraitRect.height - 10); if(isPro){ DialogueEditorGUI.drawHighlightRect(portraitTextFieldRect, 1, 1); }else{ GUI.Box(DialogueEditorGUI.getOutlineRect(portraitTextFieldRect,1), string.Empty, DialogueEditorGUI.gui.GetStyle("box_inset")); } if(phase.portrait == null) phase.portrait = string.Empty; phase.portrait = GUI.TextField(portraitTextFieldRect, phase.portrait); Rect metadataRect = new Rect(portraitRect.x, portraitRect.yMax + 5, portraitRect.width, 26); if(isPro){ DialogueEditorGUI.drawShadowedRect(metadataRect,2); }else{ GUI.Box(metadataRect, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset")); } GUI.Label(new Rect(metadataRect.x + 4, metadataRect.y + 5, 100, 20), "Metadata:"); Rect metadataTextFieldRect = new Rect(metadataRect.x + 65, metadataRect.y + 5, metadataRect.width - 65 - 5, metadataRect.height - 10); if(isPro){ DialogueEditorGUI.drawHighlightRect(metadataTextFieldRect, 1, 1); }else{ GUI.Box(DialogueEditorGUI.getOutlineRect(metadataTextFieldRect,1), string.Empty, DialogueEditorGUI.gui.GetStyle("box_inset")); } if(phase.metadata == null) phase.metadata = string.Empty; phase.metadata = GUI.TextField(metadataTextFieldRect, phase.metadata); Rect audioRect = new Rect(metadataRect.x, metadataRect.yMax + 5, metadataRect.width, 48); if(isPro){ DialogueEditorGUI.drawShadowedRect(audioRect,2); }else{ GUI.Box(audioRect, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset")); } GUI.Label(new Rect(audioRect.x + 4, audioRect.y + 5, 100, 20), "Audio:"); Rect audioTextFieldRect = new Rect(audioRect.x + 65, audioRect.y + 5, audioRect.width - 65 - 5, 16); if(isPro){ DialogueEditorGUI.drawHighlightRect(audioTextFieldRect, 1, 1); }else{ GUI.Box(DialogueEditorGUI.getOutlineRect(audioTextFieldRect,1), string.Empty, DialogueEditorGUI.gui.GetStyle("box_inset")); } // FIX THIS SHIT //phase.audio = EditorGUI.ObjectField(audioFileFieldRect, phase.audio, typeof(AudioClip), false) as AudioClip; if(phase.audio == null) phase.audio = string.Empty; phase.audio = GUI.TextField(audioTextFieldRect, phase.audio); GUI.Label(new Rect(audioRect.x + 4, audioTextFieldRect.yMax + 5, 100, 20), "Delay:"); Rect audioDelayTextFieldRect = new Rect(audioRect.x + 65, audioTextFieldRect.yMax + 5, audioRect.width - 65 - 5, 16); if(isPro){ DialogueEditorGUI.drawHighlightRect(audioDelayTextFieldRect, 1, 1); }else{ GUI.Box(DialogueEditorGUI.getOutlineRect(audioDelayTextFieldRect,1), string.Empty, DialogueEditorGUI.gui.GetStyle("box_inset")); } phase.audioDelay = EditorGUI.FloatField(audioDelayTextFieldRect, phase.audioDelay, GUI.skin.GetStyle("textfield")); Rect phaseRect = phase.rect; Rect rectRect = new Rect(audioRect.x, audioRect.yMax + 5, audioRect.width, 50); if(isPro){ DialogueEditorGUI.drawShadowedRect(rectRect,2); }else{ GUI.Box(rectRect, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset")); } Rect xRect = new Rect(rectRect.x + 20, rectRect.y + 7, 100, 16); GUI.Label(new Rect(xRect.x - 15, xRect.y, xRect.width, xRect.height), "X"); Rect yRect = new Rect(rectRect.x + 20, rectRect.y + 7 + 16 + 5, 100, 16); GUI.Label(new Rect(yRect.x - 15, yRect.y, yRect.width, yRect.height), "Y"); Rect wRect = new Rect(rectRect.xMax - 106, rectRect.y + 7, 100, 16); GUI.Label(new Rect(wRect.x - 35, wRect.y, wRect.width, wRect.height), "Width"); Rect hRect = new Rect(rectRect.xMax - 106, rectRect.y + 7 + 16 + 5, 100, 16); GUI.Label(new Rect(hRect.x - 40, hRect.y, hRect.width, hRect.height), "Height"); if(isPro){ DialogueEditorGUI.drawHighlightRect(xRect, 1, 1); DialogueEditorGUI.drawHighlightRect(yRect, 1, 1); DialogueEditorGUI.drawHighlightRect(wRect, 1, 1); DialogueEditorGUI.drawHighlightRect(hRect, 1, 1); }else{ GUI.Box(DialogueEditorGUI.getOutlineRect(xRect,1), string.Empty, DialogueEditorGUI.gui.GetStyle("box_inset")); GUI.Box(DialogueEditorGUI.getOutlineRect(yRect,1), string.Empty, DialogueEditorGUI.gui.GetStyle("box_inset")); GUI.Box(DialogueEditorGUI.getOutlineRect(wRect,1), string.Empty, DialogueEditorGUI.gui.GetStyle("box_inset")); GUI.Box(DialogueEditorGUI.getOutlineRect(hRect,1), string.Empty, DialogueEditorGUI.gui.GetStyle("box_inset")); } phaseRect.x = EditorGUI.IntField(xRect, (int)phaseRect.x); phaseRect.y = EditorGUI.IntField(yRect, (int)phaseRect.y); phaseRect.width = EditorGUI.IntField(wRect, (int)phaseRect.width); phaseRect.height = EditorGUI.IntField(hRect, (int)phaseRect.height); //DialogueEditorGUI.drawHighlightRect(new Rect(rectRect.x + 40,rectRect.y + 5, 98, 32), 1, 1); //DialogueEditorGUI.drawHighlightRect(new Rect(rectRect.x + 178,rectRect.y + 5, 97, 32), 1, 1); //if(phase.rect == null) phase.rect = new Rect(0,0,0,0); //phase.rect = EditorGUI.RectField(DialogueEditorGUI.getOutlineRect(rectRect, -5), phase.rect); phase.rect = phaseRect; //Rect otherRect = new Rect(themeBox.x + themeBox.width + 5, themeBox.y, 100 - 15, themeBox.height); //DialogueEditorGUI.drawShadowedRect(otherRect); return new Rect(baseRect.x,baseRect.y,width, advancedRect.height + baseRect.height + 5); }else{ return new Rect(baseRect.x, baseRect.y, width, baseRect.height); } }
// draw TEXT private void drawTextPhase(DialogueEditorPhaseObject phase) { int advancedHeight = (phase.advanced) ? 303 : 0 ; Rect baseRect = drawTextPhaseBase(phase, 132 + advancedHeight); Rect textBoxRect = new Rect(baseRect.x + 5, baseRect.y + baseRect.height, baseRect.width - 10, 102); Rect textBoxTitleRect = new Rect(textBoxRect.x + 5, textBoxRect.y + 5, textBoxRect.width - 10- 100, 20); if(isPro){ DialogueEditorGUI.drawShadowedRect(textBoxRect); DialogueEditorGUI.drawShadowedRect(textBoxTitleRect, 2); }else{ GUI.Box(textBoxRect, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset")); GUI.Box(textBoxTitleRect, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset")); } GUI.Label(new Rect(textBoxTitleRect.x + 3, textBoxTitleRect.y + 2, textBoxTitleRect.width - 2, 20), "Text:"); //GUI.Box(DialogueEditorGUI.getOutlineRect(textBoxRect,1), string.Empty, DialogueEditorGUI.gui.GetStyle("box_inset")); Rect advancedButtonRect = new Rect(textBoxTitleRect.xMax + 5, textBoxRect.y + 6, 70, textBoxTitleRect.height); phase.advanced = GUI.Toggle(advancedButtonRect, phase.advanced, "Advanced"); Rect textFieldRect = new Rect(textBoxRect.x + 6, textBoxRect.y + 6 + textBoxTitleRect.height + 4, textBoxRect.width - 12, textBoxRect.height - textBoxTitleRect.height - 16); if(isPro){ DialogueEditorGUI.drawHighlightRect(textFieldRect, 1, 1); }else{ GUI.Box(DialogueEditorGUI.getOutlineRect(textFieldRect,1), string.Empty, DialogueEditorGUI.gui.GetStyle("box_inset")); } phase.text = GUI.TextArea(textFieldRect, phase.text); Rect outputButtonBackRect = new Rect(textBoxTitleRect.x + textBoxRect.width - 30, textBoxTitleRect.y, textBoxTitleRect.height, textBoxTitleRect.height); if(isPro){ DialogueEditorGUI.drawShadowedRect(outputButtonBackRect, 2); }else{ GUI.Box(outputButtonBackRect, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset")); } Rect outputButtonRect = new Rect(textBoxTitleRect.x + textBoxRect.width - 28, textBoxTitleRect.y + 2, 16, 16); drawOutputConnector(phase, new Vector2(outputButtonRect.x, outputButtonRect.y), 0); drawTextPhaseAdvanced(phase, 130, (int)baseRect.width); }
private void drawAsyncPhase(DialogueEditorPhaseObject phase) { drawPhaseBase(phase, 200, 200); }
// draw SEND MESSAGE private void drawSendMessagePhase(DialogueEditorPhaseObject phase) { Rect baseRect = drawPhaseBase(phase, 200, 135); Rect sendMessageRect = new Rect(baseRect.x + 5, baseRect.yMax, baseRect.width - 10, 105); Rect sendMessageTitleRect = new Rect(sendMessageRect.x + 5, sendMessageRect.y + 5, sendMessageRect.width - 10, 20); Rect messageInputRect = new Rect(sendMessageTitleRect.x + 2, sendMessageTitleRect.yMax + 5, sendMessageTitleRect.width - 4, 18); Rect metadataTitleRect = new Rect(sendMessageRect.x + 5, messageInputRect.yMax + 5, sendMessageRect.width - 10, 20); Rect metadataInputRect = new Rect(metadataTitleRect.x + 2, metadataTitleRect.yMax + 5, metadataTitleRect.width - 4, 18); if(isPro){ DialogueEditorGUI.drawShadowedRect(sendMessageRect); DialogueEditorGUI.drawShadowedRect(sendMessageTitleRect, 2); DialogueEditorGUI.drawHighlightRect(messageInputRect, 1, 1); DialogueEditorGUI.drawShadowedRect(metadataTitleRect); DialogueEditorGUI.drawHighlightRect(metadataInputRect, 1, 1); }else{ GUI.Box(sendMessageRect, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset")); GUI.Box(sendMessageTitleRect, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset")); GUI.Box(DialogueEditorGUI.getOutlineRect(messageInputRect,1), string.Empty, DialogueEditorGUI.gui.GetStyle("box_inset")); GUI.Box(metadataTitleRect, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset")); GUI.Box(DialogueEditorGUI.getOutlineRect(metadataInputRect,1), string.Empty, DialogueEditorGUI.gui.GetStyle("box_inset")); } GUI.Label(new Rect(sendMessageTitleRect.x + 2, sendMessageTitleRect.y + 2, sendMessageTitleRect.width, sendMessageTitleRect.height), "Message Name"); phase.messageName = GUI.TextField(messageInputRect, phase.messageName); GUI.Label(new Rect(metadataTitleRect.x + 2, metadataTitleRect.y + 2, metadataTitleRect.width, metadataTitleRect.height), "Metadata"); phase.metadata = GUI.TextField(metadataInputRect, phase.metadata); Rect outputButtonRect = new Rect(sendMessageTitleRect.x + sendMessageTitleRect.width - 18, sendMessageTitleRect.y + 2, 16, 16); drawOutputConnector(phase, new Vector2(outputButtonRect.x, outputButtonRect.y), 0); }
// draw SET VARIABLE private void drawSetVariablePhase(DialogueEditorPhaseObject phase) { Rect baseRect = drawVariablePhaseBase(phase, 288); Rect setEditorRect = new Rect(baseRect.x + 5, baseRect.yMax, baseRect.width - 10, 87); Rect setEditorTitleRect = new Rect(setEditorRect.x + 5, setEditorRect.y + 5, setEditorRect.width - 10, 20); if(isPro){ DialogueEditorGUI.drawShadowedRect(setEditorRect); DialogueEditorGUI.drawShadowedRect(setEditorTitleRect, 2); }else{ GUI.Box(DialogueEditorGUI.getOutlineRect(setEditorRect, 1), string.Empty, DialogueEditorGUI.gui.GetStyle("box_inset")); GUI.Box(DialogueEditorGUI.getOutlineRect(setEditorTitleRect, 1), string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset")); } GUI.Label(new Rect(setEditorTitleRect.x + 2, setEditorTitleRect.y + 2, setEditorTitleRect.width, 20), "Output"); Rect equationTypeRect = new Rect(setEditorTitleRect.x, setEditorTitleRect.yMax + 5, setEditorTitleRect.width, 25); Rect inputRect = new Rect(equationTypeRect.x, equationTypeRect.yMax + 5, equationTypeRect.width, 20); if(phase.variableType == VariableEditorTypes.Boolean){ //FOR BOOLEANS if(phase.variableSetEquation != VariableEditorSetEquation.Equals && phase.variableSetEquation != VariableEditorSetEquation.Toggle){ phase.variableSetEquation = VariableEditorSetEquation.Equals; } if(GUI.Toggle(new Rect(equationTypeRect.x + ((equationTypeRect.width*0.5f)*0),equationTypeRect.y,(equationTypeRect.width)*0.5f, 25), (phase.variableSetEquation == VariableEditorSetEquation.Equals), "=", DialogueEditorGUI.gui.GetStyle("toolbar_left"))){ phase.variableSetEquation = VariableEditorSetEquation.Equals; } if(GUI.Toggle(new Rect(equationTypeRect.x + ((equationTypeRect.width*0.5f)*1),equationTypeRect.y,(equationTypeRect.width)*0.5f, 25), (phase.variableSetEquation == VariableEditorSetEquation.Toggle), "Toggle", DialogueEditorGUI.gui.GetStyle("toolbar_right"))){ phase.variableSetEquation = VariableEditorSetEquation.Toggle; phase.variableSetValue = "toggle"; } }else if(phase.variableType == VariableEditorTypes.Float){ //FOR FLOATS if(phase.variableSetEquation != VariableEditorSetEquation.Equals && phase.variableSetEquation != VariableEditorSetEquation.Add && phase.variableSetEquation != VariableEditorSetEquation.Subtract && phase.variableSetEquation != VariableEditorSetEquation.Multiply && phase.variableSetEquation != VariableEditorSetEquation.Divide){ phase.variableSetEquation = VariableEditorSetEquation.Equals; } if(GUI.Toggle(new Rect(equationTypeRect.x + ((equationTypeRect.width*0.2f)*0),equationTypeRect.y,(equationTypeRect.width)*0.2f, 25), (phase.variableSetEquation == VariableEditorSetEquation.Equals), "=", DialogueEditorGUI.gui.GetStyle("toolbar_left"))){ phase.variableSetEquation = VariableEditorSetEquation.Equals; } if(GUI.Toggle(new Rect(equationTypeRect.x + ((equationTypeRect.width*0.2f)*1),equationTypeRect.y,(equationTypeRect.width)*0.2f, 25), (phase.variableSetEquation == VariableEditorSetEquation.Add), "+", DialogueEditorGUI.gui.GetStyle("toolbar_center"))){ phase.variableSetEquation = VariableEditorSetEquation.Add; } if(GUI.Toggle(new Rect(equationTypeRect.x + ((equationTypeRect.width*0.2f)*2),equationTypeRect.y,(equationTypeRect.width)*0.2f, 25), (phase.variableSetEquation == VariableEditorSetEquation.Subtract), "-", DialogueEditorGUI.gui.GetStyle("toolbar_center"))){ phase.variableSetEquation = VariableEditorSetEquation.Subtract; } if(GUI.Toggle(new Rect(equationTypeRect.x + ((equationTypeRect.width*0.2f)*3),equationTypeRect.y,(equationTypeRect.width)*0.2f, 25), (phase.variableSetEquation == VariableEditorSetEquation.Multiply), "x", DialogueEditorGUI.gui.GetStyle("toolbar_center"))){ phase.variableSetEquation = VariableEditorSetEquation.Multiply; } if(GUI.Toggle(new Rect(equationTypeRect.x + ((equationTypeRect.width*0.2f)*4),equationTypeRect.y,(equationTypeRect.width)*0.2f, 25), (phase.variableSetEquation == VariableEditorSetEquation.Divide), "/", DialogueEditorGUI.gui.GetStyle("toolbar_right"))){ phase.variableSetEquation = VariableEditorSetEquation.Divide; } }else if(phase.variableType == VariableEditorTypes.String){ // FOR STRINGS if(phase.variableSetEquation != VariableEditorSetEquation.Equals && phase.variableSetEquation != VariableEditorSetEquation.Add){ phase.variableSetEquation = VariableEditorSetEquation.Equals; } if(GUI.Toggle(new Rect(equationTypeRect.x + ((equationTypeRect.width*0.5f)*0),equationTypeRect.y,(equationTypeRect.width)*0.5f, 25), (phase.variableSetEquation == VariableEditorSetEquation.Equals), "=", DialogueEditorGUI.gui.GetStyle("toolbar_left"))){ phase.variableSetEquation = VariableEditorSetEquation.Equals; } if(GUI.Toggle(new Rect(equationTypeRect.x + ((equationTypeRect.width*0.5f)*1),equationTypeRect.y,(equationTypeRect.width)*0.5f, 25), (phase.variableSetEquation == VariableEditorSetEquation.Add), "+", DialogueEditorGUI.gui.GetStyle("toolbar_right"))){ phase.variableSetEquation = VariableEditorSetEquation.Add; } } if(phase.variableType == VariableEditorTypes.Boolean){ if(GUI.Toggle(new Rect(inputRect.x + ((inputRect.width*0.5f)*0),inputRect.y,(inputRect.width)*0.5f, inputRect.height), (phase.variableSetValue == "true"), "True", DialogueEditorGUI.gui.GetStyle("toolbar_left"))){ phase.variableSetValue = "true"; } if(GUI.Toggle(new Rect(inputRect.x + ((inputRect.width*0.5f)*1),inputRect.y,(inputRect.width)*0.5f, inputRect.height), (phase.variableSetValue == "false"), "False", DialogueEditorGUI.gui.GetStyle("toolbar_right"))){ phase.variableSetValue = "false"; } }else{ Rect newInputRect = new Rect(inputRect.x + 3, inputRect.y + 2, inputRect.width - 6, inputRect.height - 4); if(isPro){ DialogueEditorGUI.drawHighlightRect(newInputRect, 1, 1); }else{ GUI.Box(DialogueEditorGUI.getOutlineRect(newInputRect, 1), string.Empty, DialogueEditorGUI.gui.GetStyle("box_inset")); } if(phase.variableType == VariableEditorTypes.Float){ float floatVar; float.TryParse(phase.variableSetValue, out floatVar); phase.variableSetValue = EditorGUI.FloatField(newInputRect, floatVar).ToString(); }else{ phase.variableSetValue = GUI.TextField(newInputRect, phase.variableSetValue); } } Rect outputButtonRect = new Rect(setEditorTitleRect.x + setEditorTitleRect.width - 18, setEditorTitleRect.y + 2, 16, 16); drawOutputConnector(phase, new Vector2(outputButtonRect.x, outputButtonRect.y), 0); }
private void drawOutputConnector(DialogueEditorPhaseObject phase, Vector2 position, int outputIndex) { Rect outputButtonRect = new Rect(position.x, position.y, 16, 16); string outputButtonType = (phase.outs[outputIndex] != null) ? "connector_full" : "connector_empty" ; if(Event.current.type == EventType.MouseDown && outputButtonRect.Contains(Event.current.mousePosition)){ if (Event.current.button == 0){ phase.outs[outputIndex] = null; __outputSelection = new DialogueEditorSelectionObject(phase.id, outputIndex ); }else if (Event.current.button == 1){ phase.outs[outputIndex] = null; if(__outputSelection != null && __outputSelection.phaseId == phase.id && __outputSelection.outputIndex == outputIndex){ __outputSelection = null; } } } GUI.Button(outputButtonRect, string.Empty, DialogueEditorGUI.gui.GetStyle(outputButtonType)); }
// BASE private Rect drawPhaseBase(DialogueEditorPhaseObject phase, int width, int height) { Rect box = new Rect(phase.position.x, phase.position.y, width, height); GUI.Box(box, string.Empty, DialogueEditorGUI.gui.GetStyle("box_opaque")); Rect titleBarRect = new Rect(box.x + 2, box.y + 2, box.width - 4, 20); if(isPro){ DialogueEditorGUI.drawShadowedRect(titleBarRect, 2); }else{ GUI.Box(titleBarRect, string.Empty, DialogueEditorGUI.gui.GetStyle("box_opaque")); GUI.Box(titleBarRect, string.Empty, DialogueEditorGUI.gui.GetStyle("box_opaque")); } GUIStyle titleBarStyle = new GUIStyle("label"); titleBarStyle.alignment = TextAnchor.MiddleCenter; Vector2 mousePosition = Event.current.mousePosition; if(titleBarRect.Contains(mousePosition)){ if(isPro){ DialogueEditorGUI.drawHighlightRect(titleBarRect, 1, -1); }else{ GUI.Box(titleBarRect, string.Empty, DialogueEditorGUI.gui.GetStyle("box_opaque")); GUI.Box(titleBarRect, string.Empty, DialogueEditorGUI.gui.GetStyle("box_opaque")); } } if(isPro){ GUI.color = new Color(0,0,0,0.3f); GUI.Label(new Rect(titleBarRect.x + 1, titleBarRect.y, titleBarRect.width, titleBarRect.height), DialogueEditorPhaseType.getPhases()[(int)phase.type].name, titleBarStyle); } GUI.color = GUI.contentColor; GUI.Label(new Rect(titleBarRect.x, titleBarRect.y - 1, titleBarRect.width, titleBarRect.height), DialogueEditorPhaseType.getPhases()[(int)phase.type].name, titleBarStyle); // Input Rect inputButtonRect = new Rect(titleBarRect.x + 2, titleBarRect.y + 2, 16, 16); //if(Event.current.type == EventType.MouseUp && inputButtonRect.Contains(mousePosition)){ if(GUI.Button(inputButtonRect, string.Empty, DialogueEditorGUI.gui.GetStyle("connector_input"))){ handlePhaseInputClicked(phase.id); Event.current.Use(); } //GUI.Button(inputButtonRect, string.Empty, DialogueEditorGUI.gui.GetStyle("connector_input")); // Close Rect closeButtonRect = new Rect(titleBarRect.x + titleBarRect.width - 16 - 2, titleBarRect.y + 2, 16, 16); if(GUI.Button(closeButtonRect, string.Empty, DialogueEditorGUI.gui.GetStyle("phase_button_remove"))){ handlePhaseRemoveClick(phase.id); Event.current.Use(); } if(closeButtonRect.Contains(Event.current.mousePosition)){ setTooltip("This button deletes the current page.\nThis can NOT be undone."); } if(Event.current.type == EventType.MouseDown && titleBarRect.Contains(mousePosition)){ __dragSelection = new DialogueEditorDragPhaseObject(phase.id, new Vector2(titleBarRect.x - mousePosition.x, titleBarRect.y - mousePosition.y)); } return new Rect(box.x, box.y, width, 25); }
// draw CONDITIONAL private void drawConditionalPhase(DialogueEditorPhaseObject phase) { Rect baseRect = drawVariablePhaseBase(phase, 310); Rect ifRect = new Rect(baseRect.x + 5, baseRect.yMax, baseRect.width - 10, 110); Rect ifTitleRect = new Rect(ifRect.x + 5, ifRect.y + 5, ifRect.width - 10, 20); if(isPro){ DialogueEditorGUI.drawShadowedRect(ifRect); DialogueEditorGUI.drawShadowedRect(ifTitleRect, 2); }else{ GUI.Box(DialogueEditorGUI.getOutlineRect(ifRect, 1), string.Empty, DialogueEditorGUI.gui.GetStyle("box_inset")); GUI.Box(DialogueEditorGUI.getOutlineRect(ifTitleRect, 1), string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset")); } GUI.Label(new Rect(ifTitleRect.x + 2, ifTitleRect.y + 2, ifTitleRect.width, 20), "If"); Rect equationTypeRect = new Rect(ifTitleRect.x, ifTitleRect.yMax + 5, ifTitleRect.width, 25); Rect inputRect = new Rect(equationTypeRect.x, equationTypeRect.yMax + 5, equationTypeRect.width, 20); if(phase.variableType == VariableEditorTypes.Boolean){ //FOR BOOLEANS if(phase.variableGetEquation != VariableEditorGetEquation.Equals && phase.variableGetEquation != VariableEditorGetEquation.NotEquals){ phase.variableGetEquation = VariableEditorGetEquation.Equals; } if(phase.variableGetValue != "true" &&phase.variableGetValue != "false"){ phase.variableGetValue = "true"; } if(GUI.Toggle(new Rect(equationTypeRect.x + ((equationTypeRect.width*0.5f)*0),equationTypeRect.y,(equationTypeRect.width)*0.5f, 25), (phase.variableGetEquation == VariableEditorGetEquation.Equals), "==", DialogueEditorGUI.gui.GetStyle("toolbar_left"))){ phase.variableGetEquation = VariableEditorGetEquation.Equals; } if(GUI.Toggle(new Rect(equationTypeRect.x + ((equationTypeRect.width*0.5f)*1),equationTypeRect.y,(equationTypeRect.width)*0.5f, 25), (phase.variableGetEquation == VariableEditorGetEquation.NotEquals), "!=", DialogueEditorGUI.gui.GetStyle("toolbar_right"))){ phase.variableGetEquation = VariableEditorGetEquation.NotEquals; } }else if(phase.variableType == VariableEditorTypes.Float){ //FOR FLOATS if(phase.variableGetEquation != VariableEditorGetEquation.Equals && phase.variableGetEquation != VariableEditorGetEquation.NotEquals && phase.variableGetEquation != VariableEditorGetEquation.GreaterThan && phase.variableGetEquation != VariableEditorGetEquation.LessThan && phase.variableGetEquation != VariableEditorGetEquation.EqualOrGreaterThan && phase.variableGetEquation != VariableEditorGetEquation.EqualOrLessThan){ phase.variableGetEquation = VariableEditorGetEquation.Equals; } if(GUI.Toggle(new Rect(equationTypeRect.x + ((equationTypeRect.width/6)*0),equationTypeRect.y,(equationTypeRect.width)/6, 25), (phase.variableGetEquation == VariableEditorGetEquation.Equals), "==", DialogueEditorGUI.gui.GetStyle("toolbar_left"))){ phase.variableGetEquation = VariableEditorGetEquation.Equals; } if(GUI.Toggle(new Rect(equationTypeRect.x + ((equationTypeRect.width/6)*1),equationTypeRect.y,(equationTypeRect.width)/6, 25), (phase.variableGetEquation == VariableEditorGetEquation.NotEquals), "!=", DialogueEditorGUI.gui.GetStyle("toolbar_center"))){ phase.variableGetEquation = VariableEditorGetEquation.NotEquals; } if(GUI.Toggle(new Rect(equationTypeRect.x + ((equationTypeRect.width/6)*2),equationTypeRect.y,(equationTypeRect.width)/6, 25), (phase.variableGetEquation == VariableEditorGetEquation.GreaterThan), ">", DialogueEditorGUI.gui.GetStyle("toolbar_center"))){ phase.variableGetEquation = VariableEditorGetEquation.GreaterThan; } if(GUI.Toggle(new Rect(equationTypeRect.x + ((equationTypeRect.width/6)*3),equationTypeRect.y,(equationTypeRect.width)/6, 25), (phase.variableGetEquation == VariableEditorGetEquation.LessThan), "<", DialogueEditorGUI.gui.GetStyle("toolbar_center"))){ phase.variableGetEquation = VariableEditorGetEquation.LessThan; } if(GUI.Toggle(new Rect(equationTypeRect.x + ((equationTypeRect.width/6)*4),equationTypeRect.y,(equationTypeRect.width)/6, 25), (phase.variableGetEquation == VariableEditorGetEquation.EqualOrGreaterThan), ">=", DialogueEditorGUI.gui.GetStyle("toolbar_center"))){ phase.variableGetEquation = VariableEditorGetEquation.EqualOrGreaterThan; } if(GUI.Toggle(new Rect(equationTypeRect.x + ((equationTypeRect.width/6f)*5),equationTypeRect.y,(equationTypeRect.width)/6, 25), (phase.variableGetEquation == VariableEditorGetEquation.EqualOrLessThan), "<=", DialogueEditorGUI.gui.GetStyle("toolbar_right"))){ phase.variableGetEquation = VariableEditorGetEquation.EqualOrLessThan; } }else if(phase.variableType == VariableEditorTypes.String){ // FOR STRINGS if(phase.variableGetEquation != VariableEditorGetEquation.Equals && phase.variableGetEquation != VariableEditorGetEquation.NotEquals){ phase.variableGetEquation = VariableEditorGetEquation.Equals; } if(GUI.Toggle(new Rect(equationTypeRect.x + ((equationTypeRect.width*0.5f)*0),equationTypeRect.y,(equationTypeRect.width)*0.5f, 25), (phase.variableGetEquation == VariableEditorGetEquation.Equals), "==", DialogueEditorGUI.gui.GetStyle("toolbar_left"))){ phase.variableGetEquation = VariableEditorGetEquation.Equals; } if(GUI.Toggle(new Rect(equationTypeRect.x + ((equationTypeRect.width*0.5f)*1),equationTypeRect.y,(equationTypeRect.width)*0.5f, 25), (phase.variableGetEquation == VariableEditorGetEquation.NotEquals), "!=", DialogueEditorGUI.gui.GetStyle("toolbar_right"))){ phase.variableGetEquation = VariableEditorGetEquation.NotEquals; } } if(phase.variableType == VariableEditorTypes.Boolean){ if(GUI.Toggle(new Rect(inputRect.x + ((inputRect.width*0.5f)*0),inputRect.y,(inputRect.width)*0.5f, inputRect.height), (phase.variableSetValue == "true"), "True", DialogueEditorGUI.gui.GetStyle("toolbar_left"))){ phase.variableSetValue = "true"; } if(GUI.Toggle(new Rect(inputRect.x + ((inputRect.width*0.5f)*1),inputRect.y,(inputRect.width)*0.5f, inputRect.height), (phase.variableSetValue == "false"), "False", DialogueEditorGUI.gui.GetStyle("toolbar_right"))){ phase.variableSetValue = "false"; } }else{ Rect newInputRect = new Rect(inputRect.x + 3, inputRect.y + 2, inputRect.width - 6, 18); if(isPro){ DialogueEditorGUI.drawHighlightRect(newInputRect, 1, 1); }else{ GUI.Box(DialogueEditorGUI.getOutlineRect(newInputRect, 1), string.Empty, DialogueEditorGUI.gui.GetStyle("box_inset")); } if(phase.variableType == VariableEditorTypes.Float){ float floatVar; float.TryParse(phase.variableGetValue, out floatVar); phase.variableGetValue = EditorGUI.FloatField(newInputRect, floatVar).ToString(); }else{ phase.variableGetValue = GUI.TextField(newInputRect, phase.variableGetValue); } } Rect ifOutputButtonRect = new Rect(ifTitleRect.x + ifTitleRect.width - 18, ifTitleRect.y + 2, 16, 16); drawOutputConnector(phase, new Vector2(ifOutputButtonRect.x, ifOutputButtonRect.y), 0); Rect elseTitleRect = new Rect(ifTitleRect.x, ifRect.yMax - 25, ifTitleRect.width, ifTitleRect.height); if(isPro){ DialogueEditorGUI.drawShadowedRect(elseTitleRect); }else{ GUI.Box(DialogueEditorGUI.getOutlineRect(elseTitleRect, 1), string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset")); } GUI.Label(new Rect(elseTitleRect.x + 2, elseTitleRect.y + 2, elseTitleRect.width, elseTitleRect.height), "Else"); Rect elseOutputButtonRect = new Rect(elseTitleRect.x + elseTitleRect.width - 18, elseTitleRect.y + 2, 16, 16); drawOutputConnector(phase, new Vector2(elseOutputButtonRect.x, elseOutputButtonRect.y), 1); }
// draw END private void drawEndPhase(DialogueEditorPhaseObject phase) { int width = 100; int height = 24; drawPhaseBase(phase, width, height); }
public void drawDebugPhase(DialogueEditorPhaseObject phase) { drawPhaseBase(phase, 200, 200); }
// draw WAIT private void drawWaitPhase(DialogueEditorPhaseObject phase) { int width = 200; int height = 75; Rect baseRect = drawPhaseBase(phase, width, height); Rect contentRect = new Rect(baseRect.x + 5, baseRect.yMax, width - 10, height - baseRect.height - 5); Rect secondsRect = new Rect(contentRect.x, contentRect.y, contentRect.width * 0.3333f, 20); if(GUI.Toggle(secondsRect, (phase.waitType == DialogueEditorWaitTypes.Seconds), "Seconds", DialogueEditorGUI.gui.GetStyle("toolbar_left"))){phase.waitType = DialogueEditorWaitTypes.Seconds;} Rect framesRect = new Rect(contentRect.x + (contentRect.width *0.3333f), contentRect.y, contentRect.width * 0.3333f, 20); if(GUI.Toggle(framesRect, (phase.waitType == DialogueEditorWaitTypes.Frames), "Frames", DialogueEditorGUI.gui.GetStyle("toolbar_center"))){phase.waitType = DialogueEditorWaitTypes.Frames;} Rect onContinueRect = new Rect(contentRect.x + ((contentRect.width *0.3333f)*2), contentRect.y, contentRect.width * 0.3333f, 20); if(GUI.Toggle(onContinueRect, (phase.waitType == DialogueEditorWaitTypes.Continue), "Continue", DialogueEditorGUI.gui.GetStyle("toolbar_right"))){phase.waitType = DialogueEditorWaitTypes.Continue;} Rect waitTextFieldRect = new Rect(contentRect.x + 2, secondsRect.yMax + 5 + 2, contentRect.width - 4 - 20, 16); if(isPro){ DialogueEditorGUI.drawHighlightRect(waitTextFieldRect, 1, 1); }else{ GUI.Box(DialogueEditorGUI.getOutlineRect(waitTextFieldRect,1), string.Empty, DialogueEditorGUI.gui.GetStyle("box_inset")); } if(phase.waitType == DialogueEditorWaitTypes.Continue){ if(isPro){ DialogueEditorGUI.drawShadowRect(waitTextFieldRect, 2, 0); }else{ GUI.Box(DialogueEditorGUI.getOutlineRect(waitTextFieldRect,1), string.Empty, DialogueEditorGUI.gui.GetStyle("box_inset")); } GUI.color = new Color(1,1,1,0.25f); GUI.Label(new Rect(waitTextFieldRect.x + 1, waitTextFieldRect.y, waitTextFieldRect.width, waitTextFieldRect.height), phase.waitDuration.ToString()); GUI.color = GUI.contentColor; }else{ if(phase.waitType == DialogueEditorWaitTypes.Seconds){ phase.waitDuration = EditorGUI.FloatField(waitTextFieldRect, phase.waitDuration); }else{ phase.waitDuration = (float)EditorGUI.IntField(waitTextFieldRect, (int)phase.waitDuration); } } Rect outputButtonRect = new Rect(waitTextFieldRect.xMax + 5, waitTextFieldRect.y, 16, 16); drawOutputConnector(phase, new Vector2(outputButtonRect.x, outputButtonRect.y), 0); }
// VARIABLE BASE private Rect drawVariablePhaseBase(DialogueEditorPhaseObject phase, int height) { int width = 300; Rect baseRect = drawPhaseBase(phase, width, height); DialogueEditorVariablesContainer variables; if(phase.variableScope == VariableEditorScopes.Global){ if(phase.variableType == VariableEditorTypes.Float){ variables = DialogueEditorDataManager.data.globals.floats; }else if(phase.variableType == VariableEditorTypes.String){ variables = DialogueEditorDataManager.data.globals.strings; } else{ variables = DialogueEditorDataManager.data.globals.booleans; } }else{ if(phase.variableType == VariableEditorTypes.Float){ variables = DialogueEditorDataManager.data.dialogues[DialogueEditorDataManager.data.currentDialogueId].floats; }else if(phase.variableType == VariableEditorTypes.String){ variables = DialogueEditorDataManager.data.dialogues[DialogueEditorDataManager.data.currentDialogueId].strings; } else{ variables = DialogueEditorDataManager.data.dialogues[DialogueEditorDataManager.data.currentDialogueId].booleans; } } Rect topRowRect = new Rect(baseRect.x + 5,baseRect.yMax,width - 10, 25); if(GUI.Toggle(new Rect(topRowRect.x,topRowRect.y,(width - 10)*0.5f, 25), (phase.variableScope == VariableEditorScopes.Global), "Global", DialogueEditorGUI.gui.GetStyle("toolbar_left"))){ phase.variableScope = VariableEditorScopes.Global; if(phase.variableId >= variables.variables.Count) phase.variableId = 0; } if(GUI.Toggle(new Rect(topRowRect.x + (topRowRect.width*0.5f),topRowRect.y,(width - 10)*0.5f, 25), (phase.variableScope == VariableEditorScopes.Local), "Local", DialogueEditorGUI.gui.GetStyle("toolbar_right"))){ phase.variableScope = VariableEditorScopes.Local; if(phase.variableId >= variables.variables.Count) phase.variableId = 0; } Rect typesRect = new Rect(topRowRect.x, topRowRect.yMax + 5, width - 10, 25); Rect typeBooleanToggleRect = new Rect(typesRect.x, typesRect.y, typesRect.width * 0.33333f, typesRect.height); Rect typeFloatToggleRect = new Rect(typesRect.x + (typesRect.width * 0.33333f), typesRect.y, typesRect.width * 0.33333f, typesRect.height); Rect typeStringToggleRect = new Rect(typesRect.x + ((typesRect.width * 0.33333f)*2), typesRect.y, typesRect.width * 0.33333f, typesRect.height); if(GUI.Toggle(typeBooleanToggleRect, (phase.variableType == VariableEditorTypes.Boolean), "Booleans", DialogueEditorGUI.gui.GetStyle("toolbar_left"))){ phase.variableType = VariableEditorTypes.Boolean; if(phase.variableId >= variables.variables.Count) phase.variableId = 0; } if(GUI.Toggle(typeFloatToggleRect, (phase.variableType == VariableEditorTypes.Float), "Floats", DialogueEditorGUI.gui.GetStyle("toolbar_center"))){ phase.variableType = VariableEditorTypes.Float; if(phase.variableId >= variables.variables.Count) phase.variableId = 0; } if(GUI.Toggle(typeStringToggleRect, (phase.variableType == VariableEditorTypes.String), "Strings", DialogueEditorGUI.gui.GetStyle("toolbar_right"))){ phase.variableType = VariableEditorTypes.String; if(phase.variableId >= variables.variables.Count) phase.variableId = 0; } // ------------------ SCROLL BOX // VISUALS Rect scrollRect = new Rect(typesRect.x + 2,typesRect.yMax + 7,width - 14, 100); if(isPro){ GUI.color = GUI.contentColor; GUI.Box(new Rect(scrollRect.x - 2, scrollRect.y - 2, scrollRect.width + 4, scrollRect.height + 4), string.Empty); GUI.color = Color.black; GUI.Box(new Rect(scrollRect.x - 1, scrollRect.y - 1, scrollRect.width +2, scrollRect.height + 2), string.Empty); GUI.Box(new Rect(scrollRect.x - 1, scrollRect.y - 1, scrollRect.width +2, scrollRect.height + 2), string.Empty); GUI.Box(new Rect(scrollRect.x - 1, scrollRect.y - 1, scrollRect.width +2, scrollRect.height + 2), string.Empty); GUI.Box(new Rect(scrollRect.x - 1, scrollRect.y - 1, scrollRect.width +2, scrollRect.height + 2), string.Empty); GUI.color = GUI.contentColor; }else{ GUI.Box(DialogueEditorGUI.getOutlineRect(scrollRect, 1), string.Empty, DialogueEditorGUI.gui.GetStyle("box_inset")); } // MOUSE HANDLING int rowHeight = 20; int rowSpacing = (EditorGUIUtility.isProSkin) ? 1 : -1; int newScrollHeight = (scrollRect.height > ((rowHeight + rowSpacing)*variables.variables.Count)) ? (int)scrollRect.height : (rowHeight + rowSpacing)*variables.variables.Count; Rect scrollContentRect = new Rect(0, 0, scrollRect.width - 15, newScrollHeight); Vector2 mouseClickPosition = Vector2.zero; if(Event.current.type == EventType.MouseDown && Event.current.button == 0 && scrollRect.Contains(Event.current.mousePosition)){ mouseClickPosition = new Vector2(Event.current.mousePosition.x - scrollRect.x - 3, Event.current.mousePosition.y - scrollRect.y - 3 + phase.variableScrollPosition.y); } //START SCROLL VIEW phase.variableScrollPosition = GUI.BeginScrollView(scrollRect, phase.variableScrollPosition, scrollContentRect, false, true); GUI.color = (isPro)? new Color(1,1,1,0.25f) : new Color(1,1,1,0.1f); GUI.DrawTextureWithTexCoords( scrollContentRect, DialogueEditorGUI.scrollboxBgTexture, new Rect(0, 0, scrollContentRect.width / DialogueEditorGUI.scrollboxBgTexture.width, scrollContentRect.height / DialogueEditorGUI.scrollboxBgTexture.height) ); GUI.color = GUI.contentColor; for(int i = 0; i<variables.variables.Count; i+=1){ Rect row = new Rect(0,0+((rowHeight + rowSpacing)*i),scrollRect.width - 15,20); if(mouseClickPosition != Vector2.zero && row.Contains(mouseClickPosition)){ phase.variableId = i; } GUI.color = new Color(1,1,1,0.5f); GUI.Box(row, string.Empty); if(i == phase.variableId){ if(isPro){ GUI.color = GUI.contentColor; GUI.Box(row, string.Empty); GUI.Box(row, string.Empty); }else{ GUI.Box(row, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset")); GUI.Box(row, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset")); } } if(row.Contains(Event.current.mousePosition)){ if(isPro){ GUI.color = Color.black; GUI.Box(new Rect(row.x - 1, row.y - 1, row.width + 2, row.height + 2), string.Empty); }else{ GUI.color = Color.white; GUI.Box(row, string.Empty); GUI.Box(row, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset")); GUI.Box(row, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset")); } } GUI.color = GUI.contentColor; Rect labelNumberRow = new Rect(row.x + 2, row.y + 2, row.width - 4, row.height - 4); Rect labelNameRow = new Rect(labelNumberRow.x + 25, labelNumberRow.y, labelNumberRow.width - 25, labelNumberRow.height); GUI.Label(labelNumberRow, variables.variables[i].id.ToString()); string labelNameText = (variables.variables[i].name != string.Empty) ? variables.variables[i].name : string.Empty; GUI.Label(labelNameRow, labelNameText); GUI.color = new Color(1,1,1,0.5f); GUI.Label(labelNameRow, (variables.variables[i].variable != string.Empty) ? labelNameText+": "+variables.variables[i].variable : string.Empty); GUI.color = GUI.contentColor; } // END SCROLL VIES GUI.EndScrollView(); Rect outputRect = new Rect(baseRect.x,baseRect.y,width,195); //DialogueEditorGUI.drawShadowedRect(outputRect); return outputRect; }
// TEXT BASE private Rect drawTextPhaseBase(DialogueEditorPhaseObject phase, int height) { int width = 300; Rect baseRect = drawPhaseBase(phase, width, height); return new Rect(baseRect.x, baseRect.y, width, baseRect.height); }
// draw BRANCHED TEXT private void drawBranchedTextPhase(DialogueEditorPhaseObject phase) { int choiceRectHeight = 55; int advancedHeight = (phase.advanced) ? 303 : 0 ; Rect baseRect = drawTextPhaseBase(phase, 132 + advancedHeight + ((choiceRectHeight + 5)*phase.outs.Count)); Rect textBoxRect = new Rect(baseRect.x + 5, baseRect.y + baseRect.height, baseRect.width - 10, 102); Rect textBoxTitleRect = new Rect(textBoxRect.x + 5, textBoxRect.y + 5, textBoxRect.width - 10 - 105 - 80, 20); if(isPro){ DialogueEditorGUI.drawShadowedRect(textBoxRect); DialogueEditorGUI.drawShadowedRect(textBoxTitleRect, 2); }else{ GUI.Box(textBoxRect, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset")); GUI.Box(textBoxTitleRect, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset")); } GUI.Label(new Rect(textBoxTitleRect.x + 3, textBoxTitleRect.y + 2, textBoxTitleRect.width - 2, 20), "Body Text"); Rect textFieldRect = new Rect(textBoxRect.x + 6, textBoxRect.y + 4 + textBoxTitleRect.height + 6, textBoxRect.width - 12, textBoxRect.height - textBoxTitleRect.height - 16); if(isPro){ DialogueEditorGUI.drawHighlightRect(textFieldRect, 1, 1); }else{ GUI.Box(DialogueEditorGUI.getOutlineRect(textFieldRect,1), string.Empty, DialogueEditorGUI.gui.GetStyle("box_inset")); } phase.text = GUI.TextArea(textFieldRect, phase.text); Rect advancedButtonRect = new Rect(textBoxTitleRect.xMax + 5, textBoxRect.y + 6, 70, textBoxTitleRect.height); phase.advanced = GUI.Toggle(advancedButtonRect, phase.advanced, "Advanced"); Rect buttonsRect = new Rect(baseRect.xMax - 110, textBoxTitleRect.y, 100, 20); Rect addButtonRect = new Rect(buttonsRect.x, buttonsRect.y, buttonsRect.width * 0.5f, buttonsRect.height); if(phase.outs.Count < 10){ if(GUI.Button(addButtonRect, "Add", DialogueEditorGUI.gui.GetStyle("toolbar_left"))){ phase.addNewChoice(); } }else{ GUI.color = new Color(1,1,1,0.5f); GUI.Button(addButtonRect, "Add", DialogueEditorGUI.gui.GetStyle("toolbar_left")); GUI.color = GUI.contentColor; } Rect removeButtonRect = new Rect(buttonsRect.x + (buttonsRect.width * 0.5f), buttonsRect.y, buttonsRect.width * 0.5f, buttonsRect.height); if(phase.outs.Count > 2){ if(GUI.Button(removeButtonRect, "Remove", DialogueEditorGUI.gui.GetStyle("toolbar_right"))){ phase.removeChoice(); } }else{ GUI.color = new Color(1,1,1,0.5f); GUI.Button(removeButtonRect, "Remove", DialogueEditorGUI.gui.GetStyle("toolbar_right")); GUI.color = GUI.contentColor; } for(int i = 0; i < phase.outs.Count; i += 1){ Rect outerChoiceRect = new Rect(baseRect.x + 5, textBoxRect.yMax + 5 + ((choiceRectHeight + 5) * i), baseRect.width - 10, choiceRectHeight); Rect choiceTitleRect = new Rect(outerChoiceRect.x + 5, outerChoiceRect.y + 5, outerChoiceRect.width - 10, 20); if(isPro){ DialogueEditorGUI.drawShadowedRect(outerChoiceRect); DialogueEditorGUI.drawShadowedRect(choiceTitleRect, 2); }else{ GUI.Box(outerChoiceRect, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset")); GUI.Box(choiceTitleRect, string.Empty, DialogueEditorGUI.gui.GetStyle("box_outset")); } GUI.Label(new Rect(choiceTitleRect.x + 2, choiceTitleRect.y + 2, choiceTitleRect.width, choiceTitleRect.height), "Choice "+(i+1)); Rect choiceRect = new Rect(choiceTitleRect.x + 2,choiceTitleRect.yMax + 5 + 2,choiceTitleRect.width - 4,17); if(isPro){ DialogueEditorGUI.drawHighlightRect(choiceRect, 1, 1); }else{ GUI.Box(DialogueEditorGUI.getOutlineRect(choiceRect,1), string.Empty, DialogueEditorGUI.gui.GetStyle("box_inset")); } phase.choices[i] = GUI.TextField(choiceRect, phase.choices[i]); Rect outputButtonRect = new Rect(choiceTitleRect.x + choiceTitleRect.width - 18, choiceTitleRect.y + 2, 16, 16); drawOutputConnector(phase, new Vector2(outputButtonRect.x, outputButtonRect.y), i); } drawTextPhaseAdvanced(phase, 130 + (phase.outs.Count * 60), (int)baseRect.width); }