IEnumerator ResetLevelViewSequence(bool isSmooth) { if (isSmooth) { var scrollTime = m_smoothScrollTime; if (m_levelCanvas.transform.position == Vector3.zero) { scrollTime = 0f; } m_levelCanvas.transform.DOMove(Vector3.zero, scrollTime); if (scrollTime != 0f) { yield return(new WaitForSeconds(scrollTime + 0.2f)); } } else { m_levelCanvas.localPosition = Vector3.zero; } EventEmitter.Emit(GameEvent.LevelStart); yield return(null); }
private void OnPlayButtonClicked() { var randomMeowSound = UnityEngine.Random.Range(8, 15); EventEmitter.Emit(GameEvent.PlaySound, new SoundEvent((SoundType)randomMeowSound, 9)); sceneMask.Show(() => SceneManager.LoadScene(ProjectInfo.SceneInfos.Main.BuildIndex)); }
protected internal override void onCreate(Bundle savedInstanceState) { // When extending the BrightcovePlayer, we must assign the BrightcoveVideoView before // entering the superclass. This allows for some stock video player lifecycle // management. Establish the video object and use it's event emitter to get important // notifications and to control logging. ContentView = R.layout.ima_activity_main; brightcoveVideoView = (BrightcoveVideoView)findViewById(R.id.brightcove_video_view); mediaController = new BrightcoveMediaController(brightcoveVideoView); brightcoveVideoView.MediaController = mediaController; base.onCreate(savedInstanceState); eventEmitter = brightcoveVideoView.EventEmitter; // Use a procedural abstraction to setup the Google IMA SDK via the plugin and establish // a playlist listener object for our sample video: the Potter Puppet show. setupGoogleIMA(); // Remove the HLS_URL field from the catalog request to allow // midrolls to work. Midrolls don't work with HLS due to // seeking bugs in the Android OS. IDictionary <string, string> options = new Dictionary <string, string>(); IList <string> values = new List <string>(Arrays.asList(VideoFields.DEFAULT_FIELDS)); values.Remove(VideoFields.HLS_URL); options["video_fields"] = StringUtil.join(values, ","); Catalog catalog = new Catalog("ErQk9zUeDVLIp8Dc7aiHKq8hDMgkv5BFU7WGshTc-hpziB3BuYh28A.."); catalog.findPlaylistByReferenceID("stitch", options, new PlaylistListenerAnonymousInnerClassHelper(this)); }
public override View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Perform the internal wiring to be able to make use of the BrightcovePlayerFragment. View view = inflater.inflate(R.layout.basic_cast_fragment, container, false); brightcoveVideoView = (BrightcoveVideoView) view.findViewById(R.id.brightcove_video_view); eventEmitter = brightcoveVideoView.EventEmitter; base.onCreateView(inflater, container, savedInstanceState); // Initialize the android_cast_plugin which requires the application id of your Cast // receiver application. string applicationId = Resources.getString([email protected]_id); googleCastComponent = new GoogleCastComponent(eventEmitter, applicationId, Activity); // Initialize the MiniController widget which will allow control of remote media playback. miniController = (MiniController) view.findViewById(R.id.miniController1); IDictionary<string, object> properties = new Dictionary<string, object>(); properties[GoogleCastComponent.CAST_MINICONTROLLER] = miniController; eventEmitter.emit(GoogleCastEventType.SET_MINI_CONTROLLER, properties); // Send the location of the media (url) and its metadata information for remote playback. Resources resources = Resources; string title = resources.getString([email protected]_title); string studio = resources.getString([email protected]_studio); string url = resources.getString([email protected]_url); string thumbnailUrl = resources.getString([email protected]_thumbnail); string imageUrl = resources.getString([email protected]_image); eventEmitter.emit(GoogleCastEventType.SET_MEDIA_METADATA, buildMetadataProperties("subTitle", title, studio, thumbnailUrl, imageUrl, url)); brightcoveVideoView.VideoPath = url; return view; }
void OnMouseDown() { m_isDragging = true; m_screenPoint = Camera.main.WorldToScreenPoint(gameObject.transform.position); m_offset = gameObject.transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, m_screenPoint.z)); EventEmitter.Emit(GameEvent.NerversDraging, new BoolEvent(true)); }
private void Awake() { RotationHelper.I.Initialize(); m_actions = m_actionContainer.GetComponentsInChildren <ActionController>(); m_keys = m_keyContainer.GetComponentsInChildren <KeyController>(); foreach (var cell in m_keys) { m_allCells.Add(cell); } m_nerves = new NerveController[m_nerveCount]; for (var i = 0; i < m_nerveCount; i++) { var nerve = Instantiate(m_nerverSettings.GetRandomNerve(), m_nerveContainer); nerve.transform.localPosition = new Vector3( Random.Range(m_nerverSettings.MinInitX, m_nerverSettings.MaxInitX), 0, 0); nerve.SetInitRotation(Random.Range(0f, m_nerverSettings.InitRotationRange)); m_nerves[i] = nerve; m_allCells.Add(nerve); } foreach (var cell in m_actions) { m_allCells.Add(cell); } EventEmitter.Add(GameEvent.Killed, OnKilled); EventEmitter.Add(GameEvent.KeyPressed, OnKeyPressed); EventEmitter.Add(GameEvent.KeyUp, OnKeyUp); }
private IEnumerator StageClearPerform() { yield return(new WaitForSeconds(1.0f)); EventEmitter.Emit(GameEvent.Complete); yield return(null); }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.tag == "Player") { EventEmitter.Emit(GameEvent.Killed); } }
private void Start() { #if UNITY_WEBGL || UNITY_EDITOR || UNITY_STANDALONE EventEmitter.Add(GameEvent.NerversDraging, OnNeverDragging); #endif gameObject.SetActive(!IsRotationKey); }
protected internal override void onCreate(Bundle savedInstanceState) { // When extending the BrightcovePlayer, we must assign the BrightcoveVideoView before // entering the superclass. This allows for some stock video player lifecycle // management. Establish the video object and use it's event emitter to get important // notifications and to control logging. ContentView = R.layout.ima_activity_main; brightcoveVideoView = (BrightcoveVideoView) findViewById(R.id.brightcove_video_view); mediaController = new BrightcoveMediaController(brightcoveVideoView); brightcoveVideoView.MediaController = mediaController; base.onCreate(savedInstanceState); eventEmitter = brightcoveVideoView.EventEmitter; // Use a procedural abstraction to setup the Google IMA SDK via the plugin and establish // a playlist listener object for our sample video: the Potter Puppet show. setupGoogleIMA(); // Remove the HLS_URL field from the catalog request to allow // midrolls to work. Midrolls don't work with HLS due to // seeking bugs in the Android OS. IDictionary<string, string> options = new Dictionary<string, string>(); IList<string> values = new List<string>(Arrays.asList(VideoFields.DEFAULT_FIELDS)); values.Remove(VideoFields.HLS_URL); options["video_fields"] = StringUtil.join(values, ","); Catalog catalog = new Catalog("ErQk9zUeDVLIp8Dc7aiHKq8hDMgkv5BFU7WGshTc-hpziB3BuYh28A.."); catalog.findPlaylistByReferenceID("stitch", options, new PlaylistListenerAnonymousInnerClassHelper(this)); }
public async Task <IPerceptron <IUnit, IConnection, IUnitActivation <IUnit> > > TrainAsync(IEnumerable <TrainingPattern> trainingPatterns, double errorMax, int maxEpochs = 0) { CheckErrorMax(errorMax); CheckMaxEpochs(maxEpochs); await _errorBackPropagationSteps.RunInitialization(); double netError; var epochs = 0; do { netError = 0; foreach (var trainingPattern in trainingPatterns) { EventEmitter.Log(Training, TrainingIdealValues, trainingPattern.IdealActivations); EventEmitter.Log(Training, TrainingInputs, trainingPattern.InputValues); var actualValues = await _errorBackPropagationSteps.FeedInputs(trainingPattern.InputValues); netError += _networkErrorFunction.Calculate(trainingPattern.IdealActivations, actualValues); EventEmitter.Log(NetError, NetError, netError); EventEmitter.Log(Training, Training, RunningFeedback); await _errorBackPropagationSteps.RunFeedbackPhaseAsync(trainingPattern.IdealActivations); EventEmitter.Log(Training, Training, RanFeedback); } _errorBackPropagationSteps.CompleteRun(); }while (Math.Abs(netError) > errorMax && (maxEpochs < 1 || ++epochs < maxEpochs)); return(_errorBackPropagationSteps.GetPerceptron()); }
// Start is called before the first frame update void Start() { ee = GameObject.FindGameObjectWithTag("EventEmitter").GetComponent <EventEmitter>(); ee.on("player_damaged", notifyPlayerDamage); ee.on("plant_created", notifyPlantCreated); ee.on("player_squished", notifyPlayerSquished); }
// Start is called before the first frame update void Start() { o_scale = this.transform.localScale; ee = GameObject.FindGameObjectWithTag("EventEmitter").GetComponent <EventEmitter>(); GRD = this.GetComponent <IsGrounded>(); passableObjectsLayerMask = (1 << LayerMask.NameToLayer("onewayplatform")) | (1 << LayerMask.NameToLayer("plant")) | (1 << LayerMask.NameToLayer("collectible")) | (1 << 2); }
private void UpdateConnectionWeight(ITraversableConnection <IUnitUnderTraining, IConnectionUnderTraining, IUnitActivationTraining> connection) { var weightChange = _calculator.CalculateChange(connection.InputUnit.ActivationValue, connection.OutputUnit.UnitActivation.Error); var momentumWeightChange = connection.Properties.LastWeightChange * _momentum; _weightChangeApplier.ApplyWeightChange(connection.Properties, weightChange + momentumWeightChange); EventEmitter.Log(WeightChange, connection.Properties.Name, connection.Properties.Weight); }
void OnEnable() { emitter = GetComponent <EventEmitter>(); if (emitter != null) { emitter.AddListener <AbilityHit>(OnHit); } }
public void BuildEventEmitter(ClassEmitter classEmitter) { if (emitter != null) { throw new InvalidOperationException(); } emitter = classEmitter.CreateEvent(name, Attributes, type); }
protected Domain(EventEmitter emitter, EventCollector collector, EventStore store) { Current = this; Emitter = emitter; Collector = collector; Store = store; TransactionTracker = new TransactionTracker(emitter); }
public void Run() { PatchableConfig.Load(); //JObject events = PatchableConfig.All["events"].AsJEnumerable().ToList(); IList <PatchableEvent> events = PatchableConfig.Events; var emitter = new EventEmitter(new PatchableConfigEventStorage()); }
private void OnTriggerEnter2D(Collider2D collision) { switch (collision.gameObject.tag) { case "InstantKill": EventEmitter.Emit(GameEvent.Killed); break; } }
public void DoesNotEmitIfEventDoesntExist() { var e = new EventEmitter(); Assert.That(() => e.Emit("test_event", "test data"), Throws.Exception .TypeOf <DoesNotExistException>() .With.Message.EqualTo("Event [test_event] does not exist in the emitter. Consider calling EventEmitter.On")); }
public void RemoveFuncFromListenerThatDoesNotExistFails() { var e = new EventEmitter(); Assert.That(() => e.RemoveListener("data", IncrementNumberBy2), Throws.Exception .TypeOf <DoesNotExistException>() .With.Message.EqualTo("Event [data] does not exist to have listeners removed.")); }
public void ParallelsSimpleTest() { var emitter = new EventEmitter(_observers, new ParallelsObserverInvoker()); var evnt = new HelloWorldEvent(); emitter.Emit(evnt); Assert.IsTrue(Constants.ExpectedResultForHelloWorldEvent.IsMatch(evnt.Data)); }
public void ThrowsWhenRemovingFuncThatDoesNotExist() { var e = new EventEmitter(); e.On("test_event", TestMethod); Assert.That(() => e.RemoveListener("test_event", IncrementNumber), Throws.Exception .TypeOf <DoesNotExistException>() .With.Message.EqualTo("Func [Void IncrementNumber(System.Object)] does not exist to be removed.")); }
public void OnWithArgs() { var e = new EventEmitter(); e.On("event", (bool value) => { Assert.IsTrue(value); }); e.Emit("event", true); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: @Override protected void setUp() throws Exception protected internal override void setUp() { base.setUp(); ActivityInitialTouchMode = false; mainActivity = Activity; brightcoveVideoView = (BrightcoveVideoView)mainActivity.findViewById(R.id.brightcove_video_view); eventEmitter = brightcoveVideoView.EventEmitter; eventEmitter.once(EventType.DID_SET_VIDEO, new EventListenerAnonymousInnerClassHelper(this)); }
public void EmitCallsAllAttachedFunctions() { var e = new EventEmitter(); numberToTest = 0; e.On("data", IncrementNumber); e.On("data", IncrementNumberBy2); e.Emit("data", numberToTest); Assert.AreEqual(3, numberToTest); }
private void Awake() { instance = this; m_rigid = GetComponent <Rigidbody2D>(); m_collider = GetComponent <BoxCollider2D>(); EventEmitter.Add(GameEvent.Action, HandleOnAction); EventEmitter.Add(GameEvent.Killed, ElectricKill); EventEmitter.Add(GameEvent.StageClear, RequestStageClear); }
void Start() { ee = GameObject.FindGameObjectWithTag("EventEmitter").GetComponent <EventEmitter>(); ee = FindObjectOfType <EventEmitter>(); ee.on("win", DeactivateSquishCollision); passableObjectsLayerMask = (1 << LayerMask.NameToLayer("onewayplatform")) | (1 << LayerMask.NameToLayer("plant")) | (1 << LayerMask.NameToLayer("collectible")) | (1 << LayerMask.NameToLayer("passable")) | (1 << 2); player = GameObject.FindGameObjectWithTag("Player"); Gr = player.GetComponent <IsGrounded>(); }
/// <summary> /// Default entry into managed code. /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task <object> Invoke(object input) { if (console == null) { console = await WebSharpJs.NodeJS.Console.Instance(); } try { Func <object, Task <object> > listener1 = (async(commands) => { console.Log($"Listener 1 executed"); return(null); }); var eventEmitter = await EventEmitter.Create(); eventEmitter.AddListener("connection", listener1); eventEmitter.AddListener("connection", (async(commands) => { console.Log($"Listener 2 executed."); return(null); })); console.Log($"# of 'connection' listeners {await eventEmitter.ListenerCount("connection")}"); console.Log($"emitted {await eventEmitter.Emit("connection")}"); console.Log("Removing all listeners"); eventEmitter.RemoveAllListeners("connection"); console.Log($"# of 'connection' listeners {await eventEmitter.ListenerCount("connection")}"); eventEmitter.Once("foo", (async(x) => { console.Log("a"); return(null); })); eventEmitter.PrependOnceListener("foo", (async(x) => { console.Log("b"); return(null); })); eventEmitter.Emit("foo"); // Should be logged first b then a eventEmitter.Emit("foo"); // Listeners will not be called again. } catch (Exception exc) { console.Log($"extension exception: {exc.Message}"); } return(null); }
public void GetCaught() { if (CurPlayerState == PlayerState.Dig) { return; } //TODO: perform EventEmitter.Emit(GameEvent.LevelFail); }
public DirectoryScanner(string modulesDirectory, string moduleFilePattern) { _modulesDirectory = AppDomain.CurrentDomain.BaseDirectory + modulesDirectory; _moduleFilePattern = moduleFilePattern; //Set the scan frequency. _frequencySeconds = GetScanFrequency(); //Setup the event emitter. _eventEmitter = new EventEmitter<FileInfo>(); }
public void SimpleTest() { var emitter = new EventEmitter(_observers); var evnt = new HelloWorldEvent(); emitter.Emit(evnt); Assert.AreEqual("January, February, March", evnt.Data); }
public void RemoveListenerRemovesFunction() { var e = new EventEmitter(); numberToTest = 0; e.On("data", IncrementNumber); e.On("data", IncrementNumberBy2); e.RemoveListener("data", IncrementNumberBy2); e.Emit("data", numberToTest); Assert.AreEqual(1, numberToTest); }
void Start() { ee = GameObject.FindGameObjectWithTag("EventEmitter").GetComponent <EventEmitter>(); //var lm = Physics2D.GetLayerCollisionMask(gameObject.layer)+LayerMask.NameToLayer("plant"); //cf.SetLayerMask(lm); mBody = this.GetComponent <Rigidbody2D>(); oldPos = this.transform.position; playerCollider = this.GetComponent <BoxCollider2D>(); mVelocity = Vector3.zero; speed = 0f; }
static void test() { var e = new EventEmitter(); e.On("event", (bool args1, string args2) => { Console.WriteLine(args1); }); e.Emit("event", true, "test1"); e.Emit("event", false, "test2"); }
public void TestEmitInt() { var value = 0; EventEmitter.Add(GameEvent.None, Action1); EventEmitter.Emit(GameEvent.None, new IntEvent(1)); Assert.AreEqual(expected: 1, actual: value); void Action1(IEvent @event) { value = (@event as IntEvent).Value; } }
//handle progression of entity, attributes, and resources public void Awake() { attr = new FloatRange(0); attr.SetModifier("Mod1", FloatModifier.Value(1)); attr.SetModifier("Mod2", FloatModifier.Value(3)); attr.SetModifier("Mod3", FloatModifier.Value(6)); attr2 = new FloatRange(0); attr2.SetModifier("Mod1", FloatModifier.Value(5)); attr2.SetModifier("Mod2", FloatModifier.Percent(0.2f)); attr2.SetModifier("Mod3", FloatModifier.Value(5)); resourceManager = new ResourceManager(this); statusManager = new StatusEffectManager(this); abilityManager = new AbilityManager(this); emitter = new EventEmitter(); EntityManager.Instance.Register(this); //gameObject.layer = LayerMask.NameToLayer("Entity"); }
protected internal override void onCreate(Bundle savedInstanceState) { // When extending the BrightcovePlayer, we must assign the BrightcoveVideoView // before entering the superclass. This allows for some stock video player lifecycle // management. ContentView = R.layout.freewheel_activity_main; brightcoveVideoView = (BrightcoveVideoView) findViewById(R.id.brightcove_video_view); base.onCreate(savedInstanceState); adFrame = (FrameLayout) findViewById(R.id.ad_frame); eventEmitter = brightcoveVideoView.EventEmitter; setupFreeWheel(); setupWidevine(); Catalog catalog = new Catalog("FqicLlYykdimMML7pj65Gi8IHl8EVReWMJh6rLDcTjTMqdb5ay_xFA.."); catalog.findVideoByID("2142114984001", new VideoListenerAnonymousInnerClassHelper(this)); }
protected internal override void onCreate(Bundle savedInstanceState) { // When extending the BrightcovePlayer, we must assign the BrightcoveVideoView // before entering the superclass. This allows for some stock video player lifecycle // management. ContentView = R.layout.freewheel_activity_main; brightcoveVideoView = (BrightcoveVideoView) findViewById(R.id.brightcove_video_view); base.onCreate(savedInstanceState); adFrame = (FrameLayout) findViewById(R.id.ad_frame); eventEmitter = brightcoveVideoView.EventEmitter; setupFreeWheel(); // Add a test video to the BrightcoveVideoView. Catalog catalog = new Catalog("ErQk9zUeDVLIp8Dc7aiHKq8hDMgkv5BFU7WGshTc-hpziB3BuYh28A.."); catalog.findPlaylistByReferenceID("stitch", new PlaylistListenerAnonymousInnerClassHelper(this)); }
public void CachedTest() { var cache = new MemoryCache("MyObservers"); var emitter = new EventEmitter(new CachedObserverStorage(cache, _observers)); var evnt = new HelloWorldEvent(); var noncachedStartTicks = DateTime.Now.Ticks; emitter.Emit(evnt); var nonCachedTicks = DateTime.Now.Ticks - noncachedStartTicks; var cachedStartTicks = DateTime.Now.Ticks; emitter.Emit(evnt); var cachedTicks = DateTime.Now.Ticks - cachedStartTicks; Console.WriteLine("Difference in miliseconds between cached and noncached: {0}", (nonCachedTicks - cachedTicks) / TimeSpan.TicksPerMillisecond); Assert.AreNotEqual(cachedTicks, nonCachedTicks); Assert.IsTrue(cachedTicks < nonCachedTicks); }
protected internal override void onCreate(Bundle savedInstanceState) { // When extending the BrightcovePlayer, we must assign the BrightcoveVideoView before // entering the superclass. This allows for some stock video player lifecycle // management. Establish the video object and use it's event emitter to get important // notifications and to control logging. ContentView = R.layout.ima_widevine_activity_main; brightcoveVideoView = (BrightcoveVideoView) findViewById(R.id.brightcove_video_view); base.onCreate(savedInstanceState); eventEmitter = brightcoveVideoView.EventEmitter; // Use a procedural abstraction to setup the Google IMA SDK via the plugin and establish // a playlist listener object for our sample video: the Potter Puppet show. setupGoogleIMA(); // Initialize the widevine plugin. setupWidevine(); // Create the catalog object which will start and play the video. Catalog catalog = new Catalog("FqicLlYykdimMML7pj65Gi8IHl8EVReWMJh6rLDcTjTMqdb5ay_xFA.."); catalog.findVideoByID("2223563028001", new VideoListenerAnonymousInnerClassHelper(this)); }
public TestableDomain(EventEmitter emitter, EventCollector collector, EventStore store) : base(emitter, collector, store) { }
protected internal override void onCreate(Bundle savedInstanceState) { // When extending the BrightcovePlayer, we must assign the BrightcoveVideoView // before entering the superclass. This allows for some stock video player lifecycle // management. ContentView = R.layout.adobepass_activity_main; brightcoveVideoView = (BrightcoveVideoView) findViewById(R.id.brightcove_video_view); eventEmitter = brightcoveVideoView.EventEmitter; base.onCreate(savedInstanceState); // configure the AdobePass AccessEnabler library try { accessEnabler = AccessEnabler.Factory.getInstance(this); if (accessEnabler != null) { accessEnabler.Delegate = this; accessEnabler.useHttps(true); } } catch (AccessEnablerException e) { Log.e(TAG, "Failed to initialize the AccessEnabler library: " + e.Message); return; } string requestorId = Resources.getString([email protected]_id); string credentialStorePassword = Resources.getString([email protected]_store_password); System.IO.Stream credentialStore = Resources.openRawResource(R.raw.adobepass); // A signature must be passed along with the requestor id from a private key and a password. PrivateKey privateKey = extractPrivateKey(credentialStore, credentialStorePassword); string signedRequestorId = null; try { signedRequestorId = generateSignature(privateKey, requestorId); } catch (AccessEnablerException e) { Log.e(TAG, "Failed to generate signature."); } // The production URL is the default when no URL is passed. If // we are using a staging requestorID, we need to pass the staging // URL. List<string> spUrls = new List<string>(); spUrls.Add(STAGING_URL); // Set the requestor ID. accessEnabler.setRequestor(requestorId, signedRequestorId, spUrls); // TODO (once we media API changes are made): // Media API call will return result with nulled out URL fields if the media // is protected. We need to make the adobepass calls to get the token for the media, // then make another Media API call with the adobepass token included (in the header or // a cookie) which will return a result with non-nulled URL fields. // 1. Ignore URL fields on the first call. // 2. Make the AdobePass calls // 3. Add token to next Media API call. // Add a test video to the BrightcoveVideoView. IDictionary<string, string> options = new Dictionary<string, string>(); IList<string> values = new List<string>(Arrays.asList(VideoFields.DEFAULT_FIELDS)); Catalog catalog = new Catalog("ErQk9zUeDVLIp8Dc7aiHKq8hDMgkv5BFU7WGshTc-hpziB3BuYh28A.."); catalog.findPlaylistByReferenceID("stitch", options, new PlaylistListenerAnonymousInnerClassHelper(this)); }
public override void EmitEvent(EventInfo eventInfo) { var emitter = new EventEmitter(TypeBuilder, ImplField); emitter.Emit(eventInfo); }
public TransactionTracker(EventEmitter emitter) { this.emitter = emitter; }
public EventResourceManager(EventEmitter eventEmitter, Transaction transaction) { this.eventEmitter = eventEmitter; transaction.EnlistVolatile(this, EnlistmentOptions.None); changes = new List<RaisedEvent>(); }
public ModuleManager(ILogger logger = null) : base(logger) { OnModuleLoadedEventEmitter = new EventEmitter<Type>(); }
static extern int listenerCount(EventEmitter emitter, string @event);