Skip to content

Commit

Permalink
change settings system namespaces, class names
Browse files Browse the repository at this point in the history
  • Loading branch information
brnkhy committed Oct 4, 2016
1 parent 873bdbd commit 3bc661a
Show file tree
Hide file tree
Showing 27 changed files with 705 additions and 695 deletions.
2 changes: 1 addition & 1 deletion Assets/MapzenGo/Models/Enums/RailwayType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Linq;
using System.Text;

namespace Assets.MapzenGo.Models.Enums
namespace MapzenGo.Models.Enums
{
public enum RailwayType
{
Expand Down
1 change: 1 addition & 0 deletions Assets/MapzenGo/Models/Factories/BuildingFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Linq;
using MapzenGo.Helpers;
using MapzenGo.Models.Enums;
using MapzenGo.Models.Settings;
using TriangleNet;
using TriangleNet.Geometry;
using UniRx;
Expand Down
1 change: 1 addition & 0 deletions Assets/MapzenGo/Models/Factories/LanduseFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Linq;
using MapzenGo.Models.Enums;
using MapzenGo.Helpers;
using MapzenGo.Models.Settings;
using TriangleNet;
using TriangleNet.Geometry;
using UniRx;
Expand Down
1 change: 1 addition & 0 deletions Assets/MapzenGo/Models/Factories/RoadFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Text;
using MapzenGo.Helpers;
using MapzenGo.Models.Enums;
using MapzenGo.Models.Settings;
using UniRx;
using UnityEngine;

Expand Down
1 change: 1 addition & 0 deletions Assets/MapzenGo/Models/Factories/WaterFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Linq;
using MapzenGo.Models.Enums;
using MapzenGo.Helpers;
using MapzenGo.Models.Settings;
using TriangleNet;
using TriangleNet.Geometry;
using UniRx;
Expand Down
39 changes: 19 additions & 20 deletions Assets/MapzenGo/Models/Settings/Base/SettingsLayers.cs
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
using System;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Assets.MapzenGo.Models.Enums;
using MapzenGo.Models.Enums;
using SerializableCollections;
using UnityEngine;

[System.Serializable]
public abstract class SettingsLayers : ScriptableObject
namespace MapzenGo.Models.Settings.Base
{
public virtual T GetSettingsFor<T>(Enum type) where T : BaseSetting
[System.Serializable]
public abstract class SettingsLayers : ScriptableObject
{
return null;
}
public virtual T GetSettingsFor<T>(Enum type) where T : BaseSetting
{
return null;
}

public virtual bool HasSettingsFor(Enum type)
{
return false;
}

public static T GetScriptableObject<T>() where T : SettingsLayers
{
return Resources.Load<T>("Settings/" + (typeof (T).ToString()));
}

}

public class SettingsLayersDictionary : SerializableDictionary<Enum, BaseSetting> { };
public virtual bool HasSettingsFor(Enum type)
{
return false;
}

public static T GetScriptableObject<T>() where T : SettingsLayers
{
return Resources.Load<T>("Settings/" + (typeof(T).ToString()));
}

}

public class SettingsLayersDictionary : SerializableDictionary<Enum, BaseSetting> { };
}
2 changes: 1 addition & 1 deletion Assets/MapzenGo/Models/Settings/BoundaryFactorySettings.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Assets.MapzenGo.Models.Enums;
using MapzenGo.Models.Enums;
using MapzenGo.Models.Settings.Base;

public class BoundaryFactorySettings: SettingsLayers
{
Expand Down
42 changes: 23 additions & 19 deletions Assets/MapzenGo/Models/Settings/BuildingFactorySettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,34 @@
using System.Collections.Generic;
using System.Linq;
using MapzenGo.Models.Enums;
using MapzenGo.Models.Settings.Base;

public class BuildingFactorySettings: SettingsLayers
namespace MapzenGo.Models.Settings
{
public BuildingSettings DefaultBuilding = new BuildingSettings();
public List<BuildingSettings> SettingsBuildings;
public class BuildingFactorySettings: SettingsLayers
{
public BuildingSettings DefaultBuilding = new BuildingSettings();
public List<BuildingSettings> SettingsBuildings;


public override BuildingSettingsField GetSettingsFor<BuildingSettingsField>(Enum type)
{
if ((BuildingType)type == BuildingType.Unknown)
return DefaultBuilding as BuildingSettingsField;
return SettingsBuildings.FirstOrDefault(x => x.Type == (BuildingType)type) as BuildingSettingsField ?? DefaultBuilding as BuildingSettingsField;
}
public override BuildingSettingsField GetSettingsFor<BuildingSettingsField>(Enum type)
{
if ((BuildingType)type == BuildingType.Unknown)
return DefaultBuilding as BuildingSettingsField;
return SettingsBuildings.FirstOrDefault(x => x.Type == (BuildingType)type) as BuildingSettingsField ?? DefaultBuilding as BuildingSettingsField;
}

public override bool HasSettingsFor(Enum type)
public override bool HasSettingsFor(Enum type)
{
return SettingsBuildings.Any(x => x.Type== (BuildingType)type);
}
}
[System.Serializable]
public class BuildingSettings:BaseSetting
{
return SettingsBuildings.Any(x => x.Type== (BuildingType)type);
public BuildingType Type;
public int MinimumBuildingHeight = 2;
public int MaximumBuildingHeight = 5;
public bool IsVolumetric = true;
}
}
[System.Serializable]
public class BuildingSettings:BaseSetting
{
public BuildingType Type;
public int MinimumBuildingHeight = 2;
public int MaximumBuildingHeight = 5;
public bool IsVolumetric = true;
}
2 changes: 1 addition & 1 deletion Assets/MapzenGo/Models/Settings/Editor/HelperExtention.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static T GetOrCreateSObjectReturn<T>(ref T scriptebleObject, string pathS
{
if (!Directory.Exists(pathSaveScriptableObject)) Directory.CreateDirectory(pathSaveScriptableObject);

var path = pathSaveScriptableObject + typeof(T).ToString()+ ".asset";
var path = pathSaveScriptableObject + typeof(T).Name + ".asset";
if (File.Exists(Path.Combine(Environment.CurrentDirectory, path)))
{
// Debug.LogError("\u25B6 " + "GET OBJECT" + path);
Expand Down
Loading

0 comments on commit 3bc661a

Please sign in to comment.