ui Changes

This commit is contained in:
2024-09-29 23:33:11 +03:00
parent 8678db83f5
commit 1aa9048c40
22 changed files with 156 additions and 82 deletions
+2 -2
View File
@@ -2644,7 +2644,7 @@ PrefabInstance:
- target: {fileID: 1626998783868662017, guid: 5a6b5585f9fba3340a6f0d4893b46d48,
type: 3}
propertyPath: m_LocalPosition.z
value: -1.245
value: -1.331
objectReference: {fileID: 0}
- target: {fileID: 1626998783868662017, guid: 5a6b5585f9fba3340a6f0d4893b46d48,
type: 3}
@@ -3696,7 +3696,7 @@ PrefabInstance:
- target: {fileID: 168138393772344589, guid: 910e671451e1bf94e9bba00c3809c94a,
type: 3}
propertyPath: m_LocalPosition.x
value: 1.376
value: 0.919
objectReference: {fileID: 0}
- target: {fileID: 168138393772344589, guid: 910e671451e1bf94e9bba00c3809c94a,
type: 3}
+6
View File
@@ -16104,6 +16104,12 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 5411692448278503736}
m_Modifications:
- target: {fileID: 551020291880888998, guid: 1a6eb89c878bfd64babad29d36df197b,
type: 3}
propertyPath: BuildingInfo
value:
objectReference: {fileID: 11400000, guid: 9decf03291be4634888cf5440dd0b485,
type: 2}
- target: {fileID: 551020291880888998, guid: 1a6eb89c878bfd64babad29d36df197b,
type: 3}
propertyPath: _spawnPointInSceneName
+4 -4
View File
@@ -37,7 +37,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 250, y: 50}
m_SizeDelta: {x: 150, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7523537103864575754
CanvasRenderer:
@@ -76,7 +76,7 @@ MonoBehaviour:
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
m_PixelsPerUnitMultiplier: 0.4
--- !u!114 &8504314472782682815
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -225,8 +225,8 @@ MonoBehaviour:
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 40
m_fontSizeBase: 40
m_fontSize: 20
m_fontSizeBase: 20
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
+1 -1
View File
@@ -36,7 +36,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 25.22, y: -18.965}
m_SizeDelta: {x: 0, y: 0}
m_SizeDelta: {x: 40.44, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3806516703089782043
CanvasRenderer:
+4 -54
View File
@@ -1451,7 +1451,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 364890571}
serializedVersion: 2
m_LocalRotation: {x: 0.3826835, y: 0.000000022481233, z: -0.000000009312033, w: 0.92387956}
m_LocalRotation: {x: 0.3826835, y: 0.000000022481231, z: -0.000000009312033, w: 0.9238795}
m_LocalPosition: {x: 29.11, y: 5, z: -5}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@@ -2223,7 +2223,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 663697246}
serializedVersion: 2
m_LocalRotation: {x: 0.3826835, y: 0.000000022481233, z: -0.000000009312033, w: 0.92387956}
m_LocalRotation: {x: 0.3826835, y: 0.000000022481231, z: -0.000000009312033, w: 0.9238795}
m_LocalPosition: {x: 29.11, y: 5, z: -5}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@@ -2706,55 +2706,6 @@ BoxCollider:
serializedVersion: 3
m_Size: {x: 0.089999996, y: 0.089999996, z: 0.0016000008}
m_Center: {x: 0.00000023841858, y: 0, z: 0.0008000004}
--- !u!1 &856744744
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 856744746}
- component: {fileID: 856744745}
m_Layer: 5
m_Name: UIDocument
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &856744745
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 856744744}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 19102, guid: 0000000000000000e000000000000000, type: 0}
m_Name:
m_EditorClassIdentifier:
m_PanelSettings: {fileID: 11400000, guid: 91d76c20b085bbf4d8cd8ec60bb56af3, type: 2}
m_ParentUI: {fileID: 0}
sourceAsset: {fileID: 9197481963319205126, guid: f56df0e5e8c60e241a519804b41d2e2d,
type: 3}
m_SortingOrder: 0
--- !u!4 &856744746
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 856744744}
serializedVersion: 2
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &861905856 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 919132149155446097, guid: 06629d5387e888e408bfe1c0a360997a,
@@ -5594,7 +5545,7 @@ RectTransform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4333559282153253760}
m_LocalRotation: {x: 0, y: -0.7071068, z: 0, w: 0.7071068}
m_LocalPosition: {x: 0, y: 0, z: 0.19}
m_LocalPosition: {x: 0, y: 0, z: -0.15}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@@ -5616,7 +5567,7 @@ GameObject:
- component: {fileID: 1595984949156300432}
- component: {fileID: 4333559282153253761}
m_Layer: 0
m_Name: InteractPoint
m_Name: Interactable
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@@ -5684,4 +5635,3 @@ SceneRoots:
- {fileID: 276784286}
- {fileID: 100471662}
- {fileID: 913350237}
- {fileID: 856744746}
+16 -3
View File
@@ -490,7 +490,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 580921796}
serializedVersion: 2
m_LocalRotation: {x: 0.3826835, y: 0.000000022481233, z: -0.000000009312033, w: 0.92387956}
m_LocalRotation: {x: 0.3826835, y: 0.000000022481231, z: -0.000000009312033, w: 0.9238795}
m_LocalPosition: {x: 29.11, y: 5, z: -5}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@@ -808,8 +808,9 @@ GameObject:
m_Component:
- component: {fileID: 715788843}
- component: {fileID: 715788844}
- component: {fileID: 715788845}
m_Layer: 5
m_Name: UIDocument
m_Name: InGameHud
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@@ -847,6 +848,18 @@ MonoBehaviour:
sourceAsset: {fileID: 9197481963319205126, guid: f56df0e5e8c60e241a519804b41d2e2d,
type: 3}
m_SortingOrder: 0
--- !u!114 &715788845
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 715788842}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b12a25de2b34933489e52900d32221dd, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &856666918
GameObject:
m_ObjectHideFlags: 0
@@ -1852,7 +1865,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1758781746}
serializedVersion: 2
m_LocalRotation: {x: 0.3826835, y: 0.000000022481233, z: -0.000000009312033, w: 0.92387956}
m_LocalRotation: {x: 0.3826835, y: 0.000000022481231, z: -0.000000009312033, w: 0.9238795}
m_LocalPosition: {x: 29.11, y: 5, z: -5}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
+1 -1
View File
@@ -12,7 +12,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 5fd44e1aaa501ac4c8f210861aa1b08c, type: 3}
m_Name: Mini market
m_EditorClassIdentifier:
BuidingName: Mini market
BuidingName: MiniMarket
Address: Mini market
SpawnPointInSceneName: Door
Prefab: {fileID: 785642118100129014, guid: 20b968bb62f7c9d49a2a731d06ca7224, type: 3}
+12 -6
View File
@@ -10,20 +10,21 @@ public class BuildingManager : MonoBehaviour
public void BuildingInteract(IndoorSO indoor)
{
IsOpen = CheckIsOpen(indoor.OpenHoursFrom, indoor.OpenHoursTo);
if (!IsInside)
{
EnterBuilding(indoor);
}
else
{
ExitBuilding();
ExitBuilding(indoor);
}
}
private void EnterBuilding(IndoorSO indoor)
{
if(IsOpen)
IsOpen = CheckIsOpen(indoor?.OpenHoursFrom, indoor?.OpenHoursTo);
if (IsOpen)
{
Indoor = indoor;
IsInside = true;
@@ -31,14 +32,19 @@ public class BuildingManager : MonoBehaviour
}
}
public void ExitBuilding()
public void ExitBuilding(IndoorSO indoor)
{
GameManager.Instance.Scene.Change("city");
IsInside = false;
GameManager.Instance.Scene.Change("city",indoor.BuidingName);
}
private bool CheckIsOpen(int from, int to)
private bool CheckIsOpen(int? from, int? to)
{
if (from.HasValue && to.HasValue)
{
return GameManager.Instance.Time.CurrentTime.Hours >= from
&& GameManager.Instance.Time.CurrentTime.Hours <= to;
}
return true;
}
}
+1 -2
View File
@@ -145,8 +145,7 @@ public class CameraSystem : MonoBehaviour
private void HandleCameraMovement(Vector2 inputDir)
{
Vector3 moveDir = transform.forward * -inputDir.y + transform.right * -inputDir.x;
Vector3 moveDir = transform.forward * inputDir.y + transform.right * inputDir.x;
transform.position += moveDir * _moveSpeed * Time.deltaTime;
}
@@ -51,7 +51,8 @@ public class InGameMouseHandler : UnityEngine.Object
public void Update()
{
if (Mouse.current.leftButton.wasPressedThisFrame)
if (GameManager.Instance.Input.PlayerAction.PointClick.WasPressedThisFrame())
{
ClickToMove(!EventSystem.current.IsPointerOverGameObject());
}
@@ -49,6 +49,17 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
""action"": ""PointClick"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""25a11c76-9acb-4544-bf8f-121962b3bf0b"",
""path"": ""<Gamepad>/buttonSouth"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""PointClick"",
""isComposite"": false,
""isPartOfComposite"": false
}
]
},
@@ -26,6 +26,17 @@
"action": "PointClick",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "25a11c76-9acb-4544-bf8f-121962b3bf0b",
"path": "<Gamepad>/buttonSouth",
"interactions": "",
"processors": "",
"groups": "",
"action": "PointClick",
"isComposite": false,
"isPartOfComposite": false
}
]
},
+2 -1
View File
@@ -9,8 +9,9 @@ public class SceneManager
UnityEngine.SceneManagement.SceneManager.sceneLoaded += SceneManager_sceneLoaded;
}
public void Change(string sceneName)
public void Change(string sceneName,string spawnName= "DefaultStartPoint")
{
_spawnLocationName = spawnName;
UnityEngine.SceneManagement.SceneManager.LoadScene(sceneName);
}
+1 -1
View File
@@ -30,7 +30,7 @@ public class RadialMenuItem : MonoBehaviour
float posX = Mathf.Sin(theta);
float posY = Mathf.Cos(theta);
button.transform.localPosition = new Vector3(posX, posY, 0) * 150f;
button.transform.localPosition = new Vector3(posX, posY, 0) * 50f;
var textMeshPro = button.GetComponentInChildren<TextMeshProUGUI>();
if (textMeshPro != null)
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c347a40ca3c44cf4da082942f26de978
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+50
View File
@@ -0,0 +1,50 @@
using Assets.Scripts.Interfaces;
using UnityEngine;
using UnityEngine.UIElements;
public class TopPanel : MonoBehaviour
{
private Label _timeLabel;
private Label _moneyLabel;
private Label _locationLabel;
private VisualElement _energy;
private VisualElement _food;
void Start()
{
GameManager.Instance.Time.OnMinuteChanged -= UpdateTime;
GameManager.Instance.Time.OnMinuteChanged += UpdateTime;
var root = GetComponent<UIDocument>().rootVisualElement;
_timeLabel = root.Q<Label>("TimeLabel");
_locationLabel= root.Q<Label>("LocationLabel");
_moneyLabel = root.Q<Label>("MoneyLabel");
_energy = root.Q<VisualElement>("EnergyProgressFill");
_food = root.Q<VisualElement>("HungerProgressFill");
}
private void OnDisable()
{
GameManager.Instance.Time.OnMinuteChanged -= UpdateTime;
}
// Update is called once per frame
void Update()
{
_moneyLabel.text = $"${(Player.Instance.Stats[StatsId.Money] as INumericStat).Value}";
_locationLabel.text= $"{(Player.Instance.Stats[StatsId.LocationName] as IStringStat).Value}";
}
private void UpdateTime()
{
if (_timeLabel != null)
{
_timeLabel.text = $"{GameManager.Instance.Time.CurrentTime.GetDayName()} {GameManager.Instance.Time.CurrentTime.ToString(@"hh\:mm")} day ({GameManager.Instance.Time.CurrentTime.Days})";
}
//progressBarFill.style.width = new Length(progress * 100, LengthUnit.Percent);
_energy.style.width = new Length((Player.Instance.Stats[StatsId.Energy] as INumericStat).Value , LengthUnit.Percent);
_food.style.width = new Length((Player.Instance.Stats[StatsId.Food] as INumericStat).Value, LengthUnit.Percent);
}
}
+2
View File
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: b12a25de2b34933489e52900d32221dd
+6
View File
@@ -0,0 +1,6 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="False">
<Style src="project://database/Assets/UI/progressBar.uss?fileID=7433441132597879392&amp;guid=755fc3f2b04b5014794dec9f2787b86e&amp;type=3#progressBar" />
<ui:VisualElement name="VisualElement">
<ui:Button text="Button" style="border-top-left-radius: 20px; border-top-right-radius: 20px; border-bottom-right-radius: 20px; border-bottom-left-radius: 20px; background-color: rgb(255, 255, 255); color: rgb(0, 2, 255); width: 150px;" />
</ui:VisualElement>
</ui:UXML>
+10
View File
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 257b45a55d104c846b4c2a03096e6afa
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
+4 -4
View File
@@ -8,14 +8,14 @@
<Style src="project://database/Assets/UI/progressBar.uss?fileID=7433441132597879392&amp;guid=755fc3f2b04b5014794dec9f2787b86e&amp;type=3#progressBar" />
<ui:VisualElement name="icon" class="progress-icon" style="background-image: url(&quot;project://database/Assets/3dAssets/Textures/EnergyIcon.png?fileID=2800000&amp;guid=dfe1a973babd6cc4bb1a418ed2f3562e&amp;type=3#EnergyIcon&quot;);" />
<ui:VisualElement name="progressBarContainer" class="progress-bar-container">
<ui:VisualElement name="progressFill" class="progress-bar-fill" />
<ui:VisualElement name="EnergyProgressFill" class="progress-bar-fill" />
</ui:VisualElement>
</ui:VisualElement>
<ui:VisualElement name="HungerProgress" template="progressBar" class="stat-container">
<Style src="project://database/Assets/UI/progressBar.uss?fileID=7433441132597879392&amp;guid=755fc3f2b04b5014794dec9f2787b86e&amp;type=3#progressBar" />
<ui:VisualElement name="icon" class="progress-icon" style="background-image: url(&quot;project://database/Assets/3dAssets/Textures/FoodIcon.png?fileID=2800000&amp;guid=bc479ad3f781c4540995d023a62d8c1d&amp;type=3#FoodIcon&quot;);" />
<ui:VisualElement name="progressBarContainer" class="progress-bar-container">
<ui:VisualElement name="progressFill" class="progress-bar-fill" />
<ui:VisualElement name="HungerProgressFill" class="progress-bar-fill" />
</ui:VisualElement>
</ui:VisualElement>
<ui:VisualElement name="MoneyPanel" class="stat-container">
@@ -24,12 +24,12 @@
</ui:VisualElement>
</ui:VisualElement>
<ui:VisualElement name="LocationInfo" class="top-elements-block justify-center">
<ui:Label text="Nowhere" name="AdressLabel" class="top-bar-label justify-center" />
<ui:Label text="Nowhere" name="LocationLabel" class="top-bar-label justify-center" />
</ui:VisualElement>
<ui:VisualElement name="TimeInfo" class="top-elements-block justify-right">
<ui:VisualElement name="TimePanel" class="stat-container">
<ui:VisualElement name="icon" style="background-image: url(&quot;project://database/Assets/3dAssets/Textures/CalendarIcon.png?fileID=2800000&amp;guid=40259e4947454c74bb483b1fab03888e&amp;type=3#CalendarIcon&quot;); height: 20px; width: 20px;" />
<ui:Label text="Nowhere" name="ClockLabel" class="top-bar-label" />
<ui:Label text="Nowhere" name="TimeLabel" class="top-bar-label" />
</ui:VisualElement>
</ui:VisualElement>
</ui:VisualElement>