ATVO by Appgineering
Download
Read-only

Tower for quallifying

9 posts 5,069 views Started 07 Oct 2019, 20:29
Showing 1–9 of 9 posts
Alwin L.
Original poster

Hi all, i have a questiion. I am working at ma first theme at the moment. Its working well, but now I have a questiion.

I am working for a tower, to show the position of the driver and his lap time in qualifying. At the moment I have set a background
picture. Problem is, that picture has 20 rows (numbers of starters), but if only first 8 drivers or so set a lap time, you just see data of these
drivers and the rest you just see the empty background.

My question is now, is it possible with ATVO, that, if first driver set a time, you see just one row, if second set a time you see one more, ...?
Hope you know what I mean.

If it is possible, how can I do it? At he moment I have really now idea how to do.

Nick Thissen Appgineering
Reply #1

First of all use the Ticker functionality. Then in the template subwidget check the "Dynamic" property. This means if there is no data this subwidget will become invisible.

Nick Thissen Appgineering
Reply #3

You make one Subwidget and select it as the template. The Ticker will then make a copy for each item in the dataset.

In the Ticker properties you can also select the direction in which the items are repeated and in which they scroll (if desired).

Alwin L.
Reply #4
· edited

ok, found the function to show it downwards. Now what you mean now. Last question. Either I'm blind, or it is hidden. How to set the SW as template? Do you mean in the "Main Widget" There it is as template. So this is right, right?

Alwin L.
Reply #5

Hi Nick, thanks for your help. It's working so far. Only think is not working, that at the beginning of qualifying for example no row is shown. I can see all drivers who are registred for the race and which are on server. Don't know where is my misstake.

Nick Thissen Appgineering
Reply #6

Did you check the Dynamic property on the SubWidget or possibly on the Label inside that SubWidget?

Alwin L.
Reply #7
· edited

Dynamic is set every where. But maybe to late, because I get already data from server before. I think my fault is, that I am working with a background image, which is set in the SubWidget. I think i have to set it in the Label, hat every part of lable and also the Pos, Name and time will
show when driver cross finish line.

But it looks much better than before, like there is a background with a fix image for a tower, it shows 20 Positions, but just 10 driver or so are on the server.

I will try and test a bit more tomorrow. I think i can solve it, if not I will come back to you.

But many thanks for support.

Nick Thissen Appgineering
Reply #8

I see, it may be difficult in that case yes. If you cannot get it to work with dynamic labels, a script may be possible, but not trivial.

You'd need a general script that runs every update (for performance it would be wise to limit the execution to once every second orso), counts the number of drivers that set a qualifying time, and updates the ticker to show that many items.

In theory something like this should work, perhaps with some modifications:

using System;
using ATVO.ThemesSDK;
using ATVO.ThemeEditor.ThemeModels;
using ATVO.ThemeEditor.Scripting.DotNET;
using ATVO.ThemesSDK.Data.Session;
using ATVO.ThemesSDK.Data.Results;

namespace Scripts
{
	public class UpdateQualTicker : IScript
	{
		private DateTime? _lastUpdateTime = null;
	
		public object Execute(ThemeContentItem item, object value, string parameter, ISimulation sim)
		{
			// Stop if last update time was less than 1s ago
			if (_lastUpdateTime != null && (DateTime.Now - _lastUpdateTime.Value).TotalSeconds < 1)
				return null;
							
			// Set last update time
			_lastUpdateTime = DateTime.Now;
			
			// Get qual session
			var session = sim.Session.GetQualification();
			
			// Get results
			var results = session?.Results;
			if (results?.Count == 0)
				return null;
			
			// Count number of results with a laptime
			var count = 0;
			foreach (var result in results)
			{
				if (result.FastestLapTime > 0)
				{
					count++;
				}
			}
			
			// Find the ticker widget
			var widget = item.Theme.Widgets.Find("myWidget");
						
			// Update how many items to show
			widget.Ticker.ItemCount = count;
								
			return null;
		}
	}
}
Archive · Read-only

New replies have moved to Discord.