Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
(cherry picked from commit 0adddb8)
  • Loading branch information
mark-gerow-lge authored and EricBoiseLGSVL committed Jul 22, 2021
1 parent 2779eba commit fa27ccd
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion Assets/Scripts/Bridge/IBridgeFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ public class BridgeNameAttribute : Attribute
{
public string Name { get; private set; }

public BridgeNameAttribute(string name)
public string Type { get; private set; }
public BridgeNameAttribute(string name, string type)
{
Name = name;
Type = type;
}
}

Expand Down
1 change: 1 addition & 0 deletions Assets/Scripts/Editor/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,7 @@ public void RunBuild(string outputFolder)

var plugin = new BridgePlugin(bridgeFactory);
manifest.bridgeDataTypes = plugin.GetSupportedDataTypes();
manifest.bridgeType = bridgeFactory.GetType().GetCustomAttribute<BridgeNameAttribute>().Type;
}

var manifestOutput = Path.Combine(outputFolder, "manifest.json");
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Utilities/BundleConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public enum BundleTypes
[BundleTypes.Sensor] = "com.svlsimulator.5",
[BundleTypes.Controllable]= "com.svlsimulator.2",
[BundleTypes.NPC] = "com.svlsimulator.2",
[BundleTypes.Bridge] = "com.svlsimulator.2",
[BundleTypes.Bridge] = "com.svlsimulator.3",
[BundleTypes.Pedestrian] = "com.svlsimulator.2",
};

Expand Down
1 change: 1 addition & 0 deletions Assets/Scripts/Utilities/Manifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class Manifest
public List<Simulator.Utilities.SensorParam> sensorParams;
public string[] bridgeDataTypes;
public string[] supportedBridgeTypes;
public string bridgeType;
}

public struct HdMaps
Expand Down
4 changes: 2 additions & 2 deletions Assets/Scripts/Web/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,9 @@ public static void LoadBridgePlugin(Manifest manifest, VfsEntry dir)
if (bridgesAssembly == null) bridgesAssembly = Assembly.Load("Simulator.Bridges");
foreach (Type ty in bridgesAssembly.GetTypes())
{
if (typeof(IBridgeFactory).IsAssignableFrom(ty) && !ty.IsAbstract && ty.GetCustomAttribute<BridgeNameAttribute>().Name == manifest.assetName)
if (typeof(IBridgeFactory).IsAssignableFrom(ty) && !ty.IsAbstract && ty.GetCustomAttribute<BridgeNameAttribute>().Name == manifest.bridgeType)
{
Debug.LogWarning($"Loading {manifest.assetName} ({manifest.assetGuid}) in Developer Debug Mode. If you wish to use this bridge plugin from WISE, disable Developer Debug Mode in Simulator->Developer Debug Mode or remove the bridge from Assets/External/Bridges");
Debug.LogWarning($"Loading {manifest.bridgeType} ({manifest.assetGuid}) in Developer Debug Mode. If you wish to use this bridge plugin from WISE, disable Developer Debug Mode in Simulator->Developer Debug Mode or remove the bridge from Assets/External/Bridges");
var bridgeFactory = Activator.CreateInstance(ty) as IBridgeFactory;
BridgePlugins.Add(bridgeFactory);
}
Expand Down

0 comments on commit fa27ccd

Please sign in to comment.