editor input locking fix (#175)

* fix keyboard input locking

* add build date auto-generation script
This commit is contained in:
minenice55 2022-10-13 12:20:48 -04:00 committed by GitHub
parent 695f6671fb
commit b361814c11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 399 additions and 19 deletions

View File

@ -465,6 +465,140 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3236230}
m_CullTransparentMesh: 1
--- !u!1 &3554289
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3554290}
- component: {fileID: 3554292}
- component: {fileID: 3554291}
m_Layer: 5
m_Name: BuildDateLabel
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &3554290
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3554289}
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: 2051557111}
m_RootOrder: 5
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: 0}
m_SizeDelta: {x: 0, y: 23.860992}
m_Pivot: {x: 0.5, y: 0}
--- !u!114 &3554291
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3554289}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: (EDITOR) 00/00/0000 00:00:00
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 4810e200fa0cb24438bac52343d7674b, type: 2}
m_sharedMaterial: {fileID: 2100000, guid: 6d4610587e293f74ca2b71ec1cf59da3, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 12
m_fontSizeBase: 12
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 4
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 10, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!222 &3554292
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3554289}
m_CullTransparentMesh: 1
--- !u!1 &5365812
GameObject:
m_ObjectHideFlags: 0
@ -7037,6 +7171,140 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 232337124}
m_CullTransparentMesh: 1
--- !u!1 &233055005
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 233055006}
- component: {fileID: 233055008}
- component: {fileID: 233055007}
m_Layer: 5
m_Name: BuildDateLabel
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &233055006
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 233055005}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1.0000167, y: 1.0000167, z: 1.0000167}
m_Children: []
m_Father: {fileID: 703340359}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -0.000017166, y: 0.5050001}
m_SizeDelta: {x: 1277, y: 24.01}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &233055007
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 233055005}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: (EDITOR) 00/00/0000 00:00:00
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 4810e200fa0cb24438bac52343d7674b, type: 2}
m_sharedMaterial: {fileID: 2100000, guid: 6d4610587e293f74ca2b71ec1cf59da3, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 2164260863
m_fontColor: {r: 1, g: 1, b: 1, a: 0.5019608}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 12
m_fontSizeBase: 12
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 4
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 10, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!222 &233055008
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 233055005}
m_CullTransparentMesh: 1
--- !u!1 &236484355
GameObject:
m_ObjectHideFlags: 0
@ -17424,7 +17692,7 @@ MonoBehaviour:
m_HandleRect: {fileID: 704039020}
m_Direction: 0
m_Value: 0
m_Size: 0.032871276
m_Size: 0.032871284
m_NumberOfSteps: 0
m_OnValueChanged:
m_PersistentCalls:
@ -20361,6 +20629,7 @@ RectTransform:
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 233055006}
- {fileID: 1196204503}
m_Father: {fileID: 1791483803}
m_RootOrder: 4
@ -25293,8 +25562,8 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 1589389272}
m_HandleRect: {fileID: 1589389271}
m_Direction: 2
m_Value: 0
m_Size: 1
m_Value: 1
m_Size: 0.9999896
m_NumberOfSteps: 0
m_OnValueChanged:
m_PersistentCalls:
@ -32318,7 +32587,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: 0, y: 129.8829}
m_AnchoredPosition: {x: 0, y: 129.8085}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 1}
--- !u!114 &1154875944
@ -33121,7 +33390,7 @@ RectTransform:
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: -49.999878}
m_AnchoredPosition: {x: 0, y: -49.99991}
m_SizeDelta: {x: -48, y: -148}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1182686745
@ -33565,7 +33834,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 703340359}
m_RootOrder: 0
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
@ -39134,6 +39403,7 @@ MonoBehaviour:
eventSelectorBG: {fileID: 110654310}
Timeline: {fileID: 1861169747}
GameEventSelectorTitle: {fileID: 246861490}
BuildDateDisplay: {fileID: 233055007}
NewBTN: {fileID: 1683100750}
OpenBTN: {fileID: 1665554291}
SaveBTN: {fileID: 678553526}
@ -44346,7 +44616,7 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 1292844878}
m_HandleRect: {fileID: 1292844877}
m_Direction: 2
m_Value: 0
m_Value: 1
m_Size: 1
m_NumberOfSteps: 0
m_OnValueChanged:
@ -45761,7 +46031,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 111.50012, y: -29.533966}
m_AnchoredPosition: {x: 111.50012, y: -29.533981}
m_SizeDelta: {x: 223, y: -108.27}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1671351976
@ -51487,6 +51757,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
dialog: {fileID: 1946344930}
BuildDateDisplay: {fileID: 3554291}
--- !u!1 &1946352456
GameObject:
m_ObjectHideFlags: 0
@ -52541,7 +52812,7 @@ RectTransform:
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: -29.529999}
m_AnchoredPosition: {x: 0, y: -29.530014}
m_SizeDelta: {x: 0, y: -108.26}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1980243267
@ -54441,6 +54712,7 @@ RectTransform:
- {fileID: 1507800756}
- {fileID: 830092700}
- {fileID: 1182686744}
- {fileID: 3554290}
m_Father: {fileID: 1946344931}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

88
Assets/Scripts/AppInfo.cs Normal file
View File

@ -0,0 +1,88 @@
using System;
public static class AppInfo {
//--- AutoGenerated.begin
public const string Version = "0.0.961";
public static readonly DateTime Date = new DateTime(2022, 10, 13, 16, 09, 43, 581, DateTimeKind.Utc);
//--- AutoGenerated.end
}
#if UNITY_EDITOR
/// <summary>
/// Increase Build Number Automatically
/// </summary>
public class BuildNumberUpdater : UnityEditor.Build.IPreprocessBuild
{
private static readonly char[] LineDelimiter = {'\n', '\r'};
/// <summary> File name where info is stored </summary>
private const string AppInfoFileName = "AppInfo.cs";
public int callbackOrder {
get { return 0; }
}
void UnityEditor.Build.IPreprocessBuild.OnPreprocessBuild(UnityEditor.BuildTarget target, string path) {
var scriptPath = GetScriptPath(AppInfoFileName);
var version = IncVersion();
var time = DateTime.UtcNow;
string date = "new DateTime(" + time.ToString("yyyy, MM, dd, HH, mm, ss, fff") + ", DateTimeKind.Utc)";
UnityEngine.Debug.LogFormat(
"OnPreprocessBuild. Modify AppInfo in file={0}, set version={1} and current DateTime",
scriptPath, version);
var text = System.IO.File.ReadAllText(scriptPath);
text = ReplaceText(text, " Version = ", "\"" + version + "\";");
text = ReplaceText(text, " Date = ", date + ";");
System.IO.File.WriteAllText(scriptPath, text);
}
private static string ReplaceText(string text, string field, string newValue) {
int v1 = text.IndexOf(field, StringComparison.Ordinal);
int v2 = text.IndexOfAny(LineDelimiter, v1);
if (v1 < 0 || v2 < 0)
throw new Exception("Undefined field=" + field);
return text.Substring(0, v1 + field.Length) + newValue + text.Substring(v2);
}
private static string IncVersion() {
var bundleVersionSplit = UnityEditor.PlayerSettings.bundleVersion.Split('.');
int major = 0;
int minor = 0;
int subVersion = 0;
if (bundleVersionSplit.Length >= 1)
int.TryParse(bundleVersionSplit[0], out major);
if (bundleVersionSplit.Length >= 2)
int.TryParse(bundleVersionSplit[1], out minor);
if (bundleVersionSplit.Length >= 3)
int.TryParse(bundleVersionSplit[2], out subVersion);
++subVersion;
string version = string.Format("{0}.{1}.{2}", major, minor, subVersion);
var bundleVersionCode = (major * 100000) + (minor * 1000) + subVersion;
UnityEditor.PlayerSettings.bundleVersion = version;
UnityEditor.PlayerSettings.Android.bundleVersionCode = bundleVersionCode;
UnityEditor.PlayerSettings.macOS.buildNumber = bundleVersionCode.ToString();
return version;
}
private static string GetScriptPath(string fileName) {
var assets = UnityEditor.AssetDatabase.FindAssets(System.IO.Path.GetFileNameWithoutExtension(fileName));
string scriptPath = null;
foreach (var asset in assets) {
var path = UnityEditor.AssetDatabase.GUIDToAssetPath(asset);
if (path.EndsWith(".cs")) {
scriptPath = path;
break;
}
}
if (string.IsNullOrEmpty(scriptPath))
throw new Exception("No asset file with name '" + AppInfoFileName + "' found");
return scriptPath;
}
}
#endif

View File

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

View File

@ -11,6 +11,8 @@ namespace HeavenStudio
{
public static GlobalGameManager instance { get; set; }
public static string buildTime = "00/00/0000 00:00:00";
public static int loadedScene;
public int lastLoadedScene;
public static float fadeDuration;
@ -61,6 +63,11 @@ namespace HeavenStudio
Starpelly.OS.ChangeWindowTitle("Heaven Studio DEMO");
QualitySettings.maxQueuedFrames = 1;
PlayerInput.InitInputControllers();
#if UNITY_EDITOR
buildTime = "(EDITOR) " + System.DateTime.UtcNow.ToString("dd/MM/yyyy hh:mm:ss");
#else
buildTime = AppInfo.Date.ToString("dd/MM/yyyy hh:mm:ss");
#endif
}
public static GameObject CreateFade()

View File

@ -12,8 +12,8 @@ namespace HeavenStudio.Editor
[SerializeField] protected GameObject dialog;
public void ForceState(bool onoff = false)
{
Editor.instance.canSelect = onoff;
Editor.instance.inAuthorativeMenu = !onoff;
Editor.instance.canSelect = !onoff;
Editor.instance.inAuthorativeMenu = onoff;
dialog.SetActive(onoff);
}

View File

@ -41,6 +41,7 @@ namespace HeavenStudio.Editor
[Header("Components")]
[SerializeField] private Timeline Timeline;
[SerializeField] private TMP_Text GameEventSelectorTitle;
[SerializeField] private TMP_Text BuildDateDisplay;
[Header("Toolbar")]
[SerializeField] private Button NewBTN;
@ -123,6 +124,8 @@ namespace HeavenStudio.Editor
Tooltip.AddTooltip(EditorSettingsBTN.gameObject, "Editor Settings <color=#adadad>[Ctrl+Shift+O]</color>");
UpdateEditorStatus(true);
BuildDateDisplay.text = GlobalGameManager.buildTime;
}
public void LateUpdate()

View File

@ -1,14 +1,11 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using HeavenStudio.Editor.Track;
using TMPro;
namespace HeavenStudio.Editor
{
public class SettingsDialog : Dialog
{
[SerializeField] private TMP_Text BuildDateDisplay;
private void Start() {}
public void SwitchSettingsDialog()
@ -22,6 +19,8 @@ namespace HeavenStudio.Editor
Editor.instance.canSelect = false;
Editor.instance.inAuthorativeMenu = true;
dialog.SetActive(true);
BuildDateDisplay.text = GlobalGameManager.buildTime;
}
}

View File

@ -8,7 +8,7 @@ EditorBuildSettings:
- enabled: 1
path: Assets/Scenes/Editor.unity
guid: 0791ed85a2c8d7140b5c0928073fa113
- enabled: 1
- enabled: 0
path: Assets/Scenes/Game.unity
guid: 2cda990e2423bbf4892e6590ba056729
m_configObjects: {}

View File

@ -134,7 +134,7 @@ PlayerSettings:
16:10: 1
16:9: 1
Others: 1
bundleVersion: 1.0
bundleVersion: 0.0.961
preloadedAssets: []
metroInputSource: 0
wsaTransparentSwapchain: 0
@ -155,11 +155,11 @@ PlayerSettings:
applicationIdentifier:
Standalone: com.Megaminerzero.HeavenStudio
buildNumber:
Standalone: 0
Standalone: 961
iPhone: 0
tvOS: 0
overrideDefaultApplicationIdentifier: 0
AndroidBundleVersionCode: 1
AndroidBundleVersionCode: 961
AndroidMinSdkVersion: 19
AndroidTargetSdkVersion: 0
AndroidPreferredInstallLocation: 1