Exemple #1
0
        public void AddMessage(string message)
        {
            var msgInstance = chatMessage.Duplicate() as RichTextLabel;

            msgInstance.Name = rnd.RandiRange(1000, 99999999).ToString();
            messageBox.AddChild(msgInstance);
            msgInstance.BbcodeText = message;
            msgInstance.GetNode <AnimationPlayer>("Animation").Play("Enter");
            msgInstance.Visible = true;

            var msgTimer = msgInstance.GetNode <Timer>("Timer");

            msgTimer.Connect("timeout", this, "MessageTimeout", new Array {
                msgInstance
            });
            msgTimer.Start();

            msgInstances.Add(msgInstance);
            if (msgInstances.Count > MaxMessages)
            {
                var ms = msgInstances[0];
                msgInstances.Remove(ms);

                ms.Free();
            }
        }