private void setupUI() { gridOne = new UiGrid(assetMngr); OSTI = new OnScreenTextInput(); continueBtn = UiMngr.createUIObj(continueText, new InstructPtr(uiContinue), new Tuple <int, int>(0, -39), (SpaceMngr.scale / 23f)); //Profile Select Test profileSelBtn = UiMngr.createUIObj(blank, new InstructPtr(uiSelectList), new Tuple <int, int>(0, 30), (SpaceMngr.scale / 2f)); createProfileBtn = UiMngr.createUIObj(continueText, new InstructPtr(createProfile), new Tuple <int, int>(0, -50), (SpaceMngr.scale / 23f)); }
//Public public void initialize() //Called in dreamer's iniitalize override function for the game class. Starts up all abstract realm realated managers (except Asset Manager). { inputMngr = new InputMngr(); uiMngr = new UiMngr(); spaceMngr = new SpaceMngr(); stateMngr = new StateMngr(); stateMngr.setCRTState(StateMngr.ARstate.AR_Launch, assetMngr); ulong rateToTicks = (ulong)10000000 / (ulong)AR.display.framerate; Console.WriteLine("ratetoTicks: " + rateToTicks); dreamer.TargetElapsedTime = new TimeSpan((long)rateToTicks); dreamer.IsFixedTimeStep = true; }
//Profile Selection List private void setProfileSelListUI() { uiProfilePtr profileFunc = new uiProfilePtr(uiProfile); gridProfileSel = new UiGrid(assetMngr); gridProfileSel.createGrid(1, profileMngr.getProfileNum()); Console.WriteLine("profile num: "); int profilePos = 0; int position = 50; foreach (KeyValuePair <string, ProfileMngr.Profile> profile in profileMngr.profileLib) { string profileName = profile.Value.profileName; RenderTarget2D renderTargetString = new RenderTarget2D(assetMngr.gDevice, 2500, 200); assetMngr.spriteBatch.Begin(); assetMngr.spriteBatch.DrawString(miramo, profileName, Vector2.Zero, Color.White, 0f, Vector2.Zero, 10f, new SpriteEffects(), 0f); assetMngr.gDevice.SetRenderTarget(renderTargetString); Texture2D profileNameText = (Texture2D)renderTargetString; assetMngr.gDevice.Clear(new Color(0, 0, 0, 0)); assetMngr.spriteBatch.End(); UIObj profileBtn = UiMngr.createUIObj(profileName, profileNameText, profileFunc, new Tuple <int, int>(0, position), (SpaceMngr.scale / 23f)); gridProfileSel.setGrid(profileBtn, 0, profilePos); profilePos = profilePos + 1; position = position - 10; } assetMngr.gDevice.SetRenderTarget(null); firstPass = false; }
public override void Update(InputMngr inputMngr) { switch (currentFocus) { case focus.profileCheck: { if (profileMngr.getProfileNum() > 0) { currentFocus = focus.profileSel; break; } if (ProfileMngr.currentProfile == null) { if (firstPass == true) { setProfileCheckUI(); } UiMngr.checkInput(gridOne, inputMngr); } else { throw new Exception("Something went wrong with the profile manager."); } } break; case focus.profileSel: { if (firstPass == true) { setProfileSelUI(); setProfileSelListUI(); } switch (subCurrentFocus) { case subFocus.profileSel: { UiMngr.checkInput(gridOne, inputMngr); if (inputMngr.checkInput(controls.goTestTri) == true) { stateMngr.setCRTState(States.StateMngr.ARstate.AR_Launch, assetMngr); } if (inputMngr.checkInput(controls.pressEnd) == true) { display.changeDisplay(); } } break; case subFocus.profileSelList: { UiMngr.checkInput(gridProfileSel, inputMngr); if (inputMngr.checkInput(controls.pressBack) == true) { subCurrentFocus = subFocus.profileSel; } } break; } } break; case focus.osti: { OSTI.Update(inputMngr); if (OSTI.getDone() == true) { profileName = OSTI.getText(); OSTI.setActive(false); if (profileMngr.checkForProfile(profileName) == false) { profileMngr.createProfile(profileName); currentFocus = focus.profileSel; } else { Console.WriteLine("Profile Already Exists."); OSTI = new OnScreenTextInput(); OSTI.setActive(true); } } } break; } }