public int BuildDisplayList(bool drawDebug = false) { int list = 0; list = GL.GenLists(1); GL.NewList(list, ListMode.Compile); //DEBUG LOGGING DebugTools.Log("[Engine]: Building geometry into display list."); drawWorldPoly(); if (drawDebug) { //DEBUG LOGGING DebugTools.Log("[Engine]: Building wireframe into display list."); drawWorldWireframe(); //DEBUG LOGGING DebugTools.Log("[Engine]: Building normals into display list."); drawWorldNormals(); } //DEBUG LOGGING DebugTools.Log("[Engine]: Building lines into display list."); drawWorldLines(); //DEBUG LOGGING DebugTools.Log("[Engine]: Compiling display list."); GL.EndList(); DisplayListID = list; return(list); }
public void SetFPS(string parameter) { int targetFPS = int.Parse(parameter); Mathf.Clamp(targetFPS, 10, 120); Application.targetFrameRate = targetFPS; DebugTools.Log("Curr Target Framerate: " + Application.targetFrameRate); }
private void LoadDefaultFlagValues() { DebugTools.Log("Loading Default Flags", DebugTools.DebugLevel.WARNING); FlagsDictionary.Add(Flags.ALTERNATE_REPETITION_SFX, "1"); FlagsDictionary.Add(Flags.REPETITION_VISUAL_INDICATOR, "0"); FlagsDictionary.Add(Flags.LOCALIZATION, "1"); FlagsDictionary.Add(Flags.DEBUG_MENU_ITEMS, "0"); FlagsDictionary.Add(Flags.CHECK_SENSOR_CONN, "1"); FlagsDictionary.Add(Flags.LOAD_DATA_FROM_DEBUG_JSON_IF_AVAIL, "0"); }
// Use this for initialization void Start() { DebugTools.Log("Start", gameObject, m_DisplayFrameCount, m_DisplayTime); //StartCoroutine(TranslationCoroutine(2, transform, transform.position, transform.position + Random.onUnitSphere * 5)); //StartCoroutine(RescaleCoroutine(4, transform, transform.localScale, transform.localScale * 10)); m_MultipleTransfCoroutine = MultipleRandomTranslationsCoroutine(10, transform, () => { m_AudioSource.Play(); }, () => RescaleCoroutine(4, transform, transform.localScale, transform.localScale * 10)); StartCoroutine(m_MultipleTransfCoroutine); }
private void Start() { FlagsStoragePath = Path.Combine(Application.persistentDataPath, "Config/Flags.txt"); DebugTools.Log("FlagsStoragePath: " + FlagsStoragePath); if (!File.Exists(FlagsStoragePath)) { DebugTools.Log("Flags File doesnt exist, creating new file", DebugTools.DebugLevel.WARNING); LoadDefaultFlagValues(); SaveFlagsToFile(); } else { LoadFlagsFromFile(); } }
public void ListCmd() { string text = ""; text += "Entire Command List"; text += Environment.NewLine; text += "======================="; foreach (string cmdDesc in DebugTools.Instance.GetEntireCommandList()) { text += Environment.NewLine; text += cmdDesc; text += Environment.NewLine; } text += "======================="; DebugTools.Log(text, DebugTools.DebugLevel.COMMAND); }
private void LoadFlagsFromFile() { List <string> flags = File.ReadAllLines(FlagsStoragePath).ToList(); if (flags[0].ToString().Split('-')[0] != Versioning.GetVersion()) { Debug.LogWarning("Different Unity Version, loading default flag values instead"); LoadDefaultFlagValues(); SaveFlagsToFile(); return; } DebugTools.Log(""); DebugTools.Log("Loading Flags"); DebugTools.Log("-------------------"); foreach (string flag in flags.Skip(1)) { try { if (flag.Length < 1) { continue; } string flagName = flag.Split('=')[0]; string flagContent = flag.Split('=')[1]; Flags flagENUM = flagName.ToEnum <Flags>(); if (flagENUM == Flags.NULL) { DebugTools.Log($"Invalid Flag ({flagName}), skipping flag addition", DebugTools.DebugLevel.ERROR); } DebugTools.Log(flag); FlagsDictionary.Add(flagENUM, flagContent); } catch (Exception e) { DebugTools.Log(e.ToString(), DebugTools.DebugLevel.ERROR); } } DebugTools.Log("-------------------"); DebugTools.Log("Flag load complete"); DebugTools.Log(""); }
// Update is called once per frame //void Update() //{ // DebugTools.Log("Update", gameObject, m_DisplayFrameCount, m_DisplayTime); //} //private void FixedUpdate() //{ // DebugTools.Log("FixedUpdate", gameObject, m_DisplayFrameCount, m_DisplayTime); //} //private void LateUpdate() //{ // DebugTools.Log("LateUpdate", gameObject, m_DisplayFrameCount, m_DisplayTime); //} //private void OnDestroy() //{ // DebugTools.Log("OnDestroy", gameObject, m_DisplayFrameCount, m_DisplayTime); //} #endregion IEnumerator TranslationCoroutine(float delay, Transform transf, Vector3 startPos, Vector3 endPos, EasingFunctionDelegate easingFunction) { float elapsedTime = 0; DebugTools.Log("TranslationCoroutine START", null, m_DisplayFrameCount, m_DisplayTime); //yield return new WaitForSeconds(delay); while (elapsedTime < delay) { DebugTools.Log("TranslationCoroutine UPDATE", null, m_DisplayFrameCount, m_DisplayTime); float k = elapsedTime / delay; transf.position = Vector3.Lerp(startPos, endPos, easingFunction(0, 1, k)); elapsedTime += Time.deltaTime; yield return(null); } transf.position = endPos; DebugTools.Log("TranslationCoroutine END", null, m_DisplayFrameCount, m_DisplayTime); }
private void SaveFlagsToFile() { string flags = string.Empty; flags += Versioning.GetVersion(true); flags += Environment.NewLine; foreach (var flag in FlagsDictionary) { flags += flag.Key.ToString() + "=" + flag.Value.ToString(); flags += Environment.NewLine; } try { DebugTools.Log("Runtime: " + Application.platform.ToString()); if (!Directory.Exists(Path.GetDirectoryName(FlagsStoragePath))) { DebugTools.Log("Directory Path not found, creating path"); Directory.CreateDirectory(Path.GetDirectoryName(FlagsStoragePath)); } if (!File.Exists(FlagsStoragePath)) { File.Create(FlagsStoragePath).Dispose(); } using (StreamWriter sr = new StreamWriter(FlagsStoragePath, false)) { sr.Write(flags); } DebugTools.Log("Saved Flags File to " + FlagsStoragePath); } catch (Exception e) { DebugTools.Log(e.ToString(), DebugTools.DebugLevel.ERROR); DebugTools.Log("Failed to save Flags File"); } }
public void SendMessageToAllGO(string parameter) { GameObject[] allGO = Resources.FindObjectsOfTypeAll <GameObject>(); if (parameter.Contains(",")) { List <string> parameters = parameter.Split(',').ToList(); foreach (GameObject go in allGO) { go.SendMessage(parameters[0], parameters[1], SendMessageOptions.DontRequireReceiver); } } else { string param = parameter; foreach (GameObject go in allGO) { go.SendMessage(param, SendMessageOptions.DontRequireReceiver); } } DebugTools.Log("Send Message Done"); }
public void GameObjectSetActive(string parameter) { List <string> param = parameter.Split(',').ToList(); GameObject[] allGO = Resources.FindObjectsOfTypeAll <GameObject>(); GameObject targetGO = null; if (allGO.Any(x => x.name == param[0])) { targetGO = Resources.FindObjectsOfTypeAll <GameObject>().Where(x => x.name == param[0]).First(); } else { DebugTools.Log("Cant find GameObject " + parameter[0]); return; } if (targetGO) { targetGO.SetActive(bool.Parse(param[1])); DebugTools.Log(parameter[0] + " is set " + parameter[1]); } }
private void OnDisable() { DebugTools.Log("OnDisable", gameObject, m_DisplayFrameCount, m_DisplayTime); }
// Use this for initialization void Start() { DebugTools.Log("Start", gameObject, m_DisplayFrameCount, m_DisplayTime); }
private void fileSubmitButton_Click(object sender, EventArgs e) // TODO: make a public event handler for messages meant for the user, // and replace any references to the user message box (errorLabel) // by firing off an event instead. { Spreadsheet spreadsheet; FormData formData; // Make sure this can only be ran once (for neatness I guess) Button goButton = ((Button)sender); goButton.Enabled = false; // Make sure the progress bar is at 0 to start with. ResetProgressBar(); // Get textbox value with the .xlsx file path string filePath = filePathTextBox.Text; // Check that the file exists. if (!File.Exists(filePath)) { UserMessageBox.Text = UserMessageBox.Text + "Could not find the file specified.\r\n"; goButton.Enabled = true; return; } /// Read xlsx file into a FormData object try { spreadsheet = ExcelTools.ReadExcelFile(filePath); } catch (FileFormatException) { string tempMessage = "The selected file is either corrupt, or not a valid Microsoft Excel document.\r\n"; UserMessageBox.Text += tempMessage; DebugTools.Log(tempMessage); goButton.Enabled = true; return; } formData = ExcelTools.SpreadsheetToFormData(spreadsheet); /// Submit the form with data read, saving the reference var reference = WebFormTools.PostFormDataAsync(formData); /// Wait for the form submission to finish, updating the loading bar in the meantime, /// but let the user know if something happens during submission / reference retreival. while (!reference.IsCompleted) { if (reference.IsCanceled) { string tempMessage = "Form submission cancelled.\r\n"; UserMessageBox.Text += tempMessage; DebugTools.Log(tempMessage); goButton.Enabled = true; return; } if (reference.IsFaulted) { string tempMessage = "Form submission failed due to an unknown error.\r\n"; UserMessageBox.Text += tempMessage; DebugTools.Log(tempMessage); goButton.Enabled = true; return; } // Update the progress bar. UpdateProgressBar(); // Make sure that the form doesn't hang while waiting. Refresh(); Application.DoEvents(); } // Change the progress bar to 100% and change the go button to show that we are done FillProgressBar(); goButton.Enabled = true; int errorCode = 0; string mockReference = "MockReference - 12345678"; foreach (int attempt in new[] { 1, 2 }) { try { if (attempt == 1) { errorCode = ExcelTools.AppendToExcelFile(reference.GetAwaiter().GetResult(), filePath); break; // no need to try again for attempt no. 2 } else { errorCode = ExcelTools.AppendToExcelFile(mockReference, filePath); break; } } catch (InvalidReferenceException error) { string errorMessage = $"{error.Message}\r\nFor demo purposes a mock reference was used: {mockReference}\r\n"; UserMessageBox.Text += errorMessage; DebugTools.Log(errorMessage); } catch (Exception error) { string tempMessage = $"An error has occured while saving the submission reference. Additional Info:\r\n{error.Message}\r\n"; UserMessageBox.Text += tempMessage; DebugTools.Log(tempMessage); } } switch (errorCode) { case 0: break; case 1: string errorMessage = "File specified was empty.\r\n"; UserMessageBox.Text += errorMessage; DebugTools.Log(errorMessage); goButton.Enabled = true; return; case 2: errorMessage = "Failed to get write permissions to the file.\r\n"; UserMessageBox.Text += errorMessage; DebugTools.Log(errorMessage); goButton.Enabled = true; break; } goButton.Enabled = true; ExcelTools.DisplatResults(filePath, this); }
private void Awake() { m_AudioSource = GetComponent <AudioSource>(); DebugTools.Log("Awake", gameObject, m_DisplayFrameCount, m_DisplayTime); }
private void Awake() { DebugTools.Log("Awake", gameObject, m_DisplayFrameCount, m_DisplayTime); }
private void OnDestroy() { DebugTools.Log("OnDestroy", gameObject, m_DisplayFrameCount, m_DisplayTime); }
private void LateUpdate() { DebugTools.Log("LateUpdate", gameObject, m_DisplayFrameCount, m_DisplayTime); }
private void CheckForNeedsReaction() { ENeedType needType = m_needsUpdater.GetHighestPriorityNeed(); DebugTools.Log("[Character] - Highest priority need = {0}", needType); }
// Update is called once per frame void Update() { DebugTools.Log("Update", gameObject, m_DisplayFrameCount, m_DisplayTime); }