From 75f5b5217f9093306dc48e5a2d15fa58af0c0ad5 Mon Sep 17 00:00:00 2001 From: Christopher Date: Mon, 26 Sep 2016 15:01:50 +0100 Subject: [PATCH] Reverted ICommand interface --- Assets/Fungus/Scripts/Commands/Else.cs | 4 +- Assets/Fungus/Scripts/Commands/ElseIf.cs | 2 +- Assets/Fungus/Scripts/Components/Block.cs | 6 +- Assets/Fungus/Scripts/Components/Command.cs | 4 +- Assets/Fungus/Scripts/Components/Flowchart.cs | 6 +- Assets/Fungus/Scripts/Interfaces/ICommand.cs | 166 ------------------ .../Scripts/Interfaces/ICommand.cs.meta | 12 -- ProjectSettings/ProjectSettings.asset | 39 +++- 8 files changed, 49 insertions(+), 190 deletions(-) delete mode 100644 Assets/Fungus/Scripts/Interfaces/ICommand.cs delete mode 100644 Assets/Fungus/Scripts/Interfaces/ICommand.cs.meta diff --git a/Assets/Fungus/Scripts/Commands/Else.cs b/Assets/Fungus/Scripts/Commands/Else.cs index 6b39c927..7af0fa6c 100644 --- a/Assets/Fungus/Scripts/Commands/Else.cs +++ b/Assets/Fungus/Scripts/Commands/Else.cs @@ -32,8 +32,8 @@ namespace Fungus.Commands int indent = indentLevel; for (int i = CommandIndex + 1; i < ParentBlock.CommandList.Count; ++i) { - ICommand command = ParentBlock.CommandList[i]; - + var command = ParentBlock.CommandList[i]; + if (command.IndentLevel == indent) { System.Type type = command.GetType(); diff --git a/Assets/Fungus/Scripts/Commands/ElseIf.cs b/Assets/Fungus/Scripts/Commands/ElseIf.cs index 1e1a118f..5c187e6a 100644 --- a/Assets/Fungus/Scripts/Commands/ElseIf.cs +++ b/Assets/Fungus/Scripts/Commands/ElseIf.cs @@ -40,7 +40,7 @@ namespace Fungus.Commands int indent = indentLevel; for (int i = CommandIndex + 1; i < ParentBlock.CommandList.Count; ++i) { - ICommand command = ParentBlock.CommandList[i]; + var command = ParentBlock.CommandList[i]; if (command.IndentLevel == indent) { diff --git a/Assets/Fungus/Scripts/Components/Block.cs b/Assets/Fungus/Scripts/Components/Block.cs index 1d818e98..41278dfd 100644 --- a/Assets/Fungus/Scripts/Components/Block.cs +++ b/Assets/Fungus/Scripts/Components/Block.cs @@ -74,7 +74,7 @@ namespace Fungus // Give each child command a reference back to its parent block // and tell each command its index in the list. int index = 0; - foreach (ICommand command in commandList) + foreach (var command in commandList) { if (command == null) { @@ -100,7 +100,7 @@ namespace Fungus protected virtual void Update() { int index = 0; - foreach (ICommand command in commandList) + foreach (var command in commandList) { if (command == null) // Null entry will be deleted automatically later { @@ -358,7 +358,7 @@ namespace Fungus public virtual void UpdateIndentLevels() { int indentLevel = 0; - foreach (ICommand command in commandList) + foreach (var command in commandList) { if (command == null) { diff --git a/Assets/Fungus/Scripts/Components/Command.cs b/Assets/Fungus/Scripts/Components/Command.cs index 0ef1120b..a81480e5 100644 --- a/Assets/Fungus/Scripts/Components/Command.cs +++ b/Assets/Fungus/Scripts/Components/Command.cs @@ -37,7 +37,7 @@ namespace Fungus /// /// Base class for Commands. Commands can be added to Blocks to create an execution sequence. /// - public class Command : MonoBehaviour, ICommand + public abstract class Command : MonoBehaviour { [FormerlySerializedAs("commandId")] [HideInInspector] @@ -48,7 +48,7 @@ namespace Fungus protected string errorMessage = ""; - #region ICommand implementation + #region Public methods /// /// Unique identifier for this command. diff --git a/Assets/Fungus/Scripts/Components/Flowchart.cs b/Assets/Fungus/Scripts/Components/Flowchart.cs index 9b814fff..12fd828e 100644 --- a/Assets/Fungus/Scripts/Components/Flowchart.cs +++ b/Assets/Fungus/Scripts/Components/Flowchart.cs @@ -211,7 +211,7 @@ namespace Fungus usedIds.Add(block.ItemId); } - var commands = GetComponents(); + var commands = GetComponents(); foreach (var command in commands) { if (command.ItemId == -1 || @@ -413,7 +413,7 @@ namespace Fungus maxId = Math.Max(maxId, block.ItemId); } - var commands = GetComponents(); + var commands = GetComponents(); foreach (var command in commands) { maxId = Math.Max(maxId, command.ItemId); @@ -940,7 +940,7 @@ namespace Fungus { if (resetCommands) { - ICommand[] commands = GetComponents(); + var commands = GetComponents(); foreach (var command in commands) { command.OnReset(); diff --git a/Assets/Fungus/Scripts/Interfaces/ICommand.cs b/Assets/Fungus/Scripts/Interfaces/ICommand.cs deleted file mode 100644 index 25852dc2..00000000 --- a/Assets/Fungus/Scripts/Interfaces/ICommand.cs +++ /dev/null @@ -1,166 +0,0 @@ -// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus). -// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) - -using UnityEngine; -using System.Collections.Generic; - -namespace Fungus -{ - /// - /// Commands can be added to Blocks to create an execution sequence. - /// - public interface ICommand - { - /// - /// Unique identifier for this command. - /// Unique for this Flowchart. - /// - int ItemId { get; set; } - - /// - /// Error message to display in the command inspector. - /// - string ErrorMessage { get; } - - /// - /// Indent depth of the current commands. - /// Commands are indented inside If, While, etc. sections. - /// - int IndentLevel { get; set; } - - /// - /// Index of the command in the parent block's command list. - /// - int CommandIndex { get; set; } - - /// - /// Set to true by the parent block while the command is executing. - /// - bool IsExecuting { get; set; } - - /// - /// Timer used to control appearance of executing icon in inspector. - /// - float ExecutingIconTimer { get; set; } - - /// - /// Reference to the Block object that this command belongs to. - /// This reference is only populated at runtime and in the editor when the - /// block is selected. - /// - Block ParentBlock { get; set; } - - /// - /// Returns the Flowchart that this command belongs to. - /// - Flowchart GetFlowchart(); - - /// - /// Execute the command. - /// - void Execute(); - - /// - /// End execution of this command and continue execution at the next command. - /// - void Continue(); - - /// - /// End execution of this command and continue execution at a specific command index. - /// - /// Next command index. - void Continue(int nextCommandIndex); - - /// - /// Stops the parent Block executing. - /// - void StopParentBlock(); - - /// - /// Called when the parent block has been requested to stop executing, and - /// this command is the currently executing command. - /// Use this callback to terminate any asynchronous operations and - /// cleanup state so that the command is ready to execute again later on. - /// - void OnStopExecuting(); - - /// - /// Called when the new command is added to a block in the editor. - /// - void OnCommandAdded(Block parentBlock); - - /// - /// Called when the command is deleted from a block in the editor. - /// - void OnCommandRemoved(Block parentBlock); - - /// - /// Called when this command starts execution. - /// - void OnEnter(); - - /// - /// Called when this command ends execution. - /// - void OnExit(); - - /// - /// Called when this command is reset. This happens when the Reset command is used. - /// - void OnReset(); - - /// - /// Populates a list with the Blocks that this command references. - /// - void GetConnectedBlocks(ref List connectedBlocks); - - /// - /// Returns true if this command references the variable. - /// Used to highlight variables in the variable list when a command is selected. - /// - bool HasReference(Variable variable); - - /// - /// Returns the summary text to display in the command inspector. - /// - string GetSummary(); - - /// - /// Returns the help text to display for this command. - /// - string GetHelpText(); - - /// - /// Return true if this command opens a block of commands. Used for indenting commands. - /// - bool OpenBlock(); - - /// - /// Return true if this command closes a block of commands. Used for indenting commands. - /// - bool CloseBlock(); - - /// - /// Return the color for the command background in inspector. - /// - /// The button color. - Color GetButtonColor(); - - /// - /// Returns true if the specified property should be displayed in the inspector. - /// This is useful for hiding certain properties based on the value of another property. - /// - bool IsPropertyVisible(string propertyName); - - /// - /// Returns true if the specified property should be displayed as a reorderable list in the inspector. - /// This only applies for array properties and has no effect for non-array properties. - /// - bool IsReorderableArray(string propertyName); - - /// - /// Returns the localization id for the Flowchart that contains this command. - /// - string GetFlowchartLocalizationId(); - } -} diff --git a/Assets/Fungus/Scripts/Interfaces/ICommand.cs.meta b/Assets/Fungus/Scripts/Interfaces/ICommand.cs.meta deleted file mode 100644 index 6b85918e..00000000 --- a/Assets/Fungus/Scripts/Interfaces/ICommand.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 189c3f33fdd4b47608ac0aa3a2b971bb -timeCreated: 1473856401 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 9ed24b4d..20dab2a7 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -500,7 +500,44 @@ PlayerSettings: WebGL::emscriptenArgs: WebGL::template: APPLICATION:Default additionalIl2CppArgs::additionalIl2CppArgs: - vectorPropertyNames: [] + vectorPropertyNames: + - Android::VR::enabledDevices + - Metro::VR::enabledDevices + - N3DS::VR::enabledDevices + - PS3::VR::enabledDevices + - PS4::VR::enabledDevices + - PSM::VR::enabledDevices + - PSP2::VR::enabledDevices + - SamsungTV::VR::enabledDevices + - Standalone::VR::enabledDevices + - Tizen::VR::enabledDevices + - WebGL::VR::enabledDevices + - WebPlayer::VR::enabledDevices + - WiiU::VR::enabledDevices + - Xbox360::VR::enabledDevices + - XboxOne::VR::enabledDevices + - iOS::VR::enabledDevices + - tvOS::VR::enabledDevices + Android::VR::enabledDevices: + - Oculus + Metro::VR::enabledDevices: [] + N3DS::VR::enabledDevices: [] + PS3::VR::enabledDevices: [] + PS4::VR::enabledDevices: + - PlayStationVR + PSM::VR::enabledDevices: [] + PSP2::VR::enabledDevices: [] + SamsungTV::VR::enabledDevices: [] + Standalone::VR::enabledDevices: + - Oculus + Tizen::VR::enabledDevices: [] + WebGL::VR::enabledDevices: [] + WebPlayer::VR::enabledDevices: [] + WiiU::VR::enabledDevices: [] + Xbox360::VR::enabledDevices: [] + XboxOne::VR::enabledDevices: [] + iOS::VR::enabledDevices: [] + tvOS::VR::enabledDevices: [] cloudProjectId: projectName: organizationId: