Are you sure you want to report the post shown below? This will send an email to the ATVO administrators. Please include a short reason for reporting.
Users reporting for no reason may be locked out.
using System;
using ATVO.ThemesSDK;
using ATVO.ThemeEditor.ThemeModels;
using ATVO.ThemeEditor.Scripting.DotNET;
using ATVO.ThemesSDK.Data.Entity;
using System.Linq;
namespace Scripts
{
public class ChangeFocus : IScript
{
public object Execute(ThemeContentItem item, object value, string parameter, ISimulation sim)
{
ControlInput input = null;
// Check if you want input 1 or 2
if (value?.ToString() == "1")
input = item.Theme.ControlInputs.Find("Input_CarNumber1");
else if (value?.ToString() == "2")
input = item.Theme.ControlInputs.Find("Input_CarNumber2");
if (input != null)
{
var carNumber = input.Text;
if (!string.IsNullOrWhiteSpace(carNumber))
{
// Find the corresponding entity (team entry)
var entity = sim.Session?.Entities?.SingleOrDefault(e => e.Car.Number == carNumber);
if (entity != null)
{
sim.CameraManager.Show(entity);
}
}
}
return null;
}
}
}