public void SetStreetLight(NetInfo prefab, PropInfo prop) { var newSegmentData = new SegmentData(SegmentDataManager.Instance.GetActiveOptions(prefab)); if (prop != GetDefaultStreetLight(prefab)) { newSegmentData.SetPrefabFeature(SegmentData.FeatureFlags.StreetLight, prop); } else { newSegmentData.UnsetFeature(SegmentData.FeatureFlags.StreetLight); } SegmentDataManager.Instance.SetActiveOptions(prefab, newSegmentData); }
public void SetTree(NetInfo prefab, LanePosition position, TreeInfo tree) { var newSegmentData = new SegmentData(SegmentDataManager.Instance.GetActiveOptions(prefab)); if (tree != GetDefaultTree(prefab, position)) { newSegmentData.SetPrefabFeature(position.ToTreeFeatureFlag(), tree); } else { newSegmentData.UnsetFeature(position.ToTreeFeatureFlag()); } SegmentDataManager.Instance.SetActiveOptions(prefab, newSegmentData); }
private static void SetTreeFeature(SegmentData data, string treeName, SegmentData.FeatureFlags flag) { if (treeName == null) { return; } TreeInfo tree = null; if (treeName != NoneValue) { tree = PrefabCollection <TreeInfo> .FindLoaded(treeName); } data.SetPrefabFeature(flag, tree); }
private void Apply(BuildingInfo prefab) { BuildingNetworkSkinsDef.Building buildingDef; if (!_buildingDefsMap.TryGetValue(prefab, out buildingDef)) { return; } foreach (var networkDef in buildingDef.NetworkDefs) { var netInfo = PrefabCollection <NetInfo> .FindLoaded(networkDef.Name); if (netInfo == null) { continue; } var data = new SegmentData(); if (networkDef.StreetLight != null) { PropInfo streetLight = null; if (networkDef.StreetLight != NoneValue) { streetLight = PrefabCollection <PropInfo> .FindLoaded(networkDef.StreetLight); } data.SetPrefabFeature(SegmentData.FeatureFlags.StreetLight, streetLight); } SetTreeFeature(data, networkDef.TreeLeft, SegmentData.FeatureFlags.TreeLeft); SetTreeFeature(data, networkDef.TreeMiddle, SegmentData.FeatureFlags.TreeMiddle); SetTreeFeature(data, networkDef.TreeRight, SegmentData.FeatureFlags.TreeRight); SetPillarFeature(netInfo, networkDef.BridgePillar, PillarType.BridgePillar, _userModeBridgePillars); SetPillarFeature(netInfo, networkDef.MiddlePillar, PillarType.MiddlePillar, _userModeMiddlePillars); SegmentDataManager.Instance.SetActiveOptions(netInfo, data); } }
private void Apply(BuildingInfo prefab) { BuildingNetworkSkinsDef.Building buildingDef; if (!_buildingDefsMap.TryGetValue(prefab, out buildingDef)) return; foreach (var networkDef in buildingDef.NetworkDefs) { var netInfo = PrefabCollection<NetInfo>.FindLoaded(networkDef.Name); if (netInfo == null) continue; var data = new SegmentData(); if (networkDef.StreetLight != null) { PropInfo streetLight = null; if (networkDef.StreetLight != NoneValue) streetLight = PrefabCollection<PropInfo>.FindLoaded(networkDef.StreetLight); data.SetPrefabFeature(SegmentData.FeatureFlags.StreetLight, streetLight); } SetTreeFeature(data, networkDef.TreeLeft, SegmentData.FeatureFlags.TreeLeft); SetTreeFeature(data, networkDef.TreeMiddle, SegmentData.FeatureFlags.TreeMiddle); SetTreeFeature(data, networkDef.TreeRight, SegmentData.FeatureFlags.TreeRight); SetPillarFeature(netInfo, networkDef.BridgePillar, PillarType.BridgePillar, _userModeBridgePillars); SetPillarFeature(netInfo, networkDef.MiddlePillar, PillarType.MiddlePillar, _userModeMiddlePillars); SegmentDataManager.Instance.SetActiveOptions(netInfo, data); } }
private static void SetTreeFeature(SegmentData data, string treeName, SegmentData.FeatureFlags flag) { if (treeName == null) return; TreeInfo tree = null; if (treeName != NoneValue) tree = PrefabCollection<TreeInfo>.FindLoaded(treeName); data.SetPrefabFeature(flag, tree); }