// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. using System; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using FlaxEngine; namespace FlaxEditor { partial class GameCooker { /// /// Build options data. /// public struct Options { /// /// The platform. /// public BuildPlatform Platform; /// /// The build configuration. /// public BuildConfiguration Configuration; /// /// The options. /// public BuildOptions Flags; /// /// The output path (normalized, absolute). /// public string OutputPath; } /// /// Building event type. /// public enum EventType { /// /// The build started. /// BuildStarted = 0, /// /// The build failed. /// BuildFailed = 1, /// /// The build done. /// BuildDone = 2, } /// /// Game building event delegate. /// /// The type. public delegate void BuildEventDelegate(EventType type); /// /// Game building progress reporting delegate type. /// /// The information text. /// The total progress percentage (normalized to 0-1). public delegate void BuildProgressDelegate(string info, float totalProgress); /// /// Occurs when building event rises. /// public static event BuildEventDelegate Event; /// /// Occurs when building game progress fires. /// public static event BuildProgressDelegate Progress; /// /// Gets the type of the platform from the game build platform type. /// /// The build platform. /// The run-type platform type. public static PlatformType GetPlatformType(BuildPlatform buildPlatform) { switch (buildPlatform) { case BuildPlatform.Windows32: case BuildPlatform.Windows64: return PlatformType.Windows; case BuildPlatform.UWPx86: case BuildPlatform.UWPx64: return PlatformType.UWP; case BuildPlatform.XboxOne: return PlatformType.XboxOne; case BuildPlatform.LinuxX64: return PlatformType.Linux; case BuildPlatform.PS4: return PlatformType.PS4; default: throw new ArgumentOutOfRangeException(nameof(buildPlatform), buildPlatform, null); } } internal static void Internal_OnEvent(EventType type) { Event?.Invoke(type); } internal static void Internal_OnProgress(string info, float totalProgress) { Progress?.Invoke(info, totalProgress); } } }