<commit_before>﻿using UnityEngine;
using System.Collections;

public class SavegameMenu : MonoBehaviour {
    public GUISkin Skin;

    public delegate void LoadSaveButtonPressed(string filename);
    public LoadSaveButtonPressed OnSaveButtonPressed;
    public LoadSaveButtonPressed OnLoadButtonPressed;

    private Rect windowRect = new Rect(10, 10, 200, 200);
    private const string NoSavegamesFound = "No savegames found";
    private string[] savegameNames = new string[] { NoSavegamesFound };
    private int selectedNameIndex = -1;
    private string saveName = "";

    public bool InRect(Vector3 mousePosition) {
        return windowRect.Contains(mousePosition);
    }

    private void ShowWindow(int id) {
        GUILayout.BeginVertical();
        GUILayout.Label("Save games");
        bool savegamesFound = (savegameNames[0] != NoSavegamesFound);
        GUI.enabled = savegamesFound;
        selectedNameIndex = GUILayout.SelectionGrid(selectedNameIndex, savegameNames, 1);
        GUI.enabled = true;
        GUILayout.Space(100);

        saveName = GUILayout.TextField(saveName);
        GUILayout.BeginHorizontal();

        GUI.enabled = (saveName != "");
        if (GUILayout.Button("Save")) {
            if (OnSaveButtonPressed != null) {
                OnSaveButtonPressed(savegameNames[selectedNameIndex]);
            }
        }

        GUI.enabled = savegamesFound;
        if (GUILayout.Button("Load")) {
            if (OnLoadButtonPressed != null) {
                OnLoadButtonPressed(savegameNames[selectedNameIndex]);
            }
        }
        GUI.enabled = true;

        GUILayout.EndHorizontal();
        GUILayout.EndVertical();
    }
    private void OnGUI() {
        GUI.skin = Skin;
        windowRect = GUILayout.Window(0, windowRect, ShowWindow, "Load/save game");
    }
}<commit_msg>Add IsMouseOver method, to check whether the mouse is hovering over the menu<commit_after>﻿using UnityEngine;
using System.Collections;

public class SavegameMenu : MonoBehaviour {
    public GUISkin Skin;

    public delegate void LoadSaveButtonPressed(string filename);
    public LoadSaveButtonPressed OnSaveButtonPressed;
    public LoadSaveButtonPressed OnLoadButtonPressed;

    private Rect windowRect = new Rect(10, 10, 200, 200);
    private const string NoSavegamesFound = "No savegames found";
    private string[] savegameNames = new string[] { NoSavegamesFound };
    private int selectedNameIndex = -1;
    private string saveName = "";

    public bool InRect(Vector3 mousePosition) {
        return windowRect.Contains(mousePosition);
    }

    private void ShowWindow(int id) {
        GUILayout.BeginVertical();
        GUILayout.Label("Save games");
        bool savegamesFound = (savegameNames[0] != NoSavegamesFound);
        GUI.enabled = savegamesFound;
        selectedNameIndex = GUILayout.SelectionGrid(selectedNameIndex, savegameNames, 1);
        GUI.enabled = true;
        GUILayout.Space(100);

        saveName = GUILayout.TextField(saveName);
        GUILayout.BeginHorizontal();

        GUI.enabled = (saveName != "");
        if (GUILayout.Button("Save")) {
            if (OnSaveButtonPressed != null) {
                OnSaveButtonPressed(savegameNames[selectedNameIndex]);
            }
        }

        GUI.enabled = savegamesFound;
        if (GUILayout.Button("Load")) {
            if (OnLoadButtonPressed != null) {
                OnLoadButtonPressed(savegameNames[selectedNameIndex]);
            }
        }
        GUI.enabled = true;

        GUILayout.EndHorizontal();
        GUILayout.EndVertical();
    }
    private void OnGUI() {
        GUI.skin = Skin;
        windowRect = GUILayout.Window(0, windowRect, ShowWindow, "Load/save game");
    }

    public bool IsMouseOver() {
        Vector3 mp = Input.mousePosition;
        mp.y = Mathf.Abs(mp.y - Screen.height);

        if (InRect(mp)) {
            return false;
        }

        return true;
    }
}
{'fraction_non_alphanumeric': 0.09674160141449861, 'fraction_numerical': 0.009345794392523364, 'mean_word_length': 2.673469387755102, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6535102', 'n_tokens_mistral': 1171, 'n_tokens_neox': 1073, 'n_words': 247}