Subversion Repository Public Repository

Nextrek

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
/*
 *
 *	Adventure Creator
 *	by Chris Burton, 2013-2014
 *	
 *	"SpeechLine.cs"
 * 
 *	This script is a data container for speech lines found by Speech Manager.
 *	Such data is used to provide translation support, as well as auto-numbering
 *	of speech lines for sound files.
 * 
 */

using UnityEngine;
using System.Collections.Generic;
using AC;

#if UNITY_EDITOR
using UnityEditor;
#endif

[System.Serializable]
public class SpeechLine
{
	
	public int lineID;
	public string scene;
	public string owner;
	public string text;
	public AC_TextType textType;
	
	public List<string> translationText = new List<string>();
	
	private GUIStyle style;
	
	
	public SpeechLine ()
	{
		lineID = 0;
		scene = "";
		owner = "";
		text = "";
		translationText = new List<string> ();
		textType = AC_TextType.Speech;
	}


	public SpeechLine (int _id, string _scene, string _text, int _languagues, AC_TextType _textType)
	{
		lineID = _id;
		scene = _scene;
		owner = "";
		text = _text;
		textType = _textType;
		
		translationText = new List<string>();
		for (int i=0; i<_languagues; i++)
		{
			translationText.Add (_text);
		}
	}
	
	
	public SpeechLine (int[] idArray, string _scene, string _text, int _languagues, AC_TextType _textType)
	{
		// Update id based on array
		lineID = 0;

		foreach (int _id in idArray)
		{
			if (lineID == _id)
				lineID ++;
		}

		scene = _scene;
		owner = "";
		text = _text;
		textType = _textType;
		
		translationText = new List<string>();
		for (int i=0; i<_languagues; i++)
		{
			translationText.Add (_text);
		}
	}
	
	
	public SpeechLine (int _id, string _scene, string _owner, string _text, int _languagues, AC_TextType _textType)
	{
		lineID = _id;
		scene = _scene;
		owner = _owner;
		text = _text;
		textType = _textType;
		
		translationText = new List<string>();
		for (int i=0; i<_languagues; i++)
		{
			translationText.Add (_text);
		}
	}
	
	
	public SpeechLine (int[] idArray, string _scene, string _owner, string _text, int _languagues, AC_TextType _textType)
	{
		// Update id based on array
		lineID = 0;
		foreach (int _id in idArray)
		{
			if (lineID == _id)
				lineID ++;
		}
		
		scene = _scene;
		owner = _owner;
		text = _text;
		textType = _textType;
		
		translationText = new List<string>();
		for (int i=0; i<_languagues; i++)
		{
			translationText.Add (_text);
		}
	}

	
	#if UNITY_EDITOR
	
	public void ShowGUI ()
	{
		style = new GUIStyle ();
		style.wordWrap = true;
		style.alignment = TextAnchor.MiddleLeft;
	
		EditorGUILayout.BeginHorizontal ();
			if (owner != "" && textType == AC_TextType.Speech)
			{
				EditorGUILayout.LabelField (owner, style, GUILayout.Width (70));
			}
			EditorGUILayout.LabelField (lineID.ToString (), style, GUILayout.MaxWidth (30));
			EditorGUILayout.LabelField ('"' + text + '"', style, GUILayout.MaxWidth (340));
		EditorGUILayout.EndHorizontal ();

		GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));
	}


	public string GetInfo ()
	{
		string info = textType.ToString ();

		if (owner != "")
		{
			info += " (" + owner + ")";
		}

		return info;
	}
	
	
	public string Print ()
	{
		string result = "Character: " + owner + "\nFilename: " + owner + lineID.ToString () + "\n";
		result += '"';
		result += text;
		result += '"';

		return (result);
	}
	
	#endif
	
}

Commits for Nextrek/SpaceCrew/SpaceCrew/Assets/AdventureCreator/Scripts/Speech/SpeechLine.cs

Diff revisions: vs.
Revision Author Commited Message
83 FMMortaroli picture FMMortaroli Tue 13 May, 2014 11:32:51 +0000