Ejemplo n.º 1
0
    IEnumerator I_MN_SaveGame()
    {
        ingameGlobalManager.instance.saveAndLoadManager.F_SaveProcess();
        yield return(new WaitUntil(() => ingameGlobalManager.instance.saveAndLoadManager.b_saveProcessFinished == true));

        //--> Deactivate Loading black screen
        CanvasGroup refCanvas = new CanvasGroup();

        for (var i = 0; i < ingameGlobalManager.instance.canvasMainMenu.List_GroupCanvas.Count; i++)
        {
            if (ingameGlobalManager.instance.canvasMainMenu.List_GroupCanvas [i].name == "MainMenu")
            {
                refCanvas = ingameGlobalManager.instance.canvasMainMenu.List_GroupCanvas [i];
                break;
            }
        }
        ingameGlobalManager.instance.canvasMainMenu.GoToOtherPage(refCanvas);

        EventSystem eSys = GameObject.Find("EventSystem").GetComponent <EventSystem> ();

        if (eSys)
        {
            eSys.SetSelectedGameObject(btnSave);
        }

        if (txtValidation)
        {
            txtValidation.text = txtProp.returnInfoText();
        }
    }
Ejemplo n.º 2
0
    public void Update()
    {
        bool b_Selected     = false;
        int  inputRemapType = 1;

        if (ingameGlobalManager.instance.b_Joystick)
        {
            inputRemapType = 0;
        }


        //-> Know the current selected button (Input Menu)
        for (var j = 0; j < 4; j++)
        {
            for (var i = 0; i < remapButtons [j].buttonsList.Count; i++)
            {
                if (remapButtons [j].buttonsList [i] != null && eventSystem.currentSelectedGameObject == remapButtons [j].buttonsList [i])
                {
                    b_Selected        = true;
                    currentlySelected = i;
                    inputRemapType    = j;
                }
                else
                {
                    //Debug.Log ("T");
                }
            }
        }
        //-> If No button is selected
        if (!b_Selected)
        {
            currentlySelected = -1;
        }

        //-> If remap activated and the selected button change : Disable remap
        for (var j = 0; j < 4; j++)
        {
            if (lastSelected != currentlySelected)
            {
                if (lastSelected != -1 && remapButtons [j].buttonsList.Count > lastSelected && remapButtons [j].buttonsList [lastSelected] != null)
                {
                    DisableRemap(j);
                }
            }
        }



        for (var i = 0; i < AxisList.Count; i++)
        {
            //-> Remap Joystick Input Axis
            if (Mathf.Abs(Input.GetAxisRaw(AxisList[i])) == 1 &&
                standInputModule.horizontalAxis == "NoMoveInMenu" &&
                standInputModule.verticalAxis == "NoMoveInMenu" &&
                remapButtons [0].stateList.Count > currentlySelected &&
                remapButtons [0].stateList [currentlySelected] == true &&
                remapButtons [0].b_Axis [currentlySelected] == true)
            {
                Debug.Log("Axis : " + AxisList [i]);

                newInputForJoystick(0, AxisList[i]);
                break;
            }
            //-> Remap Keyboard Input Axis
            if (Mathf.Abs(Input.GetAxisRaw(AxisList[i])) == 1 &&
                standInputModule.horizontalAxis == "NoMoveInMenu" &&
                standInputModule.verticalAxis == "NoMoveInMenu" &&
                remapButtons [2].stateList.Count > currentlySelected &&
                remapButtons [2].stateList [currentlySelected] == true &&
                remapButtons [2].b_Axis [currentlySelected] == true)
            {
                Debug.Log("Axis : " + AxisList [i]);

                newInputForJoystick(2, AxisList[i]);
                break;
            }
        }



        //-> Remap a Button
        if (Input.anyKeyDown)
        {
            bool   goodKey  = false;
            string newInput = FindTheKeyCodeUpdate().ToString();


            for (var i = 0; i < keyCodeList.Count; i++)
            {
                if (Input.GetKeyDown(keyCodeList [i]))
                {
                    if (currentlySelected != -1 &&
                        (keyCodeList [i] == KeyCode.Return || keyCodeList [i] == KeyCode.Mouse0) &&
                        remapButtons [inputRemapType].stateList.Count > currentlySelected &&
                        remapButtons [inputRemapType].stateList [currentlySelected] == true)
                    {
                    }
                    else if (currentlySelected != -1)
                    {
                        Debug.Log(newInput);
                        goodKey = true;
                        Debug.Log("Button is pressed");
                        newInput = keyCodeList [i].ToString();
                        break;
                    }
                }
            }



            //-> It is possible to change the Input
            if (goodKey &&
                currentlySelected != -1 &&
                remapButtons [inputRemapType].stateList.Count > currentlySelected &&
                remapButtons [inputRemapType].buttonsList [currentlySelected] != null &&
                remapButtons [inputRemapType].stateList [currentlySelected] == false)
            {
                enableInputRemap(inputRemapType);
            }

            //-> New Input for Joystick
            else if (inputRemapType == 1 &&
                     goodKey &&
                     currentlySelected != -1 &&
                     remapButtons [inputRemapType].stateList.Count > currentlySelected &&
                     remapButtons[inputRemapType].buttonsList [currentlySelected] != null &&
                     remapButtons[inputRemapType].stateList [currentlySelected] == true)
            {
                if (remapButtons [inputRemapType].b_Axis [currentlySelected] == false)
                {
                    newInputForJoystick(inputRemapType, newInput);
                }
                else
                {
                    if (Input.GetKeyDown(KeyCode.Escape))
                    {
                        DisableRemap(inputRemapType);
                    }
                    else
                    {
                        StopCoroutine("infoPlayer");
                        StartCoroutine(infoPlayer(txt_PlayerInfoTextProp.returnInfoText()));                                    // Text : Input Not Possible
                    }
                }
            }
            //-> Display info to say why it is not possible to use this key
            else if (inputRemapType == 1 &&
                     !goodKey &&
                     currentlySelected != -1 &&
                     remapButtons [inputRemapType].stateList.Count > currentlySelected &&
                     remapButtons[inputRemapType].buttonsList [currentlySelected] != null &&
                     remapButtons[inputRemapType].stateList [currentlySelected] == true)
            {
                if (Input.GetKeyDown(KeyCode.Escape))
                {
                    DisableRemap(inputRemapType);
                }
                else
                {
                    StopCoroutine("infoPlayer");
                    StartCoroutine(infoPlayer(txt_PlayerInfoTextProp.returnInfoText()));                                // Text : Input Not Possible
                }
            }
            //-> New Input for Desktop
            else if (inputRemapType == 3 &&
                     !goodKey &&
                     currentlySelected != -1 &&
                     remapButtons [inputRemapType].stateList.Count > currentlySelected &&
                     remapButtons[inputRemapType].buttonsList [currentlySelected] != null &&
                     remapButtons[inputRemapType].stateList [currentlySelected] == true)
            {
                bool b_KeyNotAvailable = false;
                for (var i = 0; i < keyCodeNotAvailableList.Count; i++)
                {
                    if (keyCodeNotAvailableList [i].ToString() == newInput)
                    {
                        b_KeyNotAvailable = true;
                        break;
                    }
                }

                if (!b_KeyNotAvailable)
                {
                    newInputForDesktop(inputRemapType, newInput);
                }
            }
            //-> Display info to say why it is not possible to use this key
            else if (inputRemapType == 3 &&
                     goodKey &&
                     currentlySelected != -1 &&
                     remapButtons [inputRemapType].stateList.Count > currentlySelected &&
                     remapButtons[inputRemapType].buttonsList [currentlySelected] != null &&
                     remapButtons[inputRemapType].stateList [currentlySelected] == true)
            {
                StopCoroutine("infoPlayer");
                StartCoroutine(infoPlayer(txt_PlayerInfoTextProp.returnInfoText()));                            // Text : Input Not Possible
            }
        }

        lastSelected = currentlySelected;
    }