void Update()
 {
     if (Input.GetKeyDown(KeyCode.P))
     {
         OnScreenConsole.Log(IsValid());
     }
 }
    private static void Createcurrent()
    {
        GameObject empty = new GameObject();

        empty.name            = "On Screen Console";
        m_current             = empty.AddComponent <OnScreenConsole> ();
        m_current.m_textColor = Color.white;
    }
    private static void CreateStaticRef()
    {
        GameObject empty = new GameObject();

        empty.name          = "On Screen Console";
        m_staticRef         = empty.AddComponent <OnScreenConsole> ();
        m_staticRef.m_color = Color.white;
    }
Ejemplo n.º 4
0
    public static OnScreenConsole Create(Canvas canvas, float width)
    {
        // Main Object
        GameObject mainGO = new GameObject();

        mainGO.name = "On-Screen Console";
        RectTransform mainRT = mainGO.AddComponent <RectTransform>();

        mainRT.SetParent(canvas.transform);
        mainRT.sizeDelta        = new Vector2(width, Screen.height);
        mainRT.anchorMin        = new Vector2(0.5f, 0.5f);
        mainRT.anchorMax        = new Vector2(0.5f, 0.5f);
        mainRT.pivot            = new Vector2(0, 0.5f);
        mainRT.anchoredPosition = new Vector2(-Screen.width / 2f, 0);
        OnScreenConsole osc = mainGO.AddComponent <OnScreenConsole>();

        // Background
        GameObject uiGO = new GameObject();

        uiGO.name = "On-Screen Console UI";
        RectTransform uiRT = uiGO.AddComponent <RectTransform>();

        uiRT.SetParent(mainRT);
        uiRT.sizeDelta        = new Vector2(width, Screen.height);
        uiRT.anchorMin        = new Vector2(0.5f, 0.5f);
        uiRT.anchorMax        = new Vector2(0.5f, 0.5f);
        uiRT.pivot            = new Vector2(0.5f, 0.5f);
        uiRT.anchoredPosition = new Vector2(0, 0);
        Image uiImage = uiGO.AddComponent <Image>();

        uiImage.raycastTarget = false;
        VerticalLayoutGroup uiLG = uiGO.AddComponent <VerticalLayoutGroup>();

        uiLG.padding               = new RectOffset(0, 0, 0, 0);
        uiLG.childAlignment        = TextAnchor.UpperLeft;
        uiLG.childControlWidth     = true; uiLG.childControlHeight = false;
        uiLG.childForceExpandWidth = true; uiLG.childForceExpandHeight = false;
        osc.ui   = uiGO;
        osc.uiRT = uiRT;
        uiGO.gameObject.SetActive(false);

        osc.uiWidth = width;

        // log colors
        osc.logtypeColors = new Dictionary <LogType, string>();
        osc.logtypeColors.Add(LogType.Log, "#011A37");
        osc.logtypeColors.Add(LogType.Error, "#FB2650");
        //osc.logtypeColors.Add(LogType.Warning, "#FFC254");
        osc.logtypeColors.Add(LogType.Warning, "#FDB636");
        osc.logtypeColors.Add(LogType.Exception, "#FB2650");
        osc.logtypeColors.Add(LogType.Assert, "#FB2650");

        // set bg colors
        osc.SetBackgroundColor(new Color(0.996f, 0.996f, 0.996f));


        return(osc);
    }
Ejemplo n.º 5
0
    public string ToString(OnScreenConsole osc)
    {
        string logString = "<color=" + osc.logtypeColors[type] + ">" + condition + "</color>";

        if (osc.ShowStackTrace)
        {
            logString = "<color=" + osc.logtypeColors[type] + ">" + condition + "\n<size=" + (OnScreenConsole.FONT_SIZE - 5).ToString() + ">" + stackTrace + "</size></color>";
        }

        return(logString);
    }
Ejemplo n.º 6
0
 public void SaveSong()
 {
     OnScreenConsole.Log("SONG SAVED");
     if (GameUtility.mySavedSong != null)
     {
         GameUtility.mySavedSong.tempo  = tempo;
         GameUtility.mySavedSong.track0 = tracks [0].clips;
         GameUtility.mySavedSong.track1 = tracks [1].clips;
         GameUtility.mySavedSong.track2 = tracks [2].clips;
         GameUtility.mySavedSong.track3 = tracks [3].clips;
     }
 }
Ejemplo n.º 7
0
    private void Awake()
    {
        // singleton Instance
        if (instance && instance != this)
        {
            Destroy(gameObject); return;
        }
        instance = this;


        // setup on-screen console
        if (onScreenConsoleActive)
        {
            Canvas canvas = FindObjectOfType <Canvas>();
            if (canvas == null)
            {
                Debug.Log("Creating a Canvas object in the Scene for the on-screen console.");
                canvas = CreateCanvas(1920, 1080);
            }

            onScreenConsole = OnScreenConsole.Create(canvas, 700);
        }
    }
Ejemplo n.º 8
0
 public void Howl()
 {
     OnScreenConsole.Log(Random.value);
 }
 void OnDestroy()
 {
     m_current = null;
 }
 void Awake()
 {
     m_current = this;
 }
 void OnDestroy()
 {
     m_staticRef = null;
 }
 void Awake()
 {
     m_staticRef = this;
 }