public void LoadKeyboard(string aUserName)
    {
        userName = aUserName;
        Keyboard.resetKeyboard();
        AllKeys.removeLegend();
        Debug.Log("Loading Keyboard for " + aUserName);
        if (File.Exists (Application.persistentDataPath + "/" + aUserName + "KeyboardInfo.dat"))
        {

            BinaryFormatter bf = new BinaryFormatter ();
            FileStream file = File.Open (Application.persistentDataPath + "/" + aUserName + "KeyboardInfo.dat", FileMode.Open);
            KeyboardDataSer keyData = (KeyboardDataSer)bf.Deserialize(file);
            file.Close();

            InputManager.inputManagerList = new List<InputManager.INPUT_CLASS>();
            Inputs.inputDict = new Dictionary<string, Inputs>();
            AllKeys.legendList = new List<Button>();

            foreach(InputManager.INPUT_CLASS_FOR_DATA_STORAGE inputClass in keyData.inputManagerList)
            {

                InputManager.INPUT_CLASS tempInputClass = new InputManager.INPUT_CLASS(
                    inputClass.Input, buttonSer.getButtonSer(inputClass.Key.buttonName,
                    inputClass.Key.buttonTag), inputClass.Type, inputClass.Tag, inputClass.Name);

                InputManager.inputManagerList.Add(tempInputClass);

            }
            for(int i = 0; i < keyData.inputManagerList.Count; i++)
            {

                inputManager.setKey(InputManager.inputManagerList[i]);
                AllKeys.INITIAL_LIST_LEGEND(keyData.inputManagerList[i].Name, keyData.inputManagerList[i].Tag);

            }

            Keyboard.KeyboardTags.keyboardTagsAndTypes();
            Debug.Log("Keyboard data found for: " + aUserName);

        }
        else
        {

            InputManager.inputManagerList = inputManager.inputManagerList_FROM_INSPECTOR;
            Debug.Log("No Keyboard data found - Using Inspector setup");
            inputManager.CONFIGURE_LAYOUT();
            SaveKeyboard();

        }
    }
    public void LoadKeyboard(string aUserName)
    {
        userName = aUserName;
        Keyboard.resetKeyboard();
        AllKeys.removeLegend();
        Debug.Log("Loading Keyboard for " + aUserName);
        if (File.Exists(Application.persistentDataPath + "/" + aUserName + "KeyboardInfo.dat"))
        {
            BinaryFormatter bf      = new BinaryFormatter();
            FileStream      file    = File.Open(Application.persistentDataPath + "/" + aUserName + "KeyboardInfo.dat", FileMode.Open);
            KeyboardDataSer keyData = (KeyboardDataSer)bf.Deserialize(file);
            file.Close();

            InputManager.inputManagerList = new List <InputManager.INPUT_CLASS>();
            Inputs.inputDict   = new Dictionary <string, Inputs>();
            AllKeys.legendList = new List <Button>();

            foreach (InputManager.INPUT_CLASS_FOR_DATA_STORAGE inputClass in keyData.inputManagerList)
            {
                InputManager.INPUT_CLASS tempInputClass = new InputManager.INPUT_CLASS(
                    inputClass.Input, buttonSer.getButtonSer(inputClass.Key.buttonName,
                                                             inputClass.Key.buttonTag), inputClass.Type, inputClass.Tag, inputClass.Name);

                InputManager.inputManagerList.Add(tempInputClass);
            }
            for (int i = 0; i < keyData.inputManagerList.Count; i++)
            {
                inputManager.setKey(InputManager.inputManagerList[i]);
                AllKeys.INITIAL_LIST_LEGEND(keyData.inputManagerList[i].Name, keyData.inputManagerList[i].Tag);
            }

            Keyboard.KeyboardTags.keyboardTagsAndTypes();
            Debug.Log("Keyboard data found for: " + aUserName);
        }
        else
        {
            InputManager.inputManagerList = inputManager.inputManagerList_FROM_INSPECTOR;
            Debug.Log("No Keyboard data found - Using Inspector setup");
            inputManager.CONFIGURE_LAYOUT();
            SaveKeyboard();
        }
    }
예제 #3
0
 public static void DISTRIBUTE_KEYS(InputManager.INPUT_CLASS inputClass)
 {
     KEYS(inputClass.Tag, inputClass.Key, inputClass.Type, inputClass.Name);
 }
예제 #4
0
 public void setKey(InputManager.INPUT_CLASS inputClass)
 {
     //Gets the button that was added above, and the tag from above
     Keyboard.setKeyboardBasedOnTags(inputClass.Key, inputClass.Tag, inputClass.Input.ToString(), inputClass.Type,
                                     inputClass.Name);
 }