public void ActivateTutorial(string _tutorialID) { TutorialObject _object = _tutorialObjects.Find(o => o.TutorialID == _tutorialID); if (_object != null) { _activeTutorial = _object; OnActive?.Invoke(_activeTutorial); } else { throw new ArgumentNullException("Tutorial Not Found"); } }
public async Task <string> Work(int fuelTankVolume, WriterDelegate writerDelegate) { try { int time = 3000; var step = time * Volume / 1000; for (int i = 0; i < fuelTankVolume; i += step) { if (i == step) { OnActive?.Invoke(this, new EventArgs()); } await Task.Delay(time); writerDelegate($"{this.ToString()} Мощность = {Power} лс"); } OnDeactivate?.Invoke(this, new EventArgs()); return("ok"); } catch (Exception ex) { return(ex.Message); } }
void OnEnable() { OnActive.Invoke(); }
override public void Interact() { base.Interact(); OnActive?.Invoke(); }
public override bool Active() { OnActive.Invoke(); return(base.Active()); }
private void CreateGateButtons(InputContainer componentMenu, GameMenu gameMenu) { List <TextureField> icons = new List <TextureField>(); ButtonTexture bt = new ButtonTexture( InputController.DefaultTexture, new Color(50, 50, 50), new Color(100, 100, 100), new Color(75, 75, 75), new Color(95, 115, 255) ); int buttonSize = (Width - (ButtonPrRow + 1) * BPadding) / ButtonPrRow; int offsetY = 0; for (int i = 0; i < gateTypes.Count; i++) { Type gateType = gateTypes[i]; int offsetX = (i % ButtonPrRow); offsetX = offsetX * buttonSize + offsetX * BPadding; offsetY = (i / ButtonPrRow); offsetY = offsetY * buttonSize + offsetY * BPadding; Rectangle bounds = new Rectangle(X + BPadding + offsetX, Y + BPadding + offsetY, buttonSize, buttonSize); Rectangle iconBounds = bounds; iconBounds.Inflate(-4, -4); Texture2D texture; if (gameMenu.GateTextureMap.ContainsKey(gateType.FullName)) { texture = gameMenu.GateTextureMap[gateType.FullName]; } else { texture = InputController.DefaultTexture; } TextureField icon = new TextureField(iconBounds, texture, Color.White); Button temp = new Button(bounds, bt, new Text("", Color.White)); temp.ID = gateType.FullName; icons.Add(icon); group.Add(temp, false); } group.BeforeSelectedButtonChange += (object sender, ButtonEventArgs e) => { if (group.SelectedButton != null) { Containers[group.SelectedButton.ID].Active = false; Containers[group.SelectedButton.ID].DeFocus(); } if (!Selected) { OnActive?.Invoke(); } }; group.AfterSelectedButtonChange += (object sender, ButtonEventArgs e) => { Containers[e.Button.ID].Active = true; Containers[e.Button.ID].Focus(); }; componentMenu.Add(group); componentMenu.Add(icons); CurrentY = offsetY + buttonSize + BPadding; }