示例#1
0
    public PlayerKeys GetPlayerKeys(EKeyset pKeyset)
    {
        KeyCode up    = PlayerPrefsX.GetKeysetKey(pKeyset, EActionKey.Up);
        KeyCode right = PlayerPrefsX.GetKeysetKey(pKeyset, EActionKey.Right);
        KeyCode down  = PlayerPrefsX.GetKeysetKey(pKeyset, EActionKey.Down);
        KeyCode left  = PlayerPrefsX.GetKeysetKey(pKeyset, EActionKey.Left);

        KeyCode swap = PlayerPrefsX.GetKeysetKey(pKeyset, EActionKey.Swap);
        KeyCode use  = PlayerPrefsX.GetKeysetKey(pKeyset, EActionKey.Use);

        PlayerKeys keys = new PlayerKeys(up, right, down, left, swap, use);

        if (!keys.IsValid())
        {
            Debug.LogError($"{pKeyset} not set. is this first run?");
            keys = new PlayerKeys(pKeyset);
        }

        return(keys);
    }