Esempio n. 1
0
 // Update is called once per frame
 void Update()
 {
     if (isChangeKeyPanelActive)
     {
         foreach (KeyCode keyCode in Enum.GetValues(typeof(KeyCode)))
         {
             if (Input.GetKeyDown(keyCode))
             {
                 if (VerifyIfKeyCodeAuthorized(keyCode))
                 {
                     if (!configuration.VerifyIfKeyCodeExist(keyCode))
                     {
                         keyText.text = configuration.GetKeyCodeToString(keyCode);
                         configuration.SetKeyCodePlayerAction(playerNameInSystem, actionNameInSystem, keyCode);
                         ShowOrHideChangeKeyPanel();
                         configuration.needSaveConfig = true;
                     }
                     else
                     {
                         messageText.text = string.Format("La touche {0} est déjà utilisé.", configuration.GetKeyCodeToString(keyCode));
                     }
                 }
                 else
                 {
                     ShowOrHideChangeKeyPanel();
                     return;
                     // messageText.text = string.Format("La touche {0} n'est pas accepté.", keyCode);
                 }
             }
         }
     }
 }
Esempio n. 2
0
    private void UpdateUI()
    {
        // Player 1 keys
        UpKeyPlayer1.text            = conf.GetKeyCodeToString(conf.Player1_UpKey);
        DownKeyPlayer1.text          = conf.GetKeyCodeToString(conf.Player1_DownKey);
        LeftKeyPlayer1.text          = conf.GetKeyCodeToString(conf.Player1_LeftKey);
        RightKeyPlayer1.text         = conf.GetKeyCodeToString(conf.Player1_RightKey);
        AttackBaseKeyPlayer1.text    = conf.GetKeyCodeToString(conf.Player1_BaseAttackKey);
        SpecialAttackKeyPlayer1.text = conf.GetKeyCodeToString(conf.Player1_SpecialAttackKey);
        UseObjectKeyPlayer1.text     = conf.GetKeyCodeToString(conf.Player1_UseObjectKey);

        // Player 2 keys
        UpKeyPlayer2.text            = conf.GetKeyCodeToString(conf.Player2_UpKey);
        DownKeyPlayer2.text          = conf.GetKeyCodeToString(conf.Player2_DownKey);
        LeftKeyPlayer2.text          = conf.GetKeyCodeToString(conf.Player2_LeftKey);
        RightKeyPlayer2.text         = conf.GetKeyCodeToString(conf.Player2_RightKey);
        AttackBaseKeyPlayer2.text    = conf.GetKeyCodeToString(conf.Player2_BaseAttackKey);
        SpecialAttackKeyPlayer2.text = conf.GetKeyCodeToString(conf.Player2_SpecialAttackKey);
        UseObjectKeyPlayer2.text     = conf.GetKeyCodeToString(conf.Player2_UseObjectKey);

        //Info Player 1
        Player1Name.text           = String.Format("<b>Fiche</b> : {0}", select.player1.nameCharacter);
        IconPlayer1.sprite         = select.player1.iconeCharacter1;
        AttackBaseNameText.text    = String.Format("<b>{0}</b>", select.player1.baseAttack);
        SpecialAttackNameText.text = String.Format("<b>{0}</b>", select.player1.specialAttack);
        AttackBaseText.text        = select.player1.baseAttackDescription ?? "???";
        SpecialAttackText.text     = select.player1.specialAttackDescription ?? "???";

        //Info Player 2
        Player2Name.text            = String.Format("<b>Fiche</b> : {0}", select.player2.nameCharacter);
        IconPlayer2.sprite          = select.player2.iconeCharacter2;
        AttackBaseNameText2.text    = String.Format("<b>{0}</b>", select.player2.baseAttack);
        SpecialAttackNameText2.text = String.Format("<b>{0}</b>", select.player2.specialAttack);
        AttackBaseText2.text        = select.player2.baseAttackDescription ?? "???";
        SpecialAttackText2.text     = select.player2.specialAttackDescription ?? "???";

        UpdateProgressBar();
    }
    void Update()
    {
        KeyCode k = configuration.GetKeyCodePlayerAction(playerNameInSystem, actionNameInSystem) ?? KeyCode.None;

        keyText.text = configuration.GetKeyCodeToString(k);
    }