Пример #1
0
 private void CreateTextLabels( )
 {
     // Create some textLabels
     TextLabelStreamer.CreateDynamicTextLabel("Some Text", new Vector3(-879.655f, -853.499f, 19.566f), 0, true, new Rgba(255, 255, 255, 255));
     TextLabelStreamer.CreateDynamicTextLabel("Another textlabel", new Vector3(-869.655f, -853.499f, 19.566f), 0, true, new Rgba(25, 231, 125, 255));
     TextLabelStreamer.CreateDynamicTextLabel("[SOME MORE TEXT]", new Vector3(-859.655f, -853.499f, 19.566f), 0, true, new Rgba(125, 10, 250, 255));
 }
Пример #2
0
        private async Task OnConsoleCommand(string name, string[] args)
        {
            // destroy all textLabels
            if (name == "dao")
            {
                TextLabelStreamer.DestroyAllDynamicTextLabels( );
                Console.WriteLine($"all textLabels destroyed.");
            }

            // create all textLabels
            if (name == "cao")
            {
                TextLabelStreamer.DestroyAllDynamicTextLabels( );
                CreateTextLabels( );
            }

            // destroy textLabel
            if (name == "do")
            {
                if (args.Length == 0)
                {
                    return;
                }

                ulong textLabelId = Convert.ToUInt64(args[0]);
                if (TextLabelStreamer.DestroyDynamicTextLabel(textLabelId))
                {
                    Console.WriteLine($"TextLabel with ID { textLabelId } deleted!");
                }
            }

            // change scale
            if (name == "cs")
            {
                if (args.Length == 0)
                {
                    return;
                }

                ulong textLabelId = Convert.ToUInt64(args[0]);
                var   textLabel   = TextLabelStreamer.GetDynamicTextLabel(textLabelId);
                if (textLabel != null)
                {
                    textLabel.Scale += 1;
                    Console.WriteLine($"TextLabel scale increased by 1.");
                }
                else
                {
                    Console.WriteLine($"Couldnt find textLabel with ID { textLabelId }");
                }
            }

            // change color
            if (name == "cc")
            {
                if (args.Length == 0)
                {
                    return;
                }

                ulong textLabelId = Convert.ToUInt64(args[0]);
                var   textLabel   = TextLabelStreamer.GetDynamicTextLabel(textLabelId);
                if (textLabel != null)
                {
                    Random r = new Random( );
                    textLabel.Color = new Rgba(( byte )r.Next(0, 256), ( byte )r.Next(0, 256), ( byte )r.Next(0, 256), 255);
                    Console.WriteLine($"Textlabel color changed to random value");
                }
                else
                {
                    Console.WriteLine($"Couldnt find textLabelect with ID { textLabelId }");
                }
            }

            // change pos
            if (name == "cp")
            {
                if (args.Length == 0)
                {
                    return;
                }

                ulong textLabelId = Convert.ToUInt64(args[0]);
                var   textLabel   = TextLabelStreamer.GetDynamicTextLabel(textLabelId);
                if (textLabel != null)
                {
                    Console.WriteLine($"textLabel pos: { textLabel.Position.Z }");

                    textLabel.Position += new Vector3(0, 0, 5);
                    Console.WriteLine($"TextLabel position increased on Z with +5f { textLabel.Position.Z }");
                }
                else
                {
                    Console.WriteLine($"Couldnt find textLabel with ID { textLabelId }");
                }
            }

            // get textLabel by ID
            if (name == "go")
            {
                if (args.Length == 0)
                {
                    return;
                }

                ulong textLabelId = Convert.ToUInt64(args[0]);
                var   textLabel   = TextLabelStreamer.GetDynamicTextLabel(textLabelId);
                if (textLabel != null)
                {
                    Console.WriteLine($"TextLabel found, data: { textLabel.Text }, { textLabel.Scale }, { textLabel.Center }, { textLabel.Font }, ...!");
                }
                else
                {
                    Console.WriteLine($"Couldnt find textLabel with ID { textLabelId }");
                }
            }

            // count textLabels
            if (name == "counttextlabels")
            {
                Console.WriteLine($"total textLabels created: { TextLabelStreamer.GetAllDynamicTextLabels( ).Count }");
            }
        }
Пример #3
0
 public override void OnStop( )
 {
     TextLabelStreamer.DestroyAllDynamicTextLabels( );
     Console.WriteLine($"Server stopped.");
 }