Skip to content

Commit

Permalink
breaking experimental api changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ShiJbey committed Feb 15, 2024
1 parent 4dba83e commit bd9e0ea
Show file tree
Hide file tree
Showing 95 changed files with 2,053 additions and 1,485 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@
"UserSettings/": true,
"Logs/": true
},
"cSpell.words": ["Kryzarel", "TDRS"],
"cSpell.words": ["Effectable", "Kryzarel", "TDRS"],
"dotnet.defaultSolution": "Unity-TDRS.sln"
}
18 changes: 9 additions & 9 deletions Assets/StreamingAssets/events.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
- effects:
- DecreaseRelationshipStat ?victim ?betrayer Friendship 10 5
- RemoveRelationshipTrait ?victim ?betrayer friend
- precondition: |
?victim.relationships.?victim_friend.traits.friend
neq ?victim_friend ?betrayer
- preconditions:
- ?victim.relationships.?victim_friend.traits.friend
- neq ?victim_friend ?betrayer
effects:
- DecreaseRelationshipStat ?victim_friend ?betrayer Friendship 5 6
- precondition: |
?victim.relationships.?victim_family.traits.family
neq ?victim_family ?betrayer
- preconditions:
- ?victim.relationships.?victim_family.traits.family
- neq ?victim_family ?betrayer
effects:
- AddRelationshipTrait ?victim_family ?betrayer angry_at 10

Expand All @@ -39,8 +39,8 @@
- RemoveRelationshipTrait ?character_b ?character_a dating
- AddRelationshipTrait ?character_a ?character_b ex-partner
- AddRelationshipTrait ?character_b ?character_a ex-partner
- precondition: |
?character_b.relationships.?other.traits.rival
neq ?other ?character_a
- preconditions:
- ?character_b.relationships.?other.traits.rival
- neq ?other ?character_a
effects:
- IncreaseAgentStat ?other confidence 5
17 changes: 10 additions & 7 deletions Assets/StreamingAssets/traits.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@
description: "[owner] is a jerk"
effects:
- IncreaseAgentStat ?owner Confidence 5
socialRules:
- precondition: |
not ?other.traits.jerk
SocialRules:
- preconditions:
- ?other.relationships.?owner
- not ?other.traits.jerk
effects:
- DecreaseRelationshipStat ?other ?owner Friendship 10
description: "[owner] is a jerk"
- precondition: |
?other.traits.jerk
- preconditions:
- ?owner.relationships.?other
- ?other.traits.jerk
effects:
- IncreaseRelationshipStat ?owner ?other Friendship 10
description: "Jerks like other jerks"
Expand All @@ -34,7 +36,9 @@
effects:
- IncreaseAgentStat ?owner Sociability 10
socialRules:
- effects:
- preconditions:
- ?owner.relationship.?other
effects:
- IncreaseRelationshipStat ?owner ?other Friendship 3

- traitID: lovers
Expand All @@ -60,4 +64,3 @@
description: "[owner] is angry at [target]"
effects:
- DecreaseRelationshipStat ?owner ?target Friendship 10
duration: 10
3 changes: 1 addition & 2 deletions Assets/TDRS_Demo/Data/Traits/HappyGoLucky.asset
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ MonoBehaviour:
m_effects:
- IncreaseAgentStat ?owner Sociability 10
m_socialRules:
- precondition:
- precondition: ?owner.relationship.?other
effects:
- IncreaseRelationshipStat ?owner ?other Friendship 3
description:
m_conflictingTraits:
- jerk
m_duration: -1
9 changes: 6 additions & 3 deletions Assets/TDRS_Demo/Data/Traits/Jerk.asset
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@ MonoBehaviour:
m_description: '[owner] is a jerk'
m_effects: []
m_socialRules:
- precondition: not ?other.traits.jerk
- precondition: 'not ?other.traits.jerk
?other.relationships.?owner'
effects:
- DecreaseRelationshipStat ?other ?owner Friendship 10
description:
- precondition: ?other.traits.jerk
- precondition: '?other.traits.jerk
?owner.relationships.?other'
effects:
- IncreaseRelationshipStat ?owner ?other Friendship 10
description: Jerks like other jerks
m_conflictingTraits: []
m_duration: -1
3 changes: 2 additions & 1 deletion Assets/TDRS_Demo/Scripts/MockGameManager.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.IO;
using TDRS.Serialization;
using UnityEngine;

namespace TDRS.Demo
Expand Down Expand Up @@ -30,7 +31,7 @@ void Start()
if (File.Exists(filePath))
{
string yamlData = File.ReadAllText(filePath);
new YamlImporter().LoadYaml(SocialEngineController.Instance.State, yamlData);
SerializedSocialEngine.Deserialize(SocialEngineController.Instance.State, yamlData);
Debug.Log($"Loaded save from: {filePath}");
}

Expand Down
22 changes: 19 additions & 3 deletions Assets/TDRS_Demo/Scripts/MockSaveSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
using UnityEngine;
using YamlDotNet.RepresentationModel;
using YamlDotNet.Serialization;
using System.Collections.Generic;
using TDRS.Serialization;

namespace TDRS.Demo
{
Expand All @@ -13,6 +15,11 @@ namespace TDRS.Demo
/// </summary>
public class MockSaveSystem : MonoBehaviour
{
public class IngredientList
{
public List<string> ingredients;
}

public const string SAVE_PATH = "TDRS_demo_save.yaml";

[SerializeField]
Expand All @@ -28,12 +35,14 @@ void Update()

if (Input.GetKeyUp(m_saveButton))
{
YamlExporter jsonExporter = new YamlExporter();
string json = jsonExporter.ToYaml(SocialEngineController.Instance.State);
string json = SerializedSocialEngine.Serialize(
SocialEngineController.Instance.State);

Debug.Log(json);

YamlMappingNode node = new YamlMappingNode()
{
{"ingredients", new YamlSequenceNode() { "Apples", "Pizza", "Pie" } }
{"ingredients", new YamlSequenceNode() { "sugar", "water", "purple" } }
};

YamlDocument doc = new YamlDocument(node);
Expand All @@ -46,6 +55,13 @@ void Update()

Debug.Log(serializer.Serialize(doc));

var ingredients = new IngredientList()
{
ingredients = new List<string>() { "sugar", "water", "purple" }
};

Debug.Log(serializer.Serialize(ingredients));

// string filePath = Path.Combine(Application.persistentDataPath, SAVE_PATH);

// File.WriteAllText(filePath, json);
Expand Down
5 changes: 2 additions & 3 deletions Packages/com.shijbey.tdrs/Editor/SocialAgentInspector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class SocialAgentInspector : Editor
public VisualTreeAsset m_UXml;

private VisualElement m_root;
private List<Trait> m_traitsList;
private List<TraitInstance> m_traitsList;
private List<KeyValuePair<string, Stat>> m_statsList;
private AgentController m_agent;
private MultiColumnListView m_traitListView;
Expand All @@ -31,7 +31,7 @@ public override VisualElement CreateInspectorGUI()

private void CreateTraitGUI(VisualElement root)
{
m_traitsList = new List<Trait>();
m_traitsList = new List<TraitInstance>();
m_traitListView = root.Q<MultiColumnListView>(name: "Traits");


Expand All @@ -48,7 +48,6 @@ private void CreateTraitGUI(VisualElement root)

cols["trait"].makeCell = () => new Label();
cols["description"].makeCell = () => new TextElement();
cols["cooldown"].makeCell = () => new TextElement();

// Set bindCell

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class SocialRelationshipInspector : Editor
public VisualTreeAsset m_UXml;

private VisualElement m_root;
private List<Trait> m_traitsList;
private List<TraitInstance> m_traitsList;
private List<KeyValuePair<string, Stat>> m_statsList;
private RelationshipController m_relationship;
private MultiColumnListView m_traitListView;
Expand All @@ -32,7 +32,7 @@ public override VisualElement CreateInspectorGUI()

private void CreateTraitGUI(VisualElement root)
{
m_traitsList = new List<Trait>();
m_traitsList = new List<TraitInstance>();
m_traitListView = root.Q<MultiColumnListView>(name: "Traits");


Expand All @@ -49,7 +49,6 @@ private void CreateTraitGUI(VisualElement root)

cols["trait"].makeCell = () => new Label();
cols["description"].makeCell = () => new TextElement() { };
cols["cooldown"].makeCell = () => new TextElement();

// Set bindCell

Expand Down
Loading

0 comments on commit bd9e0ea

Please sign in to comment.