Esempio n. 1
0
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            //this.graphics.PreferredBackBufferWidth = (int) ScreenManager.Instance.Dimention.X;
            //this.graphics.PreferredBackBufferHeight = (int) ScreenManager.Instance.Dimention.Y;
            //this.graphics.ApplyChanges();


            this.player = new Warrior(new Vector2(10, 10));
            this.players.AddEnemy(player as Character);

            this.shadow = new Shadow(new Vector2(260, 10));
            this.monsters.AddEnemy(shadow as Character);
            this.skeleton = new Skeleton(new Vector2(310, 110));
            this.monsters.AddEnemy(skeleton as Character);
            this.goblin = new Goblin(new Vector2(160, 255));
            this.monsters.AddEnemy(goblin as Character);
            this.gargoyle = new Gargoyle(new Vector2(560, 10));
            this.monsters.AddEnemy(gargoyle as Character);
            this.death = new Death(new Vector2(610, 300));
            this.monsters.AddEnemy(death as Character);
            this.sorceror = new Sorceror(new Vector2(110, 410));
            this.monsters.AddEnemy(sorceror as Character);


            this.map.Initialize(this.MapFactory, this.TileFactory);


            base.Initialize();
        }
Esempio n. 2
0
        public bool IsActLocationValidInContext(IAct act)
        {
            switch (act.Location)
            {
            case Location.UNKNOWN:                                                        return(true);

            case Location.MAP when Tracking.IsCurrentlyOnMap != null:                     return((bool)Tracking.IsCurrentlyOnMap);

            case Location.SETTLEMENT when Tracking.IsCurrentlyInSettlement != null:       return((bool)Tracking.IsCurrentlyInSettlement);

            case Location.VILLAGE when Tracking.IsCurrentlyInVillage != null:             return((bool)Tracking.IsCurrentlyInVillage);

            case Location.DUNGEON when Tracking.IsCurrentlyInDungeon != null:             return((bool)Tracking.IsCurrentlyInDungeon);

            case Location.CASTLE when Tracking.IsCurrentlyInCastle != null:               return((bool)Tracking.IsCurrentlyInCastle);

            case Location.FORTIFICATION when Tracking.IsCurrentlyInFortification != null: return((bool)Tracking.IsCurrentlyInFortification);

            case Location.TOWN when Tracking.IsCurrentlyInTown != null:                   return((bool)Tracking.IsCurrentlyInTown);

            case Location.HIDEOUT when Tracking.IsCurrentlyInHideout != null:             return((bool)Tracking.IsCurrentlyInHideout);

            default: return(true);
            }
        }
        public List <PlanOfCare> FillPlanOfCare(IEntryCollection entryCollection)
        {
            List <PlanOfCare> planOfCare = new List <PlanOfCare>();

            foreach (IEntry singleRecord in entryCollection)
            {
                IObservation observation  = singleRecord.AsObservation;
                IAct         entryAct     = singleRecord.AsAct;
                string       goal         = null;
                string       instructions = null;
                if (observation != null)
                {
                    meterialCode = observation.Code;
                    goal         = meterialCode.DisplayName;
                    datetime     = observation.EffectiveTime;
                }
                if (entryAct != null)
                {
                    instructions = entryAct.Text.Text;
                }
                PlanOfCare ptPlanOfCare = new PlanOfCare();
                ptPlanOfCare.Goal         = goal;
                ptPlanOfCare.PlannedDate  = datetime != null ? datetime.Center != null ? new DateTime?(datetime.Center.AsDateTime) : null : null;
                ptPlanOfCare.Instructions = instructions;
                planOfCare.Add(ptPlanOfCare);
            }


            return(planOfCare);
        }
Esempio n. 4
0
            public async Task Handle(PacManDeadEvent notification, CancellationToken cancellationToken)
            {
                if (_gameStats.IsDemo)
                {
                    IAct act = await _mediator.Send(new GetActRequest("AttractAct"), cancellationToken);

                    await act.Reset();

                    _game.SetAct(act);

                    return;
                }

                PlayerStats currentPlayerStats = _gameStats.CurrentPlayerStats;

                if (currentPlayerStats.LivesRemaining == 0 || _gameStats.IsGameOver)
                {
                    await _mediator.Publish(new PlayerHasNoLivesEvent(), cancellationToken);

                    return;
                }

                _gameStats.ChoseNextPlayer();

                await _mediator.Publish(new PlayerStartingEvent(), cancellationToken);
            }
Esempio n. 5
0
        public IAct GetActNamed(string name)
        {
            IAct act = _acts[name];

            act.Reset();

            return(act);
        }
Esempio n. 6
0
        public async Task DrawAsync(IAct act)
        {
            var history = await act.DrawAsync(this);

            DrawEventSource.OnNext(new DrawEventArgs());
            // 描画履歴を返す。
            HistorySource.OnNext(history);
        }
Esempio n. 7
0
        private void RegisterPlayedAct(IAct act)
        {
            if (act.GetType() == typeof(BaseSequence))
            {
                return;
            }

            GameData.Instance.StoryContext.AddToPlayedActs(act);
        }
Esempio n. 8
0
        public async Task Handle(CoinInsertedEvent notification, CancellationToken cancellationToken)
        {
            _coinBox.CoinInserted();

            await _gameSoundPlayer.CoinInserted();

            IAct currentAct = _acts.GetActNamed("StartButtonAct");

            _game.SetAct(currentAct);
        }
Esempio n. 9
0
 public Act(IAct act)
 {
     Name         = act.Name;
     Intro        = act.Intro;
     Location     = act.Location;
     Image        = act.Image;
     Restrictions = act.Restrictions;
     Choices      = act.Choices;
     ParentStory  = act.ParentStory;
 }
Esempio n. 10
0
        public IAct SelectAction(List <IAct> possibleActions, IScene scene)
        {
            IAct result = null;

            while (result == null)
            {
                result = possibleActions.Where(act => act.Name == LastAction).FirstOrDefault();
            }

            LastAction = null;
            return(result);
        }
Esempio n. 11
0
        public IAct GetAct(Guid guidValue, string nameValue = null)
        {
            IAct foundAct = null;

            if (guidValue != null && guidValue != Guid.Empty)
            {
                foundAct = GetActFromPossibleList(guidValue.ToString());
            }
            if (foundAct == null && guidValue == Guid.Empty && nameValue != null)//look by name only if do not have GUID so only old flows will still work with name mapping
            {
                foundAct = GetActFromPossibleList(nameToLookBy: nameValue);
            }
            return(foundAct);
        }
Esempio n. 12
0
    private void StartAct()
    {
        if (CurrentAct != null)
        {
            CurrentAct.GameObject.SetActive(false);
        }

        CurrentAct = ActManager.Instance().GetActObject(
            ActManager.Instance().GetActDict().ElementAt(ActIndex).Key
            );

        Acts.Add(CurrentAct);
        CurrentAct.InitAct(OnActEnd);
        ContinueStory();
    }
Esempio n. 13
0
 //Manipulation with available actors that are currently registered using Observer pattern for receiving events
 public void AddActor(IAct actor)
 {
     if (actor != null)
     {
         if (actor is IPlacedInField)
         {
             ((IPlacedInField)actor).AddedToField(this);
             ActorList.AddLast(actor);
         }
         else
         {
             ActorList.AddLast(actor);
         }
     }
 }
        public List <PatientAllergies> FillAllergies(IEntryCollection entryCollection)
        {
            List <PatientAllergies> alleryies = new List <PatientAllergies>();

            foreach (IEntry entryitem in entryCollection)
            {
                IAct entryact = entryitem.AsAct;
                IEntryRelationship entryRelationship  = entryact.EntryRelationship[0];
                IObservation       entryobservation   = entryRelationship.AsObservation;
                IIVL_TS            effectivetime      = entryact.EffectiveTime;
                IParticipant2      allergyParticipant = entryobservation.Participant[0];
                IParticipantRole   participantRole    = allergyParticipant.ParticipantRole;
                IPlayingEntity     playingEntity      = participantRole.AsPlayingEntity;
                ICE              code        = playingEntity.Code;
                IPNCollection    name        = playingEntity.Name;
                string           substance   = name != null && name.Count() > 0 ? name[0].Text : code.DisplayName;
                PatientAllergies ptallergies = new PatientAllergies();
                ptallergies.substance = substance;
                IEntryRelationship entryRelationshipMFST = entryobservation.EntryRelationship.Where(r => r.TypeCode.ToString() == "MFST").FirstOrDefault();
                if (entryRelationshipMFST != null && entryRelationshipMFST.AsObservation.Value != null)
                {
                    IANY Reactionvaluecollection = entryRelationshipMFST.AsObservation.Value.FirstOrDefault();
                    CD   valuesReaction          = (CD)Reactionvaluecollection;
                    ptallergies.reaction = valuesReaction.DisplayName;
                }
                ptallergies.rxNorm = code.Code;
                IEntryRelationship entryRelationshipSUBJ = entryobservation.EntryRelationship.Where(r => r.TypeCode.ToString() == "SUBJ").FirstOrDefault();
                if (entryRelationshipSUBJ != null && entryRelationshipSUBJ.AsObservation.Value != null)
                {
                    IANY Statusvaluecollection = entryRelationshipSUBJ.AsObservation.Value.FirstOrDefault();
                    ICE  values = (ICE)Statusvaluecollection;
                    ptallergies.status = values.DisplayName;
                }
                if (effectivetime != null && effectivetime.Value != null)
                {
                    ptallergies.allergyDate = effectivetime.AsDateTime.ToString();
                }
                alleryies.Add(ptallergies);
            }

            return(alleryies);
        }
Esempio n. 15
0
        public async Task Handle(GameOverEvent notification, CancellationToken cancellationToken)
        {
            await _storage.SetHighScore(_gameStats.HighScore);

            if (_gameStats.IsGameOver)
            {
                // ReSharper disable once HeapView.BoxingAllocation
                IAct act = await _mediator.Send(new GetActRequest("AttractAct"), cancellationToken);

                await act.Reset();

                _game.SetAct(act);

                return;
            }

            _gameStats.ChoseNextPlayer();

            await _mediator.Publish(new PlayerStartingEvent(), cancellationToken);
        }
Esempio n. 16
0
        private IAct GetActFromPossibleList(String guidToLookByString = null, string nameToLookBy = null)
        {
            Guid guidToLookBy = Guid.Empty;

            if (!string.IsNullOrEmpty(guidToLookByString))
            {
                guidToLookBy = Guid.Parse(guidToLookByString);
            }

            List <IAct> lstActions = null;

            if (guidToLookBy != Guid.Empty)
            {
                lstActions = Acts.Where(x => x.Guid == guidToLookBy).ToList();
            }
            else
            {
                lstActions = Acts.Where(x => x.Description == nameToLookBy).ToList();
            }

            if (lstActions == null || lstActions.Count == 0)
            {
                return(null);
            }
            else if (lstActions.Count == 1)
            {
                return(lstActions[0]);
            }
            else//we have more than 1
            {
                IAct firstActive = lstActions.Where(x => x.Active == true).FirstOrDefault();
                if (firstActive != null)
                {
                    return(firstActive);
                }
                else
                {
                    return(lstActions[0]);//no one is Active so returning the first one
                }
            }
        }
Esempio n. 17
0
        private void Split(object sender, RoutedEventArgs e)
        {
            Act      CurrentAction = (Act)grdActions.CurrentItem;
            Activity activity      = new Activity()
            {
                Active = true
            };

            activity.TargetApplication = mCurrentActivity.TargetApplication;
            activity.ActivityName      = CurrentAction.Description;


            // Find the action index to split on
            int i = 0;

            for (i = 0; i < mCurrentActivity.Acts.Count; i++)
            {
                if (mCurrentActivity.Acts[i] == CurrentAction)
                {
                    break;
                }
            }

            // Move the actions to the new activity
            for (int j = i; j < mCurrentActivity.Acts.Count; j++)
            {
                IAct a1 = mCurrentActivity.Acts[j];
                activity.Acts.Add(a1);
            }

            // remove the actions to from current activity - need to happen in 2 steps so the array count will not change while looping backwards
            for (int j = mCurrentActivity.Acts.Count - 1; j >= i; j--)
            {
                IAct a1 = mCurrentActivity.Acts[j];
                mCurrentActivity.Acts.Remove(a1);
            }
            mBusinessFlow.AddActivity(activity);
            mBusinessFlow.Activities.CurrentItem = activity;
        }
Esempio n. 18
0
        //Performs an operation on each actor on the Field.
        //If the operation returns true, iteration MAY stop (depending on implementation, the value is ignored for now).
        public void ForEachActor <ActorType>(ActorAction <ActorType> action)
        {
            //This operation is synchronized
            lock (ActorListLock)
            {
                //Iterate over the list and Act on all actors
                LinkedListNode <IAct> actor = ActorList.First;
                while (actor != null)
                {
                    //We allow the actor to remove himself from the list by taking care of a possible concurrent list modification problem
                    IAct currentActor = actor.Value;
                    actor = actor.Next;

                    //Only Actors with the correct type will act
                    if (currentActor is ActorType)
                    {
                        //Action returns true if it intends to modify the list, but we don't use that value
                        action((ActorType)currentActor);
                    }
                }
            }
        }
Esempio n. 19
0
        public void LogAction(IAct logAction)
        {
            if (!logAction.EnableActionLogConfig)
            {
                return;
            }

            StringBuilder   strBuilder      = new StringBuilder();
            ActionLogConfig actionLogConfig = logAction.ActionLogConfig;
            FormatTextTable formatTextTable = new FormatTextTable();

            // log timestamp
            strBuilder.AppendLine(GetCurrentTimeStampHeader());

            // create a new log file if not exists and append the contents
            strBuilder.AppendLine("[Action] " + logAction.ActionDescription);
            strBuilder.AppendLine("[Text] " + actionLogConfig.ActionLogText);

            // log all the input values
            if (actionLogConfig.LogInputVariables)
            {
                strBuilder.AppendLine("[Input Values]");
                formatTextTable = new FormatTextTable();

                List <string> colHeaders = new List <string>();
                colHeaders.Add("Parameter");
                colHeaders.Add("Value");
                formatTextTable.AddRowHeader(colHeaders);

                foreach (ActInputValue actInputValue in logAction.InputValues)
                {
                    List <string> colValues = new List <string>();
                    colValues.Add(actInputValue.ItemName);
                    colValues.Add(actInputValue.Value);
                    formatTextTable.AddRowValues(colValues);
                }
                strBuilder.AppendLine(formatTextTable.FormatLogTable());
            }

            // log all the output variables
            if (actionLogConfig.LogOutputVariables)
            {
                strBuilder.AppendLine("[Return Values]");
                formatTextTable = new FormatTextTable();

                List <string> colHeaders = new List <string>();
                colHeaders.Add("Parameter");
                colHeaders.Add("Expected");
                colHeaders.Add("Actual");
                formatTextTable.AddRowHeader(colHeaders);

                foreach (ActReturnValue actReturnValue in logAction.ReturnValues)
                {
                    List <string> colValues = new List <string>();
                    colValues.Add(actReturnValue.ItemName);
                    colValues.Add(actReturnValue.Expected);
                    colValues.Add(actReturnValue.Actual);
                    formatTextTable.AddRowValues(colValues);
                }
                strBuilder.AppendLine(formatTextTable.FormatLogTable());
            }

            // action status
            if (actionLogConfig.LogRunStatus)
            {
                strBuilder.AppendLine("[Run Status] " + logAction.Status);
            }

            // action elapsed time
            if (actionLogConfig.LogElapsedTime)
            {
                strBuilder.AppendLine("[Elapsed Time (In Secs)] " + logAction.ElapsedSecs);
            }

            // action error
            if (actionLogConfig.LogError)
            {
                strBuilder.AppendLine("[Error] " + logAction.Error);
            }

            // flush value expression
            // flush flow control

            // flush to log file
            FlushToLogFile(strBuilder.ToString());
        }
Esempio n. 20
0
 public ActionReport(IAct Act, ProjEnvironment environment = null)
 {
     this.mAction = Act;
     this.mExecutionEnviroment = environment;
 }
Esempio n. 21
0
 public void PlayAct(IAct act)
 {
     GameMenu.ExitToLast();
     GameMenu.ActivateGameMenu(act.Id);
     RegisterPlayedAct(act);
 }
Esempio n. 22
0
 public static void LogAction(BusinessFlow BF, IAct act)
 {
 }
Esempio n. 23
0
 public void RemoveActor(IAct actor)
 {
     throw new NotImplementedException();
 }
Esempio n. 24
0
 public void SetAction(IAct strategy)
 {
     _strategy = strategy;
 }
Esempio n. 25
0
 public static float LayerDepth(this IAct iAct, float y)
 {
     return(y * 0.0000001f);
 }
Esempio n. 26
0
 public static void LogActionPublished(IAct act)
 {
 }
        private void okBtn_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (mItemsVarsDataIsValid)
                {
                    //Clear old dependencies configurations
                    switch (mDepededItemType)
                    {
                    case (eDependedItemsType.Actions):
                        foreach (Act activityAct in ((Activity)mParentObject).Acts)
                        {
                            activityAct.VariablesDependencies.Clear();
                        }
                        break;

                    case (eDependedItemsType.Activities):
                        foreach (Activity activity in ((BusinessFlow)mParentObject).Activities)
                        {
                            activity.VariablesDependencies.Clear();
                        }
                        break;
                    }

                    //Save new dependencies configurations
                    grdDependencies.StopGridSearch();
                    grdDependencies.grdMain.CommitEdit();
                    switch (mDepededItemType)
                    {
                    case (eDependedItemsType.Actions):
                        foreach (DataRowView row in grdDependencies.grdMain.Items)
                        {
                            IAct act       = ((Activity)mParentObject).Acts[grdDependencies.grdMain.Items.IndexOf(row)];
                            int  colsIndex = 2;
                            foreach (VariableBase var in mParentListVars)
                            {
                                foreach (OptionalValue optVal in ((VariableSelectionList)var).OptionalValuesList)
                                {
                                    if ((bool)row[colsIndex] == true)
                                    {
                                        VariableDependency actAcd = act.VariablesDependencies.Where(acd => acd.VariableName == var.Name).FirstOrDefault();
                                        if (actAcd != null)
                                        {
                                            if (actAcd.VariableValues.Contains(optVal.Value) == false)
                                            {
                                                actAcd.VariableValues.Add(optVal.Value);
                                            }
                                        }
                                        else
                                        {
                                            actAcd = new VariableDependency(var.Guid, var.Name, optVal.Value);
                                            act.VariablesDependencies.Add(actAcd);
                                        }
                                    }
                                    colsIndex++;
                                }
                            }
                        }
                        break;

                    case (eDependedItemsType.Activities):
                        foreach (DataRowView row in grdDependencies.grdMain.Items)
                        {
                            Activity act       = (Activity)((BusinessFlow)mParentObject).Activities[grdDependencies.grdMain.Items.IndexOf(row)];
                            int      colsIndex = 2;
                            foreach (VariableBase var in mParentListVars)
                            {
                                foreach (OptionalValue optVal in ((VariableSelectionList)var).OptionalValuesList)
                                {
                                    if ((bool)row[colsIndex] == true)
                                    {
                                        VariableDependency actAcd = act.VariablesDependencies.Where(acd => acd.VariableName == var.Name).FirstOrDefault();
                                        if (actAcd != null)
                                        {
                                            if (actAcd.VariableValues.Contains(optVal.Value) == false)
                                            {
                                                actAcd.VariableValues.Add(optVal.Value);
                                            }
                                        }
                                        else
                                        {
                                            actAcd = new VariableDependency(var.Guid, var.Name, optVal.Value);
                                            act.VariablesDependencies.Add(actAcd);
                                        }
                                    }
                                    colsIndex++;
                                }
                            }
                        }
                        break;
                    }
                }

                //close window
                _pageGenericWin.Close();
            }
            catch (Exception ex)
            {
                Reporter.ToUser(eUserMsgKey.GeneralErrorOccured, ex.Message);
                Reporter.ToLog(eLogLevel.ERROR, "Failed to save the " + mDepededItemType.ToString() + "-Variables dependencies configurations", ex);
                _pageGenericWin.Close();
            }
        }
Esempio n. 28
0
 void IAction.Do(IAct act)
 {
     Start_HelloAct_Action_1();
 }
Esempio n. 29
0
 public ActionReport(IAct Act, Context context)
 {
     this.mAction = Act;
     mContext     = context;
     //this.mExecutionEnviroment = environment;
 }
Esempio n. 30
0
 void IAction.Do(IAct act)
 {
     PlayTestAnimation();
 }