GUI update

This commit is contained in:
AbstractConcept 2022-10-20 21:35:10 -05:00
parent 2e50221118
commit d9e6288e3a
172 changed files with 563 additions and 116 deletions

View file

@ -0,0 +1,200 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &4519153595037294460
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5865042972203952037}
- component: {fileID: 4773754530765333552}
- component: {fileID: 8949439805660757818}
m_Layer: 0
m_Name: Tick
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &5865042972203952037
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4519153595037294460}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 6475516625516223088}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: 0, y: 5}
m_SizeDelta: {x: 2, y: 32}
m_Pivot: {x: 0.5, y: 0}
--- !u!222 &4773754530765333552
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4519153595037294460}
m_CullTransparentMesh: 0
--- !u!114 &8949439805660757818
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4519153595037294460}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.9056604, g: 0.9056604, b: 0.9056604, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &5439485647102441628
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7227308177506853860}
- component: {fileID: 4618099823212146798}
- component: {fileID: 5433021296761974750}
m_Layer: 0
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &7227308177506853860
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5439485647102441628}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 6475516625516223088}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: -1.5, y: 0}
m_SizeDelta: {x: -3, y: 20}
m_Pivot: {x: 0.5, y: 0}
--- !u!222 &4618099823212146798
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5439485647102441628}
m_CullTransparentMesh: 0
--- !u!114 &5433021296761974750
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5439485647102441628}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 5
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: 999
--- !u!1 &5891687054347736455
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6475516625516223088}
- component: {fileID: 2585039022071695514}
m_Layer: 0
m_Name: LinearScaleTick
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &6475516625516223088
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5891687054347736455}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 7227308177506853860}
- {fileID: 5865042972203952037}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 50, y: 40}
m_Pivot: {x: 1, y: 0}
--- !u!222 &2585039022071695514
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5891687054347736455}
m_CullTransparentMesh: 0

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 229f16c49d39ed446bf8c22c8065cd8a
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -10658,7 +10658,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 63, y: -23.5}
m_SizeDelta: {x: 4, y: -63}
m_SizeDelta: {x: 6, y: -63}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &591894606
MonoBehaviour:
@ -12628,8 +12628,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 537.5, y: -52.5}
m_SizeDelta: {x: 1055, y: 15}
m_AnchoredPosition: {x: 537.5, y: -55}
m_SizeDelta: {x: 1055, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &719308825
GameObject:
@ -17716,6 +17716,42 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1018392366}
m_CullTransparentMesh: 0
--- !u!1 &1021107889
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1021107890}
m_Layer: 0
m_Name: LinearScalePanel
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1021107890
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1021107889}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1673215398}
m_Father: {fileID: 1100016168}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 537.5, y: -75}
m_SizeDelta: {x: 1055, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &1029409988
GameObject:
m_ObjectHideFlags: 0
@ -18522,13 +18558,14 @@ RectTransform:
- {fileID: 591894605}
- {fileID: 539052777}
- {fileID: 714321235}
- {fileID: 1021107890}
m_Father: {fileID: 531246357}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: 0, y: 40}
m_SizeDelta: {x: 0, y: 65}
m_SizeDelta: {x: 0, y: 90}
m_Pivot: {x: 0, y: 0}
--- !u!114 &1100016169
MonoBehaviour:
@ -25739,6 +25776,84 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
valiationType: 1
--- !u!1 &1469866143
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1469866144}
- component: {fileID: 1469866145}
- component: {fileID: 1469866146}
m_Layer: 0
m_Name: LinearScale
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1469866144
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1469866143}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1673215398}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!114 &1469866145
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1469866143}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Padding:
m_Left: 0
m_Right: 0
m_Top: 0
m_Bottom: 0
m_ChildAlignment: 0
m_Spacing: 0
m_ChildForceExpandWidth: 1
m_ChildForceExpandHeight: 0
m_ChildControlWidth: 1
m_ChildControlHeight: 0
m_ChildScaleWidth: 0
m_ChildScaleHeight: 0
--- !u!114 &1469866146
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1469866143}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4264bb913f7501844bf60529d6b59b8a, type: 3}
m_Name:
m_EditorClassIdentifier:
targetDivisions: 30
divisionBands: 0100000002000000050000000a000000190000003200000064000000fa000000f4010000e8030000
linearScaleTickPrefab: {fileID: 5891687054347736455, guid: 229f16c49d39ed446bf8c22c8065cd8a,
type: 3}
--- !u!1 &1469930348
GameObject:
m_ObjectHideFlags: 0
@ -28812,6 +28927,42 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1671366298}
m_CullTransparentMesh: 0
--- !u!1 &1673215397
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1673215398}
m_Layer: 0
m_Name: LinearScaleParent
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1673215398
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1673215397}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1469866144}
m_Father: {fileID: 1021107890}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 22.5, y: 10}
m_SizeDelta: {x: -61, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &1676585153
GameObject:
m_ObjectHideFlags: 0

View file

@ -0,0 +1,72 @@
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 LinearScale : Singleton<LinearScale>
{
public int targetDivisions = 30;
public List<int> divisionBands = new List<int>() { 5, 10, 25, 50, 100, 250, 500, 1000 };
public GameObject linearScaleTickPrefab;
private List<int> divisions = new List<int>();
private float minDiff = -1f;
private RectTransform rect;
private int lastStageWindowSize = -1;
public void Start()
{
rect = GetComponent<RectTransform>();
}
public void Update()
{
if (lastStageWindowSize != Workspace.StageWindowSize)
{
UpdateLinearScale();
lastStageWindowSize = Workspace.StageWindowSize;
}
}
public void UpdateLinearScale()
{
if (Workspace.animationDef == null) return;
minDiff = -1f;
foreach (int division in divisionBands)
{
float numDivisions = (float)Workspace.StageWindowSize / division;
if (minDiff >= 0f && Mathf.Abs(targetDivisions - numDivisions) > minDiff) continue;
minDiff = Mathf.Abs(targetDivisions - numDivisions);
int i = 0;
divisions.Clear();
while (i + division <= Workspace.StageWindowSize)
{
i += division;
divisions.Add(i);
}
}
foreach (Transform child in transform)
{ Destroy(child.gameObject); }
foreach (int division in divisions)
{
GameObject obj = Instantiate(linearScaleTickPrefab, transform);
obj.GetComponentInChildren<Text>().text = division.ToString();
float xOffset = ((float)(division - 1) / (Workspace.StageWindowSize - 1)) * transform.parent.GetComponent<RectTransform>().rect.width;
obj.GetComponent<RectTransform>().localPosition = new Vector3(xOffset, 0, 0);
}
}
}
}

View file

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

View file

@ -15,7 +15,7 @@ namespace RimWorldAnimationStudio
public static int defaultAnimationClipLength = 600;
public static int minTick = 1;
public static int minAnimationClipLength = 2;
public static int minAnimationClipLength = 5;
public static int maxAnimationClipLength = 9999;
public static Color ColorWhite = new Color(1f, 1f, 1f);