public void Parse_NullInput_Throws() { var parser = CreateParser(); CharacterLine nullInput = null; Assert.Throws <ArgumentNullException>( () => parser.Parse(nullInput)); }
public void Map_Always_ReturnsCharacterLine() { var mapper = CreateMapper(); var timestampsToMap = new SubtitleTimestamps( TimestampTests.CreateTimestamp(5, 4, 3, 2), TimestampTests.CreateTimestamp(5, 4, 4, 0)); var expectedLine = new CharacterLine("05:04:03,002 --> 05:04:04,000"); var actualLine = mapper.Map(timestampsToMap); Assert.AreEqual(expectedLine, actualLine); }
public AmstradGateArray(CPCBase machine, GateArrayType chipType) { _machine = machine; ChipType = chipType; //PenColours = new int[17]; borderType = _machine.CPC.SyncSettings.BorderType; SetupScreenSize(); //Reset(); CRCT.AttachHSYNCCallback(OnHSYNC); CRCT.AttachVSYNCCallback(OnVSYNC); CurrentLine = new CharacterLine(); InitByteLookup(); CalculateNextScreenMemory(); }
// Use this for initialization void Start() { //fill the dictionaries actorImages = new Dictionary <string, string> () { { "blank", "CutScenes/blank" }, { "RoyStandard", "CutScenes/royNEUTRAL_cutscene_2" }, { "RoyDetermined", "CutScenes/royDETERMINEDL_cutscene_5" }, { "RoyScared", "CutScenes/roySCARED_cutscene_10" }, { "RoyHappy", "CutScenes/royHAPPY_cutscene_3" }, { "EmilyCurious", "CutScenes/emilyCURIOUS_cutscene_3" }, { "EmilyScared", "CutScenes/emilySCARED_cutscene_8" }, { "JakeScared", "CutScenes/jakeSCAREDcutscene_8" }, { "JakeCurious", "CutScenes/jakeCURIOUScutscene_4" }, { "JakeHappy", "CutScenes/jakeHAPPYScutscene_2" }, { "TankStandard", "CutScenes/tank" }, { "EmilyHappy", "CutScenes/emilyHAPPY" }, { "DadScared", "CutScenes/fatherSCARED" }, { "DadHappy", "CutScenes/fatherHAPPY" } }; backgrounds = new Dictionary <string, string> () { { "templeOutside", "CutScenes/cutscene_Outside" }, { "templeInfront", "CutScenes/cutscene_1" }, { "templeStairs", "CutScenes/cutscene_7" }, { "templeCollapse", "CutScenes/cutscene_9" }, { "templeInside", "CutScenes/cutscene_Inside" }, { "foundJake", "CutScenes/cutscene_4" }, { "emilyBegin", "Cutscenes/cutscene_Emily-alone" }, { "tankBegin", "Cutscenes/cutscene_TankAlone" }, { "emilyandtank", "Cutscenes/cutscene_EmilyandTank" }, { "tuckersreunited", "Cutscenes/cutscene_Reunited" }, { "tankPup", "Cutscenes/cutscene_TankPup" }, { "tankGrownUp", "Cutscenes/cutscene_Family" }, { "sadFamily", "Cutscenes/cutscene_SadFamily" }, { "kidsReading", "Cutscenes/cutscene_Reading" }, { "kidsGrownUp", "Cutscenes/cutscene_GrownUp" }, { "familyPictures", "Cutscenes/cutscene_FamilyPictures" }, { "blackScreen", "Cutscenes/black-screen" }, { "johnTuckerFigure", "Cutscenes/johnTuckerFigure" } }; sounds = new Dictionary <string, string> () { { "roy_hmm", "CutScenes/Roy/Roy - Thinking" }, // {"roy_notsure", "CutScenes/Andre-ImNotSureAboutThis"}, // {"roy_confused", "CutScenes/Andre-WhatWasThat"}, { "roy_relieved", "CutScenes/Roy/Roy - Relieved" }, { "roy_spooked", "CutScenes/Roy/Roy - Shook" }, { "roy_unsure", "CutScenes/Roy/Roy - Unsure" }, { "roy_determined", "CutScenes/Roy/Roy - Determined" }, { "roy_pumped", "CutScenes/Roy/Roy - EndLevel1" }, { "emily_determined", "CutScenes/Emily/Emily - Determined" }, { "emily_disturbed", "CutScenes/Emily/Emily - Disturbed" }, { "emily_happylaugh", "CutScenes/Emily/Emily - HappyLaugh" }, { "emily_relief", "CutScenes/Emily/Emily - Relief" }, { "emily_spooked", "CutScenes/Emily/Emily - Shook" }, { "emily_thinking", "CutScenes/Emily/Emily - Thinking" }, { "jake_affirmative", "CutScenes/Jake/Jake - Affirmative" }, { "jake_confused", "CutScenes/Jake/Jake - Confused" }, { "jake_scared", "CutScenes/Jake/Jake - Really Scared or Death" }, { "jake_relief", "CutScenes/Jake/Jake - Relieved" }, { "jake_spooked", "CutScenes/Jake/Jake - Shook" }, { "jake_unsure", "CutScenes/Jake/Jake - Unsure" }, { "tank_cautious", "CutScenes/Tank/Tank - Cautious" }, { "tank_concerned", "CutScenes/Tank/Tank - Concerned" }, { "tank_distressed", "CutScenes/Tank/Tank - Distressed" }, { "tank_happy", "CutScenes/Tank/Tank - Happy2" }, { "tank_loudroar", "CutScenes/Tank/Tank - Death" }, { "temple_rumble", "CutScenes/templerumbling" }, { "temple_collapse", "CutScenes/Temple Falling" } }; cutSceneFiles = new Dictionary <int, string>() { { 1, "CutScene_Opening" }, //these cutscenes play before the level { 11, "CutScene_Flashback1" }, { 21, "CutScene_JakeFound" }, { 26, "CutScene_Flashback2" }, { 31, "CutScene_EmilyAlone" }, { 35, "CutScene_TankAlone" }, { 37, "CutScene_EmilyAndTank" }, { 41, "CutScene_TuckerKidsReunited" }, { 51, "CutScene_Conclusion" } }; //intialize GameObjects background = transform.Find("Background").gameObject; textBox = transform.Find("TextBox").gameObject; //loadingImage = GameObject.Find ("LoadingImage").gameObject; //set manually dialogueWriter = transform.Find("Text").GetComponent <DialogueWriter> (); tapPrompt = transform.Find("TapPrompt").gameObject; sceneIndex = 0; lineIndex = -1; //line index gets set to -1 since there is currently no line displayed at all promptTimer = 0; //get the current level zombie = GameObject.Find("ZombiePasser"); int currLevel = zombie.GetComponent <ZombiePasser>().getLevel(); //check if the current level has a cutscene if (!cutSceneFiles.ContainsKey(currLevel)) { Debug.Log("No cutscene for level " + currLevel); endCutScene(); return; } if (currLevel == 21) { zombie.GetComponent <SocialPlatform>().AchievementProgress(GPGSIds.achievement_brotherly_love, false); } if (currLevel == 31) { zombie.GetComponent <SocialPlatform>().AchievementProgress(GPGSIds.achievement_sister_sister, false); } if (currLevel == 35) { zombie.GetComponent <SocialPlatform>().AchievementProgress(GPGSIds.achievement_bear_with_me, false); } if (currLevel == 41) { zombie.GetComponent <SocialPlatform>().AchievementProgress(GPGSIds.achievement_family_reunion, false); } if (currLevel == 51) { zombie.GetComponent <SocialPlatform>().AchievementProgress(GPGSIds.achievement_all_tuckered_out, false); } //load in the JSON file, the same way as levelReader TextAsset cutSceneFile = Resources.Load(cutSceneFiles[currLevel]) as TextAsset; jsonString = cutSceneFile.ToString(); cutSceneData = JsonMapper.ToObject(jsonString); cutScenes = new List <CutScene> (); //iterate through all the 'scenes', by adding an int to the end of the identifier int i = 1; while (cutSceneData.Keys.Contains(iterString + i.ToString())) { JsonData sceneInfo = cutSceneData[iterString + i.ToString()]; CutScene cutScene = new CutScene { BackgroundImage = backgrounds[(string)sceneInfo ["image"]], Lines = new List <CharacterLine>() }; int j = 1; while (sceneInfo.Keys.Contains(iterString2 + j.ToString())) { JsonData lineInfo = sceneInfo [iterString2 + j.ToString()]; CharacterLine line = new CharacterLine { characterImage = actorImages[(string)lineInfo["image"]], LineText = (string)lineInfo["text"] }; string soundName = (string)lineInfo ["sound"]; if (sounds.ContainsKey(soundName)) { line.soundByte = sounds[soundName]; } cutScene.Lines.Add(line); j++; } // add level to levels list: cutScenes.Add(cutScene); i++; } //set background to first image, and make the text box invisible background.GetComponent <Image> ().sprite = Resources.Load <Sprite>(cutScenes[0].BackgroundImage); textBox.GetComponent <CanvasGroup>().alpha = 0f; nextLine(); }