Example #1
0
        public override void _Ready()
        {
            base._Ready();

            connect_button = content.GetNode <Button>("ConnectButton");
            userbox        = content.GetNode <HBoxContainer>("UsernameBox");
            ipbox          = content.GetNode <HBoxContainer>("IpBox");

            username_field      = userbox.GetNode <LineEdit>("LineEdit");
            username_field.Text = Vars.PersistentData.username;

            ip_field = ipbox.GetNode <LineEdit>("LineEdit");

            username_field.Connect("text_changed", this, "_onUsernameFieldTextChange");
            ip_field.Connect("text_changed", this, "_onIpFieldTextChange");
            connect_button.Connect("pressed", this, "_onConnectButtonPress");

            Vars.PersistentData.ip = ip_field.Text;
        }
Example #2
0
        public override void _Ready()
        {
            if (instance == null)
            {
                instance = this;
            }
            else
            {
                instance.Dispose();
                instance = this;
            }

            if (Vars.PersistentData.isMobile)
            {
                RectPosition = new Vector2(9, 0);
            }

            content            = GetNode("MarginContainer").GetNode <VBoxContainer>("Content");
            messageScrollerBox = content.GetNode <ScrollContainer>("Messages");
            messageBox         = messageScrollerBox.GetNode <VBoxContainer>("MessageContainer");
            senderBox          = content.GetNode <HBoxContainer>("Sender");
            chatMessage        = messageBox.GetNode <RichTextLabel>("ChatMessage");

            button    = senderBox.GetNode <Button>("Button");
            _lineEdit = senderBox.GetNode <LineEdit>("LineEdit");

            _lineEdit.Connect("focus_entered", this, "_onSenderBoxFocusEnter");
            _lineEdit.Connect("focus_exited", this, "_onFocusLost");
            _lineEdit.Connect("text_changed", this, "_onTextChanged");
            _lineEdit.custom_behaviour = true;

            rnd = new RandomNumberGenerator();

            chatMessage.Visible = false;
            senderBox.Modulate  = new Color(0, 0, 0, 0);

            button.Connect("pressed", this, "SendPressed");
            messageScrollerBox.GetVScrollbar().Modulate = new Color(0, 0, 0, 0);
        }