Skip to content

Commit

Permalink
v5.0-beta.8 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Zerbu committed Oct 25, 2022
1 parent 50049c7 commit 32a760e
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 23 deletions.
Expand Up @@ -81,7 +81,7 @@ protected internal override void OnExport(SituationExportContext context)
tunableTuple3.Set<TunableBasic>("reward", GoldReward);
if (ScoreToReachGold != 30)
{
tunableTuple2.Set<TunableBasic>("score_delta", ScoreToReachGold);
tunableTuple3.Set<TunableBasic>("score_delta", ScoreToReachGold);
}

var tunableTuple4 = tunableTuple1.Get<TunableTuple>("silver");
Expand All @@ -93,7 +93,7 @@ protected internal override void OnExport(SituationExportContext context)
tunableTuple4.Set<TunableBasic>("reward", SilverReward);
if (ScoreToReachGold != 30)
{
tunableTuple2.Set<TunableBasic>("score_delta", ScoreToReachSilver);
tunableTuple4.Set<TunableBasic>("score_delta", ScoreToReachSilver);
}

if (IsHidden)
Expand Down
6 changes: 5 additions & 1 deletion Constructor5.Elements/Statistics/Statistic.cs
@@ -1,4 +1,5 @@
using Constructor5.Base.ComponentSystem;
using Constructor5.Base.CustomTuning;
using Constructor5.Base.ElementSystem;
using Constructor5.Base.Export;
using Constructor5.Base.ExportSystem.Tuning;
Expand All @@ -9,11 +10,12 @@
namespace Constructor5.Elements.Statistics
{
[ElementTypeData("Statistic", true, ElementTypes = new[] { typeof(Statistic), typeof(Commodity) }, PresetFolders = new[] { "Statistic", "Commodity", "Skill", "SimInfoStatistic", "Need" })]
public class Statistic : Element, IExportableElement
public class Statistic : Element, IExportableElement, ISupportsCustomTuning
{
public int InitialValue { get; set; }
public int MinValue { get; set; }
public int MaxValue { get; set; }
public CustomTuningInfo CustomTuning { get; set; } = new CustomTuningInfo();

void IExportableElement.OnExport()
{
Expand All @@ -32,6 +34,8 @@ void IExportableElement.OnExport()
tuning.SimDataHandler.Write(64, MaxValue);
tuning.SimDataHandler.Write(68, MinValue);

CustomTuningExporter.Export(this, tuning, CustomTuning);

TuningExport.AddToQueue(tuning);
}

Expand Down
@@ -1,17 +1,18 @@
<UserControl x:Class="Constructor5.Elements.SituationGoals.Templates.SituationGoalInteractionEditor"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:c="clr-namespace:Constructor5.UI.Shared;assembly=Constructor5.UI"
xmlns:conditions="clr-namespace:Constructor5.Elements.TestConditions;assembly=Constructor5.Elements"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Constructor5.Elements.SituationGoals.Templates"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:single="clr-namespace:Constructor5.SituationGoalTemplates.Single"
xmlns:system="clr-namespace:System;assembly=mscorlib"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<UserControl
x:Class="Constructor5.Elements.SituationGoals.Templates.SituationGoalInteractionEditor"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:c="clr-namespace:Constructor5.UI.Shared;assembly=Constructor5.UI"
xmlns:conditions="clr-namespace:Constructor5.Elements.TestConditions;assembly=Constructor5.Elements"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Constructor5.Elements.SituationGoals.Templates"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:single="clr-namespace:Constructor5.SituationGoalTemplates.Single"
xmlns:system="clr-namespace:System;assembly=mscorlib"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<d:UserControl.DataContext>
<local:SituationGoalInteractionTemplate />
</d:UserControl.DataContext>
Expand All @@ -31,13 +32,18 @@
</c:Field>
<c:CheckBox IsChecked="{Binding SuccessfulOnly}">
<StackPanel>
<c:TextBlock Text="SuccessfulOnly" />
<c:TextBlock Text="RestrictBySuccess" />
<c:TextBlock FontStyle="Italic">SuccessfulOnlyHelp</c:TextBlock>
</StackPanel>
</c:CheckBox>
<c:CheckBox Content="WaitUntilCompletion"
IsChecked="{Binding WaitUntilCompletion}"
Visibility="{Binding SuccessfulOnly, Converter={StaticResource BoolToVisInverted}}" />
<c:CheckBox
Content="RequireFailure"
IsChecked="{Binding RequireFailure}"
Visibility="{Binding SuccessfulOnly, Converter={StaticResource BoolToVis}}" />
<c:CheckBox
Content="WaitUntilCompletion"
IsChecked="{Binding WaitUntilCompletion}"
Visibility="{Binding SuccessfulOnly, Converter={StaticResource BoolToVisInverted}}" />
<c:CheckBox Content="IncludeCancelledByPlayer" IsChecked="{Binding IncludeCancelledInteractions}" />
<c:CheckBox Content="IncludeCancelledByGame" IsChecked="{Binding IncludeGameCancelledInteractions}" />
<c:Field Label="MinimumRunningTime" LabelWidth="175">
Expand Down
Expand Up @@ -22,6 +22,8 @@ public class SituationGoalInteractionTemplate : SituationGoalTargetedBase
public override string Label => "Interaction Goal";
public int MinimumRunningTime { get; set; }

public bool RequireFailure { get; set; }

public bool SuccessfulOnly { get; set; }

public bool WaitUntilCompletion { get; set; }
Expand Down Expand Up @@ -74,7 +76,7 @@ protected override void OnExport(SituationGoalExportContext context)
if (SuccessfulOnly)
{
var tunableVariant1 = tunableTuple1.Set<TunableVariant>("interaction_outcome", "enabled");
tunableVariant1.Set<TunableEnum>("enabled", "SUCCESS");
tunableVariant1.Set<TunableEnum>("enabled", RequireFailure ? "FAILURE" : "SUCCESS");
}

if (MinimumRunningTime > 0)
Expand Down
2 changes: 1 addition & 1 deletion Constructor5/Version.txt
@@ -1 +1 @@
v5.0-beta.7
v5.0-beta.8

0 comments on commit 32a760e

Please sign in to comment.