Beispiel #1
0
 public void Update([FromBody] NextEvent nextEvent)
 {
     using (BusinessContext context = new BusinessContext())
     {
         context.NextEventBusiness.Update(nextEvent);
     }
 }
Beispiel #2
0
        private async void ProcessEvents()
        {
            Task NextEvent;

            while (!Shutdown)
            {
                // try to get input from players
                foreach (Player player in mPlayers)
                {
                    string CommandString = player.GetCommandString().Trim();

                    // only make a command handling event if there's a command to process
                    if (CommandString != "" && CommandString != "\n")
                    {
                        mudEventQueue.Enqueue(new Task(
                                                  () => {
                            Commands.HandleCommand(player, CommandString);
                        }
                                                  ));
                    }
                }

                if (mudEventQueue.TryDequeue(out NextEvent))
                {
                    NextEvent.Start();
                    await NextEvent;
                }
            }
        }
Beispiel #3
0
 private void btnNext_Click(object sender, RoutedEventArgs e)
 {
     if (NextEvent != null)
     {
         NextEvent.Invoke();
     }
 }
        /// <summary>
        /// 开始下一步操作
        /// </summary>
        /// <typeparam name="S">IEnlistmentNotification接口实现</typeparam>
        /// <param name="level">IsolationLevel事务的隔离级别(对全局事务处理设置)</param>
        /// <param name="source">下一步操作的自定义数据管理器</param>
        public void Next <S>(IsolationLevel level, S source)
            where S : class, IEnlistmentNotification, new()
        {
            Transaction tran = _tranStack.Peek();//获取事务栈的顶端事务

            if (tran == null)
            {
                tran = Transaction.Current;//主事务
            }
            DependentTransaction depentran = tran.DependentClone(DependentCloneOption.BlockCommitUntilComplete);

            //将本次事务处理的资源管理器压入资源栈中
            depentran.EnlistVolatile(source, EnlistmentOptions.None);
            _tranStack.Push(depentran);
            _resourceStack.Push(source);
            //切换环境事务场景
            Transaction.Current = depentran;
            if (NextEvent != null)
            {
                if (NextEvent.GetInvocationList().Length > 0)
                {
                    NextEvent(Transaction.Current);
                }
            }
        }
Beispiel #5
0
 public void Insert([FromBody] NextEvent nextEvent)
 {
     using (BusinessContext context = new BusinessContext())
     {
         context.NextEventBusiness.Insert(nextEvent);
     }
 }
        public void Next(string desc)
        {
            var time = Last = Watcher.ElapsedMilliseconds - Last;

            NextEvent.Fire(this, new JasilyPerformanceTestHitEventArgs(desc, time));
            Watcher.Restart();
        }
 private void OnNextButtonClicked()
 {
     if (_scenarioController.UseInGameQuestionnaire && _scenarioController.CurrentLevel % 5 == 0)
     {
         InGameQuestionnaire?.Invoke();
     }
     else
     {
         NextEvent?.Invoke();
     }
 }
Beispiel #8
0
        public Part Next()
        {
            Part part = null;

            lock (_parts)
            {
                if (_parts.TryGetValue(_index, out var bytes))
                {
                    _parts.Remove(_index);
                    part = new Part(_index++, bytes);
                    NextEvent?.Invoke(this, EventArgs.Empty);
                }
            }

            return(part);
        }
Beispiel #9
0
        public object[] CreateGameEventEntity(List <Event> loadedEventModels = null, List <Item> loadedItemModels = null)
        {
            loadedEventModels = loadedEventModels ?? new List <Event>();
            loadedItemModels  = loadedItemModels ?? new List <Item>();

            var _event = new NewEvent
            {
                Name        = Name,
                Description = Description,
                Behaviour   = Behaviour.Split('\n').ToList(),
                Repeat      = Repeat,
                HappensOnce = HappensOnce,
            };

            var lEvent = loadedEventModels.FirstOrDefault(e => e.Name.Equals(NextEvent.Name));

            if (lEvent == null && NextEvent != null)
            {
                var lEventObj = NextEvent.CreateGameEventEntity(loadedEventModels, loadedItemModels);
                lEvent = (Event)lEventObj[0];
                loadedEventModels.Add(lEvent);

                loadedEventModels.AddRange(((List <Event>)lEventObj[1]).Except(loadedEventModels));
                loadedItemModels.AddRange(((List <Item>)lEventObj[2]).Except(loadedItemModels));
            }
            _event.NextEvent = lEvent;

            Items?.Split('\n').ToList().ForEach(itemLine =>
            {
                var itemName = itemLine.Split(':')[0];
                var lItem    = loadedItemModels.FirstOrDefault(i => i.Name.Equals(itemName));
                if (lItem == null)
                {
                    var iiii = Game.Items.FirstOrDefault(i => i.Name.Equals(itemName));
                    if (iiii == null)
                    {
                        return;
                    }
                    lItem = iiii.CreateGameItemEntity();
                    loadedItemModels.Add(lItem);
                }
                _event.Items[itemName] = new object[] { lItem, float.Parse(itemLine.Split(':')[1]) };
            });

            return(new object[] { _event, loadedEventModels, loadedItemModels });
        }
Beispiel #10
0
 public void Update(NextEvent nextEvent)
 {
     BusinessContext.Current.RepositoryContext.NextEventRepository.Update(nextEvent);
 }
Beispiel #11
0
 public void Insert(NextEvent nextEvent)
 {
     BusinessContext.Current.RepositoryContext.NextEventRepository.Insert(nextEvent);
 }
Beispiel #12
0
 private void NextButtonClick(object sender, RoutedEventArgs e)
 {
     NextEvent?.Invoke();
 }
Beispiel #13
0
        public void Process(GenerateScribanContextPipelineArgs args)
        {
            var nextEvent = new NextEvent(GetEvent);

            args.GlobalScriptObject.Import("sc_nextevent", nextEvent);
        }