public void CompileWorksWhenCompiledMultipleTimes() { using (var container = new IocContainer()) { // Arrange var foo = new Foo1(); var bar = new Bar1(); container.RegisterInstance <IFoo>(foo); container.RegisterInstance <IBar>(bar); container.Register <IFooBar, FooBar>().WithContainerLifetime(); container.Register <IFooBarContainer, FooBarContainer>().WithContainerLifetime(); // Act container.Compile(); container.Compile(); var fooBarContainer = container.Resolve <IFooBarContainer>(); // Assert Assert.IsNotNull(fooBarContainer); Assert.IsNotNull(fooBarContainer.FooBar); Assert.IsNotNull(fooBarContainer.FooBar.Foo); Assert.IsNotNull(fooBarContainer.FooBar.Bar); Assert.AreEqual(foo, fooBarContainer.FooBar.Foo); Assert.AreEqual(bar, fooBarContainer.FooBar.Bar); } }
/// <summary> /// Creates chart data using the specified data set. /// </summary> /// <param name="dataSet">The data set.</param> protected override void OnCreateChartData(int dataSet) { Bar1.CreateChartData(dataSet); Line1.CreateChartData(dataSet); Line2.CreateChartData(Line2.DataSetCount - 1); Pie1.CreateChartData(2); }
public void TryResolveAllReturnsExpectedInstances() { using (var container = new IocContainer()) { // Arrange var foo1 = new Foo1(); var foo2 = new Foo2(); var foo3 = new Foo2(); var bar1 = new Bar1(); container.RegisterInstance<IFoo>(foo1); container.RegisterInstance<IFoo>("Foo1", foo2); container.RegisterInstance<IFoo>("Foo2", foo3); container.RegisterInstance<IBar>(bar1); // Act var results = container.TryResolveAll<IFoo>(); var resultList = results.ToList(); // Assert Assert.IsTrue(results.Count() == 3); CollectionAssert.Contains(resultList, foo1); CollectionAssert.Contains(resultList, foo2); CollectionAssert.Contains(resultList, foo3); } }
public void TryResolveAllReturnsExpectedInstances() { using (var container = new IocContainer()) { // Arrange var foo1 = new Foo1(); var foo2 = new Foo2(); var foo3 = new Foo2(); var bar1 = new Bar1(); container.RegisterInstance <IFoo>(foo1); container.RegisterInstance <IFoo>(foo2, "Foo1"); container.RegisterInstance <IFoo>(foo3, "Foo2"); container.RegisterInstance <IBar>(bar1); // Act var results = container.TryResolveAll <IFoo>(); var resultList = results.ToList(); // Assert Assert.IsTrue(results.Count() == 3); CollectionAssert.Contains(resultList, foo1); CollectionAssert.Contains(resultList, foo2); CollectionAssert.Contains(resultList, foo3); } }
public void DoSomethingWith(Bar1 bar) { if (bar == null) { Console.WriteLine("Too bad. bar is null."); return; } Console.WriteLine($"1) Foo Uses bar as an association... {bar.SomeInformation} which is used in {nameof(Foo1)}"); }
private void Modificar(object sender, EventArgs args) { Bar1.ProgressTo(1, 15000, Easing.BounceIn); Bar2.ProgressTo(1, 15000, Easing.BounceOut); Bar3.ProgressTo(1, 15000, Easing.CubicIn); Bar4.ProgressTo(1, 15000, Easing.CubicInOut); Bar5.ProgressTo(1, 15000, Easing.CubicOut); Bar6.ProgressTo(1, 15000, Easing.SinIn); Bar7.ProgressTo(1, 15000, Easing.SinInOut); Bar8.ProgressTo(1, 15000, Easing.SinOut); Bar9.ProgressTo(1, 15000, Easing.SpringIn); Bar10.ProgressTo(1, 15000, Easing.SpringOut); }
public void Method() { var b1 = new Bar1(); var b2 = new Bar2(); var b3 = new Bar3(); var b4 = new Bar4(); var b5 = new Bar5(); var b6 = new Bar6(); b1.Method(); b2.Method(); b3.Method(); b4.Method(); b5.Method(); b6.Method(); }
static void Main(string[] args) { Foo foo1 = new Foo(); Bar bar1 = new Bar1(); Bar bar2 = new Bar2(); foo1.Bar1Collection.Add(bar1); foo1.Bar2Collection.Add(bar2); Debug.Assert(bar1.Parent != null); Debug.Assert(bar2.Parent != null); bar1.DoSomething(); bar2.DoSomething(); Console.WriteLine("Done"); Console.ReadLine(); foo1.Dispose(); }
public new void Draw(SpriteBatch spriteBatch) { if (Destroyed) { foreach (var crystal in Crystals) { crystal.Draw(spriteBatch); } } else { if (Health < HealthMax) { Bar1.Draw(spriteBatch, Position, Health, HealthMax); } spriteBatch.Draw(Texture, Position, origin: Origin, rotation: Rotation); } }
public void TryResolveAllByTypeNotRegisteredReturnsEmptyEnumerable() { using (var container = new IocContainer()) { // Arrange var foo1 = new Foo1(); var foo2 = new Foo2(); var bar1 = new Bar1(); container.RegisterInstance <IFoo>(foo1); container.RegisterInstance <IFoo>(foo2, "Foo"); container.RegisterInstance <IBar>(bar1); // Act var results = container.TryResolveAll <IFooBar>(); // Assert Assert.IsTrue(results.Count() == 0); } }
public void TryResolveAllByTypeNotRegisteredReturnsEmptyEnumerable() { using (var container = new IocContainer()) { // Arrange var foo1 = new Foo1(); var foo2 = new Foo2(); var bar1 = new Bar1(); container.RegisterInstance<IFoo>(foo1); container.RegisterInstance<IFoo>("Foo", foo2); container.RegisterInstance<IBar>(bar1); // Act var results = container.TryResolveAll<IFooBar>(); // Assert Assert.IsTrue(results.Count() == 0); } }
public void CompileCanInlineInstanceRegistrations() { // Doesnt check that Compile actually works - just that it doesnt break anything using (var container = new IocContainer()) { var i1 = new Foo1(); var i2 = new Bar1(); container.RegisterInstance(i1); container.RegisterInstance(i2); var reg1 = container.Register<IFooBar>(x => new FooBar(x.Resolve<Foo1>(), x.Resolve<Bar1>())); container.Compile(); var result = (IFooBar)container.Resolve(reg1); Assert.AreEqual(i1, result.Foo); } }
public void CompileCanInlineInstanceRegistrations() { // Doesnt check that Compile actually works - just that it doesnt break anything using (var container = new IocContainer()) { var i1 = new Foo1(); var i2 = new Bar1(); container.RegisterInstance(i1); container.RegisterInstance(i2); var reg1 = container.Register <IFooBar>(x => new FooBar(x.Resolve <Foo1>(), x.Resolve <Bar1>())); container.Compile(); var result = (IFooBar)reg1.GetInstance(); Assert.AreEqual(i1, result.Foo); } }
public void CompileUsingKeyDoesntBreakUsingCompileModeDynamicWhenUsingInstanceRegistrationOrContainerLifetime() { // Test that InstanceRegistration and ContainerLifetime works using CompileMode Dynamic (should not be inlined) using (var container = new IocContainer(defaultCompileMode: CompileMode.Dynamic)) { var barInstance = new Bar1(); var reg1 = container.Register<IFoo, Foo1>("FirstKey").WithContainerLifetime(); var reg2 = container.RegisterInstance<IBar>(barInstance, "SecondKey"); var reg3 = container.Register<IFooBar>(x => new FooBar(x.Resolve<IFoo>("FirstKey"), x.Resolve<IBar>("SecondKey"))); container.Compile(); var res1 = container.Resolve<IFooBar>(); var res2 = container.Resolve<IFooBar>(); // Assert Assert.AreNotSame(res1, res2); Assert.AreSame(barInstance, res1.Bar); Assert.AreSame(res1.Foo, res2.Foo); } }
public void CompileUsingKeyDoesntBreakUsingCompileModeDynamicWhenUsingInstanceRegistrationOrContainerLifetime() { // Test that InstanceRegistration and ContainerLifetime works using CompileMode Dynamic (should not be inlined) using (var container = new IocContainer(defaultCompileMode: CompileMode.Dynamic)) { var barInstance = new Bar1(); var reg1 = container.Register <IFoo, Foo1>("FirstKey").WithContainerLifetime(); var reg2 = container.RegisterInstance <IBar>(barInstance, "SecondKey"); var reg3 = container.Register <IFooBar>(x => new FooBar(x.Resolve <IFoo>("FirstKey"), x.Resolve <IBar>("SecondKey"))); container.Compile(); var res1 = container.Resolve <IFooBar>(); var res2 = container.Resolve <IFooBar>(); // Assert Assert.AreNotSame(res1, res2); Assert.AreSame(barInstance, res1.Bar); Assert.AreSame(res1.Foo, res2.Foo); } }
int polarEnable = 0; // кнопка для открытия формы с графиком солнечной панели и ее переменная-счетчк открытия private void ShowBar(object sender, RoutedEventArgs e) { string win = ""; foreach (Window window in Application.Current.Windows) { win += window.ToString(); if (window.Title == "Монитор Солнечной панели") { window.Close(); //wingraptab.Close(); polarEnable = 1; // MessageBox.Show(win); break; } ; } if (polarEnable == 0) { Bar1 barTabSwhov = new Bar1(); barTabSwhov.Owner = this; barTabSwhov.WindowStartupLocation = System.Windows.WindowStartupLocation.Manual; double Top = this.Top; double Left = this.Left; barTabSwhov.Left = this.Left + (this.Height + 200); barTabSwhov.Top = this.Top; barTabSwhov.Show(); } else { polarEnable = 0; } }
public Foo1(Bar1 bar) { }
private Foo1 CreateFoo1(Bar1 bar1) { return(new Foo1(bar1.Id, bar1.Name, ...)); }
public void ModificarBarras(object sender, EventArgs e) { Bar1.ProgressTo(1, 3000, Easing.CubicIn); Bar2.ProgressTo(1, 5000, Easing.BounceIn); Bar3.ProgressTo(1, 5000, Easing.SpringOut); }
public override int GetHashCode() { return(Bar1.GetHashCode() + 17 * (Bar2 ?? "").GetHashCode()); }
private async void BarView1_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.AddedItems.Count == 0 || Bar1 == null || Bar2 == null || barComparer == null) { return; } // e.Handled = true; try { ImageViewer1.Visibility = Visibility.Collapsed; ImageViewer2.Visibility = Visibility.Collapsed; XMLViewer1.Visibility = Visibility.Collapsed; XMLViewer1.Text = ""; XMLViewer2.Visibility = Visibility.Collapsed; XMLViewer2.Text = ""; BarComparerEntry entry = (BarComparerView.SelectedItem as BarComparerEntry); if (entry == null) { return; } BarEntry entryOld = entry.entryOld; BarEntry entryNew = entry.entryNew; await Bar1.readFile(entryOld); await Bar2.readFile(entryNew); if (Bar1.Preview != null && Bar2.Preview != null) { try { IEnumerable <string> Old = new List <string>(); IEnumerable <string> New = new List <string>(); await Task.Run(() => { var diff = SideBySideDiffBuilder.Diff(Bar1.Preview.Text, Bar2.Preview.Text); Old = diff.OldText.Lines.Select(x => { if (x.Type == ChangeType.Inserted || x.SubPieces.Any(x => x.Type == ChangeType.Inserted)) { return("!+ " + x.Text); } if (x.Type == ChangeType.Deleted || x.SubPieces.Any(x => x.Type == ChangeType.Deleted)) { return("!- " + x.Text); } return(" " + x.Text); } ); New = diff.NewText.Lines.Select(x => { if (x.Type == ChangeType.Inserted || x.SubPieces.Any(x => x.Type == ChangeType.Inserted)) { return("!+ " + x.Text); } if (x.Type == ChangeType.Deleted || x.SubPieces.Any(x => x.Type == ChangeType.Deleted)) { return("!- " + x.Text); } return(" " + x.Text); }); }); XMLViewer1.Text = string.Join("\n", Old); XMLViewer2.Text = string.Join("\n", New); } catch { } } if (entryNew == null) { if (Bar1.Preview != null) { XMLViewer1.Text = Bar1.Preview.Text; } } if (entryOld == null) { if (Bar2.Preview != null) { XMLViewer2.Text = Bar2.Preview.Text; } } if (entryOld != null) { if (entryOld.Extension == ".DDT") { ImagePreview1.Source = Bar1.PreviewDdt.Bitmap; XMLViewer1.Visibility = Visibility.Collapsed; ImageViewer1.Visibility = Visibility.Visible; } else if (entryOld.Extension == ".BMP" || entryOld.Extension == ".PNG" || entryOld.Extension == ".CUR" || entryOld.Extension == ".JPG") { ImagePreview1.Source = Bar1.PreviewImage; XMLViewer1.Visibility = Visibility.Collapsed; ImageViewer1.Visibility = Visibility.Visible; } else if (entryOld.Extension == ".XMB" || entryOld.Extension == ".XML" || entryOld.Extension == ".SHP" || entryOld.Extension == ".LGT" || entryOld.Extension == ".XS" || entryOld.Extension == ".TXT" || entryOld.Extension == ".CFG" || entryOld.Extension == ".XAML" || entryNew.Extension == ".PY") { ImageViewer1.Visibility = Visibility.Collapsed; XMLViewer1.Visibility = Visibility.Visible; } else { ImageViewer1.Visibility = Visibility.Collapsed; XMLViewer1.Visibility = Visibility.Collapsed; } } if (entryNew != null) { if (entryNew.Extension == ".DDT") { ImagePreview2.Source = Bar2.PreviewDdt.Bitmap; XMLViewer2.Visibility = Visibility.Collapsed; ImageViewer2.Visibility = Visibility.Visible; } else if (entryNew.Extension == ".BMP" || entryNew.Extension == ".PNG" || entryNew.Extension == ".CUR" || entryNew.Extension == ".JPG") { ImagePreview2.Source = Bar2.PreviewImage; XMLViewer2.Visibility = Visibility.Collapsed; ImageViewer2.Visibility = Visibility.Visible; } else if (entryNew.Extension == ".XMB" || entryNew.Extension == ".XML" || entryNew.Extension == ".SHP" || entryNew.Extension == ".LGT" || entryNew.Extension == ".XS" || entryNew.Extension == ".TXT" || entryNew.Extension == ".CFG" || entryNew.Extension == ".XAML" || entryNew.Extension == ".PY") { ImageViewer2.Visibility = Visibility.Collapsed; XMLViewer2.Visibility = Visibility.Visible; } else { ImageViewer2.Visibility = Visibility.Collapsed; XMLViewer2.Visibility = Visibility.Collapsed; } } } catch (Exception ex) { // MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void Controller_StatusTextChanged(StatusTextChangedEventArgs e) { LabelItem1.Text = e.NewStatus; Bar1.Refresh(); }
public void CompileWorksWhenCompiledMultipleTimes() { using (var container = new IocContainer()) { // Arrange var foo = new Foo1(); var bar = new Bar1(); container.RegisterInstance<IFoo>(foo); container.RegisterInstance<IBar>(bar); container.Register<IFooBar, FooBar>().WithContainerLifetime(); container.Register<IFooBarContainer, FooBarContainer>().WithContainerLifetime(); // Act container.Compile(); container.Compile(); var fooBarContainer = container.Resolve<IFooBarContainer>(); // Assert Assert.IsNotNull(fooBarContainer); Assert.IsNotNull(fooBarContainer.FooBar); Assert.IsNotNull(fooBarContainer.FooBar.Foo); Assert.IsNotNull(fooBarContainer.FooBar.Bar); Assert.AreEqual(foo, fooBarContainer.FooBar.Foo); Assert.AreEqual(bar, fooBarContainer.FooBar.Bar); } }
public void OnClickBartender() { if (LevelChoisi >= 4 && (ItemBar_0 != null || ItemBar_1 != null || ItemBar_2 != null)) { GameObject.Find("DragManager").GetComponent <BoxCollider2D>().enabled = false; GameObject.Find("DragManager").GetComponent <DragHandler>().enabled = false; Bar2.SetActive(true); Bar1.SetActive(false); if (Items[0] > 0) { ItemBar_0.transform.position = new Vector3(-8, -1.5f, 0); if (Items[0] == 11 || Items[0] == 12) { ItemBar_0.transform.localScale += transform.localScale * 0.08f; } else { ItemBar_0.transform.localScale += transform.localScale * 0.8f; } ItemBar_0.GetComponent <SpriteRenderer>().sortingLayerName = "Bouteilles2"; } if (Items[1] > 0) { ItemBar_1.transform.position = new Vector3(-6, -1.5f, 0); if (Items[1] == 11 || Items[1] == 12) { ItemBar_1.transform.localScale += transform.localScale * 0.08f; } else { ItemBar_1.transform.localScale += transform.localScale * 0.8f; } ItemBar_1.GetComponent <SpriteRenderer>().sortingLayerName = "Bouteilles2"; } if (Items[2] > 0) { ItemBar_2.transform.position = new Vector3(-4, -1.5f, 0); if (Items[2] == 11 || Items[2] == 12) { ItemBar_2.transform.localScale += transform.localScale * 0.08f; } else { ItemBar_2.transform.localScale += transform.localScale * 0.8f; } ItemBar_2.GetComponent <SpriteRenderer>().sortingLayerName = "Bouteilles2"; } } else { ID_Cocktail = Shaker(); DestroyObject(ItemBar_0); DestroyObject(ItemBar_1); DestroyObject(ItemBar_2); Items = new int[3] { 0, 0, 0 }; Debug.Log("Cocktail ID : " + ID_Cocktail); } if (ID_Cocktail != -1) { Vector3 TMP_POS = Camera.main.ScreenToWorldPoint(Input.mousePosition); if (ID_Cocktail == 0) { GameObject.Find("Barman").GetComponent <AudioSource>().clip = bad; GameObject.Find("Barman").GetComponent <AudioSource>().Play(); Instantiate(Resources.Load <GameObject>("Prefab/FxParticle/ParticleBad"), new Vector3(TMP_POS.x, TMP_POS.y, -1), transform.rotation); } else { GameObject.Find("Barman").GetComponent <AudioSource>().clip = good; GameObject.Find("Barman").GetComponent <AudioSource>().Play(); Instantiate(Resources.Load <GameObject>("Prefab/FxParticle/ParticleGood"), new Vector3(TMP_POS.x, TMP_POS.y, -1), transform.rotation); } Sprite Cursor_Sprite = Resources.Load <Sprite>("Prefab/Boissons/" + ID_Cocktail); Cursor.SetCursor(Cursor_Sprite.texture, new Vector2(Cursor_Sprite.texture.width / 2, Cursor_Sprite.texture.height / 2), CursorMode.ForceSoftware); } }
public Foo(Bar1 bar1, Bar2 bar2) { Bar1 = bar1; Bar2 = bar2; }
public Foo(Bar1 <Bar2> generic) { }
private void Controller_OtherStatusInfosChanged(OtherStatusInfosChangedEventArgs e) { LabelItem_OtherInfoText.Text = e.Text; LabelItem_OtherInfoText.ForeColor = e.ForeColor; Bar1.Refresh(); }
void Update() { StartCoroutine("BGM"); Debug.Log(Status); if (SceneManager.GetActiveScene().name != "MenuPrincipal") { MenuPrincipal.SetActive(false); } switch (Status) { case GameState.MainMenu: MenuPrincipal.SetActive(true); Play.SetActive(false); Recettes.SetActive(false); Credits.SetActive(false); Highscore.SetActive(false); break; case GameState.SelectLevel: CheckSave(); Play.SetActive(true); break; case GameState.Recettes: Recettes.SetActive(true); break; case GameState.Credits: Credits.SetActive(true); break; case GameState.Highscore: CheckSave(); Highscore.SetActive(true); Highscore.transform.Find("HighscoreText").GetComponent <Text>().text = String.Format("Votre Highscore est : \n\n Level 1 : {0} \n Level 2 : {1} \n Level 3 : {2} \n Level 4 : {3} \n Level 5 : {4}", _DataBase.Tab_Score[0], _DataBase.Tab_Score[1], _DataBase.Tab_Score[2], _DataBase.Tab_Score[3], _DataBase.Tab_Score[4]); break; case GameState.Quitter: Application.Quit(); break; case GameState.Reset: _DataBase.ResetScore(); _DataBase.GetSave(); CheckSave(); Status = GameState.MainMenu; break; case GameState.Start: Loading.SetActive(true); MenuPrincipal.SetActive(true); Play.SetActive(false); Recettes.SetActive(false); Credits.SetActive(false); Highscore.SetActive(false); Loading.GetComponent <LoadingScreen>().Loading(0); GameManager.Status = GameState.Loading; break; case GameState.Playing: if (SceneManager.GetActiveScene().name == "Jeu") { Rnd = new System.Random(seed++); AddCustomer(); if (Input.GetMouseButtonDown(0)) { Vector3 CAM_POS = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 0)); Collider2D Collider = Physics2D.OverlapPoint(CAM_POS); if (Collider) { switch (Collider.tag) { case "Customer": Collider.gameObject.GetComponent <Customer>().CheckOrder(ID_Cocktail); Items = new int[3] { 0, 0, 0 }; ID_Cocktail = -1; Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto); break; case "Items": if (Bar1.activeInHierarchy == true) { Items[Collider.gameObject.GetComponent <Item>().IndexItemID] = 0; DestroyObject(Collider.gameObject); } else if (Bar2.activeInHierarchy == true) { if (GameObject.Find("DragManager").GetComponent <DragHandler>().ItemObject == null) { GameObject.Find("DragManager").GetComponent <DragHandler>().ItemObject = Collider.transform; Collider.transform.position = new Vector3(2.5f, -1.5f, 0); GameObject.Find("DragManager").GetComponent <DragHandler>().StartPos = Collider.transform.position; GameObject.Find("DragManager").GetComponent <DragHandler>().StartRotation = new Vector3(Collider.transform.eulerAngles.x, Collider.transform.eulerAngles.y, Collider.transform.eulerAngles.z); } } break; case "Shaker": GameObject[] ObjectItems = GameObject.FindGameObjectsWithTag("Items"); int PouredNumber = ObjectItems.Length; foreach (GameObject ObjectItem in ObjectItems) { if (ObjectItem.GetComponent <Item>().IsPoured == false && ObjectItem.GetComponent <Item>().AlreadyPoured == false) { PouredNumber--; } } if (PouredNumber == ObjectItems.Length) // Si toutes les ingérdients on été verser { ID_Cocktail = Shaker(); } else if (PouredNumber != 0) // manque des ingrédients { ID_Cocktail = 0; } else // rien { ID_Cocktail = -1; } Debug.Log(ID_Cocktail); DestroyObject(ItemBar_0); DestroyObject(ItemBar_1); DestroyObject(ItemBar_2); Items = new int[3] { 0, 0, 0 }; Bar2.SetActive(false); Bar1.SetActive(true); GameObject.Find("DragManager").GetComponent <BoxCollider2D>().enabled = false; GameObject.Find("DragManager").GetComponent <DragHandler>().enabled = false; if (ID_Cocktail != -1) { Vector3 TMP_POS = Camera.main.ScreenToWorldPoint(Input.mousePosition); if (ID_Cocktail == 0) { GameObject.Find("Barman").GetComponent <AudioSource>().clip = bad; GameObject.Find("Barman").GetComponent <AudioSource>().Play(); Instantiate(Resources.Load <GameObject>("Prefab/FxParticle/ParticleBad"), new Vector3(TMP_POS.x, TMP_POS.y, -1), transform.rotation); } else { GameObject.Find("Barman").GetComponent <AudioSource>().clip = good; GameObject.Find("Barman").GetComponent <AudioSource>().Play(); Instantiate(Resources.Load <GameObject>("Prefab/FxParticle/ParticleGood"), new Vector3(TMP_POS.x, TMP_POS.y, -1), transform.rotation); } Sprite Cursor_Sprite = Resources.Load <Sprite>("Prefab/Boissons/" + ID_Cocktail); Cursor.SetCursor(Cursor_Sprite.texture, new Vector2(Cursor_Sprite.texture.width / 2, Cursor_Sprite.texture.height / 2), CursorMode.ForceSoftware); } break; case "BorderCollider": Bar2.SetActive(false); ItemBar_0.transform.position = new Vector3(3.5f, -1.5f, 0); ItemBar_0.transform.localScale = ItemBar_0.GetComponent <Item>().DefaultScale; ItemBar_1.transform.position = new Vector3(2.5f, -1.5f, 0); ItemBar_1.transform.localScale = ItemBar_0.GetComponent <Item>().DefaultScale; ItemBar_2.transform.position = new Vector3(1.5f, -1.5f, 0); ItemBar_2.transform.localScale = ItemBar_0.GetComponent <Item>().DefaultScale; Bar1.SetActive(true); break; } } } } break; case GameState.GameClear: Items = new int[3] { 0, 0, 0 }; _DataBase.SaveScore(LevelChoisi, Score); CheckSave(); Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto); SpawnTimerSecs = 1; if (Score >= OffsetScoreRequired[LevelChoisi - 1, 0] && Score < OffsetScoreRequired[LevelChoisi - 1, 1]) { Stars = 1; } else if (Score >= OffsetScoreRequired[LevelChoisi - 1, 1] && Score < OffsetScoreRequired[LevelChoisi - 1, 2]) { Stars = 2; } else if (Score >= OffsetScoreRequired[LevelChoisi - 1, 2]) { Stars = 3; } Loading.SetActive(true); Loading.GetComponent <LoadingScreen>().Loading(0); GameManager.Status = GameState.Loading; break; case GameState.Tuto: Loading.SetActive(true); MenuPrincipal.SetActive(true); Play.SetActive(false); Recettes.SetActive(false); Credits.SetActive(false); Highscore.SetActive(false); Loading.GetComponent <LoadingScreen>().Loading(1); GameManager.Status = GameState.Loading; break; case GameState.FinTuto: GameObject.Find("Tuto6").SetActive(false); Loading.SetActive(true); MenuPrincipal.SetActive(true); Play.SetActive(false); Recettes.SetActive(false); Credits.SetActive(false); Highscore.SetActive(false); Loading.GetComponent <LoadingScreen>().Loading(0); GameManager.Status = GameState.MainMenu; break; } }
/// <summary> /// Called on each bar update event (incoming tick) /// </summary> protected override void OnBarUpdate() { // Try to connect, if we are not yet connected. // We do this here so that we do not connect everytime the indicator is instanciated. // Indicators are often instanciated several times before they are actually used. if (_indicatorState == IndicatorState.Uninitialized) { OpenConnection(); } // Are we in an error state? If so, display and exit. if (_indicatorState == IndicatorState.Error) { DrawError(); return; } // If we are actually connected to a socket, then communicate with it. if (_sock != null) { StringBuilder line = new StringBuilder(); long when = Time[0].Second + Time[0].Minute * 100l + Time[0].Hour * 10000l + Time[0].Day * 1000000l + Time[0].Month * 100000000l + Time[0].Year * 10000000000l; line.Append("\"" + PACKET_BAR + "\","); line.Append(when); line.Append(",\""); line.Append(this.Instrument.FullName); line.Append("\""); foreach (string name in _sourceData) { IDataSeries source; int totalBars = 1; string name2 = name; ParseArraySize(name, ref totalBars, ref name2); if (string.Compare(name2, "HIGH", true) == 0) { source = High; } else if (string.Compare(name2, "LOW", true) == 0) { source = Low; } else if (string.Compare(name2, "OPEN", true) == 0) { source = Open; } else if (string.Compare(name2, "CLOSE", true) == 0) { source = Close; } else if (string.Compare(name2, "VOL", true) == 0) { source = Volume; } else if (string.Compare(name2, "THIS", true) == 0) { source = Values[0]; } else { source = Eval(name2); if (source == null) { return; } } // now copy needed data var cnt = CurrentBar + 1; for (int i = 0; i < totalBars; i++) { line.Append(","); if (i >= cnt) { line.Append("?"); } else { //line.Append(Convert.ToString(source[i])); line.Append(Convert.ToString(source[i], _cultureUSA)); } } } Send(line.ToString()); // if we are expecting data back from the socket, then wait for it. if (_blockingMode) { // we are now waiting for a bar _indicatorState = IndicatorState.SentBar; while (_indicatorState != IndicatorState.Error && _indicatorState != IndicatorState.Ready) { WaitForPacket(); } // we got a bar message, then display it if (_indicatorState == IndicatorState.Ready) { if (!double.IsNaN(_indicatorData[0])) { Plot1.Set(_indicatorData[0]); } if (!double.IsNaN(_indicatorData[1])) { Plot2.Set(_indicatorData[1]); } if (!double.IsNaN(_indicatorData[2])) { Plot3.Set(_indicatorData[2]); } if (!double.IsNaN(_indicatorData[3])) { Bar1.Set(_indicatorData[3]); } if (!double.IsNaN(_indicatorData[4])) { Bar2.Set(_indicatorData[4]); } if (!double.IsNaN(_indicatorData[5])) { Bar3.Set(_indicatorData[5]); } if (!double.IsNaN(_indicatorData[6])) { IndSell.Set(_indicatorData[6]); } if (!double.IsNaN(_indicatorData[7])) { IndBuy.Set(_indicatorData[7]); } } } else { var hold = this.DrawOnPricePanel; DrawOnPricePanel = false; DrawTextFixed("general msg", "This indicator only sends data, so there is no display.", TextPosition.Center); DrawOnPricePanel = hold; } } }
public Foo(FooSettings settings) { Settings = settings; Bar1 = new Bar1(Settings); Bar2 = new Bar2(Settings); }
public void Visit(Bar1 foo) { Console.WriteLine("Bar1 ID:" + foo.Id); }