mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
Code refactor
This commit is contained in:
parent
cd4711a8e5
commit
757badf4f6
517 changed files with 2534 additions and 2221 deletions
16
Assets/Scripts/DefParents/AnimationDefs.cs
Normal file
16
Assets/Scripts/DefParents/AnimationDefs.cs
Normal file
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
[XmlRoot("Defs", IsNullable = false)]
|
||||
public class AnimationDefs
|
||||
{
|
||||
[XmlElement("Rimworld_Animations.AnimationDef")]
|
||||
public List<AnimationDef> animationDefs = new List<AnimationDef>();
|
||||
}
|
||||
}
|
11
Assets/Scripts/DefParents/AnimationDefs.cs.meta
Normal file
11
Assets/Scripts/DefParents/AnimationDefs.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6e65e28553800cf489ca2b0bc7e37408
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
53
Assets/Scripts/DefParents/PawnRaceDefs.cs
Normal file
53
Assets/Scripts/DefParents/PawnRaceDefs.cs
Normal file
|
@ -0,0 +1,53 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
public static class PawnRaceDefs
|
||||
{
|
||||
public static List<PawnRaceDef> allDefs = new List<PawnRaceDef>();
|
||||
|
||||
public static PawnRaceDef GetNamed(string pawnRaceDef)
|
||||
{
|
||||
return allDefs.FirstOrDefault(x => x.defName == pawnRaceDef);
|
||||
}
|
||||
|
||||
public static void AddDef(PawnRaceDef pawnRaceDef)
|
||||
{
|
||||
if (allDefs.Any(x => x.defName == pawnRaceDef.defName)) return;
|
||||
|
||||
allDefs.Add(pawnRaceDef);
|
||||
}
|
||||
|
||||
public static void OnLoad()
|
||||
{
|
||||
List<string> allTags = DefaultTags.bodyTypes.Concat(CustomTags.bodyTypes).ToList();
|
||||
allTags.Add("None");
|
||||
|
||||
List<CardinalDirection> facings = new List<CardinalDirection>() { CardinalDirection.North, CardinalDirection.East, CardinalDirection.South };
|
||||
string path;
|
||||
|
||||
foreach (PawnRaceDef pawnRaceDef in allDefs)
|
||||
{
|
||||
foreach (CardinalDirection facing in facings)
|
||||
{
|
||||
foreach (string bodyType in allTags)
|
||||
{
|
||||
path = pawnRaceDef.GetBodyTypeGraphicPath(facing, bodyType);
|
||||
|
||||
if (string.IsNullOrEmpty(path) == false)
|
||||
{ pawnRaceDef.SetBodyTypeGraphicPath(path, facing, bodyType); }
|
||||
}
|
||||
|
||||
path = pawnRaceDef.GetHeadGraphicPath(facing);
|
||||
|
||||
if (string.IsNullOrEmpty(path) == false)
|
||||
{ pawnRaceDef.SetHeadGraphicPath(path, facing); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/DefParents/PawnRaceDefs.cs.meta
Normal file
11
Assets/Scripts/DefParents/PawnRaceDefs.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 53e7f97b4bb5a3441884e4795d7e9391
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue