本文整理汇总了C#中UnityEngine.TextAsset.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# TextAsset.ToString方法的具体用法?C# TextAsset.ToString怎么用?C# TextAsset.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.TextAsset
的用法示例。
在下文中一共展示了TextAsset.ToString方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LevelData
public LevelData(string pathToJson)
{
jsonFile = Resources.Load(pathToJson) as TextAsset;
platforms = new List<PlatformData> ();
IDictionary dictionary = (IDictionary) Json.Deserialize (jsonFile.ToString());
RXDebug.Log ("this is the json file: "+jsonFile.ToString());
IList platform_list = (IList) dictionary ["Platforms"];
setPlatformData (platform_list);
}
示例2: splitTheStrings
public void splitTheStrings(TextAsset theJourney)
{
string[] splitStrings = theJourney.ToString().Split(new string[]{"\r\n"}, StringSplitOptions.RemoveEmptyEntries);
//INITIALIZE ALL THE LISTS
int temp = splitStrings.Length;
Debug.Log(temp);
notes = new string[temp];
index = new int[temp];
killQuests = new string[temp];
killOptionals = new string[temp];
fetchQuests = new string[temp];
lootQuests = new string[temp];
payQuests = new string[temp];
readQiests = new string[temp];
for(int i=1; i< splitStrings.Length; i++) // Skip the title row
{
string[] columns = splitStrings[i].Split(new string[]{","}, StringSplitOptions.None);
//EACH COLUMN GETS PULLED INTO A DIFFERENT LIST
notes[i] = columns[0];
index[i] = int.Parse(columns[1]);
killQuests[i] = columns[2];
killOptionals[i] = columns[3];
fetchQuests[i] = columns[4];
lootQuests[i] = columns[5];
payQuests[i] = columns[6];
readQiests[i] = columns[7];
}
}
示例3: SpriteSheet
Vector2[] animation_scale; // dim.x/dim.y
// Constructor
public SpriteSheet(Material mat, TextAsset data) {
material = mat;
// Create an instance of StreamReader to read from a file.
string lines = data.ToString();
string[] line = lines.Split("\n"[0]);
int curLine = 0;
// Read and display lines from the file until the end of the file is reached.
animation_names = line[curLine].Split(","[0]);
curLine++;
animation_frames = ssTools.stringToVector2(line[curLine].Split("-"[0]));
curLine++;
animation_fps = ssTools.stringToFloat(line[curLine].Split(","[0]));
// Wrap mode
curLine++;
animation_wrap_mode = ssTools.stringToInt(line[curLine].Split(","[0]));
curLine++;
animation_play_on_wake = ssTools.stringToBool(line[curLine].Split(","[0]));
curLine++;
animation_offset = ssTools.stringToVector2(line[curLine].Split("-"[0]));
// Get xScale and yScale values
curLine++;
animation_scale = ssTools.stringToVector2(line[curLine].Split("-"[0]));
// Get image pixel dimensions. Used for scaling mesh at runtime.
curLine++;
animation_dimensions = ssTools.stringToVector2(line[curLine].Split("-"[0]));
}
示例4: sendText
public void sendText(TextAsset incoming) {
GetComponent<Text>().text = "";
textAsset = incoming;
chars = textAsset.ToString().ToCharArray();
max = chars.Length;
counter = 0;
lastLetter = false;
}
示例5: Awake
void Awake()
{
databattle = Resources.Load("data_battle") as TextAsset;
Debug.Log(databattle);
lstCharater = new Dictionary<int, GameObject>();
JObject data= JObject.Parse(databattle.ToString());
startdata = JsonConvert.DeserializeObject<ThuocTinh[]>(data["data"]["startData"].ToString());
stepdata = JsonConvert.DeserializeObject<StepData[]>(data["data"]["stepData"].ToString());
}
示例6: Parse
public static List<pointOfSail> Parse(TextAsset csvString)
{
//get the array of lines
List<pointOfSail> arrayPointOfSail = new List<pointOfSail>();
string[] arrayOfLines = csvString.ToString().Split ("\n" [0]);
//take each line, split by comma, and then populate list at that index
for (int i=0; i<arrayOfLines.Length; i++) {
string[] arrayOfStrings = arrayOfLines[i].Split(","[0]);
pointOfSail tempPOS = new pointOfSail(arrayOfStrings[0],float.Parse(arrayOfStrings[1]));
arrayPointOfSail.Add(tempPOS);
}
return arrayPointOfSail;
}
示例7: Parse
public List<List<string>> Parse(TextAsset csvString)
{
//get the array of lines
string[] arrayOfLines = csvString.ToString().Split ("\n" [0]);
//take each line, split by comma, and then populate list at that index
for (int i=0; i<arrayOfLines.Length; i++) {
string[] arrayOfStrings = arrayOfLines[i].Split(","[0]);
listOfStrings.Add (new List<string>());
for (int j=0; j<arrayOfStrings.Length; j++){
string temp = arrayOfStrings[j].Replace('|',',');
listOfStrings[i].Add (temp);
}
}
return listOfStrings;
}
示例8: Start
// Use this for initialization
void Start()
{
file = Resources.Load ("Puzzle") as TextAsset;
//This is the file to be used.
//if you want to use your own file. Right now you have to open it in unity
//and put the file in the resources folder and change its name to Puzzle
//MUST BE A .TXT FILE
stringArray = file.ToString ().Split ("\n" [0]);
//sr = new StreamReader (Resources.Load ("Puzzle"));
setup ();
zones.Add (zone1);
zones.Add (zone2);
zones.Add (zone3);
zones.Add (zone4);
zones.Add (zone5);
zones.Add (zone6);
zones.Add (zone7);
zones.Add (zone8);
zones.Add (zone9);
}
示例9: changeState
void changeState() {
//update textAsset object and set text object
curText = Resources.Load(myState.ToString()) as TextAsset;
text.text = curText.ToString();
}
示例10: ParseJSON
private static void ParseJSON(TextAsset json)
{
ParseJSONString(json.ToString());
}
示例11: LoadLanguageFile
private static void LoadLanguageFile(string languageId, TextAsset asset = null)
{
// load json file from Resources folder
if (asset == null)
asset = Resources.Load(dataDirectory + "text_" + languageId) as TextAsset;
// parse language data
if (asset != null)
{
Dictionary<string, string> languageData = _data[languageId];
JSONObject data = JSONObject.Parse(asset.ToString());
foreach (var item in data)
{
languageData[item.Key] = item.Value.Str;
}
}
}
示例12: LoadConfigFile
private static void LoadConfigFile(TextAsset asset = null)
{
// load config from Resources folder
if (asset == null)
asset = Resources.Load(dataDirectory + "languages") as TextAsset;
// parse config file
if (asset != null)
{
JSONObject data = JSONObject.Parse(asset.ToString());
foreach (var item in data)
{
if (item.Key == "languages")
{
var languageList = item.Value.Array;
foreach (var languageName in languageList)
{
AddLanguage(languageName.Str);
}
}
else if (item.Key == "standard")
{
_standardLanguage = item.Value.Str;
}
}
}
}