diff --git a/Assembly-CSharp-Editor-firstpass.csproj b/Assembly-CSharp-Editor-firstpass.csproj index 1bfa430e..8ae83899 100644 --- a/Assembly-CSharp-Editor-firstpass.csproj +++ b/Assembly-CSharp-Editor-firstpass.csproj @@ -268,101 +268,104 @@ C:/Program Files/Unity/Hub/Editor/2019.4.16f1/Editor/Data/PlaybackEngines/WindowsStandaloneSupport/UnityEditor.WindowsStandalone.Extensions.dll + + C:/Program Files/Unity/Hub/Editor/2019.4.16f1/Editor/Data/PlaybackEngines/Switch/UnityEditor.Switch.Extensions.dll + C:/Program Files (x86)/Microsoft Visual Studio Tools for Unity/15.0/Editor/SyntaxTree.VisualStudio.Unity.Bridge.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Assets/Plugins/DotNetOpenAuth.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Assets/Plugins/DotNetOpenAuth.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Assets/Plugins/ICSharpCode.SharpZipLib.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Assets/Plugins/ICSharpCode.SharpZipLib.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Assets/Plugins/Lib/log4net.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Assets/Plugins/Lib/log4net.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.AWT.WinForms.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.AWT.WinForms.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.Beans.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.Beans.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.Charsets.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.Charsets.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.Cldrdata.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.Cldrdata.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.Corba.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.Corba.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.Core.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.Core.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.Jdbc.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.Jdbc.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.Localedata.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.Localedata.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.Management.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.Management.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.Media.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.Media.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.Misc.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.Misc.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.Naming.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.Naming.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.Nashorn.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.Nashorn.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.Remoting.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.Remoting.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.Security.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.Security.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.SwingAWT.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.SwingAWT.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.Text.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.Text.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.Util.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.Util.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.XML.API.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.XML.API.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.XML.Bind.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.XML.Bind.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.XML.Parse.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.OpenJDK.XML.Parse.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.Reflection.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.Reflection.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.Runtime.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.Runtime.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.Runtime.JNI.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/IKVM.Runtime.JNI.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/NeroxisGen.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Assets/Plugins/NeroxisMapGenerator/NeroxisGen.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Assets/StandaloneFileBrowser/Plugins/Ookii.Dialogs.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Assets/StandaloneFileBrowser/Plugins/Ookii.Dialogs.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Assets/StandaloneFileBrowser/Plugins/System.Windows.Forms.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Assets/StandaloneFileBrowser/Plugins/System.Windows.Forms.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Library/PackageCache/com.unity.ext.nunit@1.0.5/net35/unity-custom/nunit.framework.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Library/PackageCache/com.unity.ext.nunit@1.0.5/net35/unity-custom/nunit.framework.dll C:/Program Files/Unity/Hub/Editor/2019.4.16f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/mscorlib.dll @@ -719,37 +722,37 @@ C:/Program Files/Unity/Hub/Editor/2019.4.16f1/Editor/Data/MonoBleedingEdge/lib/mono/unityscript/Boo.Lang.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Library/ScriptAssemblies/UnityEditor.TestRunner.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Library/ScriptAssemblies/UnityEditor.TestRunner.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Library/ScriptAssemblies/UnityEngine.TestRunner.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Library/ScriptAssemblies/UnityEngine.TestRunner.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Library/ScriptAssemblies/Unity.Timeline.Editor.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Library/ScriptAssemblies/Unity.Timeline.Editor.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Library/ScriptAssemblies/Unity.VSCode.Editor.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Library/ScriptAssemblies/Unity.VSCode.Editor.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Library/ScriptAssemblies/UnityEngine.UI.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Library/ScriptAssemblies/UnityEngine.UI.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Library/ScriptAssemblies/Unity.Timeline.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Library/ScriptAssemblies/Unity.Timeline.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Library/ScriptAssemblies/Unity.CollabProxy.Editor.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Library/ScriptAssemblies/Unity.CollabProxy.Editor.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Library/ScriptAssemblies/Unity.Rider.Editor.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Library/ScriptAssemblies/Unity.Rider.Editor.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Library/ScriptAssemblies/Unity.2D.Sprite.Editor.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Library/ScriptAssemblies/Unity.2D.Sprite.Editor.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Library/ScriptAssemblies/Unity.2D.Tilemap.Editor.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Library/ScriptAssemblies/Unity.2D.Tilemap.Editor.dll - M:/Projekty/GithubDesktop/FAForeverMapEditor/Library/ScriptAssemblies/UnityEditor.UI.dll + C:/Users/Pawel/Documents/GitHub/FAForeverMapEditor/Library/ScriptAssemblies/UnityEditor.UI.dll diff --git a/Assets/Scripts/Ozone SCMAP Code/Lua/SaveLua_Army.cs b/Assets/Scripts/Ozone SCMAP Code/Lua/SaveLua_Army.cs index eac8a7f7..3e2ef2c3 100644 --- a/Assets/Scripts/Ozone SCMAP Code/Lua/SaveLua_Army.cs +++ b/Assets/Scripts/Ozone SCMAP Code/Lua/SaveLua_Army.cs @@ -352,7 +352,7 @@ public void UpdateGroupArmy(Army SourceOwner) } - public void GetAllUnitInstances(ref List AllUnits) + public void GetAllUnitInstances(ref List AllUnits, bool recursive = true) { if (Units.Count > 0) { @@ -365,7 +365,7 @@ public void GetAllUnitInstances(ref List AllUnits) ListEnum.Dispose(); } - if(UnitGroups.Count > 0) + if(recursive && UnitGroups.Count > 0) { var ListEnum = UnitGroups.GetEnumerator(); while (ListEnum.MoveNext()) diff --git a/Assets/Scripts/Selection/SelectionManager_Controls.cs b/Assets/Scripts/Selection/SelectionManager_Controls.cs index 95f37176..99beffc5 100644 --- a/Assets/Scripts/Selection/SelectionManager_Controls.cs +++ b/Assets/Scripts/Selection/SelectionManager_Controls.cs @@ -348,6 +348,27 @@ public void SelectObjects(List ToSelect) FinishSelectionChange(); } + /// + /// Execute selection action depend on the user input. Can add, remove or change selection + /// + /// + public void SelectObjectsInput(GameObject[] ToSelect) + { + + Undo.Current.RegisterSelectionChange(); + if (IsSelectionRemove()) + { + SelectObjectsRemove(ToSelect); + } + else if (IsSelectionAdd()) + { + SelectObjectsAdd(ToSelect); + } + else + { + SelectObjects(ToSelect); + } + } public void SelectObjectsRemove(GameObject[] ToSelect) { @@ -378,6 +399,23 @@ public void SelectObjectAdd(GameObject Obj) } } } + + public void SelectObjectsAdd(GameObject[] ToSelect) + { + bool AnyChanged = false; + for (int i = 0; i < ToSelect.Length; i++) + { + int ObjectId = GetIdOfObject(ToSelect[i]); + if (!Selection.Ids.Contains(ObjectId)) + { + Selection.Ids.Add(ObjectId); + AnyChanged = true; + } + } + + if (AnyChanged) + FinishSelectionChange(); + } #endregion diff --git a/Assets/Scripts/UI/Lists/UnitListObject.cs b/Assets/Scripts/UI/Lists/UnitListObject.cs index e74b302d..b96ee96f 100644 --- a/Assets/Scripts/UI/Lists/UnitListObject.cs +++ b/Assets/Scripts/UI/Lists/UnitListObject.cs @@ -32,6 +32,7 @@ public class UnitListObject : MonoBehaviour { public System.Action AddAction; public System.Action RemoveAction; public System.Action SelectAction; + public System.Action DoubleClickAction; public System.Action RenameAction; public System.Action ExpandAction; @@ -122,8 +123,17 @@ public void RemoveGroup() public void OnGroupClick() { - SelectAction(this, false); + if (Time.realtimeSinceStartup - LastClickTime < DoubleClickTime) // Double click + { + //SelectAction(this, false); + DoubleClickAction(this, true); + } + else // Single click + { + SelectAction(this, false); + } + LastClickTime = Time.realtimeSinceStartup; } public void OnExpandClick() diff --git a/Assets/Scripts/UI/Tools/Units/UnitSource.cs b/Assets/Scripts/UI/Tools/Units/UnitSource.cs index bf3ccb53..1a47e8db 100644 --- a/Assets/Scripts/UI/Tools/Units/UnitSource.cs +++ b/Assets/Scripts/UI/Tools/Units/UnitSource.cs @@ -21,8 +21,6 @@ public class UnitSource : MonoBehaviour BoundingSphere[] SpheresArray; HashSet Lod; - public Material strategicIconMaterial; - List ForceUpdate = new List(); void BakeInstances() { @@ -290,7 +288,7 @@ public static void DrawAllIcons(Camera current) GL.PushMatrix(); GL.LoadPixelMatrix(Mathf.RoundToInt(CameraRect.x), Mathf.RoundToInt(CameraRect.x + CameraRect.width), Mathf.RoundToInt(CameraRect.y), Mathf.RoundToInt(CameraRect.y + CameraRect.height)); - for (int i = 0; i < GetGamedataFile.LoadedUnitsStrategicDrawOrder.Length; i++) + for (int i = GetGamedataFile.LoadedUnitsStrategicDrawOrder.Length - 1; i >= 0; i--) { if (GetGamedataFile.LoadedUnitObjects.TryGetValue(GetGamedataFile.LoadedUnitsStrategicDrawOrder[i], out UnitSource value)) { diff --git a/Assets/Scripts/UI/Tools/Units/UnitsInfo_Groups.cs b/Assets/Scripts/UI/Tools/Units/UnitsInfo_Groups.cs index 00978dde..efaaf363 100644 --- a/Assets/Scripts/UI/Tools/Units/UnitsInfo_Groups.cs +++ b/Assets/Scripts/UI/Tools/Units/UnitsInfo_Groups.cs @@ -98,6 +98,7 @@ public void CreateGroup(MapLua.SaveLua.Army Army, MapLua.SaveLua.Army.UnitsGroup ulo.AddAction = AddNewGroup; ulo.RemoveAction = RemoveGroup; ulo.SelectAction = SelectGroup; + ulo.DoubleClickAction = SelectGroupUnits; ulo.RenameAction = RenameStart; ulo.ExpandAction = ExpandAction; ulo.SetGroup(Army, Grp, Parent, Root); @@ -441,6 +442,29 @@ static void ClearGrpSelection() return ToReturn; } + + public void SelectGroupUnits(UnitListObject ulo, bool recursive = true) + { + List allUnits = new List(); + ulo.Source.GetAllUnitInstances(ref allUnits); + + int unitsCount = allUnits.Count; + + if(unitsCount == 0) + { + SelectionManager.Current.CleanSelection(); + return; + } + + GameObject[] allUnitsGameObjects = new GameObject[unitsCount]; + for (int i = 0; i < unitsCount; i++) + { + allUnitsGameObjects[i] = allUnits[i].gameObject; + } + + SelectionManager.Current.SelectObjectsInput(allUnitsGameObjects); + + } #endregion }