Skip to content
Snippets Groups Projects
ControlOptionsMenu_mobile.cs 9.52 KiB
Newer Older
using UnityEngine;
using UnityEngine.UI; //andr
using static StreamingAssetLoader;
MaZiFAU's avatar
MaZiFAU committed
using static UIconfig;
Stefan Richter's avatar
Stefan Richter committed
public class ControlOptionsMenu_mobile : MonoBehaviour
{
    public GameObject TouchControlButtonT;
    public GameObject TouchControlButtonUT;
    public GameObject TouchModeButtonT;
    public GameObject TouchModeButtonUT;
    public GameObject TAV_Slider;
    public GameObject TAvisibilityT;
    public GameObject InputSystemModeButtonT;
    public GameObject InputSystemModeButtonUT;
    public Text InputManager_Txt1a;
    public Text InputManager_Txt1b;


    private Color colChangeable = new Color(1f, 1f, 1f, 0.5f);
    private Color colChangeable2 = new Color(1f, 1f, 1f, 0.5f);

    //public GameObject TouchModeButton;


    //public GameObject back_GObj;

    void Start()
    {
        TAV_Slider.GetComponent<Slider>().value = UIconfig.TAvisibility;
        touchAreaVisibilityBttn();

    private void OnEnable()
    {
        UIconfig.InputDisable = true;
    }
    private void OnDisable()
    {
        UIconfig.InputDisable = false;
    }

    {
        TAV_Slider.GetComponent<Slider>().value = UIconfig.TAvisibility;
        touchAreaVisibilityBttn();

        UpdateUI_6();
    }

    public void InputTXTupdate()
MaZiFAU's avatar
MaZiFAU committed
        InputManager_Txt1a.text = "Movement Forward: " + "\n" +
                                "Movement Backward:  " + "\n" +
MaZiFAU's avatar
MaZiFAU committed
                                "Movement Left:      " + "\n" +
                                "Movement Right:     " + "\n" +
                                "Movement Running:   " + "\n" +
                                "Movement Jump:      " + "\n" +
                                //"\n" +
                                "Action 1:           " + "\n" +
                                "Action 2:           " + "\n" +
                                "Change Tool:        " + "\n" +
                                //"\n" +
Stefan Richter's avatar
Stefan Richter committed
                                "Menu Tools:        " + "\n" +
                                "Menu Mathematics:  " + "\n" +
                                "Menu Cancel:       " + "\n" +
MaZiFAU's avatar
MaZiFAU committed
                                "Command Load:       " + "\n" +
                                "Command Save:       " + "\n" +
MaZiFAU's avatar
MaZiFAU committed
                                "Command Reset:       " + "\n" +
                                "Command Undo:       " + "\n" +
MaZiFAU's avatar
MaZiFAU committed
                                "Command Redo:       " + "\n";

        InputManager_Txt1b.text = InputManager_KeyBinding_Vertical_1 + " , " + InputManager_KeyBinding_Vertical_2 + "\n" +
                        InputManager_KeyBinding_Vertical_01 + " , " + InputManager_KeyBinding_Vertical_02 + "\n" +
                        InputManager_KeyBinding_Horizontal_01 + " , " + InputManager_KeyBinding_Horizontal_02 + "\n" +
                        InputManager_KeyBinding_Horizontal_1 + " , " + InputManager_KeyBinding_Horizontal_2 + "\n" +
                        InputManager_KeyBinding_Running_1 + "\n" +
                         InputManager_KeyBinding_Jump_1 + "\n" +
                        //"\n" +
                        InputManager_KeyBinding_Fire1_1 + "\n" +
                        InputManager_KeyBinding_Fire2_1 + "\n" +
                        InputManager_KeyBinding_talk_1 + "\n" +
                        InputManager_KeyBinding_MouseScrollWheel_1 + "\n" +
                        //"\n" +
Stefan Richter's avatar
Stefan Richter committed
                        InputManager_KeyBinding_ToolmMenu_1 + "\n" +
                         InputManager_KeyBinding_MathMenu_1 + "\n" +
                        InputManager_KeyBinding_Cancel_1 + "\n" +
MaZiFAU's avatar
MaZiFAU committed
                         //"\n" +
                         InputManager_KeyBinding_modifier + " + " + InputManager_KeyBinding_mod_load_1 + "\n" +
                        InputManager_KeyBinding_modifier + " + " + InputManager_KeyBinding_mod_save_1 + "\n" +
                         InputManager_KeyBinding_modifier + " + " + InputManager_KeyBinding_mod_reset_1 + "\n" +
                        InputManager_KeyBinding_modifier + " + " + InputManager_KeyBinding_mod_undo_1 + "\n" +
                        InputManager_KeyBinding_modifier + " + " + InputManager_KeyBinding_mod_redo_1 + "\n";



MaZiFAU's avatar
MaZiFAU committed
        switch (UIconfig.controlMode)
            case ControlMode.Keyboard:
                //TouchControlButtonT.GetComponent<Text>().text = "Touch controls: OFF";
                //TouchControlButtonUT.GetComponent<Text>().text = "Press for activating";
                TouchControlButtonT.GetComponent<Text>().text = "Keyboard & Mouse";
                TouchControlButtonUT.GetComponent<Text>().text = "Press for changing mode";
                break;

            case ControlMode.Mobile:

                //TouchControlButtonT.GetComponent<Text>().text = "Touch controls: ON";
                //TouchControlButtonUT.GetComponent<Text>().text = "Press for deactivating";
                TouchControlButtonT.GetComponent<Text>().text = "Touch-Control";
                TouchControlButtonUT.GetComponent<Text>().text = "Press for changing mode";
                break;
            default:

                //TouchControlButtonT.GetComponent<Text>().text = "Touch controls: OFF";
                //TouchControlButtonUT.GetComponent<Text>().text = "Press for activating";
                TouchControlButtonT.GetComponent<Text>().text = "Not Defined!";
                TouchControlButtonUT.GetComponent<Text>().text = "Press for changing mode";
                break;

        }

        switch (UIconfig.InputManagerVersion)
        {
            case 1:

                InputSystemModeButtonT.GetComponent<Text>().text = "use Input_Manager bindings";
                InputSystemModeButtonUT.GetComponent<Text>().text = "Press for changing mode";
                InputSystemModeButtonT.GetComponent<Text>().text = "use Input_System_Package";
                InputSystemModeButtonUT.GetComponent<Text>().text = "Press for changing mode";
            case 3:

                InputSystemModeButtonT.GetComponent<Text>().text = "Input exchange through file";
                InputSystemModeButtonUT.GetComponent<Text>().text = "Press for changing mode";
                break;
                InputSystemModeButtonT.GetComponent<Text>().text = "Not Defined!";
                InputSystemModeButtonUT.GetComponent<Text>().text = "Press for changing mode";
                break;

        }

        switch (UIconfig.touchControlMode)
        {
            case 1:

                TouchModeButtonT.GetComponent<Text>().text = "Touch mode: BUTTONS";
                TouchModeButtonUT.GetComponent<Text>().text = "Press for changing mode";
                break;

            case 2:


                TouchModeButtonT.GetComponent<Text>().text = "Touch mode: D-PAD";
                TouchModeButtonUT.GetComponent<Text>().text = "Press for changing mode";
                break;
            case 3:


                TouchModeButtonT.GetComponent<Text>().text = "Touch mode: HYBRID";
                TouchModeButtonUT.GetComponent<Text>().text = "Press for changing mode";
                break;
            default:

                TouchModeButtonT.GetComponent<Text>().text = "Not Defined!";
                TouchModeButtonUT.GetComponent<Text>().text = "Press for changing mode";
                break;
        }
MaZiFAU's avatar
MaZiFAU committed

MaZiFAU's avatar
MaZiFAU committed


    public void TouchControls()
    {
        switch (UIconfig.controlMode)
        {
            case ControlMode.Keyboard:
                UIconfig.controlMode = ControlMode.Mobile;
            case ControlMode.Mobile:
                UIconfig.controlMode = ControlMode.Keyboard;
                UIconfig.controlMode = ControlMode.Keyboard;
                break;

        }
        //updateUIpreview();
        NetworkJSON_Save();
    }

    public void TouchControlModes()
    {
        switch (UIconfig.touchControlMode)
        {
            case 1:
                UIconfig.touchControlMode = 2;
                break;
            case 3:
                UIconfig.touchControlMode = 1;
                break;
            default:
                UIconfig.touchControlMode = 1;

    public void InputSystemModes()
    {
        switch (UIconfig.InputManagerVersion)
        {
            case 1:
                UIconfig.InputManagerVersion = 2;

                break;

            case 2:
                UIconfig.InputManagerVersion = 3;
                //GameObject.Find("TextSlotTOO").GetComponent<Text>().text = "Touch controls OFF";
MaZiFAU's avatar
MaZiFAU committed

                break;
            case 3:
                UIconfig.InputManagerVersion = 1;
                //GameObject.Find("TextSlotTOO").GetComponent<Text>().text = "Touch controls OFF";

                break;
            default:
                UIconfig.InputManagerVersion = 1;

                break;

        }
        //updateUIpreview();
        NetworkJSON_Save();
    }

    public void touchAreaVisibilityBttn()
    {
        UIconfig.TAvisibility = TAV_Slider.GetComponent<Slider>().value;
        TAvisibilityT.GetComponent<Text>().text = "Touch area visibility " + (int)(100 * UIconfig.TAvisibility) + "%";

        //updateUIpreview();

    }
MaZiFAU's avatar
MaZiFAU committed