Skip to content

Commit

Permalink
correctly generate a connector brush
Browse files Browse the repository at this point in the history
  • Loading branch information
cstamford committed Feb 1, 2014
1 parent ff2fde8 commit f88a0c9
Showing 1 changed file with 75 additions and 59 deletions.
134 changes: 75 additions & 59 deletions Starstructor/GUI/ImportBrush.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,82 +119,98 @@ private DungeonBrush BuildDungeonBrushFromUserInput()
{
DungeonBrush brush = new DungeonBrush();
brush = (DungeonBrush)BuildCommonBrush(brush);
brush.Connector = CheckboxConnectorGeneralTab.Checked;

brush.Rules = new List<List<string>>();
brush.BrushRules = new List<string>();
brush.Brushes = new List<List<object>>();
brush.BrushTypes = new List<string>();

if (CheckboxClearRulesTab.Checked)
{
List<object> clearList = new List<object>();
clearList.Add("clear");
brush.Brushes.Add(clearList);
}

if (CheckboxBackAssetAssetTab.Checked && m_backAsset != null)
{
brush.Brushes.Add(new List<object> { "back", m_backAsset.ToString() });
brush.BrushTypes.Add("back");
brush.BackAsset = m_backAsset;
brush.NeedsBackAsset = true;
}
else if (CheckboxBackAssetSurfaceAssetTab.Checked)
if (CheckboxConnectorGeneralTab.Checked)
{
brush.Brushes.Add(new List<object> { "surfacebackground" });
brush.BrushTypes.Add("back");
brush.BackAsset = m_backAsset;
brush.NeedsBackAsset = true;
brush.Connector = true;
brush.FrontAsset = new StarboundAsset();
brush.FrontAsset.Image = EditorHelpers.GetGeneratedRectangle(8, 8,
brush.Colour.R,
brush.Colour.G,
brush.Colour.B,
brush.Colour.A);
brush.NeedsFrontAsset = true;
brush.IsSpecial = true;
}

if (CheckboxFrontAssetAssetTab.Checked && m_frontAsset != null)
else
{
Type frontAssetType = m_frontAsset.GetType();
brush.Rules = new List<List<string>>();
brush.BrushRules = new List<string>();
brush.Brushes = new List<List<object>>();
brush.BrushTypes = new List<string>();

if (frontAssetType == typeof(StarboundObject))
if (CheckboxClearRulesTab.Checked)
{
List<object> frontObjlist = new List<object> { "object", m_frontAsset.ToString() };

ObjectDirection dir = GetFrontAssetDirection();
List<object> clearList = new List<object>();
clearList.Add("clear");
brush.Brushes.Add(clearList);
}

if (dir == ObjectDirection.DIRECTION_LEFT) frontObjlist.Add(new JObject(new JProperty("direction", "left")));
else if (dir == ObjectDirection.DIRECTION_RIGHT) frontObjlist.Add(new JObject(new JProperty("direction", "right")));
if (CheckboxBackAssetAssetTab.Checked && m_backAsset != null)
{
brush.Brushes.Add(new List<object> {"back", m_backAsset.ToString()});
brush.BrushTypes.Add("back");
brush.BackAsset = m_backAsset;
brush.NeedsBackAsset = true;
}
else if (CheckboxBackAssetSurfaceAssetTab.Checked)
{
brush.Brushes.Add(new List<object> {"surfacebackground"});
brush.BrushTypes.Add("back");
brush.BackAsset = m_backAsset;
brush.NeedsBackAsset = true;
}

brush.Brushes.Add(frontObjlist);
brush.BrushTypes.Add("object");
if (CheckboxFrontAssetAssetTab.Checked && m_frontAsset != null)
{
Type frontAssetType = m_frontAsset.GetType();

if (frontAssetType == typeof (StarboundObject))
{
List<object> frontObjlist = new List<object> {"object", m_frontAsset.ToString()};

ObjectDirection dir = GetFrontAssetDirection();

if (dir == ObjectDirection.DIRECTION_LEFT)
frontObjlist.Add(new JObject(new JProperty("direction", "left")));
else if (dir == ObjectDirection.DIRECTION_RIGHT)
frontObjlist.Add(new JObject(new JProperty("direction", "right")));

brush.Brushes.Add(frontObjlist);
brush.BrushTypes.Add("object");
}
else if (frontAssetType == typeof (StarboundMaterial))
{
brush.Brushes.Add(new List<object> {"front", m_frontAsset.ToString()});
brush.BrushTypes.Add("front");
}

brush.FrontAsset = m_frontAsset;
brush.NeedsFrontAsset = true;
}
else if (frontAssetType == typeof(StarboundMaterial))
else if (CheckboxFrontAssetSurfaceAssetTab.Checked)
{
brush.Brushes.Add(new List<object> { "front", m_frontAsset.ToString() });
brush.Brushes.Add(new List<object> {"surface"});
brush.BrushTypes.Add("front");
brush.FrontAsset = m_frontAsset;
brush.NeedsFrontAsset = true;
}

brush.FrontAsset = m_frontAsset;
brush.NeedsFrontAsset = true;
}
else if (CheckboxFrontAssetSurfaceAssetTab.Checked)
{
brush.Brushes.Add(new List<object> { "surface"});
brush.BrushTypes.Add("front");
brush.FrontAsset = m_frontAsset;
brush.NeedsFrontAsset = true;
}
if (CheckboxWorldGenSolidRulesTab.Checked)
brush.Rules.Add(new List<string> {"worldGenMustContainSolid"});

if (CheckboxWorldGenSolidRulesTab.Checked)
brush.Rules.Add(new List<string> { "worldGenMustContainSolid" });
if (CheckboxWorldGenAirRulesTab.Checked)
brush.Rules.Add(new List<string> {"worldGenMustContainAir"});

if (CheckboxWorldGenAirRulesTab.Checked)
brush.Rules.Add(new List<string> { "worldGenMustContainAir" });
if (CheckboxWorldGenSolidBackgroundRulesTab.Checked)
brush.Rules.Add(new List<string> {"worldGenMustContainSolidBackground"});

if (CheckboxWorldGenSolidBackgroundRulesTab.Checked)
brush.Rules.Add(new List<string> { "worldGenMustContainSolidBackground" });
if (CheckboxWorldGenAirBackgroundRulesTab.Checked)
brush.Rules.Add(new List<string> {"worldGenMustContainAirBackground"});

if (CheckboxWorldGenAirBackgroundRulesTab.Checked)
brush.Rules.Add(new List<string> { "worldGenMustContainAirBackground" });

if (CheckboxOverdrawingRulesTab.Checked)
brush.Rules.Add(new List<string> { "worldGenMustContainSolid" });
if (CheckboxOverdrawingRulesTab.Checked)
brush.Rules.Add(new List<string> {"worldGenMustContainSolid"});
}

return brush;
}
Expand Down

0 comments on commit f88a0c9

Please sign in to comment.