Exemplo n.º 1
0
    public static void Main()
    {
        EventSample eventSample = new EventSample();

        eventSample.someEvent += Handler;
        eventSample.Fire();
    }
Exemplo n.º 2
0
        public async Task Test_PublishAsync_2()
        {
            IEvent @event = new EventSample {
                Value = "a"
            };
            await _eventBus.PublishAsync(@event);

            Assert.Equal("1:a", ((EventSample)@event).Result);
        }
Exemplo n.º 3
0
        public async Task Test_PublishAsync()
        {
            var @event = new EventSample {
                Value = "a"
            };
            await _eventBus.PublishAsync(@event);

            Assert.Equal("1:a", @event.Result);
        }
Exemplo n.º 4
0
        public async Task TestPublish()
        {
            var manager  = new EventHandlerManagerSample(_handler);
            var eventBus = new EventBus(manager);
            var @event   = new EventSample {
                Name = "a"
            };
            await eventBus.PublishAsync(@event);

            await _handler.Received(1).HandleAsync(@event);
        }
Exemplo n.º 5
0
        public void TestPublish()
        {
            var manager  = new EventHandlerManagerSample(_handler);
            var eventBus = new EventBus(manager);
            var @event   = new EventSample {
                Name = "a"
            };

            eventBus.Publish(@event);
            _handler.Received(1).Handle(@event);
        }
        public async Task Test_PublishAsync()
        {
            var event1 = new EventSample {
                Value = "a"
            };
            var event2 = new EventSample2();
            var event3 = new EventSample3();
            var events = new List <IEvent> {
                event1, event2, event3
            };
            await _eventBus.PublishAsync(events);

            Assert.Equal("1:a", event1.Result);
            Assert.Equal("23", event2.Result);
            Assert.Equal("54", event3.Result);
        }
Exemplo n.º 7
0
        private void b_sample_Click(object sender, EventArgs e)
        {
            if (lb_sample.SelectedItem == null)
            {
                return;
            }
            string name = lb_sample.SelectedItem.ToString();

            if (name == "None")
            {
                return;
            }
            int         addr = AudioEngine.LoadBeatmapSample(name);
            EventSample es   = new EventSample(addr, name, AudioEngine.Time, StoryLayer.Background, (int)nud_vol.Value);

            es.WriteToOsu = true;

            editor.changeManager.BeginAction(ChangeType.Event, ActionType.Add, es);

            editor.eventManager.Add(es);
            editor.changeManager.FinishAction();
            NotificationManager.ShowMessageMassive("Done", 1000);
        }
Exemplo n.º 8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="line">[00111:00000100]</param>
        private void parseDataField(string[] arr)
        {
            int[]         key = line2key(arr[0]); // 001 00
            List <string> val = line2arr(arr[1]); // 00 01 AW 00

            switch (key[1])
            {
            case 1:      //BGM
                if (IgnoreEffect)
                {
                    return;
                }
                for (int i = 0; i < val.Count; i++)
                {
                    if (val[i] == "00")
                    {
                        continue;
                    }
                    string fn;
                    if (wavDict.TryGetValue(val[i], out fn))
                    {
                        EventSample e = new EventSample(-1, fn, (int)getTime(key[0], 1.0 * i / val.Count), StoryLayer.Background, 70);
                        e.WriteToOsu = true;
                        eventManager.Add(e);
                        effectDict[fn] = true;
                    }
                }
                break;

            case 11:
            case 12:
            case 13:
            case 14:
            case 15:
            case 16:
            case 18:
            case 19:
            {
                for (int i = 0; i < val.Count; i++)
                {
                    if (val[i] == "00")
                    {
                        continue;
                    }
                    int col = key[1] == 16 ? 0 : (key[1] < 16 ? key[1] - 10 : key[1] - 12);
                    if (IgnoreSpecial)
                    {
                        col--;
                    }
                    if (longType == 2 && val[i] == longObj && pendingNotes[col] != null)
                    {
                        pendingNotes[col].EndTime = (int)getTime(key[0], 1.0 * i / val.Count);
                        pendingNotes[col].Type    = HitObjectType.Hold;
                        pendingNotes[col]         = null;
                        continue;
                    }
                    HitCircleOsu h   = new HitCircleOsu(hitObjectManager, new Vector2(hitObjectManager.ManiaStage.Columns[col].SnapPositionX, 192), (int)getTime(key[0], 1.0 * i / val.Count), false);
                    string       wav = "";
                    if (wavDict.TryGetValue(val[i], out wav) && !IgnoreSample)
                    {
                        noteDict[wav] = true;
                        h.SampleFile  = wav;
                    }
                    else
                    {
                        h.SampleVolume = 1;         //mute sample volume if file doesn't exist in meta
                    }
                    hitObjectManager.Add(h, true);
                    if (longType == 2)
                    {
                        pendingNotes[col] = h;
                    }
                }
            }
            break;

            case 51:
            case 52:
            case 53:
            case 54:
            case 55:
            case 56:
            case 58:
            case 59:
            {
                if (longType != 1)
                {
                    break;
                }
                for (int i = 0; i < val.Count; i++)
                {
                    if (val[i] == "00")
                    {
                        continue;
                    }
                    int col = key[1] == 56 ? 0 : (key[1] < 56 ? key[1] - 50 : key[1] - 52);
                    if (IgnoreSpecial)
                    {
                        col--;
                    }
                    if (pendingNotes[col] != null)
                    {
                        pendingNotes[col].EndTime = (int)getTime(key[0], 1.0 * i / val.Count);
                        pendingNotes[col]         = null;
                        continue;
                    }
                    else
                    {
                        HitCircleHold h = new HitCircleHold(hitObjectManager, new Vector2(hitObjectManager.ManiaStage.Columns[col].SnapPositionX, 192),
                                                            (int)getTime(key[0], 1.0 * i / val.Count), false, false, false, false, 0);
                        string wav = "";
                        if (wavDict.TryGetValue(val[i], out wav) && !IgnoreSample)
                        {
                            noteDict[wav] = true;
                            h.SampleFile  = wav;
                        }
                        else
                        {
                            h.SampleVolume = 1;
                        }
                        hitObjectManager.Add(h, true);
                        pendingNotes[col] = h;
                    }
                }
            }
            break;
            }
        }