public void ApplyTemplate(Serialization.KeyboardKeyTemplate template)
        {
            DefaultFromCode(code);

            normalString       = template.Normal;
            shiftedString      = template.Shifted;
            altGrString        = template.AltGr;
            shiftedAltGrString = template.ShiftedAltGr;
        }
        public void UpdateTemplate(ref Serialization.KeyboardKeyTemplate template)
        {
            if (template == null)
            {
                template = keyGlyph;
            }
            else
            {
                template.AltGr   = keyGlyph.altGrString;
                template.Shifted = keyGlyph.shiftedString;
                template.Normal  = keyGlyph.normalString;
                template.Code    = keyGlyph.code;
            }

            if (selfRectTransform == null)
            {
                selfRectTransform = GetComponent <RectTransform>();
            }

            template.KeyType     = keyType;
            template.KeySize     = selfRectTransform.sizeDelta;
            template.KeyOffset   = selfRectTransform.anchoredPosition3D;
            template.KeyRotation = selfRectTransform.localEulerAngles;

            if (keyGlyph.normalDisplay != null)
            {
                template.DisplayNormal = keyGlyph.normalDisplay.text;
            }

            if (keyGlyph.shiftedDisplay != null)
            {
                template.DisplayShifted = keyGlyph.shiftedDisplay.text;
            }

            if (keyGlyph.altGrDisplay != null)
            {
                template.DisplayAltGr = keyGlyph.altGrDisplay.text;
            }

            if (keyGlyph.shiftedAltGrDisplay != null)
            {
                template.DisplayShiftedAltGr = keyGlyph.shiftedAltGrDisplay.text;
            }
        }
        public Serialization.KeyboardKeyTemplate ToTemplate()
        {
            Serialization.KeyboardKeyTemplate template = keyGlyph;

            if (selfRectTransform == null)
            {
                selfRectTransform = GetComponent <RectTransform>();
            }

            template.KeySize     = selfRectTransform.sizeDelta;
            template.KeyOffset   = selfRectTransform.anchoredPosition3D;
            template.KeyRotation = selfRectTransform.localEulerAngles;
            template.KeyType     = keyType;

            if (keyGlyph.normalDisplay != null)
            {
                template.DisplayNormal = keyGlyph.normalDisplay.text;
            }

            if (keyGlyph.shiftedDisplay != null)
            {
                template.DisplayShifted = keyGlyph.shiftedDisplay.text;
            }

            if (keyGlyph.altGrDisplay != null)
            {
                template.DisplayAltGr = keyGlyph.altGrDisplay.text;
            }

            if (keyGlyph.shiftedAltGrDisplay != null)
            {
                template.DisplayShiftedAltGr = keyGlyph.shiftedAltGrDisplay.text;
            }

            return(template);
        }