Skip to content

Commit 53f23e4

Browse files
committed
Apply code style changes, and update layout and psring code
1 parent 1618bbc commit 53f23e4

File tree

178 files changed

+3278
-2560
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

178 files changed

+3278
-2560
lines changed

Assets/UnityX/Scripts/Components/Audio/AudioSource/AudioSourceManager.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public bool currentlyPausedBecauseTimescaleIsZero {
1515
else return false;
1616
}
1717
}
18-
LogicBlender<bool> canPlayBlender = new LogicBlender<bool>(source => source == null || source.All(x => x));
18+
LogicBlender<bool> canPlayBlender = new(source => source == null || source.All(x => x));
1919
public bool startPlayingAtRandomTime;
2020

2121
private AudioSource _audioSource;
@@ -179,7 +179,7 @@ void UpdateIsPlaying () {
179179

180180
bool _wasPlaying;
181181
[SerializeField]
182-
FloatTween _volumeTween = new FloatTween();
182+
FloatTween _volumeTween = new();
183183

184184
#if UNITY_EDITOR
185185
public void LogPauseBlender () {

Assets/UnityX/Scripts/Components/Events/TriggerListener.cs

+13-13
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,19 @@ public class TriggerListener : MonoBehaviour {
4343
public event TriggerExit2DEvent TriggerExit2D;
4444

4545

46-
public CollisionEvent OnCollisionEnterEvent = new CollisionEvent();
47-
public CollisionEvent OnCollisionStayEvent = new CollisionEvent();
48-
public CollisionEvent OnCollisionExitEvent = new CollisionEvent();
49-
public Collision2DEvent OnCollisionEnter2DEvent = new Collision2DEvent();
50-
public Collision2DEvent OnCollisionStay2DEvent = new Collision2DEvent();
51-
public Collision2DEvent OnCollisionExit2DEvent = new Collision2DEvent();
52-
53-
public TriggerEvent OnTriggerEnterEvent = new TriggerEvent();
54-
public TriggerEvent OnTriggerStayEvent = new TriggerEvent();
55-
public TriggerEvent OnTriggerExitEvent = new TriggerEvent();
56-
public Trigger2DEvent OnTriggerEnter2DEvent = new Trigger2DEvent();
57-
public Trigger2DEvent OnTriggerStay2DEvent = new Trigger2DEvent();
58-
public Trigger2DEvent OnTriggerExit2DEvent = new Trigger2DEvent();
46+
public CollisionEvent OnCollisionEnterEvent = new();
47+
public CollisionEvent OnCollisionStayEvent = new();
48+
public CollisionEvent OnCollisionExitEvent = new();
49+
public Collision2DEvent OnCollisionEnter2DEvent = new();
50+
public Collision2DEvent OnCollisionStay2DEvent = new();
51+
public Collision2DEvent OnCollisionExit2DEvent = new();
52+
53+
public TriggerEvent OnTriggerEnterEvent = new();
54+
public TriggerEvent OnTriggerStayEvent = new();
55+
public TriggerEvent OnTriggerExitEvent = new();
56+
public Trigger2DEvent OnTriggerEnter2DEvent = new();
57+
public Trigger2DEvent OnTriggerStay2DEvent = new();
58+
public Trigger2DEvent OnTriggerExit2DEvent = new();
5959

6060
[System.Serializable]
6161
public class CollisionEvent : UnityEvent<Collision> {}

Assets/UnityX/Scripts/Components/FPSManager/FPSDebugSettings.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
public class FPSDebugSettings : ScriptableObject {
44
public float fpsGraphHistoryTime = 1.0f; // The number of seconds to keep the FPS history for the graph.
5-
public Rect fpsPos = new Rect (10, 10, 100, 400);
5+
public Rect fpsPos = new(10, 10, 100, 400);
66
public bool showInEditor = true;
77
public bool showInDevBuilds = true;
88
public bool showInReleaseBuilds = false;

Assets/UnityX/Scripts/Components/FPSManager/FPSManager.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,5 +131,5 @@ private void OnGUI()
131131
}
132132
}
133133

134-
private List<float> deltaTimes = new List<float>();
134+
private List<float> deltaTimes = new();
135135
}

Assets/UnityX/Scripts/Components/GUIDrawer.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using UnityEngine;
33

44
public class GUIDrawer : MonoBehaviour {
5-
static Dictionary<object, System.Action> drawActions = new Dictionary<object, System.Action>();
5+
static Dictionary<object, System.Action> drawActions = new();
66
public static void StartDrawing (object obj, System.Action drawAction) {
77
if(drawActions.ContainsKey(obj)) drawActions[obj] = drawAction;
88
else drawActions.Add(obj, drawAction);

Assets/UnityX/Scripts/Components/Input/Gestures/Gesture.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[System.Serializable]
44
public class Gesture {
55
public string name;
6-
public List<InputPoint> inputPoints = new List<InputPoint>();
6+
public List<InputPoint> inputPoints = new();
77

88
public delegate void GestureEvent (Gesture gesture);
99
public event GestureEvent OnCompleteGesture;

Assets/UnityX/Scripts/Components/Input/InputUtils.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using UnityEngine;
22

33
public class InputUtils : MonoBehaviour {
4-
public static Vector2 clampedInputPosition => new Vector2(Mathf.Clamp(Input.mousePosition.x, 0, Screen.width), Mathf.Clamp(Input.mousePosition.y, 0, Screen.height));
4+
public static Vector2 clampedInputPosition => new(Mathf.Clamp(Input.mousePosition.x, 0, Screen.width), Mathf.Clamp(Input.mousePosition.y, 0, Screen.height));
55
public static bool HoveringOverUI (Vector2 screenPos) {
66
#if UNITY_IOS && !UNITY_EDITOR
77
return UnityEngine.EventSystems.EventSystem.current != null && Input.touchCount > 0 && UnityEngine.EventSystems.EventSystem.current.IsPointerOverGameObject(Input.GetTouch(0).fingerId);

Assets/UnityX/Scripts/Components/Input/InputX.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ public IEnumerable<InputPoint> inputPoints {
3333
}
3434
}
3535
public MouseInput mouseInput;
36-
public List<Finger> fingers = new List<Finger>();
36+
public List<Finger> fingers = new();
3737

38-
public List<Gesture> gestures = new List<Gesture>();
38+
public List<Gesture> gestures = new();
3939
public IEnumerable<Pinch> pinches {
4040
get {
4141
return gestures.Where(x => x is Pinch).Select(x => x as Pinch);
@@ -341,7 +341,7 @@ public bool TryGetTouchByID(int _id, out Touch touch){
341341
return true;
342342
}
343343
}
344-
touch = default(Touch);
344+
touch = default;
345345
return false;
346346
}
347347

Assets/UnityX/Scripts/Components/Input/TouchInputSimulator.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ void OnGUI () {
206206
if(InputX.Instance.pinches.Any()) {
207207
int i = 0;
208208
foreach(var pinch in InputX.Instance.pinches) {
209-
GUILayout.Window(i, new Rect(0,0,100,100), (int id) => {
209+
GUILayout.Window(i, new Rect(0,0,100,100), (int _) => {
210210
GUILayout.Box("Point 1: "+pinch.inputPoint1.position.ToString());
211211
GUILayout.Box("Point 2: "+pinch.inputPoint2.position.ToString());
212212
GUILayout.Box("Center: "+pinch.currentPinchCenter.ToString());

Assets/UnityX/Scripts/Components/MonoInstancer.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ static void PlayModeStateChanged (UnityEditor.PlayModeStateChange change) {
1717
}
1818
}
1919
#endif
20-
static List<T> _all = new List<T>();
20+
static List<T> _all = new();
2121
#if UNITY_EDITOR
2222
static bool _upToDate = false;
2323
#endif

Assets/UnityX/Scripts/Components/MonoSingleton.cs

+4-8
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,22 @@
44
// When the instance is destroyed we allow findobjectoftype to be used again.
55
// After that, all instance management is handled via awake/destroy
66
public abstract class MonoSingleton<T> : MonoBehaviour where T : MonoSingleton<T> {
7-
private static bool searched = false;
8-
private static T _Instance;
7+
static bool searched;
8+
static T _Instance;
99
public static T Instance {
1010
get {
1111
#if UNITY_EDITOR
1212
if(!Application.isPlaying) searched = false;
1313
#endif
1414
if(!searched && _Instance == null) {
15-
_Instance = Object.FindObjectOfType<T>();
15+
_Instance = FindObjectOfType<T>();
1616
searched = true;
1717
}
1818
return _Instance;
1919
}
2020
}
2121

22-
public static bool IsInitialized {
23-
get {
24-
return _Instance != null;
25-
}
26-
}
22+
public static bool IsInitialized => _Instance != null;
2723

2824
protected virtual void Awake () {
2925
_Instance = (T)this;

Assets/UnityX/Scripts/Components/PolygonRenderer/BasePolygonRenderer.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public MeshCollider meshCollider {
4343
protected Mesh mesh;
4444

4545
[SerializeField]
46-
Polygon _polygon = new Polygon(new RegularPolygon(4, 45).ToPolygonVerts());
46+
Polygon _polygon = new(new RegularPolygon(4, 45).ToPolygonVerts());
4747
public Polygon polygon {
4848
get {
4949
return _polygon;

Assets/UnityX/Scripts/Components/PolygonRenderer/PolygonOutlineRenderer.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public Texture2D texture {
2222
[Space]
2323
public bool front = true;
2424
public bool back;
25-
public MeshBakeParams bakeParams = new MeshBakeParams(true, true);
25+
public MeshBakeParams bakeParams = new(true, true);
2626

2727
[Space]
2828
public float innerDistance = 0f;
@@ -39,7 +39,7 @@ MaterialPropertyBlock propBlock {
3939

4040
public StrokeGeometryAttributes attributes;
4141
public float extrusion;
42-
static MeshBuilder mb = new MeshBuilder();
42+
static MeshBuilder mb = new();
4343
public override void RebuildMesh () {
4444
GetMesh();
4545
mesh.Clear();

Assets/UnityX/Scripts/Components/Region/Region.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
public class Region : MonoBehaviour {
55
#if UNITY_EDITOR
66
[SerializeField]
7-
Color _selectedFillColor = new Color(1,0,0,0.5f);
7+
Color _selectedFillColor = new(1,0,0,0.5f);
88
public Color selectedFillColor {
99
get {
1010
return _selectedFillColor;
@@ -13,7 +13,7 @@ public Color selectedFillColor {
1313
}
1414
}
1515
#endif
16-
public static List<Region> activeRegions = new List<Region>();
16+
public static List<Region> activeRegions = new();
1717
public static Region GetRegionAtPosition (Vector3 position) {
1818
foreach(Region region in activeRegions) {
1919
if(region.ContainsPoint(position))
@@ -228,10 +228,10 @@ void OnEnable () {
228228

229229
private void Reset () {
230230
polygon = new Polygon(new Vector2[] {
231-
new Vector2(-0.5f, 0.5f),
232-
new Vector2(0.5f, 0.5f),
233-
new Vector2(0.5f, -0.5f),
234-
new Vector2(-0.5f, -0.5f),
231+
new(-0.5f, 0.5f),
232+
new(0.5f, 0.5f),
233+
new(0.5f, -0.5f),
234+
new(-0.5f, -0.5f),
235235
});
236236
height = 1;
237237
}

Assets/UnityX/Scripts/Components/Render Texture Creator/RenderTextureCreator.cs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System;
21
using UnityEngine;
32

43
public class RenderTextureCreator : MonoBehaviour {
@@ -18,7 +17,7 @@ public enum RenderTextureAntiAliasing {
1817
_8 = 8
1918
}
2019
public bool fullScreen = false;
21-
public Vector2Int renderTextureSize = new Vector2Int(512, 512);
20+
public Vector2Int renderTextureSize = new(512, 512);
2221
public FilterMode filterMode = FilterMode.Bilinear;
2322
public RenderTextureDepth renderTextureDepth = RenderTextureDepth._0;
2423
public RenderTextureFormat renderTextureFormat = RenderTextureFormat.ARGB32;
@@ -29,7 +28,7 @@ public enum RenderTextureAntiAliasing {
2928

3029

3130
// public static Vector2Int screenSize => new Vector2Int(Screen.width, Screen.height);
32-
public static Vector2Int screenSize => new Vector2Int(screenWidth, screenHeight);
31+
public static Vector2Int screenSize => new(screenWidth, screenHeight);
3332
// ARGH I hate this. It's necessary because screen/display don't return the values for game view in some editor contexts (using inspector windows, for example)
3433
static int screenWidth {
3534
get {

Assets/UnityX/Scripts/Components/Screen.meta

+2-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)