Exemplo n.º 1
0
        public static Template FromDefault()
        {
            Template template = new Template();
            template.actorFields.Clear();
            template.actorFields.Add(new Field("Name", string.Empty, FieldType.Text));
            template.actorFields.Add(new Field("Pictures", "[]", FieldType.Files));
            template.actorFields.Add(new Field("Description", string.Empty, FieldType.Text));
            template.actorFields.Add(new Field("IsPlayer", "False", FieldType.Boolean));

            template.itemFields.Clear();
            template.itemFields.Add(new Field("Name", string.Empty, FieldType.Text));
            template.itemFields.Add(new Field("Pictures", "[]", FieldType.Files));
            template.itemFields.Add(new Field("Description", string.Empty, FieldType.Text));
            template.itemFields.Add(new Field("Is Item", "True", FieldType.Boolean));

            template.questFields.Clear();
            template.questFields.Add(new Field("Name", string.Empty, FieldType.Text));
            template.questFields.Add(new Field("Pictures", "[]", FieldType.Files));
            template.questFields.Add(new Field("Description", string.Empty, FieldType.Text));
            template.questFields.Add(new Field("Success Description", string.Empty, FieldType.Text));
            template.questFields.Add(new Field("Failure Description", string.Empty, FieldType.Text));
            template.questFields.Add(new Field("State", "unassigned", FieldType.Text));
            template.questFields.Add(new Field("Is Item", "False", FieldType.Boolean));

            template.locationFields.Clear();
            template.locationFields.Add(new Field("Name", string.Empty, FieldType.Text));
            template.locationFields.Add(new Field("Pictures", "[]", FieldType.Files));
            template.locationFields.Add(new Field("Description", string.Empty, FieldType.Text));

            template.variableFields.Add(new Field("Name", string.Empty, FieldType.Text));
            template.variableFields.Add(new Field("Initial Value", string.Empty, FieldType.Text));
            template.variableFields.Add(new Field("Description", string.Empty, FieldType.Text));

            template.conversationFields.Add(new Field("Title", string.Empty, FieldType.Text));
            template.conversationFields.Add(new Field("Pictures", "[]", FieldType.Files));
            template.conversationFields.Add(new Field("Description", string.Empty, FieldType.Text));
            template.conversationFields.Add(new Field("Actor", "0", FieldType.Actor));
            template.conversationFields.Add(new Field("Conversant", "0", FieldType.Actor));

            template.dialogueEntryFields.Add(new Field("Title", string.Empty, FieldType.Text));
            template.dialogueEntryFields.Add(new Field("Pictures", "[]", FieldType.Files));
            template.dialogueEntryFields.Add(new Field("Description", string.Empty, FieldType.Text));
            template.dialogueEntryFields.Add(new Field("Actor", string.Empty, FieldType.Actor));
            template.dialogueEntryFields.Add(new Field("Conversant", string.Empty, FieldType.Actor));
            template.dialogueEntryFields.Add(new Field("Menu Text", string.Empty, FieldType.Text));
            template.dialogueEntryFields.Add(new Field("Dialogue Text", string.Empty, FieldType.Text));
            template.dialogueEntryFields.Add(new Field("Parenthetical", string.Empty, FieldType.Text));
            template.dialogueEntryFields.Add(new Field("Audio Files", "[]", FieldType.Files));
            template.dialogueEntryFields.Add(new Field("Video File", string.Empty, FieldType.Text));
            template.dialogueEntryFields.Add(new Field("Sequence", string.Empty, FieldType.Text));

            if (EditorGUIUtility.isProSkin) {
                template.npcLineColor = new Color(0.75f, 0.25f, 0.25f);
                template.pcLineColor = new Color(0.25f, 0.5f, 1f);
            }

            return template;
        }
		/// <summary>
		/// Converts the source into a dialogue database. This method does housekeeping such
		/// as creating the empty asset and saving it at the end, but the main work is
		/// done in the CopySourceToDialogueDatabase() method that you must implement.
		/// </summary>
		protected virtual void Convert() {
			DialogueDatabase database = LoadOrCreateDatabase();
			if (database == null) {
				Debug.LogError(string.Format("{0}: Couldn't create asset '{1}'.", DialogueDebug.Prefix, prefs.databaseFilename));
			} else {
				if (template == null) template = Template.FromEditorPrefs();
				CopySourceToDialogueDatabase(database);
				TouchUpDialogueDatabase(database);
				EditorUtility.SetDirty(database);
				AssetDatabase.SaveAssets();
				Debug.Log(string.Format("{0}: Created database '{1}' containing {2} actors, {3} conversations, {4} items/quests, {5} variables, and {6} locations.", 
				                        DialogueDebug.Prefix, prefs.databaseFilename, database.actors.Count, database.conversations.Count, database.items.Count, database.variables.Count, database.locations.Count));
			}
		}