mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
GUI rearrangement
This commit is contained in:
parent
04f8c6a2e4
commit
2e50221118
90 changed files with 435 additions and 1440 deletions
30
Assets/Scripts/Strings/NumberValidator.cs
Normal file
30
Assets/Scripts/Strings/NumberValidator.cs
Normal file
|
@ -0,0 +1,30 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class NumberValidator : MonoBehaviour
|
||||
{
|
||||
public InputField.CharacterValidation valiationType = InputField.CharacterValidation.Decimal;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
InputField inputField = GetComponent<InputField>();
|
||||
|
||||
if (inputField)
|
||||
{
|
||||
inputField.characterValidation = valiationType;
|
||||
|
||||
if (valiationType == InputField.CharacterValidation.Decimal)
|
||||
{ inputField.onEndEdit.AddListener(delegate { MakeDecimal(); }); }
|
||||
}
|
||||
}
|
||||
|
||||
public void MakeDecimal()
|
||||
{
|
||||
InputField inputField = GetComponent<InputField>();
|
||||
|
||||
if (inputField)
|
||||
{ inputField.text = string.Format("{0:0.000}", float.Parse(inputField.text)); }
|
||||
}
|
||||
}
|
11
Assets/Scripts/Strings/NumberValidator.cs.meta
Normal file
11
Assets/Scripts/Strings/NumberValidator.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1f3886223a697384abc8109a51c855e2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue