private List <VoiceActor> Fetch() { var voiceActors = new List <VoiceActor>(); ExcelPackage.LicenseContext = LicenseContext.NonCommercial; using (var excelPackage = new ExcelPackage(new FileInfo(this._sourceFiile))) { var worksheet = excelPackage.Workbook.Worksheets["VoiceActors"]; for (var i = 2; i <= worksheet.Dimension.End.Row; ++i) { var voiceActor = new VoiceActor() { Name = worksheet.Cells[i, 1].GetValue <string>(), NameKanji = worksheet.Cells[i, 2].GetValue <string>(), }; if (string.IsNullOrEmpty(voiceActor.NameKanji)) { voiceActor.NameKanji = null; } voiceActors.Add(voiceActor); } } return(voiceActors); }
// Start is called before the first frame update void Start() { //AudioSourceコンポーネントを取得し、変数に格納 Gays = GetComponent <AudioSource>(); selector = gameObject.GetComponent <VoiceSelector>(); actor = gameObject.GetComponent <VoiceActor>(); //TimeLimiter = gameObject.AddComponent<TimeController>(); //TimeLimiter.limit = 10; //TimeLimiter.effect = PlayGaya; }
private CharacterActor actorFromRow(HtmlNode node) { var actorElement = node.SelectSingleNode("./td/a"); CharacterActor ca = new CharacterActor(); VoiceActor actor = new VoiceActor(); actor.Name = new Name() { English = commaDelimitedName(actorElement.InnerHtml) }; actor.VoiceActorID = parseLinkId(actorElement.GetAttributeValue("href", "")); ca.Actor = actor; ca.ActorId = actor.VoiceActorID; ca.Language = new Language(node.SelectSingleNode("./td/small").InnerHtml); return(ca); }
void CalculateConditions() { //reset some stuff outAuthCode = 0; for (int i = 0; i < 4; i++) { ConfirmDigits[i].text = "0"; } for (int i = 0; i < 10; i++) { Digits[i].text = "0"; } //voice actor today = DateTime.Today; if (voiceIndex == -1) { voiceIndex = Rand.Range(0, baseActors.Count()); if (today.Month == 4 && today.Day == 1) { voiceIndex = 3; Voice = VoiceActor.GoldFish; } else { Voice = baseActors[voiceIndex]; } } DebugLog("Your voice actor is " + Voice.ToString() + "."); //siloID siloID = ""; string siloBuild = ToChar((Bomb.GetBatteryHolderCount() % 36).ToString(), 0) + ToChar((Bomb.GetBatteryCount() % 36).ToString(), 0) + ToChar((Bomb.GetPortPlateCount() % 36).ToString(), 0); for (int i = 0; i < 3; i++) { int result = -1; if (int.TryParse(siloBuild[i].ToString(), out result)) { if (result == 0) { siloID += Bomb.GetSerialNumberLetters().First(); } else if (result > 0) { siloID += siloBuild[i]; } } else { siloID += siloBuild[i]; } } //message calculation int wrongIndex = Rand.Range(0, 10); outMessages[1] = ToChar(Rand.Range(10, 36).ToString(), 0) + (Bomb.GetIndicators().ToArray().Count() < 1 ? "MRP" : Bomb.GetIndicators().ToArray()[Rand.Range(0, Bomb.GetIndicators().ToArray().Count())]); if (wrongIndex == 4 || wrongIndex == 5 || wrongIndex == 8 || wrongIndex == 9) { for (int i = 0; i < Rand.Range(1, 3); i++) { int index2 = Rand.Range(1, 4); int index3 = Rand.Range(0, 26); if (index2 == 1) { outMessages[1] = "" + outMessages[1][0] + Alphabet[index3] + outMessages[1][2] + outMessages[1][3]; } else if (index2 == 2) { outMessages[1] = "" + outMessages[1][0] + outMessages[1][1] + Alphabet[index3] + outMessages[1][3]; } else { outMessages[1] = "" + outMessages[1][0] + outMessages[1][1] + outMessages[1][2] + Alphabet[index3]; } } } outMessages[0] = outMessages[1][0].ToString() + Encryptor(outMessages[1][1].ToString() + outMessages[1][2].ToString() + outMessages[1][3].ToString(), outMessages[1][0].ToString(), true); outMessages[3] = ToChar(Rand.Range(10, 36).ToString(), 0) + Bomb.GetSerialNumber()[0] + Bomb.GetSerialNumber()[2] + Bomb.GetSerialNumber()[5]; if (wrongIndex > 5) { for (int i = 0; i < Rand.Range(1, 3); i++) { int index2 = Rand.Range(1, 4); int index3 = Rand.Range(0, 26); if (index2 == 1) { outMessages[3] = "" + outMessages[3][0] + Alphabet[index3] + outMessages[3][2] + outMessages[3][3]; } else if (index2 == 2) { outMessages[3] = "" + outMessages[3][0] + outMessages[3][1] + Alphabet[index3] + outMessages[3][3]; } else { outMessages[3] = "" + outMessages[3][0] + outMessages[3][1] + outMessages[3][2] + Alphabet[index3]; } } } outMessages[2] = outMessages[3][0].ToString() + Encryptor(outMessages[3][1].ToString() + outMessages[3][2].ToString() + outMessages[3][3].ToString(), outMessages[3][0].ToString(), true); outMessages[2] = outMessages[3][0].ToString() + Encryptor(outMessages[3][1].ToString() + outMessages[3][2].ToString() + outMessages[3][3].ToString(), outMessages[3][0].ToString(), true); Log("The first part of the message is " + outMessages[1] + ", which is encrypted as " + outMessages[0] + "."); Log("The second part of the message is " + outMessages[3] + ", which is encrypted as " + outMessages[2] + "."); //authentication outAuthCode = 0; int[] logAuth = new int[6] { 0, 0, 0, 0, 0, 0 }; for (int i = 0; i < 2; i++) { for (int j = 0; j < 3; j++) { logAuth[j + (3 * i)] += (ToNum(outMessages[1 + (2 * i)][j + 1].ToString(), 0) * ToNum(Bomb.GetSerialNumber()[j + (3 * i)].ToString(), 0)); outAuthCode += logAuth[j + (3 * i)]; } } string build = "The Authentication numbers are "; for (int i = 0; i < 6; i++) { build += logAuth[i].ToString() + (i == 4 ? " and " : ", "); } Log(build + "which totals up to " + (outAuthCode % 10000).ToString("0000") + "."); if (Rand.Range(0, 3) == 2) { outAuthCode = (outAuthCode + Rand.Range(1, 10000)) % 10000; correctParts[2] = false; } else { correctParts[2] = true; } Log("You are given " + outAuthCode.ToString("0000") + ", which is " + (correctParts[2] ? "valid." : "invalid.")); //color / type int colorIndex = Rand.Range(0, 5); correctColor = colorIndex == 0 ? MessageColor.Red : colorIndex < 3 ? MessageColor.Yellow : MessageColor.Green; Log("Your message type is " + ((correctColor == MessageColor.Red) ? "Red-Alpha" : correctColor == MessageColor.Yellow ? "Yellow-Alpha" : "Green-Alpha") + "."); //message checking string[] checkParts = new string[2] { Encryptor(outMessages[0][1].ToString() + outMessages[0][2].ToString() + outMessages[0][3].ToString(), outMessages[0][0].ToString(), false), Encryptor(outMessages[2][1].ToString() + outMessages[2][2].ToString() + outMessages[2][3].ToString(), outMessages[2][0].ToString(), false) }; correctParts[0] = Bomb.GetIndicators().Count() == 0 ? checkParts[0] == "MRP" : Bomb.GetIndicators().Any(str => str == checkParts[0]); correctParts[1] = Bomb.GetSerialNumber().Contains(checkParts[1][0]) && Bomb.GetSerialNumber().Contains(checkParts[1][1]) && Bomb.GetSerialNumber().Contains(checkParts[1][2]); Log("The first part of the message is " + (correctParts[0] ? "valid" : "invalid") + ", and the second part of the message is " + (correctParts[1] ? "valid." : "invalid.")); Log("The Silo ID is " + siloID + "."); if (!correctParts[2]) { correctResponse = ResponseType.Jamming; Log("The Authentication code is invalid, you must respond with a Jamming message."); } else if (!correctParts[0] && !correctParts[1]) { correctResponse = ResponseType.Error; Log("Both parts of the message are invalid, you must respond with an Error message."); } else if (correctParts[0] && correctParts[1]) { correctResponse = ResponseType.Either; Log("Both parts of the message are valid, you may respond with either."); } else if (correctParts[0]) { correctResponse = ResponseType.First; Log("Only the first part of the message is valid, you must respond with it."); } else if (correctParts[1]) { correctResponse = ResponseType.Second; Log("Only the second part of the message is valid, you must respond with it."); } else { Log("Something went wrong, no solution was identified."); } DebugLog(CalculateSolution()); }
// Start is called before the first frame update void Start() { actor = gameObject.GetComponent <VoiceActor>(); }