mirror of
https://github.com/Xevion/Boids.git
synced 2025-12-07 18:06:23 -06:00
implemented toggle title screen boid rendering (tween based method commented out until fix located)
This commit is contained in:
@@ -912,12 +912,12 @@ RectTransform:
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 986255156}
|
||||
m_RootOrder: 1
|
||||
m_Father: {fileID: 1228909922}
|
||||
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: 2.1, y: -0.62249}
|
||||
m_AnchoredPosition: {x: 2.0999985, y: -0.622509}
|
||||
m_SizeDelta: {x: 168.99, y: 18.755}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!132 &159673837
|
||||
@@ -3695,93 +3695,6 @@ MonoBehaviour:
|
||||
m_Calls: []
|
||||
m_TypeName: UnityEngine.UI.Slider+SliderEvent, UnityEngine.UI, Version=1.0.0.0,
|
||||
Culture=neutral, PublicKeyToken=null
|
||||
--- !u!1 &986255155
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 986255156}
|
||||
- component: {fileID: 986255157}
|
||||
m_Layer: 5
|
||||
m_Name: TitleBoidsToggle
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &986255156
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 986255155}
|
||||
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: 1675835568}
|
||||
- {fileID: 159673836}
|
||||
m_Father: {fileID: 1158776167}
|
||||
m_RootOrder: 2
|
||||
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: -43.36, y: 54.3}
|
||||
m_SizeDelta: {x: 198.11, y: 20}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &986255157
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 986255155}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 2109663825, guid: f70555f144d8491a825f0804e09c671c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Navigation:
|
||||
m_Mode: 3
|
||||
m_SelectOnUp: {fileID: 0}
|
||||
m_SelectOnDown: {fileID: 0}
|
||||
m_SelectOnLeft: {fileID: 0}
|
||||
m_SelectOnRight: {fileID: 0}
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
m_SpriteState:
|
||||
m_HighlightedSprite: {fileID: 0}
|
||||
m_PressedSprite: {fileID: 0}
|
||||
m_SelectedSprite: {fileID: 0}
|
||||
m_DisabledSprite: {fileID: 0}
|
||||
m_AnimationTriggers:
|
||||
m_NormalTrigger: Normal
|
||||
m_HighlightedTrigger: Highlighted
|
||||
m_PressedTrigger: Pressed
|
||||
m_SelectedTrigger: Selected
|
||||
m_DisabledTrigger: Disabled
|
||||
m_Interactable: 1
|
||||
m_TargetGraphic: {fileID: 1675835569}
|
||||
toggleTransition: 1
|
||||
graphic: {fileID: 1210608419}
|
||||
m_Group: {fileID: 0}
|
||||
onValueChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_TypeName: UnityEngine.UI.Toggle+ToggleEvent, UnityEngine.UI, Version=1.0.0.0,
|
||||
Culture=neutral, PublicKeyToken=null
|
||||
m_IsOn: 1
|
||||
--- !u!1 &988035056
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -4108,7 +4021,7 @@ RectTransform:
|
||||
m_Children:
|
||||
- {fileID: 504626591}
|
||||
- {fileID: 1889744465}
|
||||
- {fileID: 986255156}
|
||||
- {fileID: 1228909922}
|
||||
m_Father: {fileID: 1384661769}
|
||||
m_RootOrder: 6
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
@@ -4193,6 +4106,7 @@ MonoBehaviour:
|
||||
adjCloseButton: {fileID: 945635207}
|
||||
settingsPanel: {fileID: 1158776167}
|
||||
settingsCloseButton: {fileID: 1889744462}
|
||||
showBoidsOnTitleToggle: {fileID: 1228909923}
|
||||
canvas: {fileID: 1384661772}
|
||||
boidController: {fileID: 342684658}
|
||||
--- !u!4 &1165952972
|
||||
@@ -4283,6 +4197,93 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1210608417}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!1 &1228909921
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1228909922}
|
||||
- component: {fileID: 1228909923}
|
||||
m_Layer: 5
|
||||
m_Name: ShowBoidsOnTitleToggle
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1228909922
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1228909921}
|
||||
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: 159673836}
|
||||
- {fileID: 1675835568}
|
||||
m_Father: {fileID: 1158776167}
|
||||
m_RootOrder: 2
|
||||
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.0000038147, y: 43.4}
|
||||
m_SizeDelta: {x: 198.11, y: 20}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &1228909923
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1228909921}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 2109663825, guid: f70555f144d8491a825f0804e09c671c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Navigation:
|
||||
m_Mode: 3
|
||||
m_SelectOnUp: {fileID: 0}
|
||||
m_SelectOnDown: {fileID: 0}
|
||||
m_SelectOnLeft: {fileID: 0}
|
||||
m_SelectOnRight: {fileID: 0}
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
m_SpriteState:
|
||||
m_HighlightedSprite: {fileID: 0}
|
||||
m_PressedSprite: {fileID: 0}
|
||||
m_SelectedSprite: {fileID: 0}
|
||||
m_DisabledSprite: {fileID: 0}
|
||||
m_AnimationTriggers:
|
||||
m_NormalTrigger: Normal
|
||||
m_HighlightedTrigger: Highlighted
|
||||
m_PressedTrigger: Pressed
|
||||
m_SelectedTrigger: Selected
|
||||
m_DisabledTrigger: Disabled
|
||||
m_Interactable: 1
|
||||
m_TargetGraphic: {fileID: 1675835569}
|
||||
toggleTransition: 1
|
||||
graphic: {fileID: 0}
|
||||
m_Group: {fileID: 0}
|
||||
onValueChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_TypeName: UnityEngine.UI.Toggle+ToggleEvent, UnityEngine.UI, Version=1.0.0.0,
|
||||
Culture=neutral, PublicKeyToken=null
|
||||
m_IsOn: 1
|
||||
--- !u!1 &1241320720
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -5354,13 +5355,13 @@ RectTransform:
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1675835567}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
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: 1210608418}
|
||||
m_Father: {fileID: 986255156}
|
||||
m_RootOrder: 0
|
||||
m_Father: {fileID: 1228909922}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
@@ -5380,7 +5381,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.3490566, g: 0.3490566, b: 0.3490566, a: 1}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Net;
|
||||
using JetBrains.Annotations;
|
||||
using UnityEditorInternal;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
@@ -22,6 +23,7 @@ public class UIController : MonoBehaviour {
|
||||
// Settings Panel Elements
|
||||
public RectTransform settingsPanel;
|
||||
public Button settingsCloseButton;
|
||||
public Toggle showBoidsOnTitleToggle;
|
||||
|
||||
// Element Groups (populated on Start)
|
||||
private GameObject[] _titleElements;
|
||||
@@ -34,7 +36,7 @@ public class UIController : MonoBehaviour {
|
||||
private Rect _canvasRect;
|
||||
private float _scaleFactor;
|
||||
private int _activeTweens;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// returns <c>True</c> when the UI Stance is locked due to active tweening animations
|
||||
/// </summary>
|
||||
@@ -90,6 +92,9 @@ public class UIController : MonoBehaviour {
|
||||
settingsCloseButton.onClick.AddListener(() => ChangeStance(UIStance.Title));
|
||||
adjCloseButton.onClick.AddListener(() => ChangeStance(UIStance.Title));
|
||||
|
||||
// Settings Menu Callbacks
|
||||
showBoidsOnTitleToggle.onValueChanged.AddListener(ShowBoidsTitle);
|
||||
|
||||
// Calculate UI position deltas
|
||||
_aboutDiff = new Vector3(_canvasRect.size.x * _scaleFactor, 0, 0);
|
||||
_aboutButtonDiff = new Vector3(75 * _scaleFactor, 0, 0);
|
||||
@@ -159,14 +164,20 @@ public class UIController : MonoBehaviour {
|
||||
MoveElements(UIGroup.SettingsScreen, false);
|
||||
else if (stance == UIStance.About)
|
||||
MoveElements(UIGroup.AboutScreen, false);
|
||||
else if (stance == UIStance.PlayAdjust)
|
||||
else if (stance == UIStance.PlayAdjust) {
|
||||
MoveElements(UIGroup.AdjustmentsScreen, false);
|
||||
if (!showBoidsOnTitleToggle.isOn)
|
||||
ShowBoidsTitle(true);
|
||||
}
|
||||
}
|
||||
// Settings/About/Play -> Title
|
||||
else if (stance == UIStance.Title) {
|
||||
MoveElements(UIGroup.TitleScreen, false);
|
||||
if (_currentUI == UIStance.PlayAdjust)
|
||||
if (_currentUI == UIStance.PlayAdjust) {
|
||||
MoveElements(UIGroup.AdjustmentsScreen, true);
|
||||
if(!showBoidsOnTitleToggle.isOn)
|
||||
ShowBoidsTitle(false);
|
||||
}
|
||||
else if (_currentUI == UIStance.Settings)
|
||||
MoveElements(UIGroup.SettingsScreen, true);
|
||||
else if (_currentUI == UIStance.About)
|
||||
@@ -231,4 +242,27 @@ public class UIController : MonoBehaviour {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowBoidsTitle(bool active) {
|
||||
ShowBoids(active);
|
||||
|
||||
// Works somewhat close to what is needed, but needs a fix.
|
||||
// if (!active) {
|
||||
// print("Fading out");
|
||||
// LeanTween
|
||||
// .alpha(boidController.gameObject, 0f, 0.5f)
|
||||
// .setEase(LeanTweenType.easeInCubic);
|
||||
// }
|
||||
// else {
|
||||
// print("Fading in");
|
||||
// LeanTween
|
||||
// .alpha(boidController.gameObject, 1f, 0.5f)
|
||||
// .setEase(LeanTweenType.easeInCubic);
|
||||
// }
|
||||
}
|
||||
|
||||
private void ShowBoids(bool show) {
|
||||
foreach(MeshRenderer meshRenderer in boidController.gameObject.GetComponentsInChildren<MeshRenderer>())
|
||||
meshRenderer.enabled = show;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user