private void Update()
 {
     if (this._version != InputMappingIcons.Version)
     {
         this._texture.height = this._startHeight;
         if (!InputMappingIcons.UsesText(this._action))
         {
             this._texture.mainTexture = InputMappingIcons.GetTextureFor(this._action);
             this._label.enabled       = false;
             float num = (float)this._texture.mainTexture.width / (float)this._texture.mainTexture.height;
             if (num > 1.2f)
             {
                 this._texture.height = Mathf.RoundToInt((float)this._texture.height * 0.666f);
             }
             this._texture.width = Mathf.RoundToInt(num * (float)this._texture.height);
         }
         else
         {
             this._texture.mainTexture = InputMappingIcons.GetTextureFor(this._action);
             this._label.text          = InputMappingIcons.GetMappingFor(this._action);
             this._label.enabled       = true;
             float num2 = (float)this._label.width / (float)this._label.height;
             if (num2 > 1.5f)
             {
                 this._texture.width = Mathf.RoundToInt((float)this._startHeight * num2);
             }
             else
             {
                 this._texture.width = this._startHeight;
             }
         }
         this._version = InputMappingIcons.Version;
     }
 }
Exemple #2
0
 private void Update()
 {
     if (this._version != InputMappingIcons.Version)
     {
         this._texture.texture = InputMappingIcons.GetTextureFor(this._action);
         if (!InputMappingIcons.UsesText(this._action))
         {
             this._text.enabled    = false;
             this._texture.enabled = true;
         }
         else
         {
             this._text.text       = InputMappingIcons.GetMappingFor(this._action);
             this._text.enabled    = true;
             this._texture.enabled = this._useTextBacking;
         }
         this._version = InputMappingIcons.Version;
     }
 }