mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
Standalone exported
This commit is contained in:
parent
1e2c4fa6bf
commit
7e1680a7fb
605 changed files with 2169 additions and 3312 deletions
|
@ -16,6 +16,8 @@ namespace RimWorldAnimationStudio
|
|||
public SpriteRenderer headRenderer;
|
||||
public SpriteRenderer appendageRenderer;
|
||||
|
||||
private Vector3 delta = new Vector3();
|
||||
|
||||
public bool actorBodyPartSelected { get { return GetComponentsInChildren<ActorBodyPart>().Any(x => x.isSelected); } }
|
||||
|
||||
public void Initialize(int actorID)
|
||||
|
@ -51,12 +53,15 @@ namespace RimWorldAnimationStudio
|
|||
if (keyframe == null)
|
||||
{ Debug.LogWarning("Cannot alter actor - no keyframe data available"); return; }
|
||||
|
||||
Vector3 mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
|
||||
Vector3 mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
|
||||
|
||||
if (delta == Vector3.zero)
|
||||
{ delta = mousePosition - transform.position; }
|
||||
|
||||
if (Workspace.actorManipulationMode == ActorManipulationMode.Pan)
|
||||
{
|
||||
keyframe.bodyOffsetX = mousePosition.x - Workspace.animationDef.actors[actorID].GetAlienRaceOffset().x;
|
||||
keyframe.bodyOffsetZ = mousePosition.y - Workspace.animationDef.actors[actorID].GetAlienRaceOffset().z;
|
||||
keyframe.bodyOffsetX = mousePosition.x - delta.x - Workspace.animationDef.actors[actorID].GetAlienRaceOffset().x;
|
||||
keyframe.bodyOffsetZ = mousePosition.y - delta.y - Workspace.animationDef.actors[actorID].GetAlienRaceOffset().z;
|
||||
}
|
||||
|
||||
else if (Workspace.actorManipulationMode == ActorManipulationMode.Rotate)
|
||||
|
@ -81,6 +86,7 @@ namespace RimWorldAnimationStudio
|
|||
public void OnEndDrag(PointerEventData eventData)
|
||||
{
|
||||
Workspace.Instance.RecordEvent("Actor position / orientation");
|
||||
delta = Vector3.zero;
|
||||
}
|
||||
|
||||
public void Activate()
|
||||
|
|
|
@ -13,6 +13,8 @@ namespace RimWorldAnimationStudio
|
|||
public bool isHead = false;
|
||||
public bool isSelected = false;
|
||||
|
||||
private Vector3 delta = new Vector3();
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if ((Workspace.actorID == parent.actorID && Workspace.selectedBodyPart == null) || Workspace.selectedBodyPart == this)
|
||||
|
@ -41,13 +43,16 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
Vector3 mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
|
||||
|
||||
if (delta == Vector3.zero)
|
||||
{ delta = mousePosition - transform.position; }
|
||||
|
||||
if (isHead)
|
||||
{
|
||||
if (Workspace.actorManipulationMode == ActorManipulationMode.Pan)
|
||||
{
|
||||
// It's stupid but it works
|
||||
Vector3 localPosA = transform.localPosition;
|
||||
transform.position = mousePosition;
|
||||
transform.position = mousePosition - delta;
|
||||
Vector3 localPosB = transform.localPosition;
|
||||
transform.localPosition = localPosA;
|
||||
|
||||
|
@ -88,6 +93,7 @@ namespace RimWorldAnimationStudio
|
|||
public void OnEndDrag(PointerEventData eventData)
|
||||
{
|
||||
Workspace.Instance.RecordEvent("Actor position / orientation");
|
||||
delta = Vector3.zero;
|
||||
}
|
||||
|
||||
public void Activate()
|
||||
|
|
|
@ -45,8 +45,8 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
if (type == LogType.Warning)
|
||||
{
|
||||
currentMessage.color = Constants.ColorGoldYellow;
|
||||
logMessage.color = Constants.ColorGoldYellow;
|
||||
currentMessage.color = Constants.ColorOrange;
|
||||
logMessage.color = Constants.ColorOrange;
|
||||
}
|
||||
|
||||
else if (type == LogType.Exception || type == LogType.Error)
|
||||
|
|
|
@ -102,7 +102,7 @@ namespace RimWorldAnimationStudio
|
|||
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; }
|
||||
{ Debug.LogWarning("Selected file was null or invalid"); return; }
|
||||
|
||||
alienRaceDef.SetHeadGraphicPath(paths[0], direction);
|
||||
|
||||
|
@ -114,7 +114,7 @@ namespace RimWorldAnimationStudio
|
|||
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; }
|
||||
{ Debug.LogWarning("Selected file was null or invalid"); return; }
|
||||
|
||||
alienRaceDef.SetBodyTypeGraphicPath(paths[0], direction, bodyType);
|
||||
|
||||
|
|
58
Assets/Scripts/GUI/SelectRaceDropdown.cs
Normal file
58
Assets/Scripts/GUI/SelectRaceDropdown.cs
Normal file
|
@ -0,0 +1,58 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
public class SelectRaceDropdown : MonoBehaviour
|
||||
{
|
||||
private Dropdown dropdown;
|
||||
private Text label;
|
||||
|
||||
private int actorID = -1;
|
||||
private int hashcode = -1;
|
||||
|
||||
public void OnEnable()
|
||||
{
|
||||
dropdown = GetComponent<Dropdown>();
|
||||
label = transform.Find("Label").GetComponent<Text>();
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
||||
if (actorID != Workspace.actorID || hashcode != AlienRaceDefs.allDefs.GetHashCode())
|
||||
{ UpdateDropdown(); }
|
||||
}
|
||||
|
||||
public void UpdateDropdown()
|
||||
{
|
||||
string alienRaceDefName = Workspace.animationDef.actors[Workspace.actorID].GetAlienRaceDef().defName;
|
||||
|
||||
dropdown.ClearOptions();
|
||||
dropdown.options.Add(new Dropdown.OptionData(alienRaceDefName));
|
||||
dropdown.value = 0;
|
||||
label.text = alienRaceDefName;
|
||||
|
||||
List<AlienRaceDef> optionsList = AlienRaceDefs.allDefs;
|
||||
foreach (AlienRaceDef alienRaceDef in optionsList)
|
||||
{
|
||||
if (alienRaceDef.defName != alienRaceDefName)
|
||||
{ dropdown.options.Add(new Dropdown.OptionData(alienRaceDef.defName)); }
|
||||
}
|
||||
|
||||
actorID = Workspace.actorID;
|
||||
hashcode = AlienRaceDefs.allDefs.GetHashCode();
|
||||
}
|
||||
|
||||
public void UpdateActorRace()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
||||
Workspace.animationDef.actors[Workspace.actorID].SetAlienRaceDef(label.text);
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/GUI/SelectRaceDropdown.cs.meta
Normal file
11
Assets/Scripts/GUI/SelectRaceDropdown.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0ba5b69d448f9434ca7d74d4022f3dcd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue