popups + android build utils
This commit is contained in:
parent
359b616be9
commit
42dbfc8827
@ -89,6 +89,25 @@ public static class BuildingUtils
|
||||
BuildWindows(true);
|
||||
}
|
||||
|
||||
[MenuItem("Tools/Build/Platform/Android/GooglePlay")]
|
||||
public static void BuildGooglePlay()
|
||||
{
|
||||
IncreaseBuildNumber();
|
||||
PlayerSettings.Android.bundleVersionCode++;
|
||||
EditorUserBuildSettings.buildAppBundle = true;
|
||||
|
||||
var buildPlayerOptions = new BuildPlayerOptions { scenes = new string[EditorBuildSettings.scenes.Length] };
|
||||
for (int i = 0; i < EditorBuildSettings.scenes.Length; i++)
|
||||
{
|
||||
buildPlayerOptions.scenes[i] = EditorBuildSettings.scenes[i].path;
|
||||
}
|
||||
|
||||
buildPlayerOptions.target = BuildTarget.Android;
|
||||
buildPlayerOptions.options = BuildOptions.None;
|
||||
buildPlayerOptions.locationPathName = Application.dataPath +
|
||||
$"/../../{Application.productName}-GooglePlay/{Application.productName}.aab";
|
||||
BuildPipeline.BuildPlayer(buildPlayerOptions);
|
||||
}
|
||||
|
||||
private static void BuildWindows(bool release)
|
||||
{
|
||||
|
||||
@ -34,14 +34,21 @@ namespace NegUtils.Editor
|
||||
EditorPrefs.SetBool("StartFromSceneIndex0", newVal);
|
||||
}
|
||||
|
||||
if (startFromSceneIndex0)
|
||||
if (!startFromSceneIndex0)
|
||||
return;
|
||||
|
||||
bool goToCurrentScene = EditorPrefs.GetBool("GoToCurrentSceneAfterPlay");
|
||||
newVal = GUILayout.Toggle(goToCurrentScene, "Go to current scene after play");
|
||||
if (newVal != goToCurrentScene)
|
||||
{
|
||||
bool goToCurrentScene = EditorPrefs.GetBool("GoToCurrentSceneAfterPlay");
|
||||
newVal = GUILayout.Toggle(goToCurrentScene, "Go to current scene after play");
|
||||
if (newVal != goToCurrentScene)
|
||||
{
|
||||
EditorPrefs.SetBool("GoToCurrentSceneAfterPlay", newVal);
|
||||
}
|
||||
EditorPrefs.SetBool("GoToCurrentSceneAfterPlay", newVal);
|
||||
}
|
||||
|
||||
bool goToFirstScene = EditorPrefs.GetBool("GoToFirstSceneAfterPlay");
|
||||
newVal = GUILayout.Toggle(goToFirstScene, "Go to scene with index 1 after play");
|
||||
if (newVal != goToFirstScene)
|
||||
{
|
||||
EditorPrefs.SetBool("GoToFirstSceneAfterPlay", newVal);
|
||||
}
|
||||
}
|
||||
|
||||
@ -90,7 +97,7 @@ namespace NegUtils.Editor
|
||||
if (EditorPrefs.GetBool("GoToCurrentSceneAfterPlay"))
|
||||
EditorSceneManager.LoadSceneInPlayMode(EditorPrefs.GetString("LastOpenedScenePath"),
|
||||
new LoadSceneParameters(LoadSceneMode.Single));
|
||||
else
|
||||
else if (EditorPrefs.GetBool("GoToFirstSceneAfterPlay"))
|
||||
SceneManager.LoadScene(1);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -45,6 +45,10 @@ namespace NEG.UI.Popup
|
||||
/// <summary>
|
||||
/// Invalidate popup, <see cref="UiManager"/> will automatically skip this popup
|
||||
/// </summary>
|
||||
public virtual void Invalidate() => IsValid = false;
|
||||
public virtual void Invalidate()
|
||||
{
|
||||
IsValid = false;
|
||||
UiManager.Instance.RefreshPopups();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -123,6 +123,13 @@ namespace NEG.UI
|
||||
popupsToShow.Enqueue(data, priority);
|
||||
UpdatePopupsState(forceShow, priority, data);
|
||||
}
|
||||
|
||||
public void RefreshPopups()
|
||||
{
|
||||
if(currentShownPopup.data is { IsValid: true })
|
||||
return;
|
||||
UpdatePopupsState(false);
|
||||
}
|
||||
|
||||
protected void PopupClosed(PopupData data)
|
||||
{
|
||||
@ -147,11 +154,17 @@ namespace NEG.UI
|
||||
ShowPopup(data, priority);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!popupsToShow.TryDequeue(out var d, out int p))
|
||||
return;
|
||||
|
||||
ShowPopup(d, p);
|
||||
while (popupsToShow.TryDequeue(out var d, out int p))
|
||||
{
|
||||
if(!d.IsValid)
|
||||
continue;
|
||||
ShowPopup(d, p);
|
||||
return;
|
||||
}
|
||||
|
||||
currentShownPopup.data?.Hide();
|
||||
currentShownPopup.data = null;
|
||||
}
|
||||
|
||||
private void ShowPopup(PopupData data, int priority)
|
||||
|
||||
@ -6,9 +6,9 @@ namespace NEG.UI.UnityUi.Buttons
|
||||
[RequireComponent(typeof(BaseButton))]
|
||||
public abstract class ButtonReaction : MonoBehaviour
|
||||
{
|
||||
private void Awake() => GetComponent<BaseButton>().OnButtonPressed += OnClicked;
|
||||
protected virtual void Awake() => GetComponent<BaseButton>().OnButtonPressed += OnClicked;
|
||||
|
||||
private void OnDestroy() => GetComponent<BaseButton>().OnButtonPressed -= OnClicked;
|
||||
protected virtual void OnDestroy() => GetComponent<BaseButton>().OnButtonPressed -= OnClicked;
|
||||
|
||||
protected abstract void OnClicked();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user