<commit_before>﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="CheatConsole.cs" company="Slash Games">
//   Copyright (c) Slash Games. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

namespace Slash.Unity.Common.Diagnostics
{
    using Slash.GameBase;
    using Slash.GameBase.Events;
    using Slash.Unity.Common.Core;

    using UnityEngine;

    public class CheatConsole : MonoBehaviour
    {
        #region Fields

        public Rect ButtonRect = new Rect(0, 0, 10, 10);

        public string[] QuickCheats;

        /// <summary>
        ///   Height of UI.
        /// </summary>
        public float UIHeight = 600;

        /// <summary>
        ///   Width of UI.
        /// </summary>
        public float UIWidth = 800;

        /// <summary>
        ///   Indicates if a butotn should be shown to enable/disable cheat console.
        /// </summary>
        public bool UseButton = true;

        private readonly Rect dragRect = new Rect(0, 0, 10000, 20);

        private string cheat = string.Empty;

        private Game game;

        private GameBehaviour gameBehaviour;

        private bool showConsole;

        private Rect windowRect = new Rect(10, 10, 300, 200);

        #endregion

        #region Public Methods and Operators

        public void DisableConsole()
        {
            this.showConsole = false;
        }

        public void EnableConsole()
        {
            this.showConsole = true;
        }

        #endregion

        #region Methods

        private void DrawCheatConsole(int id)
        {
            GUI.DragWindow(this.dragRect);

            if (this.game != null)
            {
                GUILayout.Label("Cheat: ");
                this.cheat = GUILayout.TextField(this.cheat);

                if (!string.IsNullOrEmpty(this.cheat) && GUILayout.Button("Submit"))
                {
                    this.game.EventManager.QueueEvent(FrameworkEventType.Cheat, this.cheat);
                }

                GUILayout.Label("Quick Cheats:");
                foreach (var quickCheat in this.QuickCheats)
                {
                    if (GUILayout.Button(quickCheat))
                    {
                        this.game.EventManager.QueueEvent(FrameworkEventType.Cheat, quickCheat);
                    }
                }
            }
            else
            {<commit_msg>CHANGED: Unity.Common - Enabling/Disabling cheat console collider when cheat console is enabled/disabled.<commit_after>﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="CheatConsole.cs" company="Slash Games">
//   Copyright (c) Slash Games. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

namespace Slash.Unity.Common.Diagnostics
{
    using Slash.GameBase;
    using Slash.GameBase.Events;
    using Slash.Unity.Common.Core;

    using UnityEngine;

    public class CheatConsole : MonoBehaviour
    {
        #region Fields

        public Rect ButtonRect = new Rect(0, 0, 10, 10);

        public string[] QuickCheats;

        /// <summary>
        ///   Height of UI.
        /// </summary>
        public float UIHeight = 600;

        /// <summary>
        ///   Width of UI.
        /// </summary>
        public float UIWidth = 800;

        /// <summary>
        ///   Indicates if a butotn should be shown to enable/disable cheat console.
        /// </summary>
        public bool UseButton = true;

        private readonly Rect dragRect = new Rect(0, 0, 10000, 20);

        private string cheat = string.Empty;

        private Game game;

        private GameBehaviour gameBehaviour;

        private bool showConsole = true;

        private Rect windowRect = new Rect(10, 10, 300, 200);

        #endregion

        #region Public Methods and Operators

        public void DisableConsole()
        {
            this.showConsole = false;

            // Disable collider if available (blocks input for other UI).
            if (this.collider != null)
            {
                this.collider.enabled = false;
            }
            if (this.collider2D != null)
            {
                this.collider2D.enabled = false;
            }
        }

        public void EnableConsole()
        {
            this.showConsole = true;

            // Enable collider if available (blocks input for other UI).
            if (this.collider != null)
            {
                this.collider.enabled = true;
            }
            if (this.collider2D != null)
            {
                this.collider2D.enabled = true;
            }
        }

        public void Start()
        {
            this.DisableConsole();
        }

        #endregion

        #region Methods

        private void DrawCheatConsole(int id)
        {
            GUI.DragWindow(this.dragRect);

            if (this.game != null)
            {
                GUILayout.Label("Cheat: ");
                this.cheat = GUILayout.TextField(this.cheat);

                if (!string.IsNullOrEmpty(this.cheat) && GUILayout.Button("Submit"))
                {
                    this.game.EventManager.QueueEvent(FrameworkEventType.Cheat, this.cheat);
                }

                GUILayout.Label("Quick Cheats:");
                foreach (var quickCheat in this.QuickCheats)
                {
                    if (GUILayout.Button(quickCheat))
                    {
                        this.game.EventManager.QueueEvent(FrameworkEventType.Cheat, quickCheat);
                    }
                }
            }
            else
            {
{'fraction_non_alphanumeric': 0.16722915963550455, 'fraction_numerical': 0.011137360782990213, 'mean_word_length': 1.1798455314453844, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4247596', 'n_tokens_mistral': 1560, 'n_tokens_neox': 1387, 'n_words': 357}