public override void SetLocationPixels(float x, float y, float width, float height)
        {
            UIElement ui = new UIElement(tag, bg.transform);

            ui.SetLocationPixels(0, -UIScaler.GetPixelsPerUnit(), width, UIScaler.GetPixelsPerUnit());
            new UIElementBorder(ui);

            base.SetLocationPixels(x, y + UIScaler.GetPixelsPerUnit(), width, height - UIScaler.GetPixelsPerUnit());
            Dictionary <string, string> CHARS = null;

            EventManager.CHARS_MAP.TryGetValue(Game.Get().gameType.TypeName(), out CHARS);

            if (CHARS != null)
            {
                float buttonWidth = width / CHARS.Keys.Count;
                float xPos        = 0;
                foreach (string oneChar in CHARS.Keys)
                {
                    StringKey translated  = new StringKey(null, oneChar);
                    string    translation = null;
                    CHARS.TryGetValue(oneChar, out translation);
                    ui = new UIElement(tag, bg.transform);
                    ui.SetLocationPixels(xPos, -UIScaler.GetPixelsPerUnit(), buttonWidth, UIScaler.GetPixelsPerUnit());
                    ui.SetText(translated);
                    ui.SetButton(delegate { InsertCharacter(translation); });

                    xPos += buttonWidth;
                }
            }
        }
Пример #2
0
        public override void SetLocationPixels(float x, float y, float width, float height)
        {
            UIElement ui = new UIElement(tag, bg.transform);

            ui.SetLocationPixels(0, -UIScaler.GetPixelsPerUnit(), width, UIScaler.GetPixelsPerUnit());
            new UIElementBorder(ui);

            base.SetLocationPixels(x, y + UIScaler.GetPixelsPerUnit(), width, height - UIScaler.GetPixelsPerUnit());
            Dictionary <string, string> CHARS = EventManager.GetCharacterMap(true);

            if (CHARS != null)
            {
                float buttonWidth = width / CHARS.Keys.Count;
                float xPos        = 0;
                foreach (string textKey in CHARS.Keys)
                {
                    ui = new UIElement(tag, bg.transform);
                    ui.SetLocationPixels(xPos, -UIScaler.GetPixelsPerUnit(), buttonWidth, UIScaler.GetPixelsPerUnit());
                    ui.SetText(CHARS[textKey]);
                    ui.SetButton(delegate { InsertCharacter(textKey); });

                    xPos += buttonWidth;
                }
            }
        }