Exemplo n.º 1
0
    //Awake is always called before any Start functions
    void Awake()
    {
        //Check if instance already exists
        if (instance == null)
        {
            //if not, set instance to this
            instance = this;
        }

        //If instance already exists and it's not this:
        else if (instance != this)
        {
            //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
            Destroy(gameObject);
        }

        loadDatas();

        if (b_DesktopInputs && SceneManager.GetActiveScene().buildIndex != 0)                           // Desktop case. Only if we are not in the main menu Scene
        {
            StartCoroutine(changeLockStateLock());
        }

        _backInputs = gameObject.GetComponent <backInputs>();
    }
Exemplo n.º 2
0
    public override void OnInspectorGUI()
    {
        if (SeeInspector.boolValue)                                                             // If true Default Inspector is drawn on screen
        {
            DrawDefaultInspector();
        }

        serializedObject.Update();

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("See Inspector :", GUILayout.Width(85));
        EditorGUILayout.PropertyField(SeeInspector, new GUIContent(""), GUILayout.Width(30));
        EditorGUILayout.EndHorizontal();

        GUIStyle style_Yellow_01     = new GUIStyle(GUI.skin.box);   style_Yellow_01.normal.background = Tex_01;
        GUIStyle style_Blue          = new GUIStyle(GUI.skin.box);   style_Blue.normal.background = Tex_03;
        GUIStyle style_Purple        = new GUIStyle(GUI.skin.box);   style_Purple.normal.background = Tex_04;
        GUIStyle style_Orange        = new GUIStyle(GUI.skin.box);   style_Orange.normal.background = Tex_05;
        GUIStyle style_Yellow_Strong = new GUIStyle(GUI.skin.box);   style_Yellow_Strong.normal.background = Tex_02;

        GUILayout.Label("");
        backInputs myScript = (backInputs)target;

        EditorGUILayout.BeginVertical(style_Orange);
        if (objCanvasInput)
        {
            EditorGUILayout.BeginHorizontal();
            GUILayout.Label("Back Button Keyboard : ", GUILayout.Width(150));
            backButtonDesktop.intValue = EditorGUILayout.Popup(backButtonDesktop.intValue, s_inputListKeyboardButton.ToArray());
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();
            GUILayout.Label("Pause Button Keyboard : ", GUILayout.Width(150));
            pauseButtonDesktop.intValue = EditorGUILayout.Popup(pauseButtonDesktop.intValue, s_inputListKeyboardButton.ToArray());
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.LabelField("");

            EditorGUILayout.BeginHorizontal();
            GUILayout.Label("Back Button Joystick : ", GUILayout.Width(150));
            backButtonJoystick.intValue = EditorGUILayout.Popup(backButtonJoystick.intValue, s_inputListJoystickButton.ToArray());
            EditorGUILayout.EndHorizontal();
        }
        else
        {
            EditorGUILayout.HelpBox("INFO : The Object InputsManager needs to be activated in the the Hierarchy (Hierarchy : Canvas_MainMenu -> p_Inputs -> inputsManager", MessageType.Warning);
        }
        EditorGUILayout.EndVertical();

        EditorGUILayout.LabelField("");

        serializedObject.ApplyModifiedProperties();
    }
Exemplo n.º 3
0
    void OnEnable()
    {
        // Setup the SerializedProperties.
        SeeInspector = serializedObject.FindProperty("SeeInspector");

        backButtonDesktop  = serializedObject.FindProperty("backButtonDesktop");
        backButtonJoystick = serializedObject.FindProperty("backButtonJoystick");
        pauseButtonDesktop = serializedObject.FindProperty("pauseButtonDesktop");

        backInputs myScript = (backInputs)target;

        GameObject tmp = GameObject.Find("InputsManager");

        if (tmp)
        {
            objCanvasInput = tmp;
            for (var i = 0; i < tmp.GetComponent <MM_MenuInputs>().remapButtons[0].buttonsList.Count; i++)
            {
                s_inputListJoystickAxis.Add(tmp.GetComponent <MM_MenuInputs> ().remapButtons [0].buttonsList [i].name);
            }
            for (var i = 0; i < tmp.GetComponent <MM_MenuInputs>().remapButtons[1].buttonsList.Count; i++)
            {
                s_inputListJoystickButton.Add(tmp.GetComponent <MM_MenuInputs> ().remapButtons [1].buttonsList [i].name);
            }

            for (var i = 0; i < tmp.GetComponent <MM_MenuInputs>().remapButtons[2].buttonsList.Count; i++)
            {
                s_inputListKeyboardAxis.Add(tmp.GetComponent <MM_MenuInputs> ().remapButtons [2].buttonsList [i].name);
            }
            for (var i = 0; i < tmp.GetComponent <MM_MenuInputs>().remapButtons[3].buttonsList.Count; i++)
            {
                s_inputListKeyboardButton.Add(tmp.GetComponent <MM_MenuInputs> ().remapButtons [3].buttonsList [i].name);
            }
        }

        Tex_01 = MakeTex(2, 2, new Color(1, .8f, 0.2F, .4f));
        Tex_02 = MakeTex(2, 2, new Color(1, .8f, 0.2F, .4f));
        Tex_03 = MakeTex(2, 2, new Color(.3F, .9f, 1, .5f));
        Tex_04 = MakeTex(2, 2, new Color(1, .3f, 1, .3f));
        Tex_05 = MakeTex(2, 2, new Color(1, .5f, 0.3F, .4f));
    }