Skip to content

Commit

Permalink
feat: c#8 and WindowsManager events
Browse files Browse the repository at this point in the history
  • Loading branch information
Tr0sT committed Aug 19, 2020
1 parent 2f1a3a9 commit 481b161
Show file tree
Hide file tree
Showing 19 changed files with 47 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using UnityEngine;

namespace NuclearBand
Expand All @@ -19,4 +20,4 @@ private void Update()
OnBackButtonPressed?.Invoke();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using UnityEngine;

namespace NuclearBand
Expand Down Expand Up @@ -60,4 +61,4 @@ private DeviceScreenOrientation CalculateOrientation()
return DeviceScreenOrientation.Portrait;
}
}
}
}
1 change: 1 addition & 0 deletions Assets/com.nuclearband.windowsmanager/Runtime/Window.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#nullable enable
using System;
using UnityEngine;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#nullable enable
using UnityEngine;

namespace NuclearBand
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#nullable enable
namespace NuclearBand
{
public class WindowReference
Expand All @@ -17,4 +18,4 @@ private void OnInitAfterRebuildCallback(Window window)
Window.OnInitAfterRebuild += OnInitAfterRebuildCallback;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#nullable enable
using UnityEngine;
using System.Collections.Generic;
using System;
Expand All @@ -21,6 +22,8 @@ public WindowBuildData(string windowPath, string suffix, Action<Window>? setupWi
}
}

public static event Action<Window>? OnWindowCreated;
public static event Action<Window>? OnWindowClosed;
public static bool InputBlocked { get; private set; }
public static GameObject InputBlockPrefab { get; private set; } = null!;

Expand Down Expand Up @@ -65,6 +68,7 @@ public static WindowReference CreateWindow(string windowPath, Action<Window>? se
window.Init();

window.Show();
OnWindowCreated?.Invoke(window);
return windowReference;
}

Expand Down Expand Up @@ -244,6 +248,7 @@ private static void WindowOnHidden(Window window)

windows.RemoveAt(i);
windowBuildDataList.RemoveAt(i);
OnWindowClosed?.Invoke(window);
return;
}
}
Expand All @@ -268,4 +273,4 @@ private static void WindowOnCloseForRebuild(Window window)
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using System.Collections.Generic;

namespace NuclearBand
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#nullable enable
using UnityEngine;

namespace NuclearBand
Expand All @@ -15,4 +16,4 @@ void Start()
WindowsManager.CreateWindow(Example1Window1.Path);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#nullable enable
using UnityEngine.UI;

namespace NuclearBand
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using UnityEngine.UI;
#nullable enable
using UnityEngine.UI;

namespace NuclearBand
{
Expand All @@ -19,4 +20,4 @@ public static WindowReference CreateWindow(string path, string title)
return WindowsManager.CreateWindow(path, window => (window as Example1Window2)!.title = title);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using UnityEngine;
#nullable enable
using UnityEngine;

namespace NuclearBand
{
Expand All @@ -15,4 +16,4 @@ private void Start()
WindowsManager.CreateWindow(Example2Window1.Path);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
namespace NuclearBand
#nullable enable
namespace NuclearBand
{
public class Example2Window1 : Example1Window1
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections;
#nullable enable
using System.Collections;
using UnityEngine;

namespace NuclearBand
Expand Down Expand Up @@ -48,4 +49,4 @@ protected override void DeInit()
canvasGroup.alpha = 1.0f;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using System.Collections.Generic;
using UnityEngine;

Expand All @@ -22,4 +23,4 @@ void Start()
WindowsManager.CreateWindow(Example3Window1.Path);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

#nullable enable

namespace NuclearBand
{
public class Example3Window1 : Example2Window1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using UnityEngine.UI;
#nullable enable
using UnityEngine.UI;

namespace NuclearBand
{
Expand Down Expand Up @@ -49,4 +50,4 @@ void DrawRebuildNum()
rebuildText.text = rebuildNum.ToString();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using UnityEngine;
#nullable enable
using UnityEngine;

namespace NuclearBand
{
Expand All @@ -15,4 +16,4 @@ void Start()
WindowsManager.CreateWindow(Example4Window1.Path);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
namespace NuclearBand
#nullable enable
namespace NuclearBand
{
public class Example4Window1 : Window
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using UnityEngine;
using UnityEngine.UI;
using Random = UnityEngine.Random;
Expand Down

0 comments on commit 481b161

Please sign in to comment.