-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
32 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
Copyright (c) 2012 - 2022 [email protected] | ||
Copyright (c) 2012 - 2023 [email protected] | ||
|
||
Данное программное обеспечение и сопутствующая документация (далее - Продукт) | ||
выпускается на условиях двойного лицензирования - под собственнической/коммерческой | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// ---------------------------------------------------------------------------- | ||
// The Proprietary or MIT-Red License | ||
// Copyright (c) 2012-2022 Leopotam <[email protected]> | ||
// Copyright (c) 2012-2023 Leopotam <[email protected]> | ||
// ---------------------------------------------------------------------------- | ||
|
||
using System; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// ---------------------------------------------------------------------------- | ||
// The Proprietary or MIT-Red License | ||
// Copyright (c) 2012-2022 Leopotam <[email protected]> | ||
// Copyright (c) 2012-2023 Leopotam <[email protected]> | ||
// ---------------------------------------------------------------------------- | ||
|
||
using System.Runtime.CompilerServices; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// ---------------------------------------------------------------------------- | ||
// The Proprietary or MIT-Red License | ||
// Copyright (c) 2012-2022 Leopotam <[email protected]> | ||
// Copyright (c) 2012-2023 Leopotam <[email protected]> | ||
// ---------------------------------------------------------------------------- | ||
|
||
using System; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// ---------------------------------------------------------------------------- | ||
// The Proprietary or MIT-Red License | ||
// Copyright (c) 2012-2022 Leopotam <[email protected]> | ||
// Copyright (c) 2012-2023 Leopotam <[email protected]> | ||
// ---------------------------------------------------------------------------- | ||
|
||
using System.Collections.Generic; | ||
|
@@ -24,6 +24,10 @@ public interface IEcsRunSystem : IEcsSystem { | |
void Run (IEcsSystems systems); | ||
} | ||
|
||
public interface IEcsPostRunSystem : IEcsSystem { | ||
void PostRun (IEcsSystems systems); | ||
} | ||
|
||
public interface IEcsDestroySystem : IEcsSystem { | ||
void Destroy (IEcsSystems systems); | ||
} | ||
|
@@ -53,6 +57,7 @@ public class EcsSystems : IEcsSystems { | |
readonly Dictionary<string, EcsWorld> _worlds; | ||
readonly List<IEcsSystem> _allSystems; | ||
readonly List<IEcsRunSystem> _runSystems; | ||
readonly List<IEcsPostRunSystem> _postRunSystems; | ||
readonly object _shared; | ||
#if DEBUG | ||
bool _inited; | ||
|
@@ -64,6 +69,7 @@ public EcsSystems (EcsWorld defaultWorld, object shared = null) { | |
_worlds = new Dictionary<string, EcsWorld> (8); | ||
_allSystems = new List<IEcsSystem> (128); | ||
_runSystems = new List<IEcsRunSystem> (128); | ||
_postRunSystems = new List<IEcsPostRunSystem> (128); | ||
} | ||
|
||
public virtual T GetShared<T> () where T : class { | ||
|
@@ -101,6 +107,9 @@ public virtual IEcsSystems Add (IEcsSystem system) { | |
if (system is IEcsRunSystem runSystem) { | ||
_runSystems.Add (runSystem); | ||
} | ||
if (system is IEcsPostRunSystem postRunSystem) { | ||
_postRunSystems.Add (postRunSystem); | ||
} | ||
return this; | ||
} | ||
|
||
|
@@ -144,6 +153,13 @@ public virtual void Run () { | |
#if DEBUG && !LEOECSLITE_NO_SANITIZE_CHECKS | ||
var worldName = CheckForLeakedEntities (this); | ||
if (worldName != null) { throw new System.Exception ($"Empty entity detected in world \"{worldName}\" after {_runSystems[i].GetType ().Name}.Run()."); } | ||
#endif | ||
} | ||
for (int i = 0, iMax = _postRunSystems.Count; i < iMax; i++) { | ||
_postRunSystems[i].PostRun (this); | ||
#if DEBUG && !LEOECSLITE_NO_SANITIZE_CHECKS | ||
var worldName = CheckForLeakedEntities (this); | ||
if (worldName != null) { throw new System.Exception ($"Empty entity detected in world \"{worldName}\" after {_postRunSystems[i].GetType ().Name}.PostRun()."); } | ||
#endif | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// ---------------------------------------------------------------------------- | ||
// The Proprietary or MIT-Red License | ||
// Copyright (c) 2012-2022 Leopotam <[email protected]> | ||
// Copyright (c) 2012-2023 Leopotam <[email protected]> | ||
// ---------------------------------------------------------------------------- | ||
|
||
using System; | ||
|