void UpdateHotspotVisibility() { if (_hotSpotStartEvent != null) { _hotSpotStartEvent.Visible = HasEngineInstance() && EngineFmodEvent.IsValid(); } }
void UpdatePlayIcon() { if (!HasEngineInstance() || _hotSpotStartEvent == null) { return; } _hotSpotStartEvent.ShowStopIcon = EngineFmodEvent.IsPlaying(); }
/// <summary> /// Start the event in the editor (e.g. hotspot button pressed) /// </summary> public void ToggleStartEvent() { if (!HasEngineInstance()) { return; } if (EngineFmodEvent.IsPlaying()) { EngineFmodEvent.Stop(); } else { // Force the event to start, even if we are not in play mode EngineFmodEvent.Start(true); } UpdatePlayIcon(); }
/// <summary> /// Overridden function /// </summary> public override void OnSelected() { base.OnSelected(); // start button _hotSpotStartEvent = new HotSpotPlayButton(this, @"textures\Media_play.TGA", VisionColors.RGBA(200, 200, 200, 255), VisionColors.White, 15.0f); _hotSpotStartEvent.ToolTipText = "Start event"; _hotSpotStartEvent.Set2DOffset(0.0f, 30.0f); EditorManager.ActiveView.HotSpots.Add(_hotSpotStartEvent); // Update the engine instance, in order to offer stolen info-only events the possibility to convert into a playable event instance. Thus hotspot button // will be always available for all event instances. Please note: All stolen event instances, which have a "Max playbacks behavior" without failing // (1 = steal oldest, 2 = steal newest, 3 = steal quietest), will not recover. This is absolute necessary, in order to avoid an endless cycle of stealing // and recovering of such event instances, as none of the requests for a not info-only event will fail. Thus for these events, the hotspot button will // not be available. EngineFmodEvent.Update(); UpdateHotspotVisibility(); }