public EventHandlerSource(RuntimeEvent @event, object owner) { this.@event = @event; this.owner = owner; eventHandler = @event.CreateDelegate(this, HandleOwnerEventMethodInfo); }
public EventCommandTrigger(RuntimeEvent @event, object owner) { _event = @event; Owner = owner; _eventHandler = @event.CreateDelegate(this, HandleOwnerEventMethodInfo); }
void OnGreedyEvent(RuntimeEvent greedy_events) { Debug.Log(String.Format("OnGreedyEvent - {0}", greedy_events)); if (greedy_events == RuntimeEvent.CAMPAIGN_LOADED || greedy_events == RuntimeEvent.CAMPAIGN_NOT_LOADED) { //Application.LoadLevel (1); } }
protected override void OnRaiseRuntimeEvent(RuntimeEvent runtimeEvent) { lock (_eventsLock) { foreach (var eventHandler in _eventHandlers) { runtimeEvent.HandleEvent(eventHandler); } } }
private bool HasOffRuntimePolicy(RuntimeEvent policyName) { var policy = DetermineAndStoreAccumulatedRuntimePolicy(policyName); if (policy.HasFlag(RuntimePolicy.Off)) { return(true); } return(false); }
private bool HasOffRuntimePolicy(RuntimeEvent policyName) { var policy = GetRuntimePolicy(policyName); if (policy.HasFlag(RuntimePolicy.Off)) { return(true); } return(false); }
private void ExecuteTabs(RuntimeEvent runtimeEvent) { var runtimeContext = Configuration.FrameworkProvider.RuntimeContext; var frameworkProviderRuntimeContextType = runtimeContext.GetType(); var messageBroker = Configuration.MessageBroker; // Only use tabs that either don't specify a specific context type, or have a context type that matches the current framework provider's. var runtimeTabs = Configuration.Tabs.Where( tab => tab.RequestContextType == null || frameworkProviderRuntimeContextType.IsSubclassOf(tab.RequestContextType) || tab.RequestContextType == frameworkProviderRuntimeContextType); var supportedRuntimeTabs = runtimeTabs.Where(p => p.ExecuteOn.HasFlag(runtimeEvent)); var tabResultsStore = TabResultsStore; var logger = Configuration.Logger; foreach (var tab in supportedRuntimeTabs) { TabResult result; var key = CreateKey(tab); try { var tabContext = new TabContext(runtimeContext, GetTabStore(key), logger, messageBroker); var tabData = tab.GetData(tabContext); var tabSection = tabData as TabSection; if (tabSection != null) { tabData = tabSection.Build(); } result = new TabResult(tab.Name, tabData); } catch (Exception exception) { result = new TabResult(tab.Name, exception.ToString()); logger.Error(Resources.ExecuteTabError, exception, key); } if (tabResultsStore.ContainsKey(key)) { tabResultsStore[key] = result; } else { tabResultsStore.Add(key, result); } } }
public static void TriggerEvent(int id, RuntimeData runnignData) { if (id == 0) { return; } var skill = GetEvent(id); RuntimeEvent re = new RuntimeEvent(); re.Init(skill, runnignData); re.FinishAction = OnFinish; runtimeEvents.Add(re); DLog.Log("trigger event " + id); }
private RuntimePolicy GetRuntimePolicy(RuntimeEvent runtimeEvent) { var frameworkProvider = Configuration.FrameworkProvider; var requestStore = frameworkProvider.HttpRequestStore; // Begin with the lowest policy for this request, or the lowest policy per config var finalResult = requestStore.Contains(Constants.RuntimePolicyKey) ? requestStore.Get <RuntimePolicy>(Constants.RuntimePolicyKey) : Configuration.DefaultRuntimePolicy; if (!finalResult.HasFlag(RuntimePolicy.Off)) { var logger = Configuration.Logger; // only run policies for this runtimeEvent, or all runtime events var policies = Configuration.RuntimePolicies.Where( policy => policy.ExecuteOn.HasFlag(runtimeEvent)); var policyContext = new RuntimePolicyContext(frameworkProvider.RequestMetadata, Configuration.Logger, frameworkProvider.RuntimeContext); foreach (var policy in policies) { var policyResult = RuntimePolicy.Off; try { policyResult = policy.Execute(policyContext); if (policyResult != RuntimePolicy.On) { logger.Debug("RuntimePolicy set to '{0}' by IRuntimePolicy of type '{1}' during RuntimeEvent '{2}'.", policyResult, policy.GetType(), runtimeEvent); } } catch (Exception exception) { logger.Warn("Exception when executing IRuntimePolicy of type '{0}'. RuntimePolicy is now set to 'Off'.", exception, policy.GetType()); } // Only use the lowest policy allowed for the request if (policyResult < finalResult) { finalResult = policyResult; } } } // store result for request requestStore.Set(Constants.RuntimePolicyKey, finalResult); return(finalResult); }
private RuntimePolicy DetermineRuntimePolicy(RuntimeEvent runtimeEvent, RuntimePolicy maximumAllowedPolicy) { if (maximumAllowedPolicy == RuntimePolicy.Off) { return(maximumAllowedPolicy); } var frameworkProvider = Configuration.FrameworkProvider; var logger = Configuration.Logger; // only run policies for this runtimeEvent var policies = Configuration.RuntimePolicies.Where( policy => policy.ExecuteOn.HasFlag(runtimeEvent)); var policyContext = new RuntimePolicyContext(frameworkProvider.RequestMetadata, Configuration.Logger, frameworkProvider.RuntimeContext); foreach (var policy in policies) { var policyResult = RuntimePolicy.Off; try { policyResult = policy.Execute(policyContext); if (policyResult != RuntimePolicy.On) { logger.Debug("RuntimePolicy set to '{0}' by IRuntimePolicy of type '{1}' during RuntimeEvent '{2}'.", policyResult, policy.GetType(), runtimeEvent); } } catch (Exception exception) { logger.Warn("Exception when executing IRuntimePolicy of type '{0}'. RuntimePolicy is now set to 'Off'.", exception, policy.GetType()); } // Only use the lowest policy allowed for the request if (policyResult < maximumAllowedPolicy) { maximumAllowedPolicy = policyResult; } // If the policy indicates Glimpse is Off, then we stop processing any other runtime policy if (maximumAllowedPolicy == RuntimePolicy.Off) { break; } } return(maximumAllowedPolicy); }
private void EventManager_OnSubEventOccuring(RuntimeEvent ge, RuntimeSubEvent se) { if (!ge.eventRef.useSubEventMessages) { return; } int index; string message; Debug.Log(se.eventRef.label + " Starting"); index = Random.Range(0, se.eventRef.startingMessage.Length); message = se.eventRef.startingMessage[index]; MessageBox.DisplayMessage(se.eventRef.label, message); }
private RuntimePolicy DetermineAndStoreAccumulatedRuntimePolicy(RuntimeEvent runtimeEvent) { var frameworkProvider = Configuration.FrameworkProvider; var requestStore = frameworkProvider.HttpRequestStore; // First determine the maximum allowed policy to start from. This is or the current stored runtime policy for this // request, or if none can be found, the default runtime policy set in the configuration var maximumAllowedPolicy = requestStore.Contains(Constants.RuntimePolicyKey) ? requestStore.Get <RuntimePolicy>(Constants.RuntimePolicyKey) : Configuration.DefaultRuntimePolicy; maximumAllowedPolicy = DetermineRuntimePolicy(runtimeEvent, maximumAllowedPolicy); // store result for request requestStore.Set(Constants.RuntimePolicyKey, maximumAllowedPolicy); return(maximumAllowedPolicy); }
private void EventManager_OnEventOccuring(RuntimeEvent ge) { if (ge.eventRef.useSubEventMessages) { return; } int index; string message; Debug.Log(ge.eventRef.name + " Starting"); if (ge.ID < onEventStarts.Count) { onEventStarts[ge.ID].Invoke(); } index = Random.Range(0, ge.eventRef.startingMessage.Length); message = ge.eventRef.startingMessage[index]; MessageBox.DisplayMessage(ge.eventRef.name, message); }
private bool HasOffRuntimePolicy(RuntimeEvent policyName) { var policy = GetRuntimePolicy(policyName); if (policy.HasFlag(RuntimePolicy.Off)) { return true; } return false; }
private RuntimePolicy GetRuntimePolicy(RuntimeEvent runtimeEvent) { var frameworkProvider = Configuration.FrameworkProvider; var requestStore = frameworkProvider.HttpRequestStore; // Begin with the lowest policy for this request, or the lowest policy per config var finalResult = requestStore.Contains(Constants.RuntimePolicyKey) ? requestStore.Get<RuntimePolicy>(Constants.RuntimePolicyKey) : Configuration.DefaultRuntimePolicy; if (!finalResult.HasFlag(RuntimePolicy.Off)) { var logger = Configuration.Logger; // only run policies for this runtimeEvent, or all runtime events var policies = Configuration.RuntimePolicies.Where( policy => policy.ExecuteOn.HasFlag(runtimeEvent)); var policyContext = new RuntimePolicyContext(frameworkProvider.RequestMetadata, Configuration.Logger, frameworkProvider.RuntimeContext); foreach (var policy in policies) { var policyResult = RuntimePolicy.Off; try { policyResult = policy.Execute(policyContext); if (policyResult != RuntimePolicy.On) { logger.Debug("RuntimePolicy set to '{0}' by IRuntimePolicy of type '{1}' during RuntimeEvent '{2}'.", policyResult, policy.GetType(), runtimeEvent); } } catch (Exception exception) { logger.Warn("Exception when executing IRuntimePolicy of type '{0}'. RuntimePolicy is now set to 'Off'.", exception, policy.GetType()); } // Only use the lowest policy allowed for the request if (policyResult < finalResult) { finalResult = policyResult; } } } // store result for request requestStore.Set(Constants.RuntimePolicyKey, finalResult); return finalResult; }
private void RaiseRuntimeEvent(RuntimeEvent runtimeEvent) { runtimeEvent.Context = RuntimeContext; RuntimeContext.RaiseRuntimeEvent(runtimeEvent); }
protected abstract void OnRaiseRuntimeEvent(RuntimeEvent runtimeEvent);
public EventHandlerBindingStrategy(RuntimeEvent @event) : base(@event) { }
protected EventHandlerBindingStrategyBase(RuntimeEvent @event) { Assert.Argument(@event, nameof(@event)).NotNull(); _event = @event; }
public void RaiseRuntimeEvent(RuntimeEvent runtimeEvent) => OnRaiseRuntimeEvent(runtimeEvent);
public static void RemoveEvent(RuntimeEvent re) { runtimeEvents.Remove(re); }
public EventListSource(RuntimeEvent @event) { this.@event = @event; eventHandler = @event.CreateDelegate(this, HandleOwnerEventMethodInfo); }
private RuntimePolicy DetermineAndStoreAccumulatedRuntimePolicy(RuntimeEvent runtimeEvent) { var frameworkProvider = Configuration.FrameworkProvider; var requestStore = frameworkProvider.HttpRequestStore; // First determine the maximum allowed policy to start from. This is or the current stored runtime policy for this // request, or if none can be found, the default runtime policy set in the configuration var maximumAllowedPolicy = requestStore.Contains(Constants.RuntimePolicyKey) ? requestStore.Get<RuntimePolicy>(Constants.RuntimePolicyKey) : Configuration.DefaultRuntimePolicy; maximumAllowedPolicy = DetermineRuntimePolicy(runtimeEvent, maximumAllowedPolicy); // store result for request requestStore.Set(Constants.RuntimePolicyKey, maximumAllowedPolicy); return maximumAllowedPolicy; }
public EventHandlerBindingStrategyBase(RuntimeEvent @event) { Assert.Argument(@event, "event").NotNull(); this.@event = @event; }
private RuntimePolicy DetermineRuntimePolicy(RuntimeEvent runtimeEvent, RuntimePolicy maximumAllowedPolicy) { if (maximumAllowedPolicy == RuntimePolicy.Off) { return maximumAllowedPolicy; } var frameworkProvider = Configuration.FrameworkProvider; var logger = Configuration.Logger; // only run policies for this runtimeEvent var policies = Configuration.RuntimePolicies.Where( policy => policy.ExecuteOn.HasFlag(runtimeEvent)); var policyContext = new RuntimePolicyContext(frameworkProvider.RequestMetadata, Configuration.Logger, frameworkProvider.RuntimeContext); foreach (var policy in policies) { var policyResult = RuntimePolicy.Off; try { policyResult = policy.Execute(policyContext); if (policyResult != RuntimePolicy.On) { logger.Debug("RuntimePolicy set to '{0}' by IRuntimePolicy of type '{1}' during RuntimeEvent '{2}'.", policyResult, policy.GetType(), runtimeEvent); } } catch (Exception exception) { logger.Warn("Exception when executing IRuntimePolicy of type '{0}'. RuntimePolicy is now set to 'Off'.", exception, policy.GetType()); } // Only use the lowest policy allowed for the request if (policyResult < maximumAllowedPolicy) { maximumAllowedPolicy = policyResult; } // If the policy indicates Glimpse is Off, then we stop processing any other runtime policy if (maximumAllowedPolicy == RuntimePolicy.Off) { break; } } return maximumAllowedPolicy; }
public EventListCommandTrigger(RuntimeEvent @event) { _event = @event; _eventHandler = @event.CreateDelegate(this, HandleOwnerEventMethodInfo); }
private bool HasOffRuntimePolicy(RuntimeEvent policyName) { var policy = DetermineAndStoreAccumulatedRuntimePolicy(policyName); if (policy.HasFlag(RuntimePolicy.Off)) { return true; } return false; }
private bool HasOffRuntimePolicy(RuntimeEvent policyName) { var policy = DetermineAndStoreAccumulatedRuntimePolicy(policyName); return policy.HasFlag(RuntimePolicy.Off); }