mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-28 20:55:44 +00:00
Fix selected province fade flicker (#8700)
This commit is contained in:
+18
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using eagle;
|
||||
using NUnit.Framework;
|
||||
@@ -50,6 +51,23 @@ namespace eagle0.Tests {
|
||||
"ProvinceWeatherController should update the project weather map material.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MapAnimationRunsAfterModelUpdates() {
|
||||
Assert.Greater(
|
||||
ExecutionOrderFor(typeof(MapController)),
|
||||
ExecutionOrderFor(typeof(EagleGameController)),
|
||||
"MapController must animate province colors after EagleGameController can " +
|
||||
"replace the model and reset their base colors.");
|
||||
}
|
||||
|
||||
private static int ExecutionOrderFor(Type componentType) {
|
||||
var attribute =
|
||||
componentType.GetCustomAttributes(typeof(DefaultExecutionOrder), inherit: false)
|
||||
.Cast<DefaultExecutionOrder>()
|
||||
.SingleOrDefault();
|
||||
return attribute?.order ?? 0;
|
||||
}
|
||||
|
||||
private static Material LoadMaterial(string path, string expectedShaderName) {
|
||||
var material = AssetDatabase.LoadAssetAtPath<Material>(path);
|
||||
Assert.NotNull(material, $"{path} must exist.");
|
||||
|
||||
@@ -10,6 +10,9 @@ using ProvinceId = System.Int32;
|
||||
using FactionId = System.Int32;
|
||||
|
||||
namespace eagle {
|
||||
// Model and highlight state are updated by other controllers in Update. Run afterward so an
|
||||
// incoming model cannot overwrite the animated province colors before they are rendered.
|
||||
[DefaultExecutionOrder(100)]
|
||||
public class MapController : MonoBehaviour {
|
||||
public EagleGameController eagleGameController;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user