From 439eb16d3b365b7d04ad2b41b53665edf544755e Mon Sep 17 00:00:00 2001 From: "j.mei7" Date: Sat, 19 Feb 2022 00:14:39 +0100 Subject: [PATCH] open calendar with "c" --- Assets/New Material.mat | 56 -- Assets/Scenes/SampleScene.unity | 30 +- .../Calendar.meta} | 6 +- Assets/Scripts/Calendar/Calendar.cs | 61 ++ Assets/Scripts/Calendar/Calendar.cs.meta | 11 + Assets/Scripts/PlayerController.cs | 7 + Assets/Scripts/TimeManager.cs | 6 +- Assets/Sprites/calendarDays.meta | 8 + Assets/Sprites/calendarDays/calendarDays.png | Bin 0 -> 889 bytes .../calendarDays/calendarDays.png.meta | 816 ++++++++++++++++++ Assets/Sprites/januar.png | Bin 0 -> 200 bytes Assets/Sprites/januar.png.meta | 134 +++ Assets/Sprites/year.png | Bin 0 -> 170 bytes Assets/Sprites/year.png.meta | 134 +++ .../Layouts/CurrentMaximizeLayout.dwlt | 90 +- 15 files changed, 1236 insertions(+), 123 deletions(-) delete mode 100644 Assets/New Material.mat rename Assets/{New Material.mat.meta => Scripts/Calendar.meta} (52%) create mode 100644 Assets/Scripts/Calendar/Calendar.cs create mode 100644 Assets/Scripts/Calendar/Calendar.cs.meta create mode 100644 Assets/Sprites/calendarDays.meta create mode 100644 Assets/Sprites/calendarDays/calendarDays.png create mode 100644 Assets/Sprites/calendarDays/calendarDays.png.meta create mode 100644 Assets/Sprites/januar.png create mode 100644 Assets/Sprites/januar.png.meta create mode 100644 Assets/Sprites/year.png create mode 100644 Assets/Sprites/year.png.meta diff --git a/Assets/New Material.mat b/Assets/New Material.mat deleted file mode 100644 index b4d89ca..0000000 --- a/Assets/New Material.mat +++ /dev/null @@ -1,56 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!21 &2100000 -Material: - serializedVersion: 6 - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_Name: New Material - m_Shader: {fileID: 4800000, guid: 13c02b14c4d048fa9653293d54f6e0e1, type: 3} - m_ShaderKeywords: - m_LightmapFlags: 4 - m_EnableInstancingVariants: 0 - m_DoubleSidedGI: 0 - m_CustomRenderQueue: -1 - stringTagMap: {} - disabledShaderPasses: [] - m_SavedProperties: - serializedVersion: 3 - m_TexEnvs: - - _AlphaTex: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _MainTex: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _MaskTex: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _NormalMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - m_Ints: [] - m_Floats: - - PixelSnap: 0 - - _ColorMask: 15 - - _CullMode: 0 - - _Cutoff: 0 - - _EnableExternalAlpha: 0 - - _Stencil: 0 - - _StencilComp: 8 - - _StencilOp: 0 - - _StencilReadMask: 255 - - _StencilWriteMask: 255 - - _UseUIAlphaClip: 0 - m_Colors: - - _ClipRect: {r: -32767, g: -32767, b: 32767, a: 32767} - - _Color: {r: 1, g: 1, b: 1, a: 1} - - _Flip: {r: 1, g: 1, b: 1, a: 1} - - _RendererColor: {r: 1, g: 1, b: 1, a: 1} - m_BuildTextureStacks: [] diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 989b6bd..f52db2e 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -168,7 +168,7 @@ Transform: - {fileID: 1759039339} - {fileID: 1938035018} m_Father: {fileID: 0} - m_RootOrder: 11 + m_RootOrder: 12 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &87507992 GameObject: @@ -448,7 +448,9 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 4d46ba76ed78c6c41805320f865295d6, type: 3} m_Name: m_EditorClassIdentifier: + partOfDay: 0 intervalTime: 1 + minutesPerInterval: 1 --- !u!4 &273326178 Transform: m_ObjectHideFlags: 0 @@ -587,7 +589,7 @@ Transform: m_Children: - {fileID: 519420032} m_Father: {fileID: 0} - m_RootOrder: 10 + m_RootOrder: 11 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!95 &310196955 Animator: @@ -1018,7 +1020,7 @@ PrefabInstance: m_Modifications: - target: {fileID: 1909482199139559713, guid: a51034cd9a84299479d24128aec330e6, type: 3} propertyPath: m_RootOrder - value: 8 + value: 9 objectReference: {fileID: 0} - target: {fileID: 1909482199139559713, guid: a51034cd9a84299479d24128aec330e6, type: 3} propertyPath: m_LocalPosition.x @@ -1160,7 +1162,7 @@ RectTransform: m_Children: - {fileID: 87507993} m_Father: {fileID: 0} - m_RootOrder: 15 + m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -1436,7 +1438,7 @@ PrefabInstance: m_Modifications: - target: {fileID: 5128193789106105257, guid: 4ca350a347d8520448f562297fbf46d4, type: 3} propertyPath: m_RootOrder - value: 2 + value: 3 objectReference: {fileID: 0} - target: {fileID: 5128193789106105257, guid: 4ca350a347d8520448f562297fbf46d4, type: 3} propertyPath: m_LocalPosition.x @@ -4406,7 +4408,7 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 13 + m_RootOrder: 14 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &1335747190 MonoBehaviour: @@ -4694,7 +4696,7 @@ PrefabInstance: m_Modifications: - target: {fileID: 1909482199139559713, guid: a51034cd9a84299479d24128aec330e6, type: 3} propertyPath: m_RootOrder - value: 6 + value: 7 objectReference: {fileID: 0} - target: {fileID: 1909482199139559713, guid: a51034cd9a84299479d24128aec330e6, type: 3} propertyPath: m_LocalPosition.x @@ -14930,7 +14932,7 @@ PrefabInstance: m_Modifications: - target: {fileID: 5128193789106105257, guid: 4ca350a347d8520448f562297fbf46d4, type: 3} propertyPath: m_RootOrder - value: 3 + value: 4 objectReference: {fileID: 0} - target: {fileID: 5128193789106105257, guid: 4ca350a347d8520448f562297fbf46d4, type: 3} propertyPath: m_LocalPosition.x @@ -27865,7 +27867,7 @@ PrefabInstance: m_Modifications: - target: {fileID: 1909482199139559713, guid: a51034cd9a84299479d24128aec330e6, type: 3} propertyPath: m_RootOrder - value: 7 + value: 8 objectReference: {fileID: 0} - target: {fileID: 1909482199139559713, guid: a51034cd9a84299479d24128aec330e6, type: 3} propertyPath: m_LocalPosition.x @@ -28079,7 +28081,7 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 12 + m_RootOrder: 13 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &2032016596 PrefabInstance: @@ -28090,7 +28092,7 @@ PrefabInstance: m_Modifications: - target: {fileID: 1909482199139559713, guid: a51034cd9a84299479d24128aec330e6, type: 3} propertyPath: m_RootOrder - value: 5 + value: 6 objectReference: {fileID: 0} - target: {fileID: 1909482199139559713, guid: a51034cd9a84299479d24128aec330e6, type: 3} propertyPath: m_LocalPosition.x @@ -28277,7 +28279,7 @@ PrefabInstance: m_Modifications: - target: {fileID: 5128193789106105257, guid: 4ca350a347d8520448f562297fbf46d4, type: 3} propertyPath: m_RootOrder - value: 4 + value: 5 objectReference: {fileID: 0} - target: {fileID: 5128193789106105257, guid: 4ca350a347d8520448f562297fbf46d4, type: 3} propertyPath: m_LocalPosition.x @@ -28334,7 +28336,7 @@ PrefabInstance: m_Modifications: - target: {fileID: 1909482199139559713, guid: a51034cd9a84299479d24128aec330e6, type: 3} propertyPath: m_RootOrder - value: 9 + value: 10 objectReference: {fileID: 0} - target: {fileID: 1909482199139559713, guid: a51034cd9a84299479d24128aec330e6, type: 3} propertyPath: m_LocalPosition.x @@ -28391,7 +28393,7 @@ PrefabInstance: m_Modifications: - target: {fileID: 5128193789106105257, guid: 4ca350a347d8520448f562297fbf46d4, type: 3} propertyPath: m_RootOrder - value: 14 + value: 15 objectReference: {fileID: 0} - target: {fileID: 5128193789106105257, guid: 4ca350a347d8520448f562297fbf46d4, type: 3} propertyPath: m_LocalPosition.x diff --git a/Assets/New Material.mat.meta b/Assets/Scripts/Calendar.meta similarity index 52% rename from Assets/New Material.mat.meta rename to Assets/Scripts/Calendar.meta index f972aff..4b5a48d 100644 --- a/Assets/New Material.mat.meta +++ b/Assets/Scripts/Calendar.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: 2d07dbbd5e1d537489f099a8a9ecaa09 -NativeFormatImporter: +guid: 419a6c97c6863fe4bba52001e71d1df1 +folderAsset: yes +DefaultImporter: externalObjects: {} - mainObjectFileID: 2100000 userData: assetBundleName: assetBundleVariant: diff --git a/Assets/Scripts/Calendar/Calendar.cs b/Assets/Scripts/Calendar/Calendar.cs new file mode 100644 index 0000000..23de0a8 --- /dev/null +++ b/Assets/Scripts/Calendar/Calendar.cs @@ -0,0 +1,61 @@ +using System; +using UnityEngine; +using UnityEngine.UI; + +public class Calendar : MonoBehaviour +{ + TimeManager timeManager; + Image prevImage; + Transform daysTransform; + + [SerializeField] + Color currentDayColor; + Color originDayColor; + private void Start() + { + daysTransform = transform.Find("Days"); + timeManager = GameObject.Find("GameManager").GetComponent(); + originDayColor = daysTransform.Find("1").gameObject.GetComponent().color; + } + + void Update() + { + if(gameObject.activeSelf) + RefreshCalendar(); + } + + void RefreshCalendar() + { + DateTime dateTime = timeManager.GetDateTime(); + + int counter; + + int daysInMonth = DateTime.DaysInMonth(dateTime.Year, dateTime.Month); + + counter = 1; + while (counter <= 31) + { + if (counter >= daysInMonth + 1) + { + daysTransform.Find(counter.ToString()).gameObject.SetActive(false); + } + else + { + daysTransform.Find(counter.ToString()).gameObject.SetActive(true); + } + + counter++; + } + + + + if (prevImage != daysTransform.Find(dateTime.Day.ToString()).gameObject.GetComponent()) + { + if (prevImage != null) + prevImage.color = originDayColor; + + daysTransform.Find(dateTime.Day.ToString()).gameObject.GetComponent().color = currentDayColor; + prevImage = daysTransform.Find(dateTime.Day.ToString()).gameObject.GetComponent(); + } + } +} diff --git a/Assets/Scripts/Calendar/Calendar.cs.meta b/Assets/Scripts/Calendar/Calendar.cs.meta new file mode 100644 index 0000000..063a5b2 --- /dev/null +++ b/Assets/Scripts/Calendar/Calendar.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 96c62da3e09569940847187705433290 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/PlayerController.cs b/Assets/Scripts/PlayerController.cs index 75ed5c7..bc81ede 100644 --- a/Assets/Scripts/PlayerController.cs +++ b/Assets/Scripts/PlayerController.cs @@ -5,7 +5,14 @@ using UnityEngine; // Handles the player input, such as interactions public class PlayerController : MonoBehaviour { + [SerializeField] + GameObject calendar; + void Update() { + if (Input.GetButtonDown("Calendar") && calendar != null) + { + calendar.SetActive(!calendar.activeSelf); + } } } diff --git a/Assets/Scripts/TimeManager.cs b/Assets/Scripts/TimeManager.cs index 5519103..304f686 100644 --- a/Assets/Scripts/TimeManager.cs +++ b/Assets/Scripts/TimeManager.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using UnityEngine; public class TimeManager : MonoBehaviour @@ -34,13 +35,10 @@ public class TimeManager : MonoBehaviour { dateTime = dateTime.AddMinutes(minutesPerInterval); CheckPartsOfDay(); - Debug.Log(GetTime()); } void CheckPartsOfDay() { - Debug.Log(dateTime.Hour); - if (dateTime.Hour >= 22) partOfDay = PartOfDay.NIGHT; else if(dateTime.Hour < 6) @@ -52,6 +50,4 @@ public class TimeManager : MonoBehaviour else if (dateTime.Hour >= 17 && dateTime.Hour < 22) partOfDay = PartOfDay.EVENING; } - - // For Plant growth maybe add a List where those plants can register themselves and every "TimeUp()" they get checked by the TimeManager } diff --git a/Assets/Sprites/calendarDays.meta b/Assets/Sprites/calendarDays.meta new file mode 100644 index 0000000..23096ba --- /dev/null +++ b/Assets/Sprites/calendarDays.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ac20b9a714900974cbe082a15ee390f4 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Sprites/calendarDays/calendarDays.png b/Assets/Sprites/calendarDays/calendarDays.png new file mode 100644 index 0000000000000000000000000000000000000000..a7d2c805c8b7a0ce221de5ae818abe02e6362275 GIT binary patch literal 889 zcmeAS@N?(olHy`uVBq!ia0vp^1wb6Y!3HD``h2VfQjEnx?oJHr&dI!FU|=@(ba4!+ znDch7uis$A-{tp%i;S203|an~=XWh_iTHZ{_u+(<3ZKn%QZE=y zpT(W2Gk=rM1IugGH$v_&;=lGUyD~ysU}wMCN4@ZbHx7T+)HYqt*t_A&!KgajKVA#W zc7*@@!cfW+W$UeB;iG_p9zTBPySM0L?N6x{`K#rle@9-q{bjpQm7VPRX{9c!?Y1Rm z=GW~DlTY4$<$V8BiN~JPjz;7=hhCl+{>kaW&&l(uIAd*&M1+5MUX@vW@8k6=_x~K2 zRyXIn)uN}p4IL?Vd%jNkS)#e{vR}meX4{4*`DKAlopRHKq?*oavre4$FN)>peVHF| z8r$ZnipZ!5prBuk52}FpSG=mp({#^kW_$nax%P4CubBAk+dIs!Y1tc;E=v9B@mh0P zlDC?nX#C^jo?kV!y)U_)<614b`}Ds9YhO=au+9JE-^NQvpQ!%Xa-;34fAp>X+26LB z#r5vnHuudt6@UBexB1_1{YyK|b>Z#%19GRM`c>9Dte$`M*7@v*`RAVd++u$_=Q2Ob z_3~&ZPg%5Z`@($iD+q7jEBG-Xi+95oqYYE`mDz3<*?*;d($rMh|C2uc-yvAIN#*v| zX&0WKoBAUAw&u@Dsl7)oZ~4(#)4}+>UwOTzqW6oX^X}NzcK`G5k3Jr+vv8%tB%w*x z;YIw~FQboNf03%;{ui5?jv;P?I*Zz@?-*|rVSLU_9Z(qA5zrA!YEai%J(f`SRjE z;{(lf7G{REz89u#+jjV8#k|$)dUpK!y8i&5uvE^qWZ{E}K-VyMy85}Sb4q9e01<&v A00000 literal 0 HcmV?d00001 diff --git a/Assets/Sprites/januar.png.meta b/Assets/Sprites/januar.png.meta new file mode 100644 index 0000000..0ebbec1 --- /dev/null +++ b/Assets/Sprites/januar.png.meta @@ -0,0 +1,134 @@ +fileFormatVersion: 2 +guid: 73b522f0dee7b2c4b9808cdf64873660 +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 + vTOnly: 0 + ignoreMasterTextureLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 0 + aniso: 1 + mipBias: 0 + 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: 16 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 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: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Server + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Windows Store Apps + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + 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: [] + nameFileIdTable: {} + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Sprites/year.png b/Assets/Sprites/year.png new file mode 100644 index 0000000000000000000000000000000000000000..a98745914b1f06f0cc89c972d8dcd92eda3e0935 GIT binary patch literal 170 zcmeAS@N?(olHy`uVBq!ia0vp^3P8-k!3HE}wEkTWq!^2X+?^QKos)S9ukK~Na0FX_MRIo6HQ|*%0JmF1HsBiJFYBZR-5A|?Xe&~<5+|44-diP zOT}apc&Ggb0&@eS_S3O8^<622F