Sex props plus quiver visuals

This commit is contained in:
AbstractConcept 2022-10-07 21:52:27 -05:00
parent f275ed90ae
commit 4a2905c7fc
152 changed files with 1985 additions and 184 deletions

View File

@ -120,6 +120,8 @@
<Compile Include="Assets\Scripts\MultiDirectionalGraphic.cs" />
<Compile Include="Assets\Scripts\NumberValidator.cs" />
<Compile Include="Assets\Scripts\RequiresAnimationDef.cs" />
<Compile Include="Assets\Scripts\SexProp.cs" />
<Compile Include="Assets\Scripts\SexPropManager.cs" />
<Compile Include="Assets\Scripts\Singleton.cs" />
<Compile Include="Assets\Scripts\SnapToKeyframe.cs" />
<Compile Include="Assets\Scripts\Utilities\PawnUtility.cs" />

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a617f36023d29334395bcdea6dc988c5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -0,0 +1,116 @@
fileFormatVersion: 2
guid: d200f76a362555742ab5cc80b974e978
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 62
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -0,0 +1,116 @@
fileFormatVersion: 2
guid: 96812a154c94f614a9f1cb4efcdc71d8
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 85
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@ -0,0 +1,116 @@
fileFormatVersion: 2
guid: b5ea419faec767a4484f4159980421f3
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 85
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 B

View File

@ -0,0 +1,116 @@
fileFormatVersion: 2
guid: 5411e5a72310c1a47a8ac4061556a2d5
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 85
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -16,7 +16,7 @@ namespace RimWorldAnimationStudio
void Update()
{
PawnKeyframe keyframe = Workspace.Instance.GetCurrentPawnKeyframe();
PawnKeyframe keyframe = Workspace.Instance.GetCurrentOrPreviousKeyframe(Workspace.actorID);
if (keyframe != null)
{ text.text = keyframe.soundEffect == null || keyframe.soundEffect == "" ? "None" : keyframe.soundEffect; }

View File

@ -28,10 +28,10 @@ namespace RimWorldAnimationStudio
_optionToggle.Find("Text").GetComponent<Text>().text = tag;
Toggle toggleComp = _optionToggle.GetComponent<Toggle>();
toggleComp.isOn = Workspace.Instance.GetCurrentPawnKeyframe()?.soundEffect == tag;
toggleComp.isOn = Workspace.Instance.GetCurrentOrPreviousKeyframe(Workspace.actorID)?.soundEffect == tag;
toggleComp.onValueChanged.AddListener(delegate
{
PawnKeyframe keyframe = Workspace.Instance.GetCurrentPawnKeyframe();
PawnKeyframe keyframe = Workspace.Instance.GetCurrentOrPreviousKeyframe(Workspace.actorID);
if (keyframe != null)
{ keyframe.soundEffect = tag; }

View File

@ -9,13 +9,13 @@ namespace RimWorldAnimationStudio
{
public void Update()
{
PawnKeyframe keyframe = Workspace.Instance.GetCurrentPawnKeyframe();
PawnKeyframe keyframe = Workspace.Instance.GetCurrentOrPreviousKeyframe(Workspace.actorID);
GetComponent<Toggle>().isOn = keyframe != null && keyframe.quiver.HasValue && keyframe.quiver.Value;
}
public void OnValueChanged()
{
PawnKeyframe keyframe = Workspace.Instance.GetCurrentPawnKeyframe();
PawnKeyframe keyframe = Workspace.Instance.GetCurrentOrPreviousKeyframe(Workspace.actorID);
if (keyframe != null)
{ keyframe.quiver = GetComponent<Toggle>().isOn; }

View File

@ -5,7 +5,6 @@ using System.Linq;
using System.IO;
using System.Xml.Serialization;
using UnityEngine;
using SFB;
using UnityEngine.UI;
namespace RimWorldAnimationStudio
@ -143,6 +142,8 @@ namespace RimWorldAnimationStudio
if (clip == null)
{ continue; }
bool quiver = isAnimating && Workspace.Instance.GetCurrentOrPreviousKeyframe(actorID).quiver == true;
float clipPercent = (float)(stageTick % clip.duration) / clip.duration;
if (stageTick == clip.duration) clipPercent = 1f;
@ -156,6 +157,8 @@ namespace RimWorldAnimationStudio
Vector3 deltaPos = new Vector3(clip.BodyOffsetX.Evaluate(clipPercent), 0, clip.BodyOffsetZ.Evaluate(clipPercent));
float bodyAngle = clip.BodyAngle.Evaluate(clipPercent);
bodyAngle += quiver ? UnityEngine.Random.value * 2f - 1f : 0f;
float headAngle = clip.HeadAngle.Evaluate(clipPercent);
int bodyFacing = (int)clip.BodyFacing.Evaluate(clipPercent);

View File

@ -144,7 +144,7 @@ namespace RimWorldAnimationStudio
public void SaveCustomArrays()
{
var path = Path.Combine(Application.streamingAssetsPath, "customTags.xml");
var path = Path.Combine(Application.persistentDataPath, "customTags.xml");
CustomTagsHelper helper = new CustomTagsHelper();
@ -159,8 +159,14 @@ namespace RimWorldAnimationStudio
public void LoadCustomArrays()
{
var path = Path.Combine(Application.streamingAssetsPath, "customTags.xml");
string path;
if (File.Exists(Path.Combine(Application.persistentDataPath, "customTags.xml")))
{ path = Path.Combine(Application.persistentDataPath, "customTags.xml"); }
else
{ path = Path.Combine(Application.streamingAssetsPath, "customTags.xml"); }
if (File.Exists(path) == false)
{ SaveCustomArrays(); return; }
@ -186,7 +192,13 @@ namespace RimWorldAnimationStudio
public void LoadAlienRaceDefs()
{
var path = Path.Combine(Application.streamingAssetsPath, "alienRaceDefs.xml");
string path;
if (File.Exists(Path.Combine(Application.persistentDataPath, "alienRaceDefs.xml")))
{ path = Path.Combine(Application.persistentDataPath, "alienRaceDefs.xml"); }
else
{ path = Path.Combine(Application.streamingAssetsPath, "alienRaceDefs.xml"); }
if (File.Exists(path) == false)
{ SaveAlienRaceDefs(); return; }
@ -197,7 +209,7 @@ namespace RimWorldAnimationStudio
public void SaveAlienRaceDefs()
{
var path = Path.Combine(Application.streamingAssetsPath, "alienRaceDefs.xml");
var path = Path.Combine(Application.persistentDataPath, "alienRaceDefs.xml");
XmlUtility.WriteXML(AlienRaceDefs.allDefs, path);
}

12
Assets/Scripts/SexProp.cs Normal file
View File

@ -0,0 +1,12 @@
using System;
using UnityEngine;
namespace RimWorldAnimationStudio
{
[Serializable]
public class SexProp
{
public string label;
public Sprite sprite;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 94f6b7ad49adabe428c011abfcf4da53
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,28 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace RimWorldAnimationStudio
{
public class SexPropManager : MonoBehaviour
{
public List<SexProp> sexProps = new List<SexProp>();
public Dropdown sexPropDropdown;
private SpriteRenderer spriteRenderer;
public void OnEnable()
{
spriteRenderer = GetComponent<SpriteRenderer>();
foreach (SexProp sexProp in sexProps)
{ sexPropDropdown.options.Add(new Dropdown.OptionData(sexProp.label)); }
}
public void OnOptionChanged()
{
spriteRenderer.sprite = sexProps[sexPropDropdown.value].sprite;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 587f7397b0c3ecf4495edb8af5dbd777
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -109,36 +109,20 @@ namespace RimWorldAnimationStudio
return animationDef.animationStages[stageID].animationClips[actorID].keyframes.Any(x => x.atTick == atTick);
}
public static void FindAdjacentKeyframes(int atTick, out PawnKeyframe prevKeyframe, out PawnKeyframe nextKeyframe, int actorID = -1, int excludedActorID = -1, bool ignoreSelf = true, int searchDistance = int.MaxValue)
public PawnKeyframe GetCurrentOrPreviousKeyframe(int actorID)
{
prevKeyframe = null;
nextKeyframe = null;
PawnKeyframe pawnKeyframe = null;
PawnAnimationClip clip = GetPawnAnimationClip(actorID);
List<PawnKeyframe> keyframesToCheck;
int stageTick = AnimationController.Instance.stageTick;
if (actorID >= 0)
{ keyframesToCheck = animationDef.animationStages[stageID].animationClips[actorID].keyframes; }
else
foreach (PawnKeyframe keyframe in clip.keyframes)
{
keyframesToCheck = animationDef.animationStages[stageID].animationClips.Where(x =>
animationDef.animationStages[stageID].animationClips.IndexOf(x) != excludedActorID).SelectMany(x => x.keyframes)?.ToList();
if (keyframe.atTick <= stageTick)
{ pawnKeyframe = keyframe; }
}
foreach (PawnKeyframe keyframe in keyframesToCheck)
{
if (keyframe.atTick <= atTick && atTick - keyframe.atTick <= searchDistance)
{
if (keyframe.atTick != atTick || ignoreSelf)
{ prevKeyframe = keyframe; }
else
{ prevKeyframe = null; }
}
if (nextKeyframe == null && keyframe.atTick > atTick && keyframe.atTick - atTick <= searchDistance)
{ nextKeyframe = keyframe; }
}
return pawnKeyframe;
}
public static int FindClosestKeyFrameAtTick(int atTick, int searchDistance = int.MaxValue, int excludedActorID = -1)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 876 B

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More