mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
Race customization and data saving
This commit is contained in:
parent
2f3f807911
commit
d3b676df06
456 changed files with 6388 additions and 419 deletions
|
@ -17,7 +17,7 @@ namespace RimWorldAnimationStudio
|
|||
[XmlArray("tags"), XmlArrayItem("li")] public List<string> tags;
|
||||
|
||||
[XmlIgnore] public ActorGender gender;
|
||||
[XmlIgnore] public string raceDef;
|
||||
[XmlIgnore] private AlienRaceDef alienRaceDef;
|
||||
|
||||
public BodyTypeOffset bodyTypeOffset = new BodyTypeOffset();
|
||||
public bool initiator = false;
|
||||
|
@ -37,9 +37,24 @@ namespace RimWorldAnimationStudio
|
|||
public bool ShouldSerializeisFucking() { return isFucking; }
|
||||
public bool ShouldSerializeisFucked() { return isFucked; }
|
||||
|
||||
public AlienRaceDef GetAlienRaceDef()
|
||||
{
|
||||
if (alienRaceDef == null)
|
||||
{ alienRaceDef = AlienRaceDefs.GetNamed("Human"); }
|
||||
|
||||
return alienRaceDef;
|
||||
}
|
||||
|
||||
public void SetAlienRaceDef(string alienRaceDefName)
|
||||
{
|
||||
AlienRaceDef alienRaceDef = AlienRaceDefs.GetNamed(alienRaceDefName);
|
||||
|
||||
if (alienRaceDef != null)
|
||||
{ this.alienRaceDef = alienRaceDef; }
|
||||
}
|
||||
|
||||
public void ValidateData()
|
||||
{
|
||||
defNames = defNames.Intersect(Tags.defNames.Concat(CustomTags.defNames))?.ToList();
|
||||
bodyDefTypes = bodyDefTypes.Intersect(Tags.bodyDefTypes.Concat(CustomTags.bodyDefTypes))?.ToList();
|
||||
requiredGenitals = requiredGenitals.Intersect(Tags.bodyParts.Concat(CustomTags.bodyParts))?.ToList();
|
||||
}
|
||||
|
|
210
Assets/Scripts/AnimationComponents/AlienRaceDef.cs
Normal file
210
Assets/Scripts/AnimationComponents/AlienRaceDef.cs
Normal file
|
@ -0,0 +1,210 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
public class AlienRaceDef
|
||||
{
|
||||
public string defName;
|
||||
public bool isHumanoid = true;
|
||||
public float scale = 1f;
|
||||
|
||||
public List<MultiDirectionalGraphic> bodyTypeGraphics = new List<MultiDirectionalGraphic>();
|
||||
public MultiDirectionalGraphic headGraphics = new MultiDirectionalGraphic();
|
||||
|
||||
public AlienRaceDef()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public AlienRaceDef(string defName)
|
||||
{
|
||||
this.defName = defName;
|
||||
}
|
||||
|
||||
public Sprite GetHeadGraphic(CardinalDirection facing)
|
||||
{
|
||||
if (HasValidHeadGraphicPath(facing) == false)
|
||||
{ return null; }
|
||||
|
||||
switch (facing)
|
||||
{
|
||||
case CardinalDirection.North: return headGraphics.northGraphic.sprite;
|
||||
case CardinalDirection.East: return headGraphics.eastGraphic.sprite;
|
||||
case CardinalDirection.South: return headGraphics.southGraphic.sprite;
|
||||
default: return headGraphics.eastGraphic.sprite;
|
||||
}
|
||||
}
|
||||
|
||||
public Sprite GetBodyTypeGraphic(CardinalDirection facing, string bodyType = "None")
|
||||
{
|
||||
if (HasValidBodyTypeGraphicPath(facing, bodyType) == false)
|
||||
{ return null; }
|
||||
|
||||
MultiDirectionalGraphic bodyTypeGraphic = bodyTypeGraphics.FirstOrDefault(x => x.bodyType == bodyType);
|
||||
|
||||
if (bodyTypeGraphic == null)
|
||||
{
|
||||
bodyTypeGraphic = new MultiDirectionalGraphic(bodyType);
|
||||
bodyTypeGraphics.Add(bodyTypeGraphic);
|
||||
}
|
||||
|
||||
switch (facing)
|
||||
{
|
||||
case CardinalDirection.North: return bodyTypeGraphic.northGraphic.sprite;
|
||||
case CardinalDirection.East: return bodyTypeGraphic.eastGraphic.sprite;
|
||||
case CardinalDirection.South: return bodyTypeGraphic.southGraphic.sprite;
|
||||
default: return bodyTypeGraphic.eastGraphic.sprite;
|
||||
}
|
||||
}
|
||||
|
||||
public string GetHeadGraphicPath(CardinalDirection facing)
|
||||
{
|
||||
if (HasValidHeadGraphicPath(facing) == false)
|
||||
{ return "Invalid file path"; }
|
||||
|
||||
switch (facing)
|
||||
{
|
||||
case CardinalDirection.North: return headGraphics.northGraphic.path;
|
||||
case CardinalDirection.East: return headGraphics.eastGraphic.path;
|
||||
case CardinalDirection.South: return headGraphics.southGraphic.path;
|
||||
default: return headGraphics.eastGraphic.path;
|
||||
}
|
||||
}
|
||||
|
||||
public string GetBodyTypeGraphicPath(CardinalDirection facing, string bodyType = "None")
|
||||
{
|
||||
if (HasValidBodyTypeGraphicPath(facing, bodyType) == false)
|
||||
{ return "Invalid file path"; }
|
||||
|
||||
MultiDirectionalGraphic bodyTypeGraphic = bodyTypeGraphics.FirstOrDefault(x => x.bodyType == bodyType);
|
||||
|
||||
if (bodyTypeGraphic == null)
|
||||
{
|
||||
bodyTypeGraphic = new MultiDirectionalGraphic(bodyType);
|
||||
bodyTypeGraphics.Add(bodyTypeGraphic);
|
||||
}
|
||||
|
||||
switch (facing)
|
||||
{
|
||||
case CardinalDirection.North: return bodyTypeGraphic.northGraphic.path;
|
||||
case CardinalDirection.East: return bodyTypeGraphic.eastGraphic.path;
|
||||
case CardinalDirection.South: return bodyTypeGraphic.southGraphic.path;
|
||||
default: return bodyTypeGraphic.eastGraphic.path;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetHeadGraphicPath(string path, CardinalDirection facing)
|
||||
{
|
||||
if (path == null || path.Any() == false || File.Exists(path) == false || Path.GetExtension(path) != ".png")
|
||||
{ path = "Invalid file path"; }
|
||||
|
||||
switch (facing)
|
||||
{
|
||||
case CardinalDirection.North:
|
||||
headGraphics.northGraphic.path = path;
|
||||
headGraphics.northGraphic.sprite = LoadSprite(path); break;
|
||||
case CardinalDirection.East:
|
||||
headGraphics.eastGraphic.path = path;
|
||||
headGraphics.eastGraphic.sprite = LoadSprite(path); break;
|
||||
case CardinalDirection.South:
|
||||
headGraphics.southGraphic.path = path;
|
||||
headGraphics.southGraphic.sprite = LoadSprite(path); break;
|
||||
default:
|
||||
headGraphics.eastGraphic.path = path;
|
||||
headGraphics.eastGraphic.sprite = LoadSprite(path); break;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetBodyTypeGraphicPath(string path, CardinalDirection facing, string bodyType = "None")
|
||||
{
|
||||
if (path == null || path.Any() == false || File.Exists(path) == false || Path.GetExtension(path) != ".png")
|
||||
{ path = "Invalid file path"; }
|
||||
|
||||
MultiDirectionalGraphic bodyTypeGraphic = bodyTypeGraphics.FirstOrDefault(x => x.bodyType == bodyType);
|
||||
|
||||
if (bodyTypeGraphic == null)
|
||||
{
|
||||
bodyTypeGraphic = new MultiDirectionalGraphic(bodyType);
|
||||
bodyTypeGraphics.Add(bodyTypeGraphic);
|
||||
}
|
||||
|
||||
switch (facing)
|
||||
{
|
||||
case CardinalDirection.North:
|
||||
bodyTypeGraphic.northGraphic.path = path;
|
||||
bodyTypeGraphic.northGraphic.sprite = LoadSprite(path); break;
|
||||
case CardinalDirection.East:
|
||||
bodyTypeGraphic.eastGraphic.path = path;
|
||||
bodyTypeGraphic.eastGraphic.sprite = LoadSprite(path); break;
|
||||
case CardinalDirection.South:
|
||||
bodyTypeGraphic.southGraphic.path = path;
|
||||
bodyTypeGraphic.southGraphic.sprite = LoadSprite(path); break;
|
||||
default:
|
||||
bodyTypeGraphic.eastGraphic.path = path;
|
||||
bodyTypeGraphic.eastGraphic.sprite = LoadSprite(path); break;
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasValidHeadGraphicPath(CardinalDirection facing)
|
||||
{
|
||||
string path;
|
||||
|
||||
switch (facing)
|
||||
{
|
||||
case CardinalDirection.North: path = headGraphics.northGraphic.path; break;
|
||||
case CardinalDirection.East: path = headGraphics.eastGraphic.path; break;
|
||||
case CardinalDirection.South: path = headGraphics.southGraphic.path; break;
|
||||
default: path = headGraphics.eastGraphic.path; break;
|
||||
}
|
||||
|
||||
if (path == null || path.Any() == false || File.Exists(path) == false || Path.GetExtension(path) != ".png") return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool HasValidBodyTypeGraphicPath(CardinalDirection facing, string bodyType = "None")
|
||||
{
|
||||
MultiDirectionalGraphic bodyTypeGraphic = bodyTypeGraphics.FirstOrDefault(x => x.bodyType == bodyType);
|
||||
|
||||
if (bodyTypeGraphic == null)
|
||||
{
|
||||
bodyTypeGraphic = new MultiDirectionalGraphic(bodyType);
|
||||
bodyTypeGraphics.Add(bodyTypeGraphic);
|
||||
}
|
||||
|
||||
string path;
|
||||
|
||||
switch (facing)
|
||||
{
|
||||
case CardinalDirection.North: path = bodyTypeGraphic.northGraphic.path; break;
|
||||
case CardinalDirection.East: path = bodyTypeGraphic.eastGraphic.path; break;
|
||||
case CardinalDirection.South: path = bodyTypeGraphic.southGraphic.path; break;
|
||||
default: path = bodyTypeGraphic.eastGraphic.path; break;
|
||||
}
|
||||
|
||||
if (path == null || path.Any() == false || File.Exists(path) == false || Path.GetExtension(path) != ".png") return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public Sprite LoadSprite(string path)
|
||||
{
|
||||
if (path == null || path.Any() == false || File.Exists(path) == false || Path.GetExtension(path) != ".png") return null;
|
||||
|
||||
byte[] pngBytes = File.ReadAllBytes(path);
|
||||
|
||||
Texture2D tex = new Texture2D(2, 2);
|
||||
tex.LoadImage(pngBytes);
|
||||
|
||||
Sprite sprite = Sprite.Create(tex, new Rect(0.0f, 0.0f, tex.width, tex.height), new Vector2(0.5f, 0.5f), 85.0f);
|
||||
|
||||
return sprite;
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/AnimationComponents/AlienRaceDef.cs.meta
Normal file
11
Assets/Scripts/AnimationComponents/AlienRaceDef.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5b8a2db320a85494c882518c143b73f7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,7 +1,10 @@
|
|||
using UnityEngine;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
[Serializable]
|
||||
public class AlienRaceOffset
|
||||
{
|
||||
public string defName;
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
[Serializable]
|
||||
public class MultiDirectionalGraphic
|
||||
{
|
||||
public string bodyType = "None";
|
||||
public DirectionalGraphic northGraphic = new DirectionalGraphic();
|
||||
public DirectionalGraphic eastGraphic = new DirectionalGraphic();
|
||||
public DirectionalGraphic southGraphic = new DirectionalGraphic();
|
||||
|
||||
public MultiDirectionalGraphic() { }
|
||||
|
||||
public MultiDirectionalGraphic(string bodyType)
|
||||
{
|
||||
this.bodyType = bodyType;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 86cb79b8d4c053f4a981ed17b86ae9bb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
14
Assets/Scripts/DirectionalGraphic.cs
Normal file
14
Assets/Scripts/DirectionalGraphic.cs
Normal file
|
@ -0,0 +1,14 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
public class DirectionalGraphic
|
||||
{
|
||||
public string path = "Invalid file path";
|
||||
[XmlIgnore] public Sprite sprite = null;
|
||||
}
|
||||
}
|
11
Assets/Scripts/DirectionalGraphic.cs.meta
Normal file
11
Assets/Scripts/DirectionalGraphic.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7eb64887148d9f44793b32cf5393c7ad
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -36,7 +36,7 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
public void OnPointerClick(PointerEventData eventData)
|
||||
{
|
||||
if (eventData.pointerCurrentRaycast.gameObject.GetComponent<ActorBody>() == null)
|
||||
if (eventData.pointerCurrentRaycast.gameObject.GetComponent<ActorBodyPart>())
|
||||
{ return; }
|
||||
|
||||
Activate();
|
||||
|
@ -61,7 +61,7 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
else if (Workspace.actorManipulationMode == ActorManipulationMode.Rotate)
|
||||
{
|
||||
float angle = Vector2.SignedAngle(Vector2.down, (Vector2)mousePosition - (Vector2)transform.position);
|
||||
float angle = -Vector2.SignedAngle(Vector2.down, (Vector2)mousePosition - (Vector2)transform.position);
|
||||
keyframe.bodyAngle = angle;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
else if (Workspace.actorManipulationMode == ActorManipulationMode.Rotate)
|
||||
{
|
||||
float angle = Vector2.SignedAngle(Vector2.down, (Vector2)mousePosition - (Vector2)transform.position);
|
||||
float angle = -Vector2.SignedAngle(Vector2.down, (Vector2)mousePosition - (Vector2)transform.position);
|
||||
keyframe.headAngle = angle;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,9 +14,6 @@ namespace RimWorldAnimationStudio
|
|||
public InputField bodyOffsetZField;
|
||||
public Toggle initiatorToggle;
|
||||
|
||||
private int actorID = -1;
|
||||
private bool isDirty = false;
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
Actor actor = Workspace.animationDef.actors[Workspace.actorID];
|
||||
|
@ -45,7 +42,7 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
public void OnValueChanged()
|
||||
{
|
||||
if (Workspace.animationDef == null || isDirty) return;
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
||||
Actor actor = Workspace.animationDef.actors[Workspace.actorID];
|
||||
|
||||
|
@ -68,66 +65,28 @@ namespace RimWorldAnimationStudio
|
|||
Workspace.Instance.RecordEvent("Actor body type offset data");
|
||||
}
|
||||
|
||||
/*public void OpenSelectBodyPartsDialog()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
||||
Actor actor = Workspace.animationDef.actors[Workspace.actorID];
|
||||
var dialog = Resources.FindObjectsOfTypeAll(typeof(SelectBodyPartsDialog)) as SelectBodyPartsDialog[];
|
||||
|
||||
if (dialog != null)
|
||||
{ dialog[0].Initialize(actor); dialog[0].Pop(); }
|
||||
}
|
||||
|
||||
public void OpenSelectDefNamesDialog()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
||||
Actor actor = Workspace.animationDef.actors[Workspace.actorID];
|
||||
var dialog = Resources.FindObjectsOfTypeAll(typeof(SelectDefNamesDialog)) as SelectDefNamesDialog[];
|
||||
|
||||
if (dialog != null)
|
||||
{ dialog[0].Initialize(actor); dialog[0].Pop(); }
|
||||
}
|
||||
|
||||
public void OpenSelectBodyDefTypesDialog()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
||||
Actor actor = Workspace.animationDef.actors[Workspace.actorID];
|
||||
var dialog = Resources.FindObjectsOfTypeAll(typeof(SelectBodyDefTypesDialog)) as SelectBodyDefTypesDialog[];
|
||||
|
||||
if (dialog != null)
|
||||
{ dialog[0].Initialize(actor); dialog[0].Pop(); }
|
||||
}*/
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
||||
if (actorID != Workspace.actorID)
|
||||
{
|
||||
isDirty = true;
|
||||
if (Workspace.actorID >= AnimationController.Instance.actorBodies.GetComponentsInChildren<ActorBody>().Count())
|
||||
{ Debug.Log("Waiting for actors to initialize..."); return; }
|
||||
|
||||
if (Workspace.actorID >= AnimationController.Instance.actorBodies.GetComponentsInChildren<ActorBody>().Count())
|
||||
{ Debug.Log("Waiting for actors to initialize..."); return; }
|
||||
Actor actor = Workspace.animationDef.actors[Workspace.actorID];
|
||||
ActorBody actorBody = AnimationController.Instance.actorBodies.GetComponentsInChildren<ActorBody>()[Workspace.actorID];
|
||||
|
||||
Actor actor = Workspace.animationDef.actors[Workspace.actorID];
|
||||
ActorBody actorBody = AnimationController.Instance.actorBodies.GetComponentsInChildren<ActorBody>()[Workspace.actorID];
|
||||
|
||||
string bodyType = actorBody.bodyType;
|
||||
bodyType = bodyType == null || bodyType == "" ? "Male" : bodyType;
|
||||
string bodyType = actorBody.bodyType;
|
||||
bodyType = bodyType == null || bodyType == "" ? "Male" : bodyType;
|
||||
|
||||
bodyTypeDropdown.value = bodyTypeDropdown.options.IndexOf(bodyTypeDropdown.options.First(x => x.text == bodyType));
|
||||
bodyOffsetXField.text = actor.bodyTypeOffset.GetOffset(bodyType).x.ToString();
|
||||
bodyOffsetZField.text = actor.bodyTypeOffset.GetOffset(bodyType).z.ToString();
|
||||
bodyTypeDropdown.value = bodyTypeDropdown.options.IndexOf(bodyTypeDropdown.options.First(x => x.text == bodyType));
|
||||
|
||||
initiatorToggle.isOn = actor.initiator;
|
||||
if (bodyOffsetXField.isFocused == false)
|
||||
{ bodyOffsetXField.text = actor.bodyTypeOffset.GetOffset(bodyType).x.ToString(); }
|
||||
|
||||
actorID = Workspace.actorID;
|
||||
if (bodyOffsetZField.isFocused == false)
|
||||
{ bodyOffsetZField.text = actor.bodyTypeOffset.GetOffset(bodyType).z.ToString(); }
|
||||
|
||||
isDirty = false;
|
||||
}
|
||||
initiatorToggle.isOn = actor.initiator;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,6 +54,18 @@ namespace RimWorldAnimationStudio
|
|||
Initialize(true);
|
||||
}
|
||||
|
||||
public void AddCustomRace(InputField field)
|
||||
{
|
||||
if (field?.text == null || field.text == "")
|
||||
{ return; }
|
||||
|
||||
AlienRaceDefs.AddDef(new AlienRaceDef(field.text));
|
||||
|
||||
ApplicationManager.Instance.SaveAlienRaceDefs();
|
||||
|
||||
Initialize(true);
|
||||
}
|
||||
|
||||
public virtual void Initialize(bool addedNewTag = false) { }
|
||||
}
|
||||
}
|
||||
|
|
127
Assets/Scripts/GUI/DialogBoxes/RaceSettingsDialog.cs
Normal file
127
Assets/Scripts/GUI/DialogBoxes/RaceSettingsDialog.cs
Normal file
|
@ -0,0 +1,127 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using SFB;
|
||||
using System.IO;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
public class RaceSettingsDialog : DialogBox
|
||||
{
|
||||
public Dropdown raceSelectDropdown;
|
||||
public Transform raceSettingsWindow;
|
||||
public Toggle isHumanoidToggle;
|
||||
|
||||
public override void Initialize(bool addedNewTag = false)
|
||||
{
|
||||
Reset();
|
||||
|
||||
string alienRaceDefName = raceSelectDropdown.value < raceSelectDropdown.options.Count ? raceSelectDropdown.options[raceSelectDropdown.value].text : "Human";
|
||||
if (alienRaceDefName == null || alienRaceDefName == "") alienRaceDefName = "Human";
|
||||
|
||||
AlienRaceDef alienRaceDef = AlienRaceDefs.GetNamed(alienRaceDefName);
|
||||
if (alienRaceDef == null) return;
|
||||
|
||||
isHumanoidToggle.isOn = alienRaceDef.isHumanoid;
|
||||
|
||||
Text bodyGraphicsTitle = AddCloneObjectToParent(raceSettingsWindow, 2).GetComponent<Text>();
|
||||
bodyGraphicsTitle.text = "Body graphic filepaths";
|
||||
|
||||
foreach (string bodyType in Tags.bodyTypes)
|
||||
{
|
||||
string _bodyType = alienRaceDef.isHumanoid ? bodyType : "None";
|
||||
|
||||
if (alienRaceDef.isHumanoid)
|
||||
{
|
||||
Text bodyTypeTitle = AddCloneObjectToParent(raceSettingsWindow, 2).GetComponent<Text>();
|
||||
bodyTypeTitle.text = bodyType;
|
||||
}
|
||||
|
||||
for (int i = 2; i >= 0; i--)
|
||||
{
|
||||
CardinalDirection facing = (CardinalDirection)i;
|
||||
|
||||
GameObject filepath = AddCloneObjectToParent(raceSettingsWindow, 0);
|
||||
filepath.GetComponent<Text>().text = facing.ToString();
|
||||
filepath.transform.Find("FilepathButton").GetComponent<Button>().onClick.AddListener(delegate
|
||||
{
|
||||
SetBodyTypeGraphicPath(alienRaceDef, facing, _bodyType);
|
||||
});
|
||||
filepath.transform.FindDeepChild("FilepathLabel").GetComponent<Text>().text = alienRaceDef.GetBodyTypeGraphicPath(facing, _bodyType);
|
||||
}
|
||||
|
||||
AddCloneObjectToParent(raceSettingsWindow, 3);
|
||||
|
||||
if (alienRaceDef.isHumanoid == false)
|
||||
{ break; }
|
||||
}
|
||||
|
||||
if (alienRaceDef.isHumanoid)
|
||||
{
|
||||
Text headGraphics = AddCloneObjectToParent(raceSettingsWindow, 2).GetComponent<Text>();
|
||||
headGraphics.text = "Head graphic filepaths";
|
||||
|
||||
for (int i = 2; i >= 0; i--)
|
||||
{
|
||||
CardinalDirection facing = (CardinalDirection)i;
|
||||
|
||||
GameObject filepath = AddCloneObjectToParent(raceSettingsWindow, 0);
|
||||
filepath.GetComponent<Text>().text = facing.ToString();
|
||||
filepath.transform.Find("FilepathButton").GetComponent<Button>().onClick.AddListener(delegate
|
||||
{
|
||||
SetHeadGraphicPath(alienRaceDef, facing);
|
||||
});
|
||||
filepath.transform.FindDeepChild("FilepathLabel").GetComponent<Text>().text = alienRaceDef.GetHeadGraphicPath(facing);
|
||||
}
|
||||
|
||||
AddCloneObjectToParent(raceSettingsWindow, 3);
|
||||
}
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
RemoveCloneObjectsFromParent(raceSettingsWindow);
|
||||
}
|
||||
|
||||
public void SetIsHumanoid()
|
||||
{
|
||||
string alienRaceDefName = raceSelectDropdown.value < raceSelectDropdown.options.Count ? raceSelectDropdown.options[raceSelectDropdown.value].text : "Human";
|
||||
if (alienRaceDefName == null || alienRaceDefName == "") alienRaceDefName = "Human";
|
||||
|
||||
AlienRaceDef alienRaceDef = AlienRaceDefs.GetNamed(alienRaceDefName);
|
||||
if (alienRaceDef == null) return;
|
||||
|
||||
alienRaceDef.isHumanoid = isHumanoidToggle.isOn;
|
||||
|
||||
Initialize();
|
||||
}
|
||||
|
||||
public void SetHeadGraphicPath(AlienRaceDef alienRaceDef, CardinalDirection direction)
|
||||
{
|
||||
var paths = StandaloneFileBrowser.OpenFilePanel("Select texture File", "", "png", false);
|
||||
|
||||
if (paths == null || paths.Any() == false || File.Exists(paths[0]) == false)
|
||||
{ Debug.LogError("Selected file was null or invalid"); return; }
|
||||
|
||||
alienRaceDef.SetHeadGraphicPath(paths[0], direction);
|
||||
|
||||
Initialize();
|
||||
}
|
||||
|
||||
public void SetBodyTypeGraphicPath(AlienRaceDef alienRaceDef, CardinalDirection direction, string bodyType)
|
||||
{
|
||||
var paths = StandaloneFileBrowser.OpenFilePanel("Select texture File", "", "png", false);
|
||||
|
||||
if (paths == null || paths.Any() == false || File.Exists(paths[0]) == false)
|
||||
{ Debug.LogError("Selected file was null or invalid"); return; }
|
||||
|
||||
alienRaceDef.SetBodyTypeGraphicPath(paths[0], direction, bodyType);
|
||||
|
||||
Initialize();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,11 +10,6 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
public class SelectActorLayerDialog : DialogBox
|
||||
{
|
||||
public void OnEnable()
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
public override void Initialize(bool addedNewTag = false)
|
||||
{
|
||||
IEnumerable<string> allTags = Tags.bodyDefTypes.Concat(CustomTags.interactionDefTypes);
|
||||
IEnumerable<string> allTags = Tags.bodyDefTypes.Concat(CustomTags.bodyDefTypes);
|
||||
string placeHolderText = "Enter new body def type...";
|
||||
|
||||
Actor actor = Workspace.animationDef.actors[Workspace.actorID];
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
public override void Initialize(bool addedNewTag = false)
|
||||
{
|
||||
IEnumerable<string> allTags = Tags.bodyParts.Concat(CustomTags.interactionDefTypes);
|
||||
IEnumerable<string> allTags = Tags.bodyParts.Concat(CustomTags.bodyParts);
|
||||
string placeHolderText = "Enter new body part name...";
|
||||
|
||||
Actor actor = Workspace.animationDef.actors[Workspace.actorID];
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
public override void Initialize(bool addedNewTag = false)
|
||||
{
|
||||
IEnumerable<string> allTags = Tags.defNames.Concat(CustomTags.interactionDefTypes);
|
||||
IEnumerable<string> allTags = AlienRaceDefs.allDefs.Select(x => x.defName);
|
||||
string placeHolderText = "Enter new def name...";
|
||||
|
||||
Actor actor = Workspace.animationDef.actors[Workspace.actorID];
|
||||
|
@ -47,7 +47,7 @@ namespace RimWorldAnimationStudio
|
|||
_optionField.Find("Placeholder").GetComponent<Text>().text = placeHolderText;
|
||||
|
||||
InputField fieldComp = _optionField.GetComponent<InputField>();
|
||||
fieldComp.onEndEdit.AddListener(delegate { AddCustomTag(fieldComp, ref Tags.defNames, ref CustomTags.defNames); });
|
||||
fieldComp.onEndEdit.AddListener(delegate { AddCustomRace(fieldComp); });
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
public class SelectRaceDialog : DialogBox
|
||||
{
|
||||
public override void Initialize(bool addedNewTag = false)
|
||||
{
|
||||
IEnumerable<string> allTags = Tags.defNames.Concat(CustomTags.interactionDefTypes);
|
||||
string placeHolderText = "Enter new def name...";
|
||||
|
||||
Actor actor = Workspace.animationDef.actors[Workspace.actorID];
|
||||
Transform contentWindow = transform.FindDeepChild("Content");
|
||||
Reset();
|
||||
|
||||
for (int i = 0; i < allTags.Count(); i++)
|
||||
{
|
||||
string tag = allTags.ElementAt(i);
|
||||
|
||||
Transform _optionToggle = AddCloneObjectToParent(contentWindow).transform;
|
||||
_optionToggle.Find("Text").GetComponent<Text>().text = tag;
|
||||
|
||||
Toggle toggleComp = _optionToggle.GetComponent<Toggle>();
|
||||
toggleComp.isOn = actor.defNames.Contains(tag);
|
||||
toggleComp.onValueChanged.AddListener(delegate
|
||||
{
|
||||
if (toggleComp.isOn && actor.defNames.Contains(tag) == false)
|
||||
{ actor.defNames.Add(tag); }
|
||||
|
||||
else if (toggleComp.isOn == false && actor.defNames.Contains(tag))
|
||||
{ actor.defNames.Remove(tag); }
|
||||
|
||||
Workspace.Instance.RecordEvent("Actor def name");
|
||||
});
|
||||
|
||||
if (addedNewTag && i == allTags.Count() - 1)
|
||||
{ toggleComp.isOn = true; }
|
||||
}
|
||||
|
||||
Transform _optionField = AddCloneObjectToParent(contentWindow, 1).transform;
|
||||
_optionField.Find("Placeholder").GetComponent<Text>().text = placeHolderText;
|
||||
|
||||
InputField fieldComp = _optionField.GetComponent<InputField>();
|
||||
fieldComp.onEndEdit.AddListener(delegate { AddCustomTag(fieldComp, ref Tags.defNames, ref CustomTags.defNames); });
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
Transform contentWindow = transform.FindDeepChild("Content");
|
||||
RemoveCloneObjectsFromParent(contentWindow);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -12,7 +12,7 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
public override void Initialize(bool addedNewTag = false)
|
||||
{
|
||||
IEnumerable<string> allTags = Tags.sexTypes.Concat(CustomTags.interactionDefTypes);
|
||||
IEnumerable<string> allTags = Tags.sexTypes.Concat(CustomTags.sexTypes);
|
||||
string placeHolderText = "Enter new sex type...";
|
||||
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
public override void Initialize(bool addedNewTag = false)
|
||||
{
|
||||
IEnumerable<string> allTags = Tags.soundDefs.Concat(CustomTags.interactionDefTypes);
|
||||
IEnumerable<string> allTags = Tags.soundDefs.Concat(CustomTags.soundDefs);
|
||||
string placeHolderText = "Enter new sound def...";
|
||||
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
|
|
@ -130,9 +130,11 @@ namespace RimWorldAnimationStudio
|
|||
{ continue; }
|
||||
|
||||
float clipPercent = (float)(stageTick % clip.duration) / clip.duration;
|
||||
if (stageTick == clip.duration) clipPercent = 1f;
|
||||
|
||||
AlienRaceDef alienRaceDef = Workspace.animationDef.actors[actorID].GetAlienRaceDef();
|
||||
ActorBody actorBody = _actorBodies[actorID];
|
||||
string bodyType = actorBody.bodyType;
|
||||
string bodyType = alienRaceDef.isHumanoid ? actorBody.bodyType : "None";
|
||||
|
||||
Vector3 deltaPos = new Vector3(clip.BodyOffsetX.Evaluate(clipPercent), 0, clip.BodyOffsetZ.Evaluate(clipPercent));
|
||||
deltaPos += Workspace.animationDef.actors[actorID].bodyTypeOffset.GetOffset(bodyType);
|
||||
|
@ -158,23 +160,31 @@ namespace RimWorldAnimationStudio
|
|||
float appendageRotation = clip.GenitalAngle.Evaluate(clipPercent);
|
||||
|
||||
actorBody.transform.position = bodyPos;
|
||||
actorBody.transform.eulerAngles = new Vector3(0, 0, bodyAngle);
|
||||
actorBody.transform.eulerAngles = new Vector3(0, 0, -bodyAngle);
|
||||
|
||||
actorBody.headRenderer.transform.localPosition = headPos;
|
||||
actorBody.headRenderer.transform.eulerAngles = new Vector3(0, 0, headAngle);
|
||||
actorBody.headRenderer.transform.eulerAngles = new Vector3(0, 0, -headAngle);
|
||||
|
||||
actorBody.appendageRenderer.transform.localPosition = new Vector3(appendagePos.x, appendagePos.z, 0f);
|
||||
actorBody.appendageRenderer.transform.eulerAngles = new Vector3(0, 0, appendageRotation);
|
||||
actorBody.appendageRenderer.transform.eulerAngles = new Vector3(0, 0, -appendageRotation);
|
||||
|
||||
actorBody.bodyRenderer.sprite = Resources.Load<Sprite>("Textures/Humanlike/Bodies/" + bodyType + bodyFacing);
|
||||
actorBody.headRenderer.sprite = Resources.Load<Sprite>("Textures/Humanlike/Heads/Head" + headFacing);
|
||||
actorBody.appendageRenderer.sprite = Resources.Load<Sprite>("Textures/Humanlike/Appendages/Appendage" + bodyFacing);
|
||||
actorBody.bodyRenderer.sprite = alienRaceDef.GetBodyTypeGraphic((CardinalDirection)bodyFacing, bodyType);
|
||||
actorBody.headRenderer.sprite = alienRaceDef.isHumanoid ? alienRaceDef.GetHeadGraphic((CardinalDirection)headFacing) : null;
|
||||
actorBody.appendageRenderer.sprite = alienRaceDef.isHumanoid && bodyFacing != 0 ? Resources.Load<Sprite>("Textures/Humanlike/Appendages/Appendage" + bodyFacing) : null;
|
||||
|
||||
actorBody.bodyRenderer.gameObject.SetActive(actorBody.bodyRenderer.sprite != null);
|
||||
actorBody.headRenderer.gameObject.SetActive(actorBody.headRenderer.sprite != null);
|
||||
actorBody.appendageRenderer.gameObject.SetActive(actorBody.appendageRenderer.sprite != null);
|
||||
|
||||
actorBody.bodyRenderer.sortingLayerName = clip.layer;
|
||||
actorBody.headRenderer.sortingLayerName = clip.layer;
|
||||
actorBody.headRenderer.sortingOrder = bodyFacing == 0 ? -1 : 1;
|
||||
actorBody.appendageRenderer.sortingLayerName = clip.layer;
|
||||
|
||||
actorBody.bodyRenderer.flipX = bodyFacing == 3;
|
||||
actorBody.headRenderer.flipX = headFacing == 3;
|
||||
//actorBody.appendageRenderer.flipX = bodyFacing == 3;
|
||||
|
||||
// ActorKeyframeCard update
|
||||
if (ActorKeyframeCard.Instance.positionXField.isFocused == false) { ActorKeyframeCard.Instance.positionXField.text = bodyPos.x.ToString("0.000"); }
|
||||
if (ActorKeyframeCard.Instance.positionZField.isFocused == false) { ActorKeyframeCard.Instance.positionZField.text = bodyPos.y.ToString("0.000"); }
|
||||
|
|
|
@ -18,6 +18,37 @@ namespace RimWorldAnimationStudio
|
|||
public void Start()
|
||||
{
|
||||
LoadCustomArrays();
|
||||
|
||||
/*AlienRaceDef human = new AlienRaceDef();
|
||||
human.Initialize("Human");
|
||||
|
||||
human.SetHeadGraphicPath(Path.Combine(Application.streamingAssetsPath, "Textures/Humanlike/Heads/Head0.png"), CardinalDirection.North);
|
||||
human.SetHeadGraphicPath(Path.Combine(Application.streamingAssetsPath, "Textures/Humanlike/Heads/Head1.png"), CardinalDirection.East);
|
||||
human.SetHeadGraphicPath(Path.Combine(Application.streamingAssetsPath, "Textures/Humanlike/Heads/Head2.png"), CardinalDirection.South);
|
||||
|
||||
human.SetBodyTypeGraphicPath(Path.Combine(Application.streamingAssetsPath, "Textures/Humanlike/Bodies/Male0.png"), CardinalDirection.North, "Male");
|
||||
human.SetBodyTypeGraphicPath(Path.Combine(Application.streamingAssetsPath, "Textures/Humanlike/Bodies/Male1.png"), CardinalDirection.East, "Male");
|
||||
human.SetBodyTypeGraphicPath(Path.Combine(Application.streamingAssetsPath, "Textures/Humanlike/Bodies/Male2.png"), CardinalDirection.South, "Male");
|
||||
|
||||
human.SetBodyTypeGraphicPath(Path.Combine(Application.streamingAssetsPath, "Textures/Humanlike/Bodies/Female0.png"), CardinalDirection.North, "Female");
|
||||
human.SetBodyTypeGraphicPath(Path.Combine(Application.streamingAssetsPath, "Textures/Humanlike/Bodies/Female1.png"), CardinalDirection.East, "Female");
|
||||
human.SetBodyTypeGraphicPath(Path.Combine(Application.streamingAssetsPath, "Textures/Humanlike/Bodies/Female2.png"), CardinalDirection.South, "Female");
|
||||
|
||||
human.SetBodyTypeGraphicPath(Path.Combine(Application.streamingAssetsPath, "Textures/Humanlike/Bodies/Fat0.png"), CardinalDirection.North, "Fat");
|
||||
human.SetBodyTypeGraphicPath(Path.Combine(Application.streamingAssetsPath, "Textures/Humanlike/Bodies/Fat1.png"), CardinalDirection.East, "Fat");
|
||||
human.SetBodyTypeGraphicPath(Path.Combine(Application.streamingAssetsPath, "Textures/Humanlike/Bodies/Fat2.png"), CardinalDirection.South, "Fat");
|
||||
|
||||
human.SetBodyTypeGraphicPath(Path.Combine(Application.streamingAssetsPath, "Textures/Humanlike/Bodies/Hulk0.png"), CardinalDirection.North, "Hulk");
|
||||
human.SetBodyTypeGraphicPath(Path.Combine(Application.streamingAssetsPath, "Textures/Humanlike/Bodies/Hulk1.png"), CardinalDirection.East, "Hulk");
|
||||
human.SetBodyTypeGraphicPath(Path.Combine(Application.streamingAssetsPath, "Textures/Humanlike/Bodies/Hulk2.png"), CardinalDirection.South, "Hulk");
|
||||
|
||||
human.SetBodyTypeGraphicPath(Path.Combine(Application.streamingAssetsPath, "Textures/Humanlike/Bodies/Thin0.png"), CardinalDirection.North, "Thin");
|
||||
human.SetBodyTypeGraphicPath(Path.Combine(Application.streamingAssetsPath, "Textures/Humanlike/Bodies/Thin1.png"), CardinalDirection.East, "Thin");
|
||||
human.SetBodyTypeGraphicPath(Path.Combine(Application.streamingAssetsPath, "Textures/Humanlike/Bodies/Thin2.png"), CardinalDirection.South, "Thin");*/
|
||||
|
||||
//AlienRaceDefs.allDefs.Add(human);
|
||||
|
||||
LoadAlienRaceDefs();
|
||||
}
|
||||
|
||||
public void TryToCloseApplication()
|
||||
|
@ -139,7 +170,6 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
CustomTagsHelper helper = new CustomTagsHelper();
|
||||
|
||||
helper.defNames = CustomTags.defNames;
|
||||
helper.bodyParts = CustomTags.bodyParts;
|
||||
helper.bodyDefTypes = CustomTags.bodyDefTypes;
|
||||
helper.sexTypes = CustomTags.sexTypes;
|
||||
|
@ -158,7 +188,6 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
CustomTagsHelper helper = XmlUtility.ReadXML<CustomTagsHelper>(path);
|
||||
|
||||
CustomTags.defNames = helper.defNames;
|
||||
CustomTags.bodyParts = helper.bodyParts;
|
||||
CustomTags.bodyDefTypes = helper.bodyDefTypes;
|
||||
CustomTags.sexTypes = helper.sexTypes;
|
||||
|
@ -168,7 +197,6 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
public void UpdateCustomArrays(AnimationDef animationDef)
|
||||
{
|
||||
CustomTags.defNames.AddRangeDistinct(animationDef.actors.SelectMany(x => x.defNames).Except(Tags.defNames));
|
||||
CustomTags.bodyParts.AddRangeDistinct(animationDef.actors.SelectMany(x => x.requiredGenitals).Except(Tags.bodyParts));
|
||||
CustomTags.bodyDefTypes.AddRangeDistinct(animationDef.actors.SelectMany(x => x.bodyDefTypes).Except(Tags.bodyDefTypes));
|
||||
CustomTags.sexTypes.AddRangeDistinct(animationDef.sexTypes.Except(Tags.sexTypes));
|
||||
|
@ -177,5 +205,23 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
SaveCustomArrays();
|
||||
}
|
||||
|
||||
public void LoadAlienRaceDefs()
|
||||
{
|
||||
var path = Path.Combine(Application.streamingAssetsPath, "alienRaceDefs.xml");
|
||||
|
||||
if (File.Exists(path) == false)
|
||||
{ SaveAlienRaceDefs(); return; }
|
||||
|
||||
AlienRaceDefs.allDefs = XmlUtility.ReadXML<List<AlienRaceDef>>(path);
|
||||
AlienRaceDefs.OnLoad();
|
||||
}
|
||||
|
||||
public void SaveAlienRaceDefs()
|
||||
{
|
||||
var path = Path.Combine(Application.streamingAssetsPath, "alienRaceDefs.xml");
|
||||
|
||||
XmlUtility.WriteXML(AlienRaceDefs.allDefs, path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
using UnityEngine;
|
||||
|
||||
|
@ -26,33 +27,78 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
public static class Tags
|
||||
{
|
||||
public static List<string> defNames = new List<string>() { "Human" };
|
||||
public static List<string> bodyParts = new List<string>() { "Penis", "Vagina", "Anus", "Breasts", "Mouth" };
|
||||
public static List<string> bodyDefTypes = new List<string>() { "Human", "Bird", "BeetleLike", "BeetleLikeWithClaw", "MechanicalCentipede", "MechanicalTermite", "Lancer", "Pikeman", "Monkey", "QuadrupedAnimalWithClawsTailAndJowl", "QuadrupedAnimalWithHooves", "QuadrupedAnimalWithHoovesAndHorn", "QuadrupedAnimalWithHoovesAndHump", "QuadrupedAnimalWithHoovesAndTusks", "QuadrupedAnimalWithHoovesTusksAndTrunk", "QuadrupedAnimalWithPaws", "QuadrupedAnimalWithPawsAndTail", "Scyther", "Snake", "TurtleLike" };
|
||||
public static List<string> sexTypes = new List<string>() { "None", "Vaginal", "Anal", "Oral", "Masturbation", "DoublePenetration", "Boobjob", "Handjob", "Footjob", "Fingering", "Scissoring", "MutualMasturbation", "Fisting", "MechImplant", "Rimming", "Fellatio", "Cunnilingus", "Sixtynine" };
|
||||
public static List<string> interactionDefTypes = new List<string>();
|
||||
public static List<string> soundDefs = new List<string>() { "None", "Sex", "Fuck", "Slimy", "Suck", "Cum" };
|
||||
public static List<string> actorLayers = new List<string>() { "Building", "BuildingOnTop", "MoteBelowThings", "Item", "ItemImportant", "LayingPawn", "PawnRope", "Projectile", "Pawn", "PawnUnused", "PawnState" };
|
||||
public static List<string> bodyTypes = new List<string>() { "Male", "Female", "Fat", "Hulk", "Thin" };
|
||||
}
|
||||
|
||||
public static class CustomTags
|
||||
{
|
||||
public static List<string> defNames = new List<string>();
|
||||
public static List<string> bodyParts = new List<string>();
|
||||
public static List<string> bodyDefTypes = new List<string>();
|
||||
public static List<string> sexTypes = new List<string>();
|
||||
public static List<string> interactionDefTypes = new List<string>();
|
||||
public static List<string> soundDefs = new List<string>();
|
||||
public static List<string> bodyTypes = new List<string>();
|
||||
}
|
||||
|
||||
[XmlRoot("CustomTagsHelper", IsNullable = false)]
|
||||
public class CustomTagsHelper
|
||||
{
|
||||
[XmlArray("defNames"), XmlArrayItem("li")] public List<string> defNames = new List<string>();
|
||||
[XmlArray("bodyParts"), XmlArrayItem("li")] public List<string> bodyParts = new List<string>();
|
||||
[XmlArray("bodyDefTypes"), XmlArrayItem("li")] public List<string> bodyDefTypes = new List<string>();
|
||||
[XmlArray("sexTypes"), XmlArrayItem("li")] public List<string> sexTypes = new List<string>();
|
||||
[XmlArray("interactionDefTypes"), XmlArrayItem("li")] public List<string> interactionDefTypes = new List<string>();
|
||||
[XmlArray("soundDefs"), XmlArrayItem("li")] public List<string> soundDefs = new List<string>();
|
||||
[XmlArray("bodyTypes"), XmlArrayItem("li")] public static List<string> bodyTypes = new List<string>();
|
||||
}
|
||||
|
||||
public static class AlienRaceDefs
|
||||
{
|
||||
public static List<AlienRaceDef> allDefs = new List<AlienRaceDef>();
|
||||
|
||||
public static AlienRaceDef GetNamed(string alienRaceDef)
|
||||
{
|
||||
return allDefs.FirstOrDefault(x => x.defName == alienRaceDef);
|
||||
}
|
||||
|
||||
public static void AddDef(AlienRaceDef alienRaceDef)
|
||||
{
|
||||
if (allDefs.Any(x => x.defName == alienRaceDef.defName)) return;
|
||||
|
||||
allDefs.Add(alienRaceDef);
|
||||
}
|
||||
|
||||
public static void OnLoad()
|
||||
{
|
||||
List<string> allTags = Tags.bodyTypes.Concat(CustomTags.bodyTypes).ToList();
|
||||
allTags.Add("None");
|
||||
|
||||
List<CardinalDirection> facings = new List<CardinalDirection>() { CardinalDirection.North, CardinalDirection.East, CardinalDirection.South };
|
||||
string path;
|
||||
|
||||
foreach (AlienRaceDef alienRaceDef in allDefs)
|
||||
{
|
||||
foreach (CardinalDirection facing in facings)
|
||||
{
|
||||
foreach (string bodyType in allTags)
|
||||
{
|
||||
path = alienRaceDef.GetBodyTypeGraphicPath(facing, bodyType);
|
||||
|
||||
if (path != null && path != "")
|
||||
{ alienRaceDef.SetBodyTypeGraphicPath(path, facing, bodyType); }
|
||||
}
|
||||
|
||||
path = alienRaceDef.GetHeadGraphicPath(facing);
|
||||
|
||||
if (path != null && path != "")
|
||||
{ alienRaceDef.SetHeadGraphicPath(path, facing); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,3 +12,10 @@ public enum ActorGender
|
|||
Male,
|
||||
}
|
||||
|
||||
public enum CardinalDirection
|
||||
{
|
||||
North,
|
||||
East,
|
||||
South,
|
||||
West,
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace RimWorldAnimationStudio
|
|||
}
|
||||
}
|
||||
|
||||
else
|
||||
else if (rotation == 1)
|
||||
{
|
||||
switch (bodyType)
|
||||
{
|
||||
|
@ -59,6 +59,19 @@ namespace RimWorldAnimationStudio
|
|||
default: return Vector3.zero;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
switch (bodyType)
|
||||
{
|
||||
case "Male": return new Vector3(-0.07f, 0f, -0.41f);
|
||||
case "Female": return new Vector3(-0.07f, 0f, -0.47f);
|
||||
case "Thin": return new Vector3(0.05f, 0f, -0.43f);
|
||||
case "Hulk": return new Vector3(0.03f, 0f, -0.64f);
|
||||
case "Fat": return new Vector3(-0.24f, 0f, -0.50f);
|
||||
default: return Vector3.zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,9 +15,7 @@ namespace RimWorldAnimationStudio
|
|||
public static int keyframeID = 0;
|
||||
|
||||
[SerializeField] private List<HistoricRecord> workspaceHistory = new List<HistoricRecord>();
|
||||
[SerializeField] private int historyIndex = 0;
|
||||
[SerializeField] private int maxHistoryDepth = 100;
|
||||
private bool isDirty = false;
|
||||
|
||||
public static ActorManipulationMode actorManipulationMode = ActorManipulationMode.Pan;
|
||||
public static ActorBodyPart selectedBodyPart;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue