public void Reset(GameEngine gameEngine, MainCharacter mainCharacter, ContentManager content) { content.Unload(); MainCharacter = mainCharacter; Content = content; Arial = content.Load <SpriteFont>("Fonts/Arial"); // Initialize buttons StartButtonImg = Content.Load <Texture2D>("start"); ExitButtonImg = Content.Load <Texture2D>("exit"); LoadingTxt = Content.Load <Texture2D>("loading"); float StartX = (Game1.GetWindowSize().X / 2) - (StartButtonImg.Width / 2); float StartY = Game1.GetWindowSize().Y / 3; float ExitX = (Game1.GetWindowSize().X / 2) - (ExitButtonImg.Width / 2); float ExitY = 2 * Game1.GetWindowSize().Y / 3; float LoadingX = (Game1.GetWindowSize().X / 2) - (LoadingTxt.Width / 2); float LoadingY = (Game1.GetWindowSize().Y / 2) - (LoadingTxt.Height / 2); StartButton = new ClickableTexture(StartButtonImg, new Vector2(StartX, StartY)); ExitButton = new ClickableTexture(ExitButtonImg, new Vector2(ExitX, ExitY)); LoadingTxtPos = new Vector2(LoadingX, LoadingY); // important to reset these components to null when the manager is reloaded KeyboardInputMenu = null; GState = StartupState.StartMenu; MouseState = Mouse.GetState(); PrevMouseState = MouseState; }
public void Reset(GameEngine gameEngine, MainCharacter mainCharacter, ContentManager content) { if (Interviewees.Count == MaxInterviewees) { GState = LocationState.ConfirmedReturn; } else { GState = LocationState.Normal; } content.Unload(); MainCharacter = mainCharacter; Content = content; IsTransitioning = false; Point WindowSize = Game1.GetWindowSize(); // Load Characters String CharPath = Path.Combine(Content.RootDirectory, "characters.txt"); String CharJSON = File.ReadAllText(CharPath); CharList = JsonSerializer.Deserialize <AllCharacters>(CharJSON); // Load Case Info String CasePath = Path.Combine(Content.RootDirectory, "case" + MainCharacter.CurrentCase + ".txt"); String CaseJSON = File.ReadAllText(CasePath); Case Case = JsonSerializer.Deserialize <Case>(CaseJSON); // Visual Elements Background = new Background(content, BGImagePath); CharPics = new Dictionary <string, ClickableTexture>(); Greetings = new Dictionary <string, string>(); Notebook = Content.Load <Texture2D>("notebook_icon"); NotebookRect = new Rectangle(WindowSize.X - 100, 20, 70, 70); MapIcon = Content.Load <Texture2D>("map-icon"); MapIconRect = new Rectangle(WindowSize.X - 200, 20, 70, 70); Arial = content.Load <SpriteFont>("Fonts/Arial"); SpeechMenu = null; int NumSuspects = Case.Suspects.Count; Vector2 CharPos = new Vector2(WindowSize.X / 6, WindowSize.Y / 3); // may want to customize position at a given location later foreach (string Suspect in Case.Suspects) { Greetings[Suspect] = CharList.AllChars[Suspect].Greetings[0]; Texture2D CharTexture = Content.Load <Texture2D>(CharList.AllChars[Suspect].ImagePath); CharPics[Suspect] = new ClickableTexture(CharTexture, CharPos); CharPos.X += 0.75f * WindowSize.X / NumSuspects; } IntervieweeListRect = new Rectangle(WindowSize.X / 4, 2 * WindowSize.Y / 3, WindowSize.X / 2, WindowSize.Y / 4); TextOffset = new Vector2(0, Arial.MeasureString("A").Y); MouseState = Mouse.GetState(); PrevMouseState = MouseState; }
public void Reset(GameEngine gameEngine, MainCharacter mainCharacter, ContentManager content) { if (IsTransitioning) { GState = CalendarState.ActivityChoice; Background = new Background(content, "bulletin"); IsTransitioning = false; return; } Point WindowSize = Game1.GetWindowSize(); content.Unload(); // Common to all Modes Background = new Background(content, "bulletin"); MainCharacter = mainCharacter; Content = content; JustBreathe = Content.Load <SpriteFont>("Fonts/JustBreathe20"); Arial = Content.Load <SpriteFont>("Fonts/Arial"); GState = CalendarState.ActivityChoice; MouseState = Mouse.GetState(); PrevMouseState = MouseState; // Load Case Info (will want to create method for this) String CasePath = Path.Combine(Content.RootDirectory, "case" + MainCharacter.CurrentCase + ".txt"); String CaseJSON = File.ReadAllText(CasePath); Case = JsonSerializer.Deserialize <Case>(CaseJSON); ThisMonday = MainCharacter.GetDate(); ActivityRect = new Rectangle(WindowSize.X / 2, WindowSize.Y / 2, 500, 300); // eventually pull from Activity list json. Dictionary <string, string> Activities = new Dictionary <string, string> { { "Have a tea party", "charm" }, { "Fight a dragon", "courage" }, { "Have a chat", "empathy" }, { "Go to the library", "intelligence" }, { "Pump iron", "strength" }, { "Start a business", "money" } }; ActivitiesList = new OptionsList(Activities, JustBreathe, new Point(ActivityRect.X + 10, ActivityRect.Y + 30)); PeopleList = new OptionsList(Case.CharDict, JustBreathe, new Point(ActivityRect.X + 4 * ActivityRect.Width / 6, ActivityRect.Y + 30)); ConfirmButton = null; Calendar = new Calendar(new Rectangle(110, 150, 960, 200), JustBreathe, ThisMonday); Notebook = new ClickableTexture(Content.Load <Texture2D>("notebook_icon"), new Vector2(WindowSize.X - 100, 20)); }
public void Reset(GameEngine gameEngine, MainCharacter mainCharacter, ContentManager content) { if (IsTransitioning) { if (TestimonyId > -1 && TestimonyId == IdContradict[0]) { Testimony NextTestimony = (from testimony in TestimonyList.Testimonies where testimony.PrevId == TestimonyId select testimony).ToList()[0]; string Text = NextTestimony.SpokenText; EventScript = new EventScript(MainCharacter, Content, Text); TestimonyId = NextTestimony.Id; IsContradicted = true; } else if (IdContradict[0] > -1) { Console.WriteLine("hello"); string Text = "%ost/gumshoe\nExcuse me, what are you suggesting?? @redgeworth #disgusted\n+n: 100"; EventScript = new EventScript(MainCharacter, Content, Text); IdContradict[0] = -1; } GState = InterviewState.PlayText; Background = new Background(Content, "castle"); IsTransitioning = false; return; } else { GState = InterviewState.TopicChoice; } content.Unload(); // Common to all Modes Background = new Background(content, "castle"); MainCharacter = mainCharacter; Content = content; IsTransitioning = false; Arial = Content.Load <SpriteFont>("Fonts/Arial"); // Load Testimonies String path = Path.Combine(Content.RootDirectory, "testimonies.txt"); String TestimonyJSON = File.ReadAllText(path); TestimonyList = JsonSerializer.Deserialize <TestimonyList>(TestimonyJSON); ContradictButton = new ClickableTexture(Content.Load <Texture2D>("notebook_icon"), new Vector2(Game1.GetWindowSize().X - 100, 20)); TopicButtons = new List <Button>(); Vector2 TopicPos = new Vector2(500, 450); HashSet <string> TopicTags = (from testimony in TestimonyList.Testimonies where testimony.IsInitial || (MainCharacter.TestimonyIds.Contains(testimony.Id) && testimony.CharacterKey == CharacterKey) select testimony.TopicTag).ToHashSet(); Dictionary <string, string> Topics = (from topic in TestimonyList.Topics where TopicTags.Contains(topic.Value) select topic).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); foreach (string Topic in Topics.Keys) { TopicButtons.Add(new Button(Topic, Arial, TopicPos)); TopicPos.Y += 75; } TopicButtons.Add(new Button("Bye!", Arial, TopicPos)); }
public void Reset(GameEngine gameEngine, MainCharacter mainCharacter, ContentManager content) { // Commmon to all Modes MainCharacter = mainCharacter; Content = content; Background = new Background(content, NotebookPath); MouseState = Mouse.GetState(); PrevMouseState = MouseState; GState = NotebookState.Stats; Arial = content.Load <SpriteFont>("Fonts/Arial"); JustBreathe = content.Load <SpriteFont>("Fonts/JustBreathe20"); JustBreathe25 = content.Load <SpriteFont>("Fonts/JustBreathe25"); // Load Characters (convert to method) String path = Path.Combine(Content.RootDirectory, "characters.txt"); String CharJSON = File.ReadAllText(path); AllChars = JsonSerializer.Deserialize <AllCharacters>(CharJSON); // Load Case (convert to method) String CasePath = Path.Combine(Content.RootDirectory, "case" + MainCharacter.CurrentCase + ".txt"); String CaseJSON = File.ReadAllText(CasePath); Case = JsonSerializer.Deserialize <Case>(CaseJSON); // Load Testimonies (convert to method) path = Path.Combine(Content.RootDirectory, "testimonies.txt"); String TestimonyJSON = File.ReadAllText(path); TestimonyList = JsonSerializer.Deserialize <TestimonyList>(TestimonyJSON); // Always start by viewing stats. Point WindowSize = Game1.GetWindowSize(); // Fixed Visual Elements ReturnIcon = Content.Load <Texture2D>("return-icon"); ReturnIconRect = new Rectangle(WindowSize.X - 100, 20, 70, 70); int TabOffset = WindowSize.X / 10 - 8; PeopleTab = new ClickableTexture(Content.Load <Texture2D>("tab_people"), new Vector2(TabOffset, TabOffset)); StatsTab = new ClickableTexture(Content.Load <Texture2D>("tab_stats"), new Vector2(TabOffset, PeopleTab.Rect.Y + PeopleTab.Rect.Height)); TestimonyTab = new ClickableTexture(Content.Load <Texture2D>("tab_testimony"), new Vector2(TabOffset, StatsTab.Rect.Y + StatsTab.Rect.Height)); OptionsTab = new ClickableTexture(Content.Load <Texture2D>("tab_options"), new Vector2(TabOffset, TestimonyTab.Rect.Y + TestimonyTab.Rect.Height)); // Variable Visual Elements MainOptionsList = null; TopicOptionsList = null; QuitButton = null; SaveButton = null; // Text Spacing TextOffset = new Vector2(0.0f, JustBreathe.MeasureString("A").Y + 0.5f); Indent = new Vector2(Arial.MeasureString("A").X, 0.0f); // Represents bounds of open notebook OpenNotebookRect = new Rectangle((int)(0.12f * WindowSize.X), (int)(0.15f * WindowSize.Y + TextOffset.Y), (int)(0.75f * WindowSize.X), (int)(0.71f * WindowSize.Y)); }