コード例 #1
0
 public void CancelSkill()
 {
     this.so.EventGroup.FireEvent((int)Event.Cancelskill, so, EventGroup.NewArg <EventSingleArgs <string>, string>(RunningSkill.SourceData.path));
     RunningSkill.Cancel();
     Pool.SP.Recycle(RunningSkill);
     RunningSkill = null;
 }
コード例 #2
0
        public async Task <IHttpActionResult> PutEventGroup(Guid id, EventGroup eventGroup)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != eventGroup.id)
            {
                return(BadRequest());
            }

            db.Entry(eventGroup).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EventGroupExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: acid1789/dsb
        private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            if (e.Button == MouseButtons.Right && e.Node != null)
            {
                _contextNode = e.Node;
                ContextMenu menu = new ContextMenu();
                menu.MenuItems.Add("Add Event Group to End").Click += OnAddEventGroup;

                if (e.Node.Tag is EventGroup)
                {
                    EventGroup eg = (EventGroup)e.Node.Tag;

                    menu.MenuItems.Add("Create Event Group Before").Click += OnCreateEventGroupBefore;
                    menu.MenuItems.Add("Create Event Group After").Click  += OnCreateEventGroupAfter;

                    if (eg.stopCondition == null)
                    {
                        menu.MenuItems.Add("-");
                        MenuItem mi = menu.MenuItems.Add("Add Stop Condition");
                        mi.Click += OnAddStopCondition;
                    }
                }
                else if (e.Node.Text == "Events")
                {
                    menu.MenuItems.Add("-");
                    menu.MenuItems.Add("Add Event").Click += OnAddEvent;
                }


                menu.Show(treeView1, e.Location);
            }
        }
コード例 #4
0
        /// <summary>
        /// Enqueues an event to the actor with the specified id.
        /// </summary>
        private EnqueueStatus EnqueueEvent(Actor actor, Event e, Actor sender, EventGroup group, SendOptions options)
        {
            EventOriginInfo originInfo;

            string stateName = null;

            if (sender is StateMachine senderStateMachine)
            {
                originInfo = new EventOriginInfo(sender.Id, senderStateMachine.GetType().FullName,
                                                 NameResolver.GetStateNameForLogging(senderStateMachine.CurrentState));
                stateName = senderStateMachine.CurrentStateName;
            }
            else if (sender is Actor senderActor)
            {
                originInfo = new EventOriginInfo(sender.Id, senderActor.GetType().FullName, string.Empty);
            }
            else
            {
                // Message comes from the environment.
                originInfo = new EventOriginInfo(null, "Env", "Env");
            }

            EventInfo eventInfo = new EventInfo(e, originInfo)
            {
                MustHandle = options?.MustHandle ?? false,
                Assert     = options?.Assert ?? -1
            };

            Guid opId = group == null ? Guid.Empty : group.Id;

            this.LogWriter.LogSendEvent(actor.Id, sender?.Id.Name, sender?.Id.Type, stateName,
                                        e, opId, isTargetHalted: false);
            return(actor.Enqueue(e, group, eventInfo));
        }
コード例 #5
0
        private async Task CreateGroupAndAssignStudentAndEventAsync(string studentId, string eventId)
        {
            var group = new Group()
            {
                Name      = "group",
                CreatorId = Guid.NewGuid().ToString(),
            };

            await this.DbContext.Groups.AddAsync(group);

            var studentGroup = new StudentGroup()
            {
                StudentId = studentId, GroupId = group.Id
            };

            await this.DbContext.StudentsGroups.AddAsync(studentGroup);

            var eventGroup = new EventGroup()
            {
                EventId = eventId, GroupId = group.Id
            };

            await this.DbContext.EventsGroups.AddAsync(eventGroup);

            await this.DbContext.SaveChangesAsync();

            this.DbContext.Entry <EventGroup>(eventGroup).State     = EntityState.Detached;
            this.DbContext.Entry <Group>(group).State               = EntityState.Detached;
            this.DbContext.Entry <StudentGroup>(studentGroup).State = EntityState.Detached;
        }
コード例 #6
0
        public async Task <IHttpActionResult> PostEventGroup(EventGroup eventGroup)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.EventGroups.Add(eventGroup);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (EventGroupExists(eventGroup.id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = eventGroup.id }, eventGroup));
        }
コード例 #7
0
        private void EleGroup_EditClick(object sender, RoutedEventArgs e)
        {
            EventGroup eventGroup = (EventGroup)((FrameworkElement)sender).DataContext;
            EventGroupEditPageViewModel eventGroupViewModel = new EventGroupEditPageViewModel(eventGroup, viewModel.GetAllGroups());

            Frame.Navigate(typeof(EventGroupEditPage), eventGroupViewModel);
        }
コード例 #8
0
ファイル: Beatmap.cs プロジェクト: guusw/fx2
        /// <summary>
        /// Finds the active event at any give time for a certain event group using a binary search in a per event collection
        /// </summary>
        /// <remarks>This collection is updated by UpdateMap</remarks>
        public Event GetEffectAtTime(TimeDivisionReference time, EventGroup group)
        {
            var collection = precomputedEvents[(int)group];

            if (collection.Count == 0)
            {
                return(null);
            }

            int left  = 0;
            int right = collection.Count - 1;

            while (left < right)
            {
                int mid    = left + (right - left) / 2;
                var middle = collection[mid];

                if (middle.Position.CompareTo(time) < 0)
                {
                    left = mid + 1;
                }
                else
                {
                    right = mid;
                }
            }

            return(collection[left].Event);
        }
コード例 #9
0
ファイル: SceneObject.cs プロジェクト: zhaocy1217/War-Clash
 internal void Init(CreateInfo createInfo)
 {
     EventGroup = new EventGroup();
     Team       = createInfo.Team;
     Pool.SP.Recycle(createInfo);
     createInfo = null;
 }
コード例 #10
0
        public void MapEventGroup_EntityWithNoAssociated_SomeMapped()
        {
            var entity = new EventGroup
            {
                Id            = 1,
                EventParentId = 1,
                UserId        = "foo",
                Name          = "bar",
                Description   = "baz"
            };
            var expected = new EventGroupModel
            {
                Id            = 1,
                EventParentId = 1,
                Name          = "bar",
                Description   = "baz"
            };

            var actual = target.Map <EventGroupModel>(entity);

            Assert.AreEqual(expected.Id, actual.Id);
            Assert.AreEqual(expected.EventParentId, actual.EventParentId);
            Assert.AreEqual(expected.EventParentName, actual.EventParentName);
            Assert.AreEqual(expected.Name, actual.Name);
            Assert.AreEqual(expected.Description, actual.Description);
        }
コード例 #11
0
        private async void EleGroup_RemoveClick(object sender, RoutedEventArgs e)
        {
            EventGroup eventGroup = (EventGroup)((FrameworkElement)sender).DataContext;

            await AskRemove(viewModel.Settings.Groups.Collection, eventGroup,
                            $"Do you want to remove group:\n{eventGroup.Name}");
        }
コード例 #12
0
    private void OnLoadUI(string uiName, UnityEngine.Object obj)
    {
        PendingViewInfo info = default(PendingViewInfo);

        for (int i = _waitingForLoadView.Count - 1; i >= 0; i--)
        {
            var pendingViewInfo = _waitingForLoadView[i];
            if (pendingViewInfo.UiName.Equals(uiName))
            {
                info = pendingViewInfo;
                _waitingForLoadView.RemoveAt(i);
                break;
            }
        }
        if (!info.Equals(default(PendingViewInfo)) && info.UiName.Equals(uiName))
        {
            GameObject go = UnityEngine.Object.Instantiate(obj) as GameObject;
            go.transform.parent = Main.SP.UIParent;
            var v = Activator.CreateInstance(info.UiType) as View;
            _views.Add(v);
            v.name = uiName;
            v.Init(go);
            v.Show(info.Param);
            FireEvent((int)UIEventList.OnShowUI, this, EventGroup.NewArg <EventSingleArgs <View>, View>(v));
        }
    }
コード例 #13
0
        /// <summary>
        /// Creates a new actor of the specified <see cref="Type"/> and name, using the specified
        /// unbound actor id, and passes the specified optional <see cref="Event"/>. This event
        /// can only be used to access its payload, and cannot be handled. The method returns only
        /// when the actor is initialized and the <see cref="Event"/> (if any) is handled.
        /// </summary>
        internal Task <ActorId> CreateActorAndExecuteAsync(ActorId id, Type type, string name, Event initialEvent = null,
                                                           EventGroup group = null)
        {
            var creatorOp = this.Scheduler.GetExecutingOperation <ActorOperation>();

            return(this.CreateActorAndExecuteAsync(id, type, name, initialEvent, creatorOp?.Actor, group));
        }
コード例 #14
0
    private void HideUI(object sender, EventMsg e)
    {
        var v = e as EventSingleArgs <View>;

        v.value.OnHide();
        FireEvent((int)UIEventList.OnHideUI, this, EventGroup.NewArg <EventSingleArgs <View>, View>(v.value));
    }
コード例 #15
0
        /// <inheritdoc/>
        internal override void SendEvent(ActorId targetId, Event e, Actor sender, EventGroup group, SendOptions options)
        {
            if (e is null)
            {
                string message = sender != null?
                                 string.Format("{0} is sending a null event.", sender.Id.ToString()) :
                                     "Cannot send a null event.";

                this.Assert(false, message);
            }

            if (sender != null)
            {
                this.Assert(targetId != null, "{0} is sending event {1} to a null actor.", sender.Id, e);
            }
            else
            {
                this.Assert(targetId != null, "Cannot send event {1} to a null actor.", e);
            }

            this.AssertExpectedCallerActor(sender, "SendEvent");

            EnqueueStatus enqueueStatus = this.EnqueueEvent(targetId, e, sender, group, options, out Actor target);

            if (enqueueStatus is EnqueueStatus.EventHandlerNotRunning)
            {
                this.RunActorEventHandler(target, null, false, null);
            }
        }
コード例 #16
0
        public int Add(EventGroupModel model)
        {
            try
            {
                var user = new EventGroup()
                {
                    EventId   = model.EventId,
                    GroupId   = model.GroupId,
                    CreatedBy = model.CreatedBy,
                    CreatedOn = UnixTimeBaseClass.UnixTimeNow
                };

                _db.EventGroups.Add(user);
                _db.SaveChanges();

                return(user.EventGroupId);
            }
            catch (Exception ex)
            {
                JavaScriptSerializer js = new JavaScriptSerializer();
                string json             = js.Serialize(model);
                Log.Error("EventGroup - Add - " + json, ex);
                throw;
            }
        }
コード例 #17
0
ファイル: EventManager.cs プロジェクト: bluesektor/Common
        public ServiceResult InsertEventGroup(INode n)
        {
            if (!this.DataAccessAuthorized(n, "post", false))
            {
                return(ServiceResponse.Error("You are not authorized this action."));
            }

            n.Initialize(this._requestingUser.UUID, this._requestingUser.AccountUUID, this._requestingUser.RoleWeight);

            var s = (EventGroup)n;

            s.Name = s.Name.Trim();

            using (var context = new GreenWerxDbContext(this._connectionKey))
            {
                EventGroup dbU = context.GetAll <EventGroup>()?.FirstOrDefault(wu => (wu.Name?.EqualsIgnoreCase(s.Name) ?? false) && wu.AccountUUID == s.AccountUUID);

                if (dbU != null)
                {
                    return(ServiceResponse.Error("EventGroup already exists."));
                }

                if (context.Insert <EventGroup>(s))
                {
                    return(ServiceResponse.OK("", s));
                }
            }
            return(ServiceResponse.Error("An error occurred inserting EventGroup " + s.Name));
        }
コード例 #18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MockStateMachineManager"/> class.
 /// </summary>
 internal MockStateMachineManager(ControlledRuntime runtime, StateMachine instance, EventGroup group)
 {
     this.Runtime  = runtime;
     this.Instance = instance;
     this.IsEventHandlerRunning = true;
     this.ProgramCounter        = 0;
     this.CurrentEventGroup     = group;
 }
コード例 #19
0
 public void Init()
 {
     InitConfig();
     LockFrameMgr = new LockFrameMgr();
     SceneManager = new SceneManager();
     EventGroup   = new EventGroup();
     _timeStep    = 1f / LockFrameMgr.FixedFrameRate;
 }
コード例 #20
0
        protected virtual void OnHit(SceneObject receiver)
        {
            var _battleScene = LogicCore.SP.SceneManager.CurrentScene as BattleScene;

            EventManager.TriggerEvent(ProjectileAction.hitEvent, new RuntimeData(Sender, receiver, Data));
            EventGroup.FireEvent((int)ProjectileEvent.OnHit, this, null);
            _battleScene.RemoveSceneObject(this.Id);
        }
        internal override IRule ToRule()
        {
            var group = new EventGroup();

            group.Bookings = new DbBookingDao().GetByEvents(EventIds);
            group.Events   = new DbEventDao().GetBy(EventIds);

            return(new EventGroupRule(group, AvailabilityStatus.Booked));
        }
コード例 #22
0
        private void IbnAddGroup_Click(object sender, RoutedEventArgs e)
        {
            EventGroup eventGroup = new EventGroup();
            EventGroupEditPageViewModel eventGroupViewModel = new EventGroupEditPageViewModel(eventGroup, viewModel.GetAllGroups());

            viewModel.Settings.Groups.Collection.Add(eventGroup);

            Frame.Navigate(typeof(EventGroupEditPage), eventGroupViewModel);
        }
コード例 #23
0
ファイル: ContentPanel.cs プロジェクト: rob-opsi/ARGUS-TV
        protected void StartListenerTask(EventGroup eventGroups)
        {
            _uiSyncContext = SynchronizationContext.Current;

            _listenerCancellationTokenSource = new CancellationTokenSource();
            _listenerTask = new Task(() => HandleArgusTVEvents(_listenerCancellationTokenSource.Token),
                                     _listenerCancellationTokenSource.Token, TaskCreationOptions.LongRunning);
            _listenerTask.Start();
        }
コード例 #24
0
        /// <summary>
        /// Lay ra danh sach cac su kien trong nhom su kien nay
        /// </summary>
        /// <param name="mmEventGroup">mã nhóm sự kiện được chọn </param>
        /// <Modified>
        ///     Author      Date        Comments
        ///     Cuongdb    18/2/2008    Tạo mới
        /// </Modified>
        public void BindData(int mmEventGroup)
        {
            DataTable dt;

            //DataRow arow;
            mEventGroup          = new EventGroup(mmEventGroup);
            dt                   = mEventGroup.GetEvents();
            grdSuKien.DataSource = dt;
        }
コード例 #25
0
ファイル: Form1.cs プロジェクト: acid1789/dsb
        private void OnAddStopCondition(object sender, EventArgs e)
        {
            EventGroup eg = (EventGroup)_contextNode.Tag;

            eg.stopCondition = new StopCondition();
            TreeNode stopCondition = _contextNode.Nodes.Add("Stop Condition");

            stopCondition.Tag = eg.stopCondition;
            SetDirty();
        }
コード例 #26
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MockActorManager"/> class.
 /// </summary>
 internal MockActorManager(ControlledRuntime runtime, Actor instance, EventGroup group)
 {
     this.Runtime  = runtime;
     this.Instance = instance;
     this.IsEventHandlerRunning = true;
     this.ProgramCounter        = 0;
     this.IsTransitionStatementCalledInCurrentAction = false;
     this.IsInsideOnExit    = false;
     this.CurrentEventGroup = group;
 }
コード例 #27
0
        /// <inheritdoc/>
        public void OnReceiveEvent(Event e, EventGroup group, EventInfo eventInfo)
        {
            if (group != null)
            {
                // Inherit the event group of the receive operation, if it is non-null.
                this.CurrentEventGroup = group;
            }

            this.Runtime.NotifyReceivedEvent(this.Instance, e, eventInfo);
        }
コード例 #28
0
        public void SendCommand(LockFrameCommand cmd)
        {
#if LocalDebug
            cmd.Execute();
            return;
#endif
            NetDataWriter w = new NetDataWriter(true);
            cmd.Serialize(w);
            EventDispatcher.FireEvent(UIEventList.SendNetMsg.ToInt(), this, EventGroup.NewArg <EventSingleArgs <NetDataWriter>, NetDataWriter>(w));
        }
コード例 #29
0
 /// <summary>
 /// Name: ValidDeparment
 /// Description: Method to check if department is valid
 /// </summary>
 private void ValidDeparment(IEnumerable <EventGroup> currentEventGroups, EventGroup eventGroup)
 {
     foreach (EventGroup currentEventGroup in currentEventGroups)
     {
         if (currentEventGroup.Name.ToLower().Equals(eventGroup.Name.ToLower()))
         {
             throw new ManagerException(ERROR_EVENTGROUP_ALREADY_EXIST, new System.Exception(string.Format("A event group with name: {0}, already exist", eventGroup.Name)));
         }
     }
 }
コード例 #30
0
        public void PreloadGroup(string name)
        {
            EventGroup group  = null;
            RESULT     result = eventSystem.getGroup(name, true, ref group);

            fmodErrorCheck(result);

            result = group.loadEventData();
            fmodErrorCheck(result);
        }
コード例 #31
0
 /// <summary>
 /// Subscribe your client to a group of ARGUS TV events using a polling mechanism.
 /// </summary>
 /// <param name="uniqueClientId">The unique ID (e.g. your DNS hostname combined with a constant GUID) to identify your client.</param>
 /// <param name="eventGroups">The event group(s) to subscribe to (flags can be OR'd).</param>
 public async Task SubscribeServiceEvents(string uniqueClientId, EventGroup eventGroups)
 {
     var request = NewRequest(HttpMethod.Post, "ServiceEvents/{0}/Subscribe/{1}", uniqueClientId, eventGroups);
     await ExecuteAsync(request).ConfigureAwait(false);
 }
コード例 #32
0
ファイル: ContentPanel.cs プロジェクト: Christoph21x/ARGUS-TV
        protected void StartListenerTask(EventGroup eventGroups)
        {
            _uiSyncContext = SynchronizationContext.Current;

            _listenerCancellationTokenSource = new CancellationTokenSource();
            _listenerTask = new Task(() => HandleArgusTVEvents(_listenerCancellationTokenSource.Token),
                _listenerCancellationTokenSource.Token, TaskCreationOptions.LongRunning);
            _listenerTask.Start();
        }
コード例 #33
0
 public static void LogEvent(EventGroup eg, string name)
 {
     LogEvent(eg.ToString(), name);
 }
コード例 #34
0
ファイル: RegionGroup.cs プロジェクト: teetow/teevegas
		public RegionGroup(Region Region)
		{
			_Events = new EventGroup();
			_Region = Region;
		}
コード例 #35
0
 public EventGroupsWithSubGroups(EventGroup grp, EventGroupSubType[] subGrps)
 {
     EventGroup = grp;
     SubGroups = subGrps;
 }