void Start() { if (GameObject.FindGameObjectWithTag ("Data")) { optionsData = GameObject.FindGameObjectWithTag ("Data").GetComponent<OptionsData> (); } else { Debug.LogError ("No options data found. Did you start from the correct scene?"); } if (optionsData.GetCursor==false) { objectToDisableCursor.SetActive (false); objectToEnableCursor.SetActive (true); } if (optionsData.GetVibration==false) { objectToDisableVibration.SetActive (false); objectToEnableVibration.SetActive (true); } if (optionsData.GetTutorial == false) { objectToDisableTutorial.SetActive(false); objectToEnableTutorial.SetActive(true); } if (optionsData.GetMusic == false) { objectToDisableMusic.SetActive(false); objectToEnableMusic.SetActive(true); } }
void Awake() { if (GameObject.FindGameObjectWithTag("Data").GetComponent<OptionsData>()) { optionsData = GameObject.FindGameObjectWithTag("Data").GetComponent<OptionsData>(); RetrieveSavedOptionsData(); } }
void Start() { spriteRenderer = GetComponent<SpriteRenderer> (); if (GameObject.FindGameObjectWithTag ("Data")) { optionsData = GameObject.FindGameObjectWithTag ("Data").GetComponent<OptionsData> (); } if (optionsData.GetCursor == false) { spriteRenderer.sprite = null; } }
/// <summary> Creates a new gamesave from nothing </summary> public GameSave(bool createNew) { index = 0; if (createNew) { levels = new LevelsData(); stats = new StatsData(); options = new OptionsData(); } else { levels = LevelManager.Instance.levelsData; stats = LevelManager.Instance.statsData; options = LevelManager.Instance.optionsData; } }
void Start() { if (GameObject.FindGameObjectWithTag ("Data")) { optionsData = GameObject.FindGameObjectWithTag ("Data").GetComponent<OptionsData> (); } if (optionsData.GetTutorial == false) { tutorialHolder.GetComponent<TutorialUnlocker> ().enabled = false; } if (optionsData.GetTutorial == true) { tutorialHolder.GetComponent<TutorialUnlocker> ().enabled = true; } }
public OptionsData(OptionsData _optionsData, int _ID) { language = _optionsData.language; showSubtitles = _optionsData.showSubtitles; sfxVolume = _optionsData.sfxVolume; musicVolume = _optionsData.musicVolume; speechVolume = _optionsData.speechVolume; linkedVariables = _optionsData.linkedVariables; saveFileNames = _optionsData.saveFileNames; lastSaveID = -1; ID =_ID; label = "Profile " + (ID + 1).ToString (); }
// Start is called before the first frame update void Start() { cont = 0; Time.timeScale = 1; c = GameObject.Find("CountDown").GetComponent <CountDown>(); if (GameObject.Find("OptionsData") != null) { optionsData = GameObject.Find("OptionsData").GetComponent <OptionsData>(); setKeysTables(); } else { print("No OptionsData found, probably started without menu"); } if (GameObject.Find("PhonySelectionData") != null) { PhonySelectionData = GameObject.Find("PhonySelectionData").GetComponent <PhonySelectionData>(); ConfigurePhonies(); } else { print("No PhonySelectionData found, probably started without menu"); } if (player1.activeSelf) { phonyList.Add(player1); } if (player2.activeSelf) { phonyList.Add(player2); } if (player3.activeSelf) { phonyList.Add(player3); } if (player4.activeSelf) { phonyList.Add(player4); } }
public bool TryGetOptions(int maxPoolSize, string filePath, out BitmapFactory.Options options) { foreach (var item in pool) { if (item.FilePath.Equals(filePath)) { // Image already in the pool - just return it item.LastAccess = DateTime.Now; options = item.Options; return(true); } } if (maxPoolSize > pool.Count) { // Add new instance to pool var optionsData = new OptionsData(filePath, DateTime.Now, new BitmapFactory.Options()); options = optionsData.Options; pool.Add(optionsData); } else { // Find the oldest pool item OptionsData optionsData = null; var lastAccess = DateTime.Now; foreach (var item in pool) { if (lastAccess.CompareTo(item.LastAccess) == 1) { lastAccess = item.LastAccess; optionsData = item; } } // ...and substitute with the new item optionsData.FilePath = filePath; optionsData.LastAccess = DateTime.Now; options = optionsData.Options; } return(false); }
protected override void Handle(IHttpContext context, TFSSourceControlProvider sourceControlProvider) { IHttpRequest request = context.Request; IHttpResponse response = context.Response; string path = GetPath(request); response.AppendHeader("DAV", "1,2"); response.AppendHeader("DAV", "version-control,checkout,working-resource"); response.AppendHeader("DAV", "merge,baseline,activity,version-controlled-collection"); response.AppendHeader("MS-Author-Via", "DAV"); response.AppendHeader("Allow", "OPTIONS,GET,HEAD,POST,DELETE,TRACE,PROPFIND,PROPPATCH,COPY,MOVE,LOCK,UNLOCK,CHECKOUT"); sourceControlProvider.ItemExists(Helper.Decode(path)); // Verify permissions to access OptionsData data = null; if (request.InputStream.Length != 0) { using (XmlReader reader = XmlReader.Create(request.InputStream, Helper.InitializeNewXmlReaderSettings())) { reader.MoveToContent(); data = Helper.DeserializeXml <OptionsData>(reader); } SetResponseSettings(response, "text/xml; charset=\"utf-8\"", Encoding.UTF8, 200); } else { if (path == "/") { SetResponseSettings(response, "httpd/unix-directory", Encoding.UTF8, 200); } else { SetResponseSettings(response, "text/plain", Encoding.UTF8, 200); } } if (data != null) { Options(sourceControlProvider, path, response.OutputStream); } }
public static OptionsData LoadOptions() { string path = Application.persistentDataPath + "/options.nt"; if (File.Exists(path)) { BinaryFormatter formatter = new BinaryFormatter(); FileStream stream = new FileStream(path, FileMode.Open); OptionsData data = formatter.Deserialize(stream) as OptionsData; stream.Close(); return(data); } else { Debug.LogError("Save file not found in " + path); return(null); } }
/// <summary> /// Show to options screen. /// </summary> /// <param name="sender">Sender</param> /// <param name="e">Event</param> private void ButtonOptions_Click(object sender, RoutedEventArgs e) { // Backup the config _previousOptions = Options.Clone(); var rc = _optionsWindow.ShowDialog(); // Null = cancel; false = OK if (null == rc) { // Restore the old options when canceled Options.CopyToInstance(_previousOptions); } else { SaveOptions(); } // Options changed, so gotta reload everything man Initialize(); }
/// <summary> /// Function to save options values. /// </summary> public void LoadOptions() { OptionsData data = new OptionsData(); string path = Application.persistentDataPath + "/Options.sav"; if (File.Exists(path)) { BinaryFormatter formatter = new BinaryFormatter(); FileStream stream = new FileStream(path, FileMode.Open); data = formatter.Deserialize(stream) as OptionsData; stream.Close(); activeLanguage = data.activeLanguage; activeRegion = data.activeRegion; firstTimeLanguage = data.firstTimeLanguage; gameVolume = data.gameVolume; fullscreen = data.fullscreen; } }
/// <summary> /// Function to load options values. /// </summary> public void SaveOptions() { OptionsData data = new OptionsData { activeLanguage = activeLanguage, activeRegion = activeRegion, firstTimeLanguage = firstTimeLanguage, gameVolume = gameVolume, fullscreen = fullscreen }; BinaryFormatter formatter = new BinaryFormatter(); string path = Application.persistentDataPath + "/Options.sav"; FileStream fileStream = new FileStream(path, FileMode.Create); formatter.Serialize(fileStream, data); fileStream.Close(); }
// Update is called once per frame void Update() { if (GameObject.Find("OptionsData") != null) { if (optionsData == null) { optionsData = GameObject.Find("OptionsData").GetComponent <OptionsData>(); } if (keysChange2()) { setKeysTables(); if (PhonySelectionData != null) { setControllers(); } } } foreach (GameObject phony in phonyList) { if (phony.tag == "Untagged") { cont++; } } if (cont == phonyList.Count) { time += Time.deltaTime; texto.transform.position = new Vector3(950, 600, 0); c.the_end(texto); if (time >= 3.5) { time = 0; endGame = true; SceneManager.LoadScene("Map Selection"); } } cont = 0; }
// Called from the Back button public void SaveOptions() { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Create(Application.persistentDataPath + "/" + userName + "Options.dat"); OptionsData optionsData = new OptionsData(); /**************************************************************** * General */ optionsData.mouseSensitivity = options.mouseSens.value; optionsData.fieldOfView = options.fovValue.value; optionsData.subtitles = options.subtitlesOnOff.isOn; optionsData.mouseInversion = options.mouseInver.isOn; /**************************************************************** * Audio */ optionsData.masterLevel = options.masterVol.value; optionsData.effectsLevel = options.effectVol.value; optionsData.voiceLevel = options.voiceVol.value; optionsData.musicLevel = options.musicVol.value; /**************************************************************** * Graphics */ optionsData.resolution = options.currentResolution; optionsData.windowedOrFullscreen = options.windowFull.isOn; optionsData.brightness = options.brightness.value; optionsData.graphics = options.currentGraphics; /**************************************************************** * Advanced */ optionsData.antialiasingMode = options.currentAA; optionsData.filteringMode = options.currentFiltering; bf.Serialize(file, optionsData); file.Close(); }
public void Load() { if (File.Exists(Application.persistentDataPath + "/options.dat")) { print(Application.persistentDataPath); BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + "/options.dat", FileMode.Open); OptionsData options = bf.Deserialize(file) as OptionsData; file.Close(); snakename = options.snakename; SetAds(options.ads); skinIndex = options.skinIndex; SetSkin(skinIndex); if (options.skinsUnlocked) { UnlockSkins(); } controls = options.controls; SetControls((int)controls); } }
public OptionsData GetDefaultPCOptions() { OptionsData options = new OptionsData(); options.VideoHeight = FrameworkCore.options.resolutionY; options.VideoWidth = FrameworkCore.options.resolutionX; options.bloom = FrameworkCore.options.bloom; options.isFullscreen = FrameworkCore.options.fullscreen; options.renderPlanets = FrameworkCore.options.renderPlanets; options.mousewheel = FrameworkCore.options.mousewheel; options.sensitivity = FrameworkCore.options.sensitivity; options.hardwaremouse = FrameworkCore.options.hardwaremouse; options.manualDefault = FrameworkCore.options.manualDefault; options.player1UseMouse = FrameworkCore.options.p1UseMouse; options.player2UseMouse = FrameworkCore.options.p2UseMouse; options.vsync = FrameworkCore.options.vsync; options.fixedTimeStep = FrameworkCore.options.fixedTimeStep; return(options); }
public void loadOptionsToPlayer(OptionsData optionsData) { // TODO Add a line that sets the player main camera //GENERAL if(mainCamera != null) { mainCamera.GetComponentInParent<MouseLook>().sensitivityX = optionsData.mouseSensitivity; if(optionsData.mouseInversion) { mainCamera.GetComponent<MouseLook>().sensitivityY = -optionsData.mouseSensitivity; } else { mainCamera.GetComponent<MouseLook>().sensitivityY = optionsData.mouseSensitivity; } mainCamera.GetComponent<Camera>().fieldOfView = optionsData.fieldOfView; if(optionsData.subtitles) { //TODO Write a subtitle feature } //AUDIO //TODO Do something about the master volume volumeSettings.updateEffect(optionsData.effectsLevel); volumeSettings.updateDialogue(optionsData.voiceLevel); volumeSettings.updateMusic(optionsData.musicLevel); //GRAPHICS Screen.SetResolution(optionsData.resX, optionsData.resY, optionsData.windowedOrFullscreen); //TODO Figure out brightness //TODO Do the graphics...? //ADVANCED //TODO AntiAliasing //TODO Filtering } }
public void loadOptionsToPlayer(OptionsData optionsData) { // TODO Add a line that sets the player main camera //GENERAL if (mainCamera != null) { mainCamera.GetComponentInParent <MouseLook>().sensitivityX = optionsData.mouseSensitivity; if (optionsData.mouseInversion) { mainCamera.GetComponent <MouseLook>().sensitivityY = -optionsData.mouseSensitivity; } else { mainCamera.GetComponent <MouseLook>().sensitivityY = optionsData.mouseSensitivity; } mainCamera.GetComponent <Camera>().fieldOfView = optionsData.fieldOfView; if (optionsData.subtitles) { //TODO Write a subtitle feature } //AUDIO //TODO Do something about the master volume volumeSettings.updateEffect(optionsData.effectsLevel); volumeSettings.updateDialogue(optionsData.voiceLevel); volumeSettings.updateMusic(optionsData.musicLevel); //GRAPHICS Screen.SetResolution(optionsData.resX, optionsData.resY, optionsData.windowedOrFullscreen); //TODO Figure out brightness //TODO Do the graphics...? //ADVANCED //TODO AntiAliasing //TODO Filtering } }
private IEnumerator Setup() { while (!OptionsData.ready) { yield return(null); } StartCoroutine(Fade(false, cover)); StartCoroutine(Fade(false)); if (OptionsData.GetName() == "") { ChangeName(); } else { cName.text = "Current name: " + OptionsData.GetName(); nameScreen.alpha = 0; nameScreen.interactable = false; nameScreen.blocksRaycasts = false; } AdMobController.Show(); ready = true; }
public Options() { try { Stream stream = File.OpenRead(settingsFilename); //open the settings file XmlSerializer serializer = new XmlSerializer(typeof(OptionsData)); //make a new serializer gameSettings = (OptionsData)serializer.Deserialize(stream); //set the gameSettings object to the deserialization of the file stream.Close(); } catch (System.IO.FileNotFoundException) //if settings file doesnt exist { gameSettings = new OptionsData(); //set defaults gameSettings.musicVolume = 100; gameSettings.soundVolume = 100; gameSettings.invertY = false; gameSettings.fullscreen = true; gameSettings.clippingDistance = 100; gameSettings.gamePad = false; gameSettings.controller = PlayerIndex.One; new FileStream(settingsFilename, FileMode.Create, FileAccess.Write).Close();//create the file saveOptions();//save the defaults to the file. } }
protected virtual void Dispose(Boolean disposing) { if (_disposed) { return; } if (disposing) { } if (_mData != null) { _mData = null; } if (_oData != null) { _oData.Save(); _oData = null; } if (_rssManager != null) { _rssManager = null; } }
void LoadData() { OptionsData data = SaveSystem.LoadOptions(); if (data == null) { return; } isGameSaved = data.isGameSaved; isShopActive = data.isShopActive; currentStage = data.currentStage; Tutorial.isCompleted = data.isTutorialCompleted; if (data.joystickType == 1) { JoystickManager.type = Type.Fixed; } else if (data.joystickType == 2) { JoystickManager.type = Type.Floating; } JoystickManager.isJoystickChanged = true; }
public void Load() { var serializer = new XmlSerializer(typeof(OptionsData)); using (var stream = new FileStream(filePath, FileMode.Open)) { data = serializer.Deserialize(stream) as OptionsData; } forward = data.forward; backward = data.backward; left = data.left; right = data.right; jump = data.jump; crouch = data.crouch; sprint = data.sprint; interact = data.interact; mainAudio.volume = data.volSlider; dirLight.intensity = data.brightSlider; RenderSettings.ambientIntensity = data.ambientSlider; Screen.fullScreen = data.fullScreen; }
/// <summary> /// Launch a new Razor instance. /// </summary> /// <param name="options">UOMachine.OptionsData to use for launching Razor.</param> /// <param name="clientIndex">Client index of launched client.</param> /// <returns>True on success.</returns> public static bool LaunchRazor(OptionsData options, out int clientIndex) { return(RazorLauncher.Launch(options, out clientIndex)); }
public void setOptionsData(OptionsData o) { gameSettings = o; }
public static void SaveOptions() { OptionsData data = new OptionsData(); data.controls_SensitivityX = CustomInputManager.sensitivityX; data.controls_SensitivityY = CustomInputManager.sensitivityY; data.controls_InvertMouse = CustomInputManager.invertMouse; data.controls_UseMouseWheelToChangeWeapon = CustomInputManager.useMouseWheelToChangeWeapon; data.controls_Action_Primary = CustomInputManager.keys.Action.primary; data.controls_Action_Secondary = CustomInputManager.keys.Action.secondary; data.controls_Action_Primary = CustomInputManager.keys.Action.primary; data.controls_Action_Secondary = CustomInputManager.keys.Action.secondary; data.controls_Aim_Primary = CustomInputManager.keys.Aim.primary; data.controls_Aim_Secondary = CustomInputManager.keys.Aim.secondary; data.controls_ChangeGun_Primary = CustomInputManager.keys.ChangeGun.primary; data.controls_ChangeGun_Secondary = CustomInputManager.keys.ChangeGun.secondary; data.controls_Crouch_Primary = CustomInputManager.keys.Crouch.primary; data.controls_Crouch_Secondary = CustomInputManager.keys.Crouch.secondary; data.controls_Fire_Primary = CustomInputManager.keys.Fire.primary; data.controls_Fire_Secondary = CustomInputManager.keys.Fire.secondary; data.controls_Grenade_SnipeTimeController_Primary = CustomInputManager.keys.Grenade_SnipeTimeController.primary; data.controls_Grenade_SnipeTimeController_Secondary = CustomInputManager.keys.Grenade_SnipeTimeController.secondary; data.controls_Jump_Primary = CustomInputManager.keys.Jump.primary; data.controls_Jump_Secondary = CustomInputManager.keys.Jump.secondary; data.controls_Melee_Primary = CustomInputManager.keys.Melee.primary; data.controls_Melee_Secondary = CustomInputManager.keys.Melee.secondary; data.controls_Missions_Primary = CustomInputManager.keys.Missions.primary; data.controls_Missions_Secondary = CustomInputManager.keys.Missions.secondary; data.controls_MoveBackward_Primary = CustomInputManager.keys.MoveBackward.primary; data.controls_MoveBackward_Secondary = CustomInputManager.keys.MoveBackward.secondary; data.controls_MoveForward_Primary = CustomInputManager.keys.MoveForward.primary; data.controls_MoveForward_Secondary = CustomInputManager.keys.MoveForward.secondary; data.controls_MoveLeft_Primary = CustomInputManager.keys.MoveLeft.primary; data.controls_MoveLeft_Secondary = CustomInputManager.keys.MoveLeft.secondary; data.controls_MoveRight_Primary = CustomInputManager.keys.MoveRight.primary; data.controls_MoveRight_Secondary = CustomInputManager.keys.MoveRight.secondary; data.controls_Reload_Primary = CustomInputManager.keys.Reload.primary; data.controls_Reload_Secondary = CustomInputManager.keys.Reload.secondary; data.controls_Sprint_SnipeSteady_Primary = CustomInputManager.keys.Sprint_SnipeSteady.primary; data.controls_Sprint_SnipeSteady_Secondary = CustomInputManager.keys.Sprint_SnipeSteady.secondary; // data.audio_GeneralVolume = AudioController.GeneralVolume; data.audio_MusicVolume = AudioController.musicVolume; data.audio_SFXVolume = AudioController.sfxVolume; data.audio_VoiceVolume = AudioController.voiceVolume; // data.video_ResolutionIndex = VideoSettingsController.curResolutionIndex; data.video_VSync = VideoSettingsController.curIsVSyncOn; data.video_Brightness = VideoSettingsController.curBrightness; data.video_LODBias = VideoSettingsController.curLODBias; data.video_Type = VideoSettingsController.curVideoSettingType; data.video_IsShadowOn = VideoSettingsController.curIsShadowOn; data.video_ShadowQual = VideoSettingsController.curShadowQual; data.video_ShadowDistance = VideoSettingsController.curShadowDistance; data.video_TextureQual = VideoSettingsController.curTextureQual; data.video_UseSSAO = VideoSettingsController.curUseSSAO; data.video_UseAnisotropic = VideoSettingsController.curUseAnisotropic; data.video_UseBloom = VideoSettingsController.curUseBloom; // string filePath = GetOptionsPath(); Stream stream = null; try { stream = File.Open(filePath, FileMode.Create); BinaryFormatter bformatter = new BinaryFormatter(); bformatter.Binder = new VersionDeserializationBinder(); bformatter.Serialize(stream, data); } catch { //<Test> Debug.LogError("Saving options error!!!"); //</Test> } finally { if (stream != null) { stream.Close(); } } }
/// <summary> /// Launch a new UOSteam instance. /// </summary> /// <param name="options">UOMachine.OptionsData to use for launching Razor.</param> /// <param name="clientIndex">Client index of launched client.</param> /// <returns>True on success.</returns> public static bool LaunchSteam( OptionsData options, out int clientIndex ) { return SteamLauncher.Launch( options, out clientIndex ); }
void LoadLevelsFromSave() { SaveAndLoad.Load(); levelsData = GameSave.current.levels; statsData = GameSave.current.stats; optionsData = GameSave.current.options; //Create new if not existing if (levelsData == null) levelsData = new LevelsData(); if (statsData == null) statsData = new StatsData(); if (optionsData == null) optionsData = new OptionsData(); //Get Levels from old data. Should support adding more levels (savefile with less levels than currently) List<Level> newLevelList = new List<Level>(); for (int i = 0; i < worldList_par.Count; ++i) { for (int j = 0; j < worldList_par[i].Count; ++j) { Level previousLevelData = PopLevelInList(levelsData.levelList, i+1, j); if(previousLevelData != null) { newLevelList.Add(new Level(GetLevelID(i+1, j), previousLevelData.unlocked, previousLevelData.completed, previousLevelData.completedPar, previousLevelData.bestMoveScore)); //Debug.Log("world" + (i + 1) + " level " + (j) + " found. Completed : " + previousLevelData.completed + " completedPar : " + previousLevelData.completedPar + " unlocked : " + previousLevelData.unlocked); } else { newLevelList.Add(new Level(GetLevelID(i+1,j))); } newLevelList[newLevelList.Count - 1].SetPar( worldList_par[i][j]); } } levelsData.levelList = newLevelList; GameSave.current.levels = levelsData; GameSave.current.stats = statsData; GameSave.current.options = optionsData; //Debug.Log("Chaos Shown :" + statsData.notif_chaos_shown + " Chaos Time : " + statsData.notif_chaos_time); SaveAndLoad.Save(); }
private void Awake() { optionsData = new OptionsData(); resolutionDropdown.onValueChanged.AddListener(delegate { OnResolutionChange(); }); }
/// <summary> /// Launch a new Razor instance. /// </summary> /// <param name="options">UOMachine.OptionsData to use for launching Razor.</param> /// <param name="clientIndex">Client index of launched client.</param> /// <returns>True on success.</returns> public static bool LaunchRazor(OptionsData options, out int clientIndex) { return RazorLauncher.Launch(options, out clientIndex); }
// Called from the Back button public void SaveOptions() { BinaryFormatter bf = new BinaryFormatter (); FileStream file = File.Create (Application.persistentDataPath + "/" + userName + "Options.dat"); OptionsData optionsData = new OptionsData(); /**************************************************************** * General */ optionsData.mouseSensitivity = options.mouseSens.value; optionsData.fieldOfView = options.fovValue.value; optionsData.subtitles = options.subtitlesOnOff.isOn; optionsData.mouseInversion = options.mouseInver.isOn; /**************************************************************** * Audio */ optionsData.masterLevel = options.masterVol.value; optionsData.effectsLevel = options.effectVol.value; optionsData.voiceLevel = options.voiceVol.value; optionsData.musicLevel = options.musicVol.value; /**************************************************************** * Graphics */ optionsData.resolution = options.currentResolution; optionsData.windowedOrFullscreen = options.windowFull.isOn; optionsData.brightness = options.brightness.value; optionsData.graphics = options.currentGraphics; /**************************************************************** * Advanced */ optionsData.antialiasingMode = options.currentAA; optionsData.filteringMode = options.currentFiltering; bf.Serialize (file, optionsData); file.Close(); }
void Start() { options = XMLController.Instance.Options; if (options == null) { options = new OptionsData(); } mapSizeOptions = new List <int> { 5, 10, 15, 25, 40 }; if (mapSizeOptions.Contains(options.mapSize)) { mapSizeDropdown.value = mapSizeOptions.FindIndex(x => x == options.mapSize); } else if (options.mapSize < 100 && options.mapSize > 1) //If the player finds and edits the save file, I'll allow different map sizes but limit them to less than 100, more could crash their computer. { mapSizeOptions.Add(options.mapSize); } else { options.mapSize = mapSizeOptions[3]; //Select the second largest map by default, I think it's the best compromise between looking good and running well for most computers. } mapSizeDropdown.AddOptions(mapSizeOptions.ConvertAll(x => x.ToString())); mapSizeDropdown.value = mapSizeOptions.FindIndex(x => x == options.mapSize); volume.value = options.volume; mouseSensitivity.value = options.mouseSensitivity; screenBrightness.value = options.screenBrightness; int resolutionIndex = -1; foreach (Resolution r in Screen.resolutions) { string name = r.width + " X " + r.height; Dropdown.OptionData option = new Dropdown.OptionData(name); //Check for duplicates, because there should be some with different refresh rates. if (resolutionDropdown.options.Find(x => x.text == name) == null) { resolutionDropdown.options.Add(option); } else { continue; } if (r.width == options.screenResolution.width && r.height == options.screenResolution.height) { resolutionIndex = resolutionDropdown.options.Count - 1; } } //If we haven't found the correct resolution, just use the largest one available. if (resolutionIndex == -1) { resolutionIndex = resolutionDropdown.options.Count - 1; options.screenResolution = Screen.resolutions[resolutionIndex]; } resolutionDropdown.value = resolutionIndex; Screen.SetResolution(options.screenResolution.width, options.screenResolution.height, options.fullscreen); }
/// <summary> /// Launch a new client instance. /// </summary> /// <param name="options">UOMachine.OptionsData to use for launching client.</param> /// <param name="clientIndex">Client index of launched client.</param> /// <returns>Client index of launched client.</returns> public static bool LaunchClient(OptionsData options, out int clientIndex) { return ClientLauncher.Launch(options, out clientIndex); }
public void CreateQuizJSON(TblQuiz objQuiz, int rows) { try { JavaScriptSerializer json_serializer = new JavaScriptSerializer(); json_serializer.MaxJsonLength = int.MaxValue; object[] objTblQue = (object[])json_serializer.DeserializeObject(objQuiz.hdnData); var QuizData = quizRepository.GetQuizByID(rows); var ques = QuizData[0].TblQuestions; List <int> queIds = new List <int>(); foreach (var que in ques) { queIds.Add(que.QuestionId); } int index = 0; foreach (Dictionary <string, object> item in objQuiz.questionObject) { item["QuestionId"] = Convert.ToString(queIds[index]); index++; } SCORMJSON jsonData = new SCORMJSON(); ConfigData config = new ConfigData(); config.scormType = 1.2; jsonData.config = config; QuizData quiz = new QuizData(); quiz.title = "Quiz"; quiz.nameLabel = "Name"; quiz.name = objQuiz.QuizName; quiz.descLabel = "Description"; quiz.description = objQuiz.QuizDescription; quiz.timeLabel = "Time remaining: "; quiz.duration = objQuiz.Duration == 0 ? null : objQuiz.Duration; quiz.passingScore = 80;//This need to be change quiz.minScore = 0; quiz.maxScore = 100; quiz.multipleAttempts = false; quiz.timeoutMessage = "Exam time ended."; jsonData.quiz = quiz; ReviewQuizData reviewQuiz = new ReviewQuizData(); reviewQuiz.title = "Review Quiz"; reviewQuiz.nameLabel = "Name:"; reviewQuiz.name = objQuiz.QuizName; reviewQuiz.descLabel = "Description:"; reviewQuiz.description = objQuiz.QuizDescription; reviewQuiz.scoreLabel = "Score:"; jsonData.reviewQuiz = reviewQuiz; List <QuestionsData> lstQuestions = new List <QuestionsData>(); foreach (Dictionary <string, object> item in objQuiz.questionObject) { QuestionsData que = new QuestionsData(); que.questionText = Convert.ToString(item["QuestionText"]); if (Convert.ToInt32(item["QuestionTypeId"]) == 1) { que.type = "mcq"; que.instructionText = "Options"; que.randomOptions = Convert.ToBoolean(item["isRandomOption"]); List <OptionsData> lstOptions = new List <OptionsData>(); var optionsCount = (object[])item["Options"]; int[] arrAnswers = new int[optionsCount.Length]; int counter = 0; foreach (Dictionary <string, object> itemNew1 in (object[])item["Options"]) { OptionsData ops = new OptionsData(); ops.text = Convert.ToString(itemNew1["OptionText"]); ops.feedback = Convert.ToString(itemNew1["OptionFeedback"]); arrAnswers[counter] = Convert.ToInt32(itemNew1["CorrectOption"]); lstOptions.Add(ops); counter++; } que.answer = arrAnswers; que.points = 1; que.options = lstOptions; } if (Convert.ToInt32(item["QuestionTypeId"]) == 2) { que.type = "mrq"; que.instructionText = "Options"; que.randomOptions = Convert.ToBoolean(item["isRandomOption"]); List <OptionsData> lstOptions = new List <OptionsData>(); var optionsCount = (object[])item["Options"]; int[] arrAnswers = new int[optionsCount.Length]; int counter = 0; foreach (Dictionary <string, object> itemNew1 in (object[])item["Options"]) { OptionsData ops = new OptionsData(); ops.text = Convert.ToString(itemNew1["OptionText"]); arrAnswers[counter] = Convert.ToInt32(itemNew1["CorrectOption"]); lstOptions.Add(ops); counter++; } que.answer = arrAnswers; que.points = 1; que.options = lstOptions; CorrectFeedbackData correctFeedback = new CorrectFeedbackData(); correctFeedback.text = Convert.ToString(item["CorrectFeedback"]); que.correctFeedback = correctFeedback; IncorrectFeedbackData inCorrectFeedback = new IncorrectFeedbackData(); inCorrectFeedback.text = Convert.ToString(item["InCorrectFeedback"]); que.incorrectFeedback = inCorrectFeedback; } if (Convert.ToInt32(item["QuestionTypeId"]) == 3) { que.type = "para"; que.placeholderText = "Write your answer here"; que.answer = null; que.points = 1; CorrectFeedbackData correctFeedback = new CorrectFeedbackData(); correctFeedback.text = Convert.ToString(item["CorrectFeedback"]); que.correctFeedback = correctFeedback; IncorrectFeedbackData inCorrectFeedback = new IncorrectFeedbackData(); inCorrectFeedback.text = Convert.ToString(item["InCorrectFeedback"]); que.incorrectFeedback = inCorrectFeedback; } if (Convert.ToInt32(item["QuestionTypeId"]) == 4) { que.type = "video"; string base64String = string.Empty; if (!string.IsNullOrEmpty(Convert.ToString(item["mediaFile"]))) { base64String = Convert.ToString(item["mediaFile"]); byte[] newBytes = Convert.FromBase64String(base64String); MemoryStream ms = new MemoryStream(newBytes, 0, newBytes.Length); ms.Write(newBytes, 0, newBytes.Length); string fileName = Convert.ToString(item["qTypeId"]); string DestinationPath = System.Configuration.ConfigurationManager.AppSettings["ScormDestinationPath"]; DestinationPath = DestinationPath + "\\" + objQuiz.QuizName + "\\data\\media"; FileStream file = new FileStream(DestinationPath + "\\" + fileName, FileMode.Create, FileAccess.Write); ms.WriteTo(file); file.Close(); ms.Close(); que.path = "data//media//" + fileName; } else { string fileName = Convert.ToString(item["qTypeId"]); var extn = fileName.Split('.'); int count = extn.Length; fileName = Convert.ToString(item["QuestionId"]) + "." + extn[count - 1]; string DestinationPath = System.Configuration.ConfigurationManager.AppSettings["ScormDestinationPath"]; DestinationPath = DestinationPath + "\\" + objQuiz.QuizName + "\\data\\media"; string path = System.Configuration.ConfigurationManager.AppSettings["QuizMediaPath"]; System.IO.File.Move(path + "\\" + fileName, DestinationPath + "\\" + fileName); que.path = "data//media//" + fileName; } } if (Convert.ToInt32(item["QuestionTypeId"]) == 5) { que.type = "audio"; string base64String = string.Empty; if (!string.IsNullOrEmpty(Convert.ToString(item["mediaFile"]))) { base64String = Convert.ToString(item["mediaFile"]); byte[] newBytes = Convert.FromBase64String(base64String); MemoryStream ms = new MemoryStream(newBytes, 0, newBytes.Length); ms.Write(newBytes, 0, newBytes.Length); string fileName = Convert.ToString(item["qTypeId"]); string DestinationPath = System.Configuration.ConfigurationManager.AppSettings["ScormDestinationPath"]; DestinationPath = DestinationPath + "\\" + objQuiz.QuizName + "\\data\\media"; FileStream file = new FileStream(DestinationPath + "\\" + fileName, FileMode.Create, FileAccess.Write); ms.WriteTo(file); file.Close(); ms.Close(); que.path = "data//media//" + fileName; } else { string fileName = Convert.ToString(item["qTypeId"]); var extn = fileName.Split('.'); int count = extn.Length; fileName = Convert.ToString(item["QuestionId"]) + "." + extn[count - 1]; string DestinationPath = System.Configuration.ConfigurationManager.AppSettings["ScormDestinationPath"]; DestinationPath = DestinationPath + "\\" + objQuiz.QuizName + "\\data\\media"; string path = System.Configuration.ConfigurationManager.AppSettings["QuizMediaPath"]; System.IO.File.Move(path + "\\" + fileName, DestinationPath + "\\" + fileName); que.path = "data//media//" + fileName; } } lstQuestions.Add(que); } jsonData.questions = lstQuestions; string jsonFilePath = System.Configuration.ConfigurationManager.AppSettings["ScormDestinationPath"]; jsonFilePath = jsonFilePath + "\\" + objQuiz.QuizName + "\\data\\json\\"; var json = new JavaScriptSerializer().Serialize(jsonData); System.IO.File.WriteAllText(jsonFilePath + "quizdata.json", json); } catch (Exception ex) { newException.AddException(ex); } }
/// <summary> /// Initializes a new instance of OptionsWindow. /// </summary> /// <param name="options">The OptionsData to load that window with</param> public OptionsWindow(OptionsData options) { Options = options; InitializeComponent(); }
private void Awake() { optionsData = new OptionsData(); LoadPrefs(); }
public static bool Launch(OptionsData options, out int index) { /* Could all seem a bit excessive just to get the pid of the client it creates? */ ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.WorkingDirectory = MainWindow.CurrentOptions.UOSFolder; startInfo.FileName = Path.Combine(MainWindow.CurrentOptions.UOSFolder, "UOSteam.exe"); index = -1; Win32.SafeProcessHandle hProcess; Win32.SafeThreadHandle hThread; uint pid, tid; int uopid = 0; UOM.SetStatusLabel("Status : Launching UOSteam"); if (Win32.CreateProcess(startInfo, true, out hProcess, out hThread, out pid, out tid)) { /* Basically rewrites a small piece of code before the client resumes to write the pid of the new client it creates, probably not portable between versions if the registers change, what can i say, I'm a noob * Never had code of old code before RazorLauncher to see how xenoglyph did it before. * Code will need to be cleaned up. */ Process p = Process.GetProcessById((int)pid); IntPtr codeAddress; IntPtr baseAddress = GetBaseAddress(hProcess, hThread); if (baseAddress == null) { UOM.SetStatusLabel("Status : UOS Hook failed"); return(false); } byte[] buffer = new byte[0x17000]; Memory.Read(hProcess.DangerousGetHandle(), (IntPtr)(((int)baseAddress) + 0x1000), buffer, true); UOM.SetStatusLabel("Status : Patching UOSteam"); /* Originally pushes hThread and hProcess on the stack before a call, we'll overwrite here. */ byte[] findBytes = new byte[] { 0x8B, 0x44, 0x24, 0x44, // MOV EAX, [ESP+44] 0x8B, 0x4C, 0x24, 0x40 // MOV ECX, [ESP+40] }; int offset = 0; if (FindSignatureOffset(findBytes, buffer, out offset)) { if ((codeAddress = Memory.Allocate(hProcess.DangerousGetHandle(), IntPtr.Zero, 1024, true)) == IntPtr.Zero) { UOM.SetStatusLabel("Status : Memory Allocation failed"); hProcess.Dispose(); hThread.Dispose(); return(false); } byte[] patchCode1 = new byte[] { 0xB8, 0x00, 0x00, 0x00, 0x00, // MOV EAX, <codeAddress> 0x8B, 0x4C, 0x24, 0x4C, // MOV ECX, [ESP+4C] 0x89, 0x08, // MOV [EAX], ECX 0xB8, 0x00, 0x00, 0x00, 0x00, // MOV EAX, <codeAddress+4> 0x8B, 0x4C, 0x24, 0x44, // MOV ECX, [ESP+4C] 0x89, 0x08, // MOV [EAX], ECX 0x8B, 0x44, 0x24, 0x48, // MOV EAX, [ESP+48] -. 0x8B, 0x4C, 0x24, 0x44, // MOV ECX, [ESP+44] -| Original code we overwrote, but esp incremented 4 due to call return address on stack 0xC3 // RETN }; patchCode1[1] = (byte)codeAddress.ToInt32(); patchCode1[2] = (byte)(codeAddress.ToInt32() >> 8); patchCode1[3] = (byte)(codeAddress.ToInt32() >> 16); patchCode1[4] = (byte)(codeAddress.ToInt32() >> 24); int codeAddress2 = (codeAddress.ToInt32() + 4); patchCode1[12] = (byte)codeAddress2; patchCode1[13] = (byte)(codeAddress2 >> 8); patchCode1[14] = (byte)(codeAddress2 >> 16); patchCode1[15] = (byte)(codeAddress2 >> 24); int patchAddress = codeAddress.ToInt32() + 8; Memory.Write(hProcess.DangerousGetHandle(), (IntPtr)patchAddress, patchCode1, true); byte[] patchCode2 = new byte[] { 0xB8, 0x00, 0x00, 0x00, 0x00, // MOV EAX, <patchAddress> 0xFF, 0xD0, // CALL EAX 0x90 // NOP }; patchCode2[1] = (byte)patchAddress; patchCode2[2] = (byte)(patchAddress >> 8); patchCode2[3] = (byte)(patchAddress >> 16); patchCode2[4] = (byte)(patchAddress >> 24); IntPtr writeAddress = new IntPtr((baseAddress.ToInt32() + 0x1000) + offset); Memory.Write(hProcess.DangerousGetHandle(), writeAddress, patchCode2, true); if (Win32.ResumeThread(hThread.DangerousGetHandle()) == -1) { UOM.SetStatusLabel("Status : ResumeThread failed"); hProcess.Dispose(); hThread.Dispose(); return(false); } // This is dodgy, to be changed to something else. byte[] uopidbytes = new byte[4]; do { Memory.Read(hProcess.DangerousGetHandle(), (IntPtr)codeAddress, uopidbytes, true); uopid = uopidbytes[3] << 24 | uopidbytes[2] << 16 | uopidbytes[1] << 8 | uopidbytes[0]; } while (uopid == 0); } hProcess.Close(); hThread.Close(); return(ClientLauncher.Attach((uint)uopid, options, true, out index)); } UOM.SetStatusLabel("Status : Process creation failed"); return(false); }
/// <summary> /// Launch a new UOSteam instance. /// </summary> /// <param name="options">UOMachine.OptionsData to use for launching Razor.</param> /// <param name="clientIndex">Client index of launched client.</param> /// <returns>True on success.</returns> public static bool LaunchSteam(OptionsData options, out int clientIndex) { return(SteamLauncher.Launch(options, out clientIndex)); }
public static void LoadOptions() { OptionsData data = new OptionsData(); string filePath = GetOptionsPath(); Stream stream = null; try { stream = File.Open(filePath, FileMode.Open); BinaryFormatter bformatter = new BinaryFormatter(); bformatter.Binder = new VersionDeserializationBinder(); data = (OptionsData)bformatter.Deserialize(stream); CustomInputManager.sensitivityX = data.controls_SensitivityX; CustomInputManager.sensitivityY = data.controls_SensitivityY; CustomInputManager.useMouseWheelToChangeWeapon = data.controls_UseMouseWheelToChangeWeapon; CustomInputManager.invertMouse = data.controls_InvertMouse; CustomInputManager.AssignKeyToKeyInfo(CustomInputManager.keys.Action, data.controls_Action_Primary, true); CustomInputManager.AssignKeyToKeyInfo(CustomInputManager.keys.Action, data.controls_Action_Secondary, false); CustomInputManager.AssignKeyToKeyInfo(CustomInputManager.keys.Aim, data.controls_Aim_Primary, true); CustomInputManager.AssignKeyToKeyInfo(CustomInputManager.keys.Aim, data.controls_Aim_Secondary, false); CustomInputManager.AssignKeyToKeyInfo(CustomInputManager.keys.ChangeGun, data.controls_ChangeGun_Primary, true); CustomInputManager.AssignKeyToKeyInfo(CustomInputManager.keys.ChangeGun, data.controls_ChangeGun_Secondary, false); CustomInputManager.AssignKeyToKeyInfo(CustomInputManager.keys.Crouch, data.controls_Crouch_Primary, true); CustomInputManager.AssignKeyToKeyInfo(CustomInputManager.keys.Crouch, data.controls_Crouch_Secondary, false); CustomInputManager.AssignKeyToKeyInfo(CustomInputManager.keys.Fire, data.controls_Fire_Primary, true); CustomInputManager.AssignKeyToKeyInfo(CustomInputManager.keys.Fire, data.controls_Fire_Secondary, false); CustomInputManager.AssignKeyToKeyInfo(CustomInputManager.keys.Grenade_SnipeTimeController, data.controls_Grenade_SnipeTimeController_Primary, true); CustomInputManager.AssignKeyToKeyInfo(CustomInputManager.keys.Grenade_SnipeTimeController, data.controls_Grenade_SnipeTimeController_Secondary, false); CustomInputManager.AssignKeyToKeyInfo(CustomInputManager.keys.Jump, data.controls_Jump_Primary, true); CustomInputManager.AssignKeyToKeyInfo(CustomInputManager.keys.Jump, data.controls_Jump_Secondary, false); CustomInputManager.AssignKeyToKeyInfo(CustomInputManager.keys.Melee, data.controls_Melee_Primary, true); CustomInputManager.AssignKeyToKeyInfo(CustomInputManager.keys.Melee, data.controls_Melee_Secondary, false); CustomInputManager.AssignKeyToKeyInfo(CustomInputManager.keys.Missions, data.controls_Missions_Primary, true); CustomInputManager.AssignKeyToKeyInfo(CustomInputManager.keys.Missions, data.controls_Missions_Secondary, false); CustomInputManager.AssignKeyToKeyInfo(CustomInputManager.keys.MoveBackward, data.controls_MoveBackward_Primary, true); CustomInputManager.AssignKeyToKeyInfo(CustomInputManager.keys.MoveBackward, data.controls_MoveBackward_Secondary, false); CustomInputManager.AssignKeyToKeyInfo(CustomInputManager.keys.MoveForward, data.controls_MoveForward_Primary, true); CustomInputManager.AssignKeyToKeyInfo(CustomInputManager.keys.MoveForward, data.controls_MoveForward_Secondary, false); CustomInputManager.AssignKeyToKeyInfo(CustomInputManager.keys.MoveLeft, data.controls_MoveLeft_Primary, true); CustomInputManager.AssignKeyToKeyInfo(CustomInputManager.keys.MoveLeft, data.controls_MoveLeft_Secondary, false); CustomInputManager.AssignKeyToKeyInfo(CustomInputManager.keys.MoveRight, data.controls_MoveRight_Primary, true); CustomInputManager.AssignKeyToKeyInfo(CustomInputManager.keys.MoveRight, data.controls_MoveRight_Secondary, false); CustomInputManager.AssignKeyToKeyInfo(CustomInputManager.keys.Reload, data.controls_Reload_Primary, true); CustomInputManager.AssignKeyToKeyInfo(CustomInputManager.keys.Reload, data.controls_Reload_Secondary, false); CustomInputManager.AssignKeyToKeyInfo(CustomInputManager.keys.Sprint_SnipeSteady, data.controls_Sprint_SnipeSteady_Primary, true); CustomInputManager.AssignKeyToKeyInfo(CustomInputManager.keys.Sprint_SnipeSteady, data.controls_Sprint_SnipeSteady_Secondary, false); // AudioController.SetVolume_General(data.audio_GeneralVolume); AudioController.SetVolume_Music(data.audio_MusicVolume); AudioController.SetVolume_SFX(data.audio_SFXVolume); AudioController.SetVolume_Voice(data.audio_VoiceVolume); // VideoSettingsController.SetResolution(data.video_ResolutionIndex, false); VideoSettingsController.Unapplied_SetIsVSyncOn(data.video_VSync); VideoSettingsController.SetBightness(data.video_Brightness); VideoSettingsController.SetLODBias(data.video_LODBias); VideoSettingsController.SetVideoSettingType(data.video_Type); VideoSettingsController.Unapplied_SetIsShadowOn(data.video_IsShadowOn); VideoSettingsController.Unapplied_SetShadowQuality(data.video_ShadowQual); //VideoSettingsController.SetShadowDistance(data.video_ShadowDistance); VideoSettingsController.Unapplied_SetTextureQuality(data.video_TextureQual); VideoSettingsController.SetUseSSAO(data.video_UseSSAO); VideoSettingsController.SetUseAnisotropic(data.video_UseAnisotropic); VideoSettingsController.SetUseBloom(data.video_UseBloom); VideoSettingsController.ApplyRelativeAppliableSettings(); // optionsLoadWasOK = true; } catch { optionsLoadWasOK = false; //<Test> Debug.LogError("Loading options error!!!"); //</Test> } finally { if (stream != null) { stream.Close(); } } }
private StringBuilder CreateQuestionPaperXMLFromDataTable(DataTable dt) { StringBuilder strBuilder = new StringBuilder(); try { List <QuestionPaperData> listQuestionPaperData = new List <QuestionPaperData>(); int questionID = 1; foreach (DataRow row in dt.Rows) { if (row.ItemArray[0].ToString() != string.Empty) { QuestionPaperData objQuestionPaperData = new QuestionPaperData(); objQuestionPaperData.ID = questionID; objQuestionPaperData.Number = Convert.ToInt32(row.ItemArray[0]); objQuestionPaperData.QuestionText = Convert.ToString(row.ItemArray[1]); objQuestionPaperData.OptionType = Convert.ToString(row.ItemArray[2]); int optionID = 100;///option id starts from 100 int optionColumnIndex = 3; while (optionColumnIndex <= 6) { OptionsData option = new OptionsData(); option.ID = optionID; option.OptionText = Convert.ToString(row.ItemArray[optionColumnIndex]); objQuestionPaperData.Options.Add(option); optionID++; optionColumnIndex++; } string optionIDText = Convert.ToString(row.ItemArray[7]); if (optionIDText == "Option1") { objQuestionPaperData.RightOptionId = 100; } else if (optionIDText == "Option2") { objQuestionPaperData.RightOptionId = 101; } else if (optionIDText == "Option3") { objQuestionPaperData.RightOptionId = 102; } else if (optionIDText == "Option4") { objQuestionPaperData.RightOptionId = 103; } questionID++; listQuestionPaperData.Add(objQuestionPaperData); } } XmlSerializer serializer = new XmlSerializer(typeof(List <QuestionPaperData>)); using (StringWriter textWriter = new StringWriter()) { serializer.Serialize(textWriter, listQuestionPaperData); strBuilder.Append(textWriter.ToString()); } } catch (Exception) { throw; } return(strBuilder); }
public Options(OptionsData data) { InitializeComponent(); _data = data; DataContext = _data; }
/// <summary> /// Launch a new client instance. /// </summary> /// <param name="options">UOMachine.OptionsData to use for launching client.</param> /// <param name="clientIndex">Client index of launched client.</param> /// <returns>Client index of launched client.</returns> public static bool LaunchClient(OptionsData options, out int clientIndex) { return(ClientLauncher.Launch(options, out clientIndex)); }
public virtual void addHadnler(string optionName, OptionsData <object> option) { }