public static void LoadControls() { foreach (Action a in actions) { int i = 0; while (i < numAlternates && (i < a.keys.Count && PlayerPrefs.GetString(PREFIXE_ACTION + a.id + "-" + i, a.keys[i].key) != null) || (PlayerPrefs.GetString(PREFIXE_ACTION + a.id + "-" + i, "") != "" && i < 99)) { if (i < a.keys.Count) { Action.InputType type = (Action.InputType)PlayerPrefs.GetInt(PREFIXE_ACTION + a.id + "-" + i + "-" + "type", (int)a.keys[i].inputType); a.keys[i] = new ActionKey(type, PlayerPrefs.GetString(PREFIXE_ACTION + a.id + "-" + i, a.keys[i].key)); i++; } else { Action.InputType type = (Action.InputType)PlayerPrefs.GetInt(PREFIXE_ACTION + a.id + "-" + i + "-" + "type"); a.keys.Add(new ActionKey(type, PlayerPrefs.GetString(PREFIXE_ACTION + a.id + "-" + i))); i++; Debug.Log("Well... " + i + "|" + PlayerPrefs.GetString(PREFIXE_ACTION + a.id + "-" + i)); } } } }
public ActionKey(Action.InputType type, string key) { inputType = type; this.key = key; }