private string ComputeRandomName() { Dictionary <string, string[]> categoryElements = TextGenerator.FetchCategories(nameData.text); string template = TextGenerator.PickRandom("template", categoryElements); return(TextGenerator.Format(template, ingredients)); }
private InfoData CreateInfo(string template, Dictionary <string, string[]> categoryElements, Dictionary <int, string> tags) { string[] templateElements = template.Split(new char[] { ' ' }, 4); string code = templateElements[0]; bool isAffirmative = templateElements[1] == "+" ? true : false; bool hasImpact = templateElements[2] == "I" ? true : false; string text = TextGenerator.Format(templateElements[3], categoryElements); int tagCode = int.Parse(code.Substring(0, 1)); string tag = tags[tagCode]; InfoData newData = new InfoData(text, code, isAffirmative, hasImpact, tag); return(newData); }
private PostData CreatePost(string template, Dictionary <string, string[]> categoryElements, Dictionary <string, string[]> nameCategoryElements) { string[] templateElements = template.Split(new char[] { ' ' }, 4); string code = templateElements[0]; bool isAffirmative = templateElements[1] == "+" ? true : false; bool hasImpact = templateElements[2] == "I" ? true : false; string text = TextGenerator.Format(templateElements[3], categoryElements); bool isFake = false; string[] nameTemplates = nameCategoryElements["template"]; string rawAuthorName = nameTemplates[Random.Range(0, nameTemplates.Length)]; string authorName = TextGenerator.Format(rawAuthorName, nameCategoryElements); Sprite avatar = avatars[Random.Range(0, avatars.Count)]; PostData newData = new PostData(text, code, isAffirmative, hasImpact, isFake, authorName, avatar); return(newData); }