public Effect getEffectofType(EffectTypes type) { // This makes a new effect of specified type Effect e; switch (type) { case EffectTypes.test: e = new TestEffect(""); break; case EffectTypes.moveUnit: e = new MoveEffect(); break; case EffectTypes.enemySpawn: e = new EnemyEffect(); break; case EffectTypes.enemyConversion: e = new ConversationEffect(); break; default: e = new NullEffect(); break; } return(e); }
public static void ConfigureAwait_Untyped_ShouldAddCallerInfo() { var eff = new TestEffect(); var awaiter = eff.ConfigureAwait(); Assert.True(awaiter.CallerMemberName?.Length > 0); Assert.True(awaiter.CallerFilePath?.Length > 0); Assert.True(awaiter.CallerLineNumber > 0); }
public void updateTestData(string d) { if (d.Length > 0) { Effect e; currentEvent.getEffect(currentEffectIndex, out e); TestEffect t = (TestEffect)e; t.setData(d); } }
public void ShadersWithChildrenRunOnRaster(string src, Dictionary <string, SKShader> children, SKColor[] expected, Action <SKCanvas, SKPaint> preTestCallback = null) { var info = new SKImageInfo(2, 2); using var surface = SKSurface.Create(info); using var effect = new TestEffect(src); effect.SetChildren(children); effect.Test(surface, info, expected, preTestCallback); }
public void ShadersWithUniformRunOnRaster(string src, Dictionary <string, object> uniforms, SKColor[] expected, Action <SKCanvas, SKPaint> preTestCallback = null) { var info = new SKImageInfo(2, 2); using var surface = SKSurface.Create(info); using var effect = new TestEffect(src); effect.SetUniforms(uniforms); effect.Test(surface, info, expected, preTestCallback); }
public void PlayFirstElement() { const string elementId = "eID"; const string sourceId = "ID1"; var element = new EnvironmentElement { Id = elementId, Positioning = new Positioning { FixedPosition = new Position() }, Timing = new Timing { MinStartDelay = TimeSpan.FromMinutes(0), MaxStartDelay = TimeSpan.FromMinutes(0) }, Audio = new AudioComponent { Playlist = new ElementPlaylist { Order = SourceOrder.InOrder, Repeat = SourceRepeatMode.None, Descriptors = new[] { sourceId } } } }; var state = new EncounterStateElement { ElementId = elementId, StartsWithState = true }; var audio = new Mock <IAudioService> (); var storage = new Mock <ILocalStorageService> (); var effect = new TestEffect(TimeSpan.FromSeconds(30)); audio.Setup(a => a.PrepareEffectAsync(It.IsAny <EnvironmentElement> (), It.IsAny <string> (), It.IsAny <PlaybackOptions> ())) .ReturnsAsync(effect); var environmentElement = new PlaybackEnvironmentElement(state, element); environmentElement.Tick(new ActiveServices { Audio = audio.Object, Storage = storage.Object }); audio.Verify(a => a.PrepareEffectAsync(element, sourceId, It.IsAny <PlaybackOptions> ())); audio.Verify(a => a.PlayEffect(effect)); }
public void ShadersWithChildrenRunOnGpu(string src, Dictionary <string, SKShader> children, SKColor[] expected, Action <SKCanvas, SKPaint> preTestCallback = null) { using var ctx = CreateGlContext(); ctx.MakeCurrent(); using var grContext = GRContext.CreateGl(); var info = new SKImageInfo(2, 2, SKColorType.Rgba8888); using var surface = SKSurface.Create(grContext, false, info); using var effect = new TestEffect(src); effect.SetChildren(children); effect.Test(surface, info, expected, preTestCallback); }
public async Task Effect_Run_ShouldThrowNotSupportedException() { var effect = new TestEffect <int>(); await Assert.ThrowsAsync <NotSupportedException>(() => effect.Run(Handler)); }
public void showEffect(int i) { if (currentEffectPanel != null) { currentEffectPanel.SetActive(false); } Vector2 pos; switch ((EffectTypes)i) { case EffectTypes.test: TestEffect effect = (TestEffect)currentEvent.getEffects()[currentEffectIndex]; currentEffectPanel = transform.FindChild("testPanel").gameObject; currentEffectPanel.SetActive(true); currentEffectPanel.transform.FindChild("InputField").GetComponent <InputField>().text = ""; print(effect.getData()); currentEffectPanel.transform.FindChild("InputField").GetChild(1).GetComponent <Text>().text = effect.getData(); break; case EffectTypes.moveUnit: MoveEffect moveEffect = (MoveEffect)currentEvent.getEffects()[currentEffectIndex]; currentEffectPanel = transform.FindChild("moveUnitPanel").gameObject; currentEffectPanel.SetActive(true); currentEffectPanel.transform.FindChild("XField").GetComponent <InputField>().text = ""; currentEffectPanel.transform.FindChild("YField").GetComponent <InputField>().text = ""; pos = moveEffect.getPosition(); currentEffectPanel.transform.FindChild("XField").GetChild(1).GetComponent <Text>().text = pos.x.ToString(); currentEffectPanel.transform.FindChild("YField").GetChild(1).GetComponent <Text>().text = pos.y.ToString(); break; case EffectTypes.enemySpawn: EnemyEffect enemyEffect = (EnemyEffect)currentEvent.getEffects()[currentEffectIndex]; currentEffectPanel = transform.FindChild("EnemyPanel").gameObject; currentEffectPanel.SetActive(true); currentEffectPanel.transform.FindChild("XField").GetComponent <InputField>().text = ""; currentEffectPanel.transform.FindChild("YField").GetComponent <InputField>().text = ""; currentEffectPanel.transform.FindChild("UnitIndex").GetComponent <InputField>().text = ""; pos = enemyEffect.getPosition(); currentEffectPanel.transform.FindChild("XField").GetChild(1).GetComponent <Text>().text = pos.x.ToString(); currentEffectPanel.transform.FindChild("YField").GetChild(1).GetComponent <Text>().text = pos.y.ToString(); currentEffectPanel.transform.FindChild("UnitIndex").GetChild(1).GetComponent <Text>().text = enemyEffect.getIndex().ToString(); break; case EffectTypes.enemyConversion: ConversationEffect conEffect = (ConversationEffect)currentEvent.getEffects()[currentEffectIndex]; currentEffectPanel = transform.FindChild("conversationPanel").gameObject; currentEffectPanel.SetActive(true); currentEffectPanel.transform.FindChild("InputField").GetComponent <InputField>().text = ""; print(conEffect.getData()); currentEffectPanel.transform.FindChild("InputField").GetChild(1).GetComponent <Text>().text = conEffect.getData(); break; case EffectTypes.noEffect: currentEffectPanel = null; break; } }