예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
            }
        }
예제 #5
0
        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);
            }
        }
예제 #6
0
        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);
        }
예제 #7
0
        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);
        }
예제 #8
0
        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);
        }