コード例 #1
0
ファイル: Event.cs プロジェクト: thang2410199/Prison-Break
 public void InvokeOnComplete()
 {
     State = EventState.Completed;
     EventManager.State = GameState.Normal;
     if (OnComplete != null)
         OnComplete.Invoke();
 }
コード例 #2
0
ファイル: Event.cs プロジェクト: thang2410199/Prison-Break
        public void InvokeEvent()
        {
            State = EventState.Running;
            EventManager.State = GameState.InEvent;

            if (OnStart != null)
                OnStart.Invoke();
        }
コード例 #3
0
 public SearchMaterialWindow()
 {
     eventState = EventState.LayoutChangeEvent;
     InitializeComponent();            
     FillComboBoxes();                        
     UpdateInformation();            
     eventState = EventState.UserEvent;            
 }
コード例 #4
0
 public void NoteEvent(string name, bool handled = true) {
     IEventSummary summary = EventStats.ContainsKey(name) ? EventStats[name] : null;
     if (summary.IsNull()) {
         summary = new EventState { Name = name, Processed = handled };
         EventStats[name] = summary;
     }
     summary.Occurrences += 1;
 }
コード例 #5
0
 public Element(ObjectId objectIdentifier, EventType eventType, EventState eventState, byte priority, Option<uint> notificationClass)
 {
     this.ObjectIdentifier = objectIdentifier;
     this.EventType = eventType;
     this.EventState = eventState;
     this.Priority = priority;
     this.NotificationClass = notificationClass;
 }
コード例 #6
0
 public AcknowledgeAlarmRequest(uint acknowledgingProcessIdentifier, ObjectId eventObjectIdentifier, EventState eventStateAcknowledged, TimeStamp timeStamp, string acknowledgmentSource, TimeStamp timeOfAcknowledgment)
 {
     this.AcknowledgingProcessIdentifier = acknowledgingProcessIdentifier;
     this.EventObjectIdentifier = eventObjectIdentifier;
     this.EventStateAcknowledged = eventStateAcknowledged;
     this.TimeStamp = timeStamp;
     this.AcknowledgmentSource = acknowledgmentSource;
     this.TimeOfAcknowledgment = timeOfAcknowledgment;
 }
コード例 #7
0
 public ListOfEventSummariesType(ObjectId objectIdentifier, EventState eventState, EventTransitionBits acknowledgedTransitions, ReadOnlyArray<TimeStamp> eventTimeStamps, NotifyType notifyType, EventTransitionBits eventEnable, ReadOnlyArray<uint> eventPriorities)
 {
     this.ObjectIdentifier = objectIdentifier;
     this.EventState = eventState;
     this.AcknowledgedTransitions = acknowledgedTransitions;
     this.EventTimeStamps = eventTimeStamps;
     this.NotifyType = notifyType;
     this.EventEnable = eventEnable;
     this.EventPriorities = eventPriorities;
 }
コード例 #8
0
ファイル: EventRepository.cs プロジェクト: UHgEHEP/test
		public void SetState(long id, EventState state)
		{
			_executor.Execute(
				"[dbo].[Event_SetState]",
				new
				{
					id,
					state
				});
		}
コード例 #9
0
        private void AssertAndSetState(EventState expected, EventState @new)
        {
            lock (_eventStateLock) {
                if (_eventState != expected)
                {
                    throw new InvalidEventStateException($"Cannot transition event from state {expected} into {@new}");
                }

                _eventState = @new;
            }
        }
コード例 #10
0
        public bool ShouldProcessResource(IResourceFacade resource)
        {
            if (HasStreamListener(resource.Id))
            {
                _logger.DebugFormat("Listener already exists for {0}", resource);

                IListener listener = _listeners[resource.Id];

                var shouldAdapterProcessResource = false;

                if (listener.IsFixtureDeleted)
                {
                    _logger.DebugFormat("{0} was deleted and republished. Listener wil be removed", resource);
                    RemoveStreamListener(resource.Id);
                }
                else if (listener.IsIgnored)
                {
                    _logger.DebugFormat("{0} is marked as ignored. Listener wil be removed", resource);
                    RemoveStreamListener(resource.Id);
                }
                //Disconnected from the stream - this fixture should be reconnected ASAP
                else if (listener.IsDisconnected && (resource.MatchStatus == MatchStatus.Prematch || resource.MatchStatus == MatchStatus.InRunning))
                {
                    _logger.WarnFormat("{0} was disconnected from stream {1}", resource, resource.MatchStatus);
                    RemoveStreamListener(resource.Id);

                    shouldAdapterProcessResource = true;
                }
                else
                {
                    if (!RemoveStreamListenerIfFinishedProcessing(resource))
                    {
                        _listeners[resource.Id].UpdateResourceState(resource);
                    }
                }

                MarkResourceAsProcessable(resource);
                return(shouldAdapterProcessResource);
            }
            else
            {
                // Check fixture is not yet over, ignore if over
                var fixtureState = EventState.GetFixtureState(resource.Id);
                if (resource.IsMatchOver && (fixtureState == null || fixtureState.MatchStatus == resource.MatchStatus))
                {
                    _logger.InfoFormat("{0} is over. Adapter will not process the resource", resource);
                    MarkResourceAsProcessable(resource);
                    return(false);
                }

                //the resource will be processed
                return(true);
            }
        }
コード例 #11
0
    private IEnumerator StartWave(float cooldown)
    {
        abouttostartwave = true;

        yield return(new WaitForSeconds(cooldown));

        abouttostartwave = false;
        if (State == EventState.Wait)
        {
            State = EventState.Idle;
        }
    }
コード例 #12
0
    IEnumerator CheckTime()
    {
        while (!TimerEnd)
        {
            yield return(new WaitForSeconds(0.5f)); //0.5초마다 끝났는지 체크

            if (PerStageTime <= 0)
            {
                eventState = EventState.Ending;
            }
        }
    }
コード例 #13
0
    public float getStateTime(EventState state)
    {
        for (int i = 0; i < states.Length; i++)
        {
            if (states[i].state == state)
            {
                return(states[i].time);
            }
        }

        return(-1);
    }
コード例 #14
0
ファイル: Event.cs プロジェクト: true-soria/Beast-Mode
 public void EndEvent()
 {
     _eventState = EventState.Complete;
     CancelInvoke();
     ActiveBarriers(false);
     DisableAllSpawners();
     if (_gameManager)
     {
         _gameManager.SetSpawn(playerSpawnEnd);
         _gameManager.ReleaseCamera();
     }
 }
コード例 #15
0
ファイル: Event.cs プロジェクト: true-soria/Beast-Mode
    public void StartEvent()
    {
        _eventState = EventState.Active;
        ActiveBarriers(true);
        if (_gameManager)
        {
            _gameManager.SetSpawn(playerSpawnStart);
        }
        AdjustCamera();

        InvokeRepeating(nameof(SpawnEnemy), 2f, Mathf.Max(1f, spawnFrequency));
    }
コード例 #16
0
    private void InitNewGame()
    {
        GameData.EraseGame();

        // initialize events here for the moment..
        EventState.Clear();
        EventState.PushEvent(new TutorialEventChain.IntroductionEvent(), 0, 0);
        WifeEventChain.Init();
        InvestmentEventChain.Init();
        FestivalEventChain.Init();
        PoisonDemandChangeEventChain.Init();

        GameData.singleton.money          = DebugOverrides.StartingMoney;
        GameData.singleton.initialBalance = GameData.singleton.money;
        // Set final balance for the previous quarter so that next Q can use it as initial balance
        GameData.singleton.finalBalance = GameData.singleton.money;
        GameData.singleton.rent         = 300;

        // Starting unlocks
        GameData.singleton.potionsUnlocked[(int)PotionType.PT_LOVE_POTION] = true;
        GameData.singleton.potionsUnlocked[(int)PotionType.PT_FIRE_POTION] = true;
        // Queue timed unlocks of other potion types
        // The game starts in quarter 0
        EventState.PushEvent(new UnlockPotionEvent(PotionType.PT_POISON_POTION), 1);
        EventState.PushEvent(new UnlockPotionEvent(PotionType.PT_INVIS_POTION), 2);
        EventState.PushEvent(new UnlockPotionEvent(PotionType.PT_LUCK_POTION), 3);

        // Starting feathers owned
        GameData.singleton.feathersOwned[(int)FeatherType.FT_GREEN_FEATHER]  = 0;
        GameData.singleton.feathersOwned[(int)FeatherType.FT_PINK_FEATHER]   = 0;
        GameData.singleton.feathersOwned[(int)FeatherType.FT_ORANGE_FEATHER] = 5;
        GameData.singleton.feathersOwned[(int)FeatherType.FT_BLUE_FEATHER]   = 5;

        for (int i = 0; i < (int)FeatherType.FT_MAX; i++)
        {
            GameData.singleton.feathersUnlocked[i] = GameData.singleton.feathersOwned[i] > 0;
        }

        // Starting potions owned and prices
        for (int i = 0; i < GameData.singleton.potionsOwned.Length; ++i)
        {
            GameData.singleton.potionsOwned[i] = GameData.singleton.potionsUnlocked[i] ? 10 : 0;
            int numFeathersInRecipe = 0;
            foreach (FeatherAndCount feathAndCount in ((PotionType)i).GetIngredients())
            {
                numFeathersInRecipe += feathAndCount.count;
            }
            GameData.singleton.potionPrices[i] = 25 * numFeathersInRecipe;
            GameData.singleton.quarterlyReportSalePrices[i] = 25 * numFeathersInRecipe;
        }

        InitWorldParams();
    }
コード例 #17
0
        public void ShouldLoadPreviuosState()
        {
            var storeProvider = new Mock <IStoreProvider>();

            storeProvider.Setup(sp => sp.Read(It.IsAny <string>())).Returns("{\"12345\": { \"Id\" : \"12345\", \"Sequence\": 6}}");

            var eventState = EventState.Create(storeProvider.Object, new Settings());

            var currentSeq = eventState.GetCurrentSequence("Tennis", "12345");

            currentSeq.Should().Be(6);
        }
コード例 #18
0
 public bool Create(uint idMap)
 {
     if (!ServerKernel.Maps.TryGetValue(idMap, out m_pMap))
     {
         ServerKernel.Log.SaveLog(string.Format("Could not load mapid:{0} to event", idMap), true, LogType.WARNING);
         return(false);
     }
     m_dwMapIdentity = idMap;
     m_bIsComplete   = true;
     m_pState        = EventState.IDLE;
     return(true);
 }
コード例 #19
0
 private bool onKeyboardShown(KeyboardEvents.KeyboardShown evt)
 {
     if (evt.Height > 0 && currentEventState == EventState.Pending)
     {
         currentEventState = EventState.Invalid;
     }
     else if (evt.Height > 0 && currentEventState == EventState.None)
     {
         CoroutineRunner.Start(handleKeyboardShown(), this, "");
     }
     return(false);
 }
コード例 #20
0
ファイル: Player.cs プロジェクト: Surue/LondonSmog
    void OnTriggerExit2D(Collider2D collision)
    {
        if (collision.gameObject.layer == LayerMask.NameToLayer("Event") && !eventEnCours)
        {
            state = EventState.OUT_EVENT_ZONE;
        }

        if (collision.gameObject.layer == LayerMask.NameToLayer("House") || collision.gameObject.layer == LayerMask.NameToLayer("Hospital") || collision.gameObject.layer == LayerMask.NameToLayer("PoliceStation"))
        {
            isInSafeZone = false;
        }
    }
コード例 #21
0
 private void SaveEventState()
 {
     try
     {
         lock (_sync)
             EventState.WriteToFile();
     }
     catch (Exception ex)
     {
         _logger.ErrorFormat("Event state errored on attempt to save it: {0}", ex);
     }
 }
コード例 #22
0
        public bool Create()
        {
            if (!ServerKernel.Maps.TryGetValue(_MAP_ID_U, out m_pMap))
            {
                ServerKernel.Log.GmLog(_ERROR_FILE, "Could not load map on startup");
                m_pState = EventState.ENDED;
                return(false);
            }

            if (!ParseMap())
            {
                return(false);
            }

            var allRank = m_pRepo.FetchByType(_RANK_TYPE_U);

            if (allRank != null)
            {
                foreach (var rank in allRank.Where(x => x.PlayerIdentity == 0))
                {
                    m_pRanking.Add(rank.ObjectIdentity, rank);
                }
                foreach (var rank in allRank.Where(x => x.PlayerIdentity > 0))
                {
                    m_pUserRank.Add(rank.PlayerIdentity, rank);
                }
            }

            int weekday = (int)(DateTime.Now.DayOfWeek) % 7 == 0 ? 7 : (int)(DateTime.Now.DayOfWeek);
            int now     = int.Parse(DateTime.Now.ToString("hhmmss")) + weekday * 1000000;

            //if (m_pState == EventState.IDLE && now >= _STARTUP_TIME && now < _END_TIME)
            //{
            //    m_bHasStarted = true;
            //}
            //else
            //{
            //    foreach (var rank in m_pRanking.Values)
            //    {
            //        rank.Value1 = 0;
            //        rank.Value3 = 0;
            //        Repository.SaveOrUpdate(rank);
            //    }
            //    foreach (var rank in m_pUserRank.Values)
            //    {
            //        rank.Value1 = 0;
            //        rank.Value3 = 0;
            //        Repository.SaveOrUpdate(rank);
            //    }
            //}

            return(true);
        }
コード例 #23
0
        public void Enqueue(InternalSocialEvent internalEvent, XboxLiveUser user)
        {
            if (internalEvent == null)
            {
                throw new ArgumentNullException("internalEvent");
            }
            if (internalEvent.Type == InternalSocialEventType.Unknown)
            {
                throw new ArgumentException("Unable to handle Unknown event type.", "internalEvent");
            }

            SocialEventType eventType;

            switch (internalEvent.Type)
            {
            case InternalSocialEventType.UsersAdded:
                eventType = SocialEventType.UsersAddedToSocialGraph;
                break;

            case InternalSocialEventType.UsersRemoved:
                eventType = SocialEventType.UsersRemovedFromSocialGraph;
                break;

            case InternalSocialEventType.PresenceChanged:
            case InternalSocialEventType.DevicePresenceChanged:
            case InternalSocialEventType.TitlePresenceChanged:
                eventType = SocialEventType.PresenceChanged;
                break;

            case InternalSocialEventType.ProfilesChanged:
                eventType = SocialEventType.ProfilesChanged;
                break;

            case InternalSocialEventType.SocialRelationshipsChanged:
                eventType = SocialEventType.SocialRelationshipsChanged;
                break;

            case InternalSocialEventType.Unknown:
            case InternalSocialEventType.UsersChanged:
                // These events are not converted into public events.
                return;

            default:
                throw new ArgumentOutOfRangeException("internalEvent", internalEvent.Type, null);
            }

            SocialEvent evt = new SocialEvent(eventType, user, internalEvent.UserIdsAffected);

            this.events.Enqueue(evt);

            this.State = EventState.ReadyToRead;
        }
コード例 #24
0
        private async Task <int> UpdateEventStatus(Guid eventId, EventState status)
        {
            var sqlConnection = new MySqlConnection(_connectionString);
            await sqlConnection.OpenAsync();

            using var connection = sqlConnection;

            return(await connection.ExecuteAsync(
                       "UPDATE IntegrationEventLogEntry SET EventStateId = @stateId, " +
                       "TimesSent = CASE WHEN EventStateId = @inProgress THEN TimesSent + 1 ELSE TimesSent END " +
                       "WHERE Id = @id;",
                       new { stateId = (int)status, inProgress = (int)EventState.InProgress, id = eventId }));
        }
コード例 #25
0
        private void CleanUpFixtureData(string fixtureId)
        {
            var fixtureState = EventState.GetFixtureState(fixtureId);

            FixtureOverview tempObj = null;

            _fixtures.TryRemove(fixtureId, out tempObj);

            if (fixtureState != null && fixtureState.MatchStatus == MatchStatus.MatchOver)
            {
                SaveState();
            }
        }
コード例 #26
0
    /******
    *
    *
    ******/

    public void MakeEventChoice(Choice choice)
    {
        if (stateMachine_.currentState is EventState)
        {
            EventState state = (EventState)stateMachine_.currentState;

            choice.PerformChallengeSetResult();
            // TODO deduct costs for the choice, update the inventory
            gameOver_ = ExecuteResult(choice.LastResult);
            state.MakeEventChoice(choice, gameOver_);
            DeductCosts(choice);
        }
    }
コード例 #27
0
        private void loadDefault()
        {
            defaultResource = new ResourceHandle("default", this);
            IEvent evt = new BasicEvent();

            defaultResource.Load(evt);
            EventState state = evt.Wait();

            if (state == EventState.Failed)
            {
                throw new NotSupportedException("Default Resource was not loaded properly");
            }
        }
コード例 #28
0
    public static bool IsEventClose(int id)
    {
        EventState es = GetEventState(id);

        if (es == null)
        {
            return(false);
        }
        else
        {
            return(es.isClose);
        }
    }
コード例 #29
0
ファイル: EventRepository.cs プロジェクト: UHgEHEP/test
 public void Add(int partitionId, long?userId, EventType type, EventState state, byte[] data)
 {
     _executor.Execute(
         "[dbo].[Event_Add]",
         new
     {
         EventTypeId = type,
         data,
         StateId = state,
         partitionId,
         userId
     });
 }
コード例 #30
0
            public Event(string name, DateTime time, TimeSpan _duration, ulong _hostID, string _iconUrl, string description, TimeSpan _repeatTime)
            {
                this.name  = name;
                this.time  = time;
                duration   = _duration;
                hostID     = _hostID;
                iconUrl    = _iconUrl;
                repeatTime = _repeatTime;

                this.description = description;

                eventState = EventState.Awaiting;
            }
コード例 #31
0
ファイル: EventRepository.cs プロジェクト: UHgEHEP/test
		public void Add(int partitionId, long? userId, EventType type, EventState state, byte[] data)
		{
			_executor.Execute(
				"[dbo].[Event_Add]",
				new
				{
					EventTypeId = type,
					data,
					StateId = state,
					partitionId,
					userId
				});
		}
コード例 #32
0
        public ActionResult EventRequestApprove(string eventId)
        {
            var EventIdApprove = Int32.Parse(eventId);

            EventState approvedState = db.EventStates.First(d => d.Name == "aceites");

            Event update = db.Events.Include(v => v.EventState).First(d => d.Id == EventIdApprove);

            update.EventState = approvedState;
            db.SaveChanges();
            //FALTA COLOCAR AQUI UMA MENSAGEM DE AVISO QUE O PEDIDO DE EVENTO FOI APROVADO
            return(Redirect("ShowRequestsList"));
        }
コード例 #33
0
        /// <summary>
        /// Obtain the arguments for an event.
        /// </summary>
        /// <param name="theEvent">The event.</param>
        /// <returns>The arguments.</returns>
        private int[] ObtainArgs(BayesianEvent theEvent)
        {
            var result = new int[theEvent.Parents.Count];

            int index = 0;

            foreach (BayesianEvent parentEvent in theEvent.Parents)
            {
                EventState state = GetEventState(parentEvent);
                result[index++] = state.Value;
            }
            return(result);
        }
コード例 #34
0
        protected override EventResult OnStage(EventStage currentStage)
        {
            switch (currentStage)
            {
            case EventStage.START:
                EventState.currentEventText    = "Your son runs up to you while you're at the counter.";
                EventState.currentEventOptions = EventState.CONTINUE_OPTION;
                mCurrentOptionOutcomes         = new EventStage[] { EventStage.S1 };
                break;

            case EventStage.S1:
                EventState.currentEventImage   = "faceSonHappy";
                EventState.currentEventText    = "\"Daddy! What are you doing?\"";
                EventState.currentEventOptions = new string[]
                {
                    "\"Making magical potions, dear.\"",
                    "\"Adult stuff. Why don't you go play with mom?\""
                };
                mCurrentOptionOutcomes = new EventStage[] { EventStage.S2, EventStage.REFUSE };
                break;

            case EventStage.S2:
                EventState.currentEventImage   = "faceSonSurprise";
                EventState.currentEventText    = "Magical! Can you make one that makes me fly?!";
                EventState.currentEventOptions = new string[]
                {
                    "\"Why not try yourself?\"",
                    "\"Maybe later. I'm busy right now.\""
                };
                mCurrentOptionOutcomes = new EventStage[] { EventStage.ACCEPT, EventStage.REFUSE };
                break;

            case EventStage.ACCEPT:
                EventState.currentEventImage        = "";
                EventState.currentEventText         = "Excited, he grabs some empty bottles and runs over to the cauldron.";
                EventState.currentEventOptions      = EventState.OK_OPTION;
                GameData.singleton.sonRelationship += 10;
                EventState.PushEvent(new SonDropBottlesEvent(), GameData.singleton.quarter);
                return(EventResult.DONE);

            case EventStage.REFUSE:
                EventState.currentEventImage        = "faceSonSad";
                EventState.currentEventText         = "\"Okayy.\" He walks upstairs, looking dejected.";
                EventState.currentEventOptions      = EventState.OK_OPTION;
                GameData.singleton.sonRelationship -= 10;
                EventState.PushEvent(new SonEventTwo(), GameData.singleton.quarter + 2);
                return(EventResult.DONE);
            }
            return(EventResult.CONTINUE);
        }
コード例 #35
0
        protected virtual void OnQueueFull(EventWaitHandle waitHandle)
        {
            if (QueueFull != null && _size > 0)
            {
                T[] array = new T[_size];

                int i = 0, j = 0, num = ((_tail < _head) ? _array.Length : _tail + 1) - _head;
                while (num-- > 0)
                {
                    j          = _head + i;
                    array[i++] = _array[j];
                    _array[j]  = null;
                }

                // If the head is above the tail we need to get the
                // elements that exists between the top of the queue and
                // the the tail.
                if (_tail < _head)
                {
                    // when this method is called the tail points
                    // to the last used slot and not to the next free slot.
                    // So we need to include clean that node too.
                    for (j = 0; j <= _tail; j++)
                    {
                        array[i++] = _array[j];
                        _array[j]  = null;
                    }
                }

                _tail = 0;
                _head = 0;
                _size = 0;

                // the event delegate will be executed in another thread
                EventState state = new EventState(QueueFull, array, waitHandle);
                ThreadPool.QueueUserWorkItem(delegate(object o)
                {
                    EventState e = (EventState)o;
                    e.handler(e.array);
                    if (e.waithandle != null)
                    {
                        e.waithandle.Set();
                    }
                }, state);
            }
            else
            {
                waitHandle.Set();
            }
        }
コード例 #36
0
ファイル: MetaEventViewModel.cs プロジェクト: Azaret/gw2pao
        /// <summary>
        /// Default Constructor
        /// </summary>
        public MetaEventViewModel(MetaEvent metaEventData, EventsUserData userData)
        {
            this.metaEventData = metaEventData;
            this.UserData      = userData;
            this.IsVisible     = true;
            this.state         = EventState.Unknown;

            var currentTime = DateTime.UtcNow.TimeOfDay;

            this.InitializeStagesAndTimers(currentTime);
            this.prevUpdateTimeUtc = currentTime;

            this.UserData.HiddenMetaEvents.CollectionChanged += (o, e) => this.RefreshVisibility();
        }
コード例 #37
0
ファイル: MetaEventViewModel.cs プロジェクト: Azaret/gw2pao
        private void SetState()
        {
            var state             = EventState.Active;
            var listLabel         = "";
            var eventLabel        = "";
            var currentStageLabel = "";
            var nextStageLabel    = "";
            var hoverLabel        = Properties.Resources.ActiveFor;

            if (this.metaEventData is SingleMapMetaEvent)
            {
                eventLabel        = this.metaEventData.MapName;
                currentStageLabel = this.CurrentStage.Name;
                nextStageLabel    = this.NextStage.Name;
            }
            if (this.metaEventData is MultiMapMetaEvent)
            {
                eventLabel        = this.metaEventData.Name;
                currentStageLabel = this.CurrentStage.MapName;
                nextStageLabel    = this.NextStage.MapName;
            }

            if (this.CurrentStage.ID == MetaEventStageID.Inactive)
            {
                state             = EventState.Inactive;
                currentStageLabel = "";
                hoverLabel        = Properties.Resources.InactiveFor;
            }

            if (!string.IsNullOrWhiteSpace(eventLabel))
            {
                listLabel = eventLabel;
                if (!string.IsNullOrWhiteSpace(currentStageLabel))
                {
                    listLabel = string.Format(Properties.Resources.MetaEventLabel, eventLabel, currentStageLabel);
                }
            }

            if (this.NextStage.ID == MetaEventStageID.Inactive)
            {
                nextStageLabel = "ends";
            }

            this.State             = state;
            this.ListLabel         = listLabel;
            this.EventLabel        = eventLabel;
            this.CurrentStageLabel = currentStageLabel;
            this.NextStageLabel    = nextStageLabel;
            this.HoverLabel        = hoverLabel;
        }
コード例 #38
0
        /// <summary>
        /// Handles events from an event engine.  This implementation propagates events through the
        /// component hierarchy to components that implement <see cref="IEventfulComponent"/>.
        /// </summary>
        /// <param name="context">The current game context.</param>
        /// <param name="eventEngine">The event engine from which the event was fired.</param>
        /// <param name="event">The event that is to be handled.</param>
        /// <returns>Whether or not the event was consumed.</returns>
        public virtual bool Handle(IGameContext context, IEventEngine <IGameContext> eventEngine, Event @event)
        {
            if (EnabledInterfaces.Contains(typeof(IEventfulComponent)))
            {
                var state = new EventState
                {
                    Consumed = false
                };
                _handleEvent.Invoke(context, eventEngine, @event, state);
                return(state.Consumed);
            }

            return(false);
        }
コード例 #39
0
ファイル: EventManager.cs プロジェクト: morikun23/ToyBox
        /// <summary>
        /// イベントの取得
        /// ギミックから呼び出し
        /// </summary>
        /// <param name="arg_nextEvent">ギミックから呼び出したいイベントをセット</param>
        public void SetEvent(IEvent arg_nextEvent, GameObject arg_gimmick)
        {
            m_gimmick = arg_gimmick;

            m_currentEvent = arg_nextEvent;
            m_eventState   = EventState.START;


            //初期化関数に置きたいです
            if (m_player == null)
            {
                m_player = GameObject.FindObjectOfType <Player>();
            }
        }
コード例 #40
0
 public UnconfirmedEventNotificationRequest(uint processIdentifier, ObjectId initiatingDeviceIdentifier, ObjectId eventObjectIdentifier, TimeStamp timeStamp, uint notificationClass, byte priority, EventType eventType, Option<string> messageText, NotifyType notifyType, Option<bool> ackRequired, Option<EventState> fromState, EventState toState, Option<NotificationParameters> eventValues)
 {
     this.ProcessIdentifier = processIdentifier;
     this.InitiatingDeviceIdentifier = initiatingDeviceIdentifier;
     this.EventObjectIdentifier = eventObjectIdentifier;
     this.TimeStamp = timeStamp;
     this.NotificationClass = notificationClass;
     this.Priority = priority;
     this.EventType = eventType;
     this.MessageText = messageText;
     this.NotifyType = notifyType;
     this.AckRequired = ackRequired;
     this.FromState = fromState;
     this.ToState = toState;
     this.EventValues = eventValues;
 }
コード例 #41
0
        public IeSingleProtectionEvent(EventState eventState, bool elapsedTimeInvalid, bool blocked,
            bool substituted, bool notTopical, bool eventInvalid)
        {
            value = 0;

            switch (eventState)
            {
                case EventState.Off:
                    value |= 0x01;
                    break;
                case EventState.On:
                    value |= 0x02;
                    break;
            }

            if (elapsedTimeInvalid)
            {
                value |= 0x08;
            }
            if (blocked)
            {
                value |= 0x10;
            }
            if (substituted)
            {
                value |= 0x20;
            }
            if (notTopical)
            {
                value |= 0x40;
            }
            if (eventInvalid)
            {
                value |= 0x80;
            }
        }
コード例 #42
0
ファイル: MouseEvent.cs プロジェクト: microm/eplib
 public MouseEvent(EventState eventState, MouseInfo mouseInfo)
     : this(eventState, mouseInfo, new TPoint(0, 0))
 {
 }
コード例 #43
0
        /// <summary>
        /// Set all events to random values, based on their probabilities. 
        /// </summary>
        /// <param name="eventState">The event state.</param>
        private void RandomizeEvents(EventState eventState)
        {
            // first, has this event already been randomized
            if (!eventState.IsCalculated)
            {
                // next, see if we can randomize the event passed
                int[] args = ObtainArgs(eventState.Event);
                if (args != null)
                {
                    eventState.Randomize(args);
                }
            }

            // randomize children
            foreach (BayesianEvent childEvent in eventState.Event.Children)
            {
                RandomizeEvents(GetEventState(childEvent));
            }
        }
コード例 #44
0
 void Start() {
   _publicPhone = gameObject.GetComponentInChildren<EventState>();
   _publicPhone._entry = TextPublicPhone;
 }
コード例 #45
0
ファイル: PropertyStates.cs プロジェクト: LorenVS/bacstack
 public StateWrapper(EventState item)
 {
     this.Item = item;
 }
コード例 #46
0
ファイル: PropertyStates.cs プロジェクト: LorenVS/bacstack
 public static PropertyStates NewState(EventState state)
 {
     return new StateWrapper(state);
 }
コード例 #47
0
ファイル: MouseEvent.cs プロジェクト: microm/eplib
 public MouseEvent(EventState eventState, MouseInfo mouseInfo, TPoint previousPosition)
 {
     m_curInfo = mouseInfo;
     m_state = eventState;
     m_previousPosition = previousPosition;
 }
コード例 #48
0
ファイル: Sdl2.cs プロジェクト: PieterMarius/PhysicsEngine
 public static extern EventState GameControllerEventState(EventState state);
コード例 #49
0
ファイル: Sdl2.cs プロジェクト: PieterMarius/PhysicsEngine
 public static extern EventState JoystickEventState(EventState enabled);
コード例 #50
0
ファイル: ShrineADV.cs プロジェクト: tom10987/Unity.Kotodama
 void Start() {
   state = gameObject.GetComponentInChildren<EventState>();
   //    state._entry = ;
 }
コード例 #51
0
        public String Start()
        {
            currentDialog = 0;
            currentElement = 0;

            validChoices.Clear();
            validDialogs.Clear();
            validElements.Clear();

            if (orderedElements.Count == 0)
                state = EventState.END;

            state = EventState.DIALOG;

            return text;
        }
コード例 #52
0
ファイル: KeyboardEvent.cs プロジェクト: microm/eplib
 public KeyboardEvent(EventState state, TKey key, LockKey lockKey)
 {
     m_state = state;
     m_key = key;
     m_lockKey = lockKey;
 }
コード例 #53
0
ファイル: TutorialADV.cs プロジェクト: maro-n/Kotodama
 void Start() {
   _tutorial = gameObject.GetComponentInChildren<EventState>();
 }
コード例 #54
0
 public List<Choice> GetChoices()
 {
     state = EventState.END;
     return validChoices;
 }
コード例 #55
0
        private void UpdateDisplay(Data.user user, Data.participant part, Data.fitevent evt, Data.sponsor sponsor, Data.sponsor[] sponsors, bool isParticipant, EventState eventState) {
            litEventName.Text = evt.name;
            litBegins.Text = string.Format("{0:MM/dd/yy}", evt.begins);
            litEnds.Text = string.Format("{0:MM/dd/yy}", evt.ends);

            decimal percent = 0;

            phSponsors.Visible = isParticipant;
            btnSettleEvent.Enabled = !evt.settled;
            phPledge.Visible = (!isParticipant && !evt.settled);
            phDonation.Visible = (!isParticipant && evt.settled);
            if(!isParticipant) {
                if(!evt.settled) {
                    litPledgeAmount.Text = string.Format("{0:c}", sponsor.pledgeAmount);
                    litPledgeUnit.Text = sponsor.pledgePerSteps.ToString();
                    litDonationMax.Text = string.Format("{0:c}", sponsor.donationMax);
                    litPayMethodType.Text = sponsor.payMethodType;
                } else {
                    var donation = sponsor.donations.SingleOrDefault();
                    if(donation != null) {
                        litDonationAmount.Text = string.Format("{0:c}", donation.amount);
                    } else {
                        //TODO: Display something to indicate that transaction failed
                    }
                }
            }
            switch(eventState) {
                case EventState.Before:
                    phBeforeTop.Visible = true;
                    litEstSteps.Text = evt.estimatedSteps.ToString();
                    phStepsToMax.Visible = isParticipant;
                    litStepsToMax.Text = CalcStepsToMaxDonation(evt, sponsors);
                    litEstDonations.Text = CalcEstDonations(evt, sponsors);
                    phMaxDonations.Visible = isParticipant;
                    litMaxDonations.Text = CalcMaxDonations(evt, sponsors);

                    if(isParticipant) {
                        PopulateSponsorPledgeList(phSponsors, sponsors);
                    } else {
                    }
                    break;
                case EventState.During:
                    phDuringTop.Visible = true;
                    litRaisedDuring.Text = CalcRaised(part, evt, sponsors);
                    litEstDonationsDuring.Text = CalcEstDonations(evt, sponsors);
                    litStepsDuring.Text = part.stepsTaken.ToString();
                    litEstStepsDuring.Text = evt.estimatedSteps.ToString();
                    percent = CalcPercentToGoal(part, evt);
                    pnlProgressBarDuringTop.Style["width"] = percent.ToString() + "%";
                    litPercentToGoalDuring.Text = percent.ToString();
                    litTimeRemaining.Text = CalcTimeRemaining(evt);

                    if(isParticipant) {
                        PopulateSponsorPledgeList(phSponsors, sponsors);
                    } else {
                    }
                    break;
                case EventState.After:
                    phAfterTop.Visible = true;
                    litRaisedAfter.Text = CalcRaised(part, evt, sponsors);
                    litStepsAfter.Text = part.stepsTaken.ToString();
                    
                    litSuccessMessage.Text = GetSuccessMessage(isParticipant, part, evt, sponsors);
                    litSettlementStatus.Text = GetSettlementStatus(evt, sponsors);

                    percent = CalcPercentToGoal(part, evt);
                    pnlProgressBarAfterTop.Style["width"] = percent.ToString() + "%";
                    litPercentToGoalAfter.Text = percent.ToString();

                    if(isParticipant) {
                        if(evt.settled)
                            PopulateSponsorDonationList(phSponsors, sponsors);
                        else
                            PopulateSponsorPledgeList(phSponsors, sponsors);
                    } else {
                    }
                    break;
            }
        }
コード例 #56
0
		public Task EnqueueAsync(string id, EventState state, JObject data, JObject metadata)
		{
			AssertValidState();

			var item = new WriteState
				{
					Data = data,
					State = state,
					Metadata = metadata,
					Id = id
				};

			itemsToWrite.Enqueue(item);
			hasItems.Set();
			return item.TaskCompletionSource.Task;
		}
コード例 #57
0
 public Dialog NextDialog()
 {
     if (currentDialog < validDialogs.Count)
     {
         return validDialogs[currentDialog++];
     }
     else
     {
         state = EventState.CHOICES;
         return null;
     }
 }
コード例 #58
0
        /// <summary>
        /// Calculate the probability for a state.
        /// </summary>
        /// <param name="state">The state to calculate.</param>
        /// <returns>The probability.</returns>
        private double CalculateProbability(EventState state)
        {
            int[] args = ObtainArgs(state.Event);

            foreach (TableLine line in state.Event.Table.Lines)
            {
                if (line.CompareArgs(args))
                {
                    if (Math.Abs(line.Result - state.Value) < EncogFramework.DefaultDoubleEqual)
                    {
                        return line.Probability;
                    }
                }
            }

            throw new BayesianError("Could not determine the probability for "
                                    + state);
        }
コード例 #59
0
 public ScriptElement NextElement()
 {
     if (currentElement < validElements.Count)
     {
         return validElements[currentElement++];
     }
     else
     {
         state = EventState.CHOICES;
         return null;
     }
 }
コード例 #60
0
 private void SetComboBoxInitialValue()
 {
     eventState = EventState.LayoutChangeEvent;
     cboLanguage.SelectedIndex = 0;
     cboEditorial.SelectedIndex = 0;
     cboGenre.SelectedIndex = 0;
     cboAuthor.SelectedIndex = 0;
     cboLevel.SelectedIndex = 0;
     eventState = EventState.UserEvent;
 }