コード例 #1
0
 public void ChangeStatus(PersonStatus newStatus)
 {
     if (newStatus == PersonStatus.HEALTHY)
     {
         GetComponent <Renderer>().material = healthyMaterial;
     }
     else if (newStatus == PersonStatus.SICK)
     {
         GetComponent <Renderer>().material = sickMaterial;
         StatisticsBehaviour.MeContagie();
     }
     else if (newStatus == PersonStatus.TREATMENT)
     {
         GetComponent <Renderer>().material = inTreatmentMaterial;
     }
     else if (newStatus == PersonStatus.DIED)
     {
         GetComponent <Renderer>().material = diedMaterial;
     }
     else if (newStatus == PersonStatus.RECOVERED)
     {
         GetComponent <Renderer>().material = recoveredMaterial;
     }
     status = newStatus;
 }
コード例 #2
0
    void burnPerson(PersonStatus status)
    {
        FireEffect effect = new FireEffect();

        effect.initialize(fireDealer);
        status.ActivePower = effect;
    }
コード例 #3
0
        public async Task ShouldReturn_Valid_Person(string fileName, bool invitePending, bool loginEnabled,
                                                    PersonStatus status, PersonType type)
        {
            var content = GetResource(fileName);
            var api     = GetApi <Person>(HttpMethod.Get, $"{WxTeamsConstants.PeopleUrl}/UserId", content);

            var user = await api.GetUserAsync("UserId");

            user.Avatar.Should().Be("https://1efa7a94ed21783e352-c62266528714497a17239ececf39e9e2.ssl.cf1.rackcdn.com/V1~54c844c89e678e5a7b16a306bc2897b9~wx29yGtlTpilEFlYzqPKag==~1600");
            user.Created.Should().Be(new DateTimeOffset(2015, 10, 18, 14, 26, 16, TimeSpan.Zero));
            user.DisplayName.Should().Be("John Andersen");
            user.Emails.First().Should().Be("*****@*****.**");
            user.FirstName.Should().Be("John");
            user.Id.Should().Be("Y2lzY29zcGFyazovL3VzL1BFT1BMRS9mNWIzNjE4Ny1jOGRkLTQ3MjctOGIyZi1mOWM0NDdmMjkwNDY");
            user.InvitePending.Should().Be(invitePending);
            user.LastActivity.Should().Be(new DateTimeOffset(2015, 10, 18, 14, 26, 16, 028, TimeSpan.Zero));
            user.LastModified.Should().Be(new DateTimeOffset(2015, 10, 18, 14, 26, 16, TimeSpan.Zero));
            user.LastName.Should().Be("Andersen");
            user.Licenses.Count.Should().Be(2);
            user.Licenses.Any(x => x == "Y2lzY29zcGFyazovL3VzL0xJQ0VOU0UvOTZhYmMyYWEtM2RjYy0xMWU1LWExNTItZmUzNDgxOWNkYzlh").Should().BeTrue();
            user.Licenses.Any(x => x == "Y2lzY29zcGFyazovL3VzL0xJQ0VOU0UvOTZhYmMyYWEtM2RjYy0xMWU1LWIyNjMtMGY0NTkyYWRlZmFi").Should().BeTrue();
            user.LoginEnabled.Should().Be(loginEnabled);
            user.NickName.Should().Be("John");
            user.OrgId.Should().Be("Y2lzY29zcGFyazovL3VzL09SR0FOSVpBVElPTi85NmFiYzJhYS0zZGNjLTExZTUtYTE1Mi1mZTM0ODE5Y2RjOWE");
            user.PhoneNumbers.Any(x => x.Type == "work" && x.Value == "+1 408 526 7209").Should().BeTrue();
            user.Roles.Count.Should().Be(2);
            user.Roles.Any(x => x == "Y2lzY29zcGFyazovL3VzL1JPTEUvOTZhYmMyYWEtM2RjYy0xMWU1LWExNTItZmUzNDgxOWNkYzlh").Should().BeTrue();
            user.Roles.Any(x => x == "Y2lzY29zcGFyazovL3VzL1JPTEUvOTZhYmMyYWEtM2RjYy0xMWU1LWIyNjMtMGY0NTkyYWRlZmFi").Should().BeTrue();
            user.Status.Should().Be(status);
            user.Timezone.Should().Be("America/Denver");
            user.Type.Should().Be(type);
            user.TeamsApi.Should().NotBeNull();
            user.TeamsApi.TeamsClient.Should().NotBeNull();
        }
コード例 #4
0
ファイル: Fire.cs プロジェクト: AlessandroOsima/Judgement-Day
    //UPDATE POWER EFFECTS
    public override void deliverPowerEffects(PersonStatus status, AnimationScript animator, UnitNavigationController navigator)
    {
        if (status.UnitStatus != PersonStatus.Status.Raged && status.UnitStatus != PersonStatus.Status.Dead && !started)
        {
            started              = true;
            status.UnitStatus    = PersonStatus.Status.Panicked;
            animator.powerEffect = (GameObject)Instantiate(particleEffect, new Vector3(status.transform.position.x, status.transform.position.y + 0.9f, status.transform.position.z), Quaternion.identity);
            animator.powerEffect.transform.parent = animator.transform;
            status.Fear = Fear;
        }
        else if (status.UnitStatus != PersonStatus.Status.Raged && status.UnitStatus != PersonStatus.Status.Dead)
        {
            timer += Time.deltaTime;
            if (timer >= 10f)
            {
                status.Fear       = 0;
                status.UnitStatus = PersonStatus.Status.Dead;
                navigator.Stop();
                started = false;
            }
        }

        if (status.UnitStatus == PersonStatus.Status.Dead)
        {
            Destroy(animator.powerEffect, 3f);
            status.ActivePower = null;
        }
    }
コード例 #5
0
ファイル: Rage.cs プロジェクト: AlessandroOsima/Judgement-Day
    public override void deliverPowerEffects(PersonStatus status, AnimationScript animator, UnitNavigationController navigator)
    {
        if (status.UnitStatus != PersonStatus.Status.Raged && status.UnitStatus != PersonStatus.Status.Dead)
        {
            timer             = 0;
            status.UnitStatus = PersonStatus.Status.Raged;
            navigator.Stop();
            animator.powerEffect = (GameObject)Instantiate(particleEffect, new Vector3(status.transform.position.x, status.transform.position.y + 0.9f, status.transform.position.z), Quaternion.identity);
            animator.powerEffect.transform.parent = animator.transform;
            status.Fear = Fear;
        }
        else
        {
            timer += Time.deltaTime;
            if (timer >= 10f)
            {
                status.UnitStatus = PersonStatus.Status.Concerned;
                status.Fear       = 0;
                Destroy(animator.powerEffect);
                status.ActivePower = null;
                navigator.SetNewPatrolDestination(navigator.Type);
                navigator.target = null;
            }
        }

        if (status.UnitStatus == PersonStatus.Status.Dead)
        {
            if (animator.powerEffect != null)
            {
                Destroy(animator.powerEffect);
            }
        }
    }
コード例 #6
0
        public async Task <PersonStatus> AddPersonStatusAsync(string userId, string eventId, AddPersonStatus addPersonStatus)
        {
            Person person = await _personService.GetPersonAsync(userId, addPersonStatus.PersonId);

            if (person == null)
            {
                return(null);
            }

            var @event = await _eventService.GetEventAsync(userId, eventId);

            if (@event == null)
            {
                return(null);
            }

            string       personStatusId = GetNextId((await _eventService.GetEveryonesEventsAsync()).SelectMany(e => e.PersonStatuses).Select(s => s.Id));
            PersonStatus personStatus   = new PersonStatus
            {
                Id       = personStatusId,
                PersonId = addPersonStatus.PersonId,
                Status   = addPersonStatus.Status
            };

            @event.PersonStatuses.Add(personStatus);
            await _apiContext.SaveChangesAsync();

            return(personStatus);
        }
コード例 #7
0
        private TopicNode CreateTopicNode(string topic, PersonStatus validStatus = PersonStatus.Any, PersonStatus changeToStatus = PersonStatus.Any)
        {
            var n = new TopicNode(topic, validStatus, changeToStatus);

            _nodes.Add(n);
            return(n);
        }
コード例 #8
0
ファイル: Person.cs プロジェクト: MerivaIe/GoingSouth
    public void OnWaitingAreaEnter(WaitingArea waitingAreaEnterred)
    {
        WaitingArea desiredWaitingArea = (myTargetTimetableItem != null && myTargetTimetableItem.platform != null) ? myTargetTimetableItem.platform.waitingArea : GameManager.instance.foyer;

        if (waitingAreaEnterred == desiredWaitingArea)
        {
            if (status == PersonStatus.BoardingTrain)                   //for any people that fall out of train while boarding just register them as passing through
            {
                waitingAreaEnterred.RegisterNonWaitingPerson(this);
            }
            else if (status == PersonStatus.MovingToPlatform)
            {
                status = PersonStatus.ReadyToBoard;
                if (myTargetTimetableItem != null && myTargetTimetableItem.train != null && myTargetTimetableItem.train.status == Train.TrainStatus.BoardingTime)                       //if we have entered a platform whilst train is boarding already then call OnTrainBoarding and just register that we are passing through
                {
                    waitingAreaEnterred.RegisterNonWaitingPerson(this);
                    OnTrainBoardingTime();
                }
                else
                {
                    SetMovingToWaitLocationInWaitingArea(waitingAreaEnterred);
                }
            }
            else if (status == PersonStatus.MovingToFoyer)
            {
                status = PersonStatus.AtFoyer;
                SetMovingToWaitLocationInWaitingArea(waitingAreaEnterred);
            }
        }
        else
        {
            waitingAreaEnterred.RegisterNonWaitingPerson(this);
        }
    }
コード例 #9
0
        public override IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
        {
            List <ValidationResult> errors = new List <ValidationResult>();

            // Validate GivenName
            if (string.IsNullOrWhiteSpace(GivenName))
            {
                errors.Add(new ValidationResult("A given name must be provided", new string[] { "GivenName" }));
            }
            // Validate FamilyName
            if (string.IsNullOrWhiteSpace(FamilyName))
            {
                errors.Add(new ValidationResult("A family name must be provided", new string[] { "FamilyName" }));
            }

            // Set the value of CommonName if not present
            if (string.IsNullOrWhiteSpace(CommonName))
            {
                CommonName = $"{GivenName} {FamilyName}";
            }

            // Correct invalid status if the person has passed away
            if (DeathDate.HasValue && Status != PersonStatus.Deceased)
            {
                Status = PersonStatus.Deceased;
            }

            // Call the base method
            errors.AddRange(base.Validate(validationContext));

            return(errors);
        }
コード例 #10
0
    //UPDATE POWER EFFECTS
    public override void deliverPowerEffects(PersonStatus status, AnimationScript animator, UnitNavigationController navigator)
    {
        if (status.UnitStatus != PersonStatus.Status.Raged && status.UnitStatus != PersonStatus.Status.Dead && !started)
        {
            if (animator.powerEffect)
            {
                Object.Destroy(animator.powerEffect);
            }

            started           = true;
            status.UnitStatus = PersonStatus.Status.Panicked;
            BasePowerDealer fireDealer = (BasePowerDealer)GameObject.Find("Fire").GetComponent <BasePowerDealer>();
            Debug.Log(fireDealer.particleEffect);
            animator.powerEffect = (GameObject)Object.Instantiate(owner.particleEffect, new Vector3(status.transform.position.x, status.transform.position.y + 0.9f, status.transform.position.z), Quaternion.identity);
            animator.powerEffect.transform.parent = animator.transform;
            status.Fear       = owner.Fear;
            status.UnitStatus = PersonStatus.Status.Dead;
        }

        if (status.UnitStatus == PersonStatus.Status.Dead)
        {
            Object.Destroy(animator.powerEffect, 1f);
            status.ActivePower = null;
        }
    }
コード例 #11
0
ファイル: Person.cs プロジェクト: MerivaIe/GoingSouth
 public void OnTrainDeparture()
 {
     Component.Destroy(rb);
     transform.parent     = myTargetTimetableItem.train.transform;
     status               = PersonStatus.SatDown;
     totalApprovalRating += 50;
 }
コード例 #12
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,PersonStatusName")] PersonStatus personStatus)
        {
            if (id != personStatus.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(personStatus);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PersonStatusExists(personStatus.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(personStatus));
        }
コード例 #13
0
    public override void deliverPowerEffects(PersonStatus status, AnimationScript animator, UnitNavigationController navigator)
    {
        if (status.UnitStatus != PersonStatus.Status.Dead && timer == 0)
        {
            status.Fear = 0;
            navigator.Stop();
            status.UnitStatus = PersonStatus.Status.Idle;

            if (animator.powerEffect)
            {
                Object.Destroy(animator.powerEffect);
            }

            animator.powerEffect = (GameObject)Object.Instantiate(owner.particleEffect, new Vector3(status.transform.position.x, status.transform.position.y + 0f, status.transform.position.z), Quaternion.identity);
            animator.powerEffect.transform.parent = animator.transform;
        }

        timer      += Time.deltaTime;
        status.Fear = 0;

        if (timer >= 10)
        {
            Object.Destroy(animator.powerEffect);
            status.UnitStatus = PersonStatus.Status.Calm;
            navigator.SetNewPatrolDestination(navigator.Type);
            status.ActivePower = null;
        }
    }
コード例 #14
0
    //COLLISION
    public override void OnTriggerEnter(Collider other)
    {
//#if !UNITY_WINRT && UNITY_EDITOR
        string effectName = this.gameObject.name + "Effect";

        //Type type = Type.GetType(effectName);
#if UNITY_WINRT && !UNITY_EDITOR
        //PowerEffect effect = (PowerEffect)typeof(BasePowerDealer).GetTypeInfo().Assembly.CreateInstance(effectName);
        //PowerEffect effect = (PowerEffect)Activator.CreateInstance(typeof(BasePowerDealer).GetTypeInfo().Assembly.ToString(), effectName);

        PowerEffect powerEffect = getEffectFromName(effectName);
        //PowerEffect effect = (PowerEffect)Activator.CreateInstance(typeof(FireEffect));
#else
        PowerEffect powerEffect = (PowerEffect)Assembly.GetAssembly(this.GetType()).CreateInstance(effectName);
#endif

        powerEffect.initialize(this);

        if (!powerEffect.OnTriggerEnterOverride(other, this))
        {
            if (other.tag == GlobalManager.npcsTag)
            {
                PersonStatus person = other.GetComponent <PersonStatus> ();

                if (person.UnitStatus != PersonStatus.Status.Dead && person.IsAValidTarget)
                {
                    person.ActivePower = powerEffect;
                }
            }
        }
//#endif
    }
コード例 #15
0
ファイル: Person.cs プロジェクト: scglwsj/DapperTest
 public Person(int id, string name, string remark, PersonStatus status)
 {
     Id     = id;
     Name   = name;
     Remark = remark;
     Status = status;
 }
コード例 #16
0
 public void UpdateSpeaker(PersonStatus changeToStatus)
 {
     // Update Speaker
     if (changeToStatus != PersonStatus.Any)
     {
         Speaker.Status = changeToStatus;
     }
 }
コード例 #17
0
 void OnTriggerExit(Collider other)
 {
     if (other.tag == GlobalManager.npcsTag)
     {
         PersonStatus status = other.gameObject.GetComponent <PersonStatus>();
         status.IsAValidTarget = true;
     }
 }
コード例 #18
0
        public async Task<IActionResult> GetPersonStatus(string eventId, string id)
        {
            PersonStatus personStatus = await _personStatusService.GetPersonStatusAsync(User.Identity.Name, eventId, id);

            if (personStatus == null) return NotFound();

            return Ok(personStatus);
        }
コード例 #19
0
ファイル: Person.cs プロジェクト: MerivaIe/GoingSouth
 //might be better to actually do all of this on a switch(on status) at the base level actually- it is getting hard to read
 void FixedUpdate()
 {
     //only the four following statuses need to be handled in fixed update...
     if (status == PersonStatus.FindingSeat || status == PersonStatus.ReadyToBoard || status == PersonStatus.MovingToTrainDoor || status == PersonStatus.BoardingTrain)
     {
         if (myTargetTimetableItem != null && myTargetTimetableItem.train != null && myTargetTimetableItem.train.status == Train.TrainStatus.BoardingTime)
         {
             if (status == PersonStatus.FindingSeat)
             {
                 if (rb.mass == 10f && Vector3.Angle(transform.up, Vector3.up) < 30f)                        //if this is a light person and they are standing then add up force for crowd surfing
                 {
                     rb.AddForce(Vector3.up, ForceMode.Acceleration);
                 }
                 return;
             }
             //handle boarding situations (getting to door using force/velocity, getting into train using force)
             Vector3 boardingVector = trainTarget - transform.position;
             boardingVector.y = 0f;
             Vector3 boardingVectorNormalized = boardingVector.normalized;
             if (status == PersonStatus.MovingToTrainDoor && Time.time > nextCheckTime)
             {
                 boardUsingForce = !IsDirectionClear(boardingVectorNormalized);                      //check proximity periodically to set boarding by velocity or by force
                 nextCheckTime   = Time.time + checkingInterval;
             }
             if (status == PersonStatus.BoardingTrain || boardUsingForce)
             {
                 rb.AddForce(boardingForce * boardingVectorNormalized, ForceMode.Acceleration);                      //TODO: VERY LOW PRIORITY use the below but apply at transform.position at start of push and at transform.position + rb.centerOfMass at the end of the pushing... this will mean people are not flopping over at the start of pushing
                 //rb.AddForceAtPosition (boardingForce*boardingVector.normalized,transform.position,ForceMode.Acceleration);
             }
             else
             {
                 rb.velocity = nmAgent.speed * boardingVectorNormalized;
             }
         }
         else                                                                                      //catches all other TRAIN statuses when train is not boarding
         {
             if (status == PersonStatus.MovingToTrainDoor || status == PersonStatus.BoardingTrain) //pick up anyone who failed to board train
             {
                 status = PersonStatus.ReadyToBoard;                                               //TODO: URGENT I do not think this is required now that in CheckForTimetableChanges it will send people back to foyer
             }
             if (status == PersonStatus.ReadyToBoard)                                              //TODO: URGENT turning physics on for people waiting seems to drastically derease performance... why?
             // could add an interval to this check if this is too heavy on performance (i.e. 'if (Time.time > nextCheckTime) {')
             {
                 toWaitingTarget.x = waitingTarget.x - transform.position.x;
                 toWaitingTarget.z = waitingTarget.z - transform.position.z;
                 atWaitingTarget   = toWaitingTarget.sqrMagnitude < sqrTargetThreshold;              //<0.1^2
                 if (atWaitingTarget && nmAgent.enabled)                                             //if under agent control and close to target: turn off agent
                 {
                     SetAgentControl(false);
                 }
                 else if (!atWaitingTarget && !nmAgent.enabled)                                    //else under physics control and not close: nudge towards target
                 {
                     rb.AddForce(toWaitingTarget.normalized * nudgeForce, ForceMode.Acceleration); //TODO VERY LOW PRIORITY could improve performance further by setting direction just once? (normalized is heavy)
                 }
             }
         }
     }
 }
コード例 #20
0
        public void AddPersonStatus(PersonStatus ps)
        {
            if (!_calcParameters.IsSet(CalcOption.PersonStatus))
            {
                return;
            }

            _personStatus.Add(ps);
        }
 public ActionResult Edit([Bind(Include = "Id,Name")] PersonStatus personStatus)
 {
     if (ModelState.IsValid)
     {
         _psm.Update(personStatus);
         return(RedirectToAction("Index"));
     }
     return(View(personStatus));
 }
コード例 #22
0
        public TopicNode(string name, PersonStatus validStatus, PersonStatus changeToStatus) : base(validStatus, changeToStatus)
        {
            Name         = name;
            CurrentDepth = 1;

            _children = new Dictionary <int, IList <BaseNode> > {
                { 0, new List <BaseNode>() }
            };
        }
コード例 #23
0
    void powerDeActivated(PersonStatus person)
    {
        activatedPowers--;

        if (activatedPowers <= 0)
        {
            souls = souls;             // will update souls number and cause the gamestate to be set to defeat
        }
        //Debug.Log(activatedPowers);
    }
コード例 #24
0
        public async Task<IActionResult> AddPersonStatus(string eventId, [FromBody] AddPersonStatus addPersonStatus)
        {
            if (addPersonStatus == null) return BadRequest();

            PersonStatus personStatus = await _personStatusService.AddPersonStatusAsync(User.Identity.Name, eventId, addPersonStatus);

            if (personStatus == null) return BadRequest();

            return CreatedAtRoute("GetPersonStatus", new { id = personStatus.Id }, personStatus);
        }
コード例 #25
0
ファイル: Person.cs プロジェクト: RomanTino/Store
 public Person(string inName, string inSurname, string inNick, string inPassword, string inEmail, string inPhoneNumber, PersonStatus inStatus)
 {
     this.name = inName;
     this.surname = inSurname;
     this.nick = inNick;
     this.password = inPassword;
     this.email = inEmail;
     this.phoneNumber = inPhoneNumber;
     this.status = inStatus;
 }
コード例 #26
0
ファイル: Person.cs プロジェクト: RomanTino/Store
 public Person()
 {
     this.name = "N/A";
     this.surname = "N/A";
     this.nick = "N/A";
     this.password = "******";
     this.email = "N/A";
     this.phoneNumber = "N/A";
     this.status = PersonStatus.User;
 }
コード例 #27
0
 public UpdatePerson(int currentUserID, Person selectedPerson, PersonStatus personStatus)
 {
     InitializeComponent();
     dataBaseConnection  = new DataBaseConnection();
     mainWindow          = new MainWindow();
     this.currentUserID  = currentUserID;
     this.selectedPerson = selectedPerson;
     this.personStatus   = personStatus;
     FillFields(selectedPerson);
 }
コード例 #28
0
    public override void OnTriggerEnter(Collider other)
    {
        if (other.tag == GlobalManager.npcsTag)
        {
            PersonStatus person = other.GetComponent <PersonStatus>();

            //if(person.UnitStatus != PersonStatus.Status.Dead)
            //person.ActivePower = null;
        }
    }
コード例 #29
0
ファイル: Person.cs プロジェクト: MerivaIe/GoingSouth
 public void OnTrainBoardingTime()           //called 'optimistically' on EVERYONE at platform... some people may be passing through which is why we have the check here
 {
     if (status == PersonStatus.ReadyToBoard)
     {
         SetAgentControl(false);
         SetDoorTarget();
         transform.LookAt(trainTarget);              //maybe look at random target? or smoother
         status = PersonStatus.MovingToTrainDoor;
     }
 }
コード例 #30
0
        public async Task <IActionResult> Create([Bind("Id,PersonStatusName")] PersonStatus personStatus)
        {
            if (ModelState.IsValid)
            {
                _context.Add(personStatus);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(personStatus));
        }
コード例 #31
0
ファイル: Person.cs プロジェクト: MerivaIe/GoingSouth
 public void OnHitTrain()
 {
     if (status != PersonStatus.Compromised)
     {
         status = PersonStatus.Compromised;
         SetAgentControl(false);
         rb.ResetCenterOfMass();
         rb.constraints       = RigidbodyConstraints.None;
         totalApprovalRating -= 50;
     }
 }
コード例 #32
0
ファイル: BaseNode.cs プロジェクト: alexania/DialogueTree
        public BaseNode(PersonStatus validStatus, PersonStatus changeToStatus)
        {
            ValidStatuses = new List <PersonStatus> {
                validStatus
            };
            ChangeToStatus = changeToStatus;

            Conditions = new List <ICondition>();
            Effects    = new List <IEffect>();

            LastParent = null;
        }
コード例 #33
0
 public async Task UpdatePersonStatusWithElseConditionAsync()
 {
     try
     {
         var personStatus = new PersonStatus { GangwayLocation = "Gangway Location", MachineName = Environment.MachineName, PersonId = "1", PersonTypeId = "1", PersonEvent = new PersonEvent { AddedBy = "Test" }, Port = "port", ShipId = "5", Status = "True", StatusChangedBy = "Me", StatusChangedDate = DateTime.Now, StatusTypeId = "1", VoyageId = "1" };
         var result = await this.repository.UpdatePersonStatusAsync(personStatus, false);
     }
     finally
     {
         this.Dispose();
     }
 }
コード例 #34
0
ファイル: Person.cs プロジェクト: ptmaster/ZhongHuaSanGuoZhi
 //现在用PlayerKillLeader代替,应该没有使用
 public void Killed()
 {
     if (((this.LocationArchitecture != null) && !this.IsCaptive) && (this.BelongedFaction == null))
     {
         if (this.OnBeKilled != null)
         {
             this.OnBeKilled(this, this.LocationArchitecture);
         }
         this.Alive = false;
         this.ArrivingDays = 0;
         this.Status = PersonStatus.None;
         this.LocationArchitecture = null;
     }
     else if ((this.TargetArchitecture != null) && (this.BelongedFaction == null))
     {
         if (this.OnBeKilled != null)
         {
             this.OnBeKilled(this, this.TargetArchitecture);
         }
         this.Alive = false;
         this.ArrivingDays = 0;
         this.status = PersonStatus.None;
         base.Scenario.AvailablePersons.Remove(this);
     }
 }
コード例 #35
0
        /// <summary>
        /// Updates the person status asynchronous.
        /// </summary>
        /// <param name="personStatus">The person status.</param>
        /// <param name="isOnlineMode">if set to <c>true</c> [is on line mode].</param>
        /// <returns>
        /// status string
        /// </returns>
        private async Task<string> UpdatePersonStatus(PersonStatus personStatus, bool isOnlineMode)
        {
            try
            {
                await DIContainer.Instance.Resolve<PersonStatusClientRepository>().UpdatePersonStatusAsync(personStatus);
                if (isOnlineMode && personStatus.PersonEvent != null)
                {
                    await this.personEventClientRepository.CreateAsync(personStatus.PersonEvent);
                }

                return SuccessStatus;
            }
            catch (Exception exception)
            {
                LogManager.Write(exception);
                return FailureStatus;
            }
        }
コード例 #36
0
 public async Task UpdatePersonStatusAsync()
 {
     try
     {
         DIContainer.Instance.RegisterType<IPersonStatusesClient, PersonStatusesClient>();
         DIContainer.Instance.RegisterType<IPersonStatusTypesClient, PersonStatusTypesClient>();
         DIContainer.Instance.Resolve<IApplicationSetting>().PersonStatusServiceBaseAddress = "http://Localhost/";
         var personStatus = new PersonStatus { GangwayLocation = "Gangway Location", MachineName = Environment.MachineName, PersonId = "1", PersonTypeId = "1", Port = "port", ShipId = "5", Status = "True", StatusChangedBy = "Me", StatusChangedDate = DateTime.Now, StatusTypeId = "1", VoyageId = "1", PersonEvent = new PersonEvent { }, StatusChangedDateGMT = System.DateTime.Now };
         var result = await this.repository.UpdatePersonStatusAsync(personStatus, true);
     }
     finally
     {
         this.Dispose();
     }
 }
コード例 #37
0
 /// <summary>
 /// Updates person status
 /// </summary>
 /// <param name="personStatus">person Status object</param>
 /// <returns>Task instance containing string.</returns>
 public async Task<string> UpdatePersonStatusAsync(PersonStatus personStatus)
 {
     return await this.personStatusesClient.CreatePersonStatusAsync(JsonConvert.SerializeObject(personStatus));
 }
コード例 #38
0
ファイル: Person.cs プロジェクト: simon217/ZhongHuaSanGuoZhi
 //现在用PlayerKillLeader代替,应该没有使用
 public void Killed()
 {
     if (((this.LocationArchitecture != null) && !this.IsCaptive) && (this.BelongedFaction == null))
     {
         if (this.OnBeKilled != null)
         {
             this.OnBeKilled(this, this.LocationArchitecture);
         }
         if ((this.LocationArchitecture.BelongedFaction != null) && (this.LocationArchitecture.BelongedFaction.Leader != null))
         {
             foreach (Person person in base.Scenario.AvailablePersons)
             {
                 if ((person != this) && (((person.Father >= 0) && (person.Father == base.ID)) || ((person.Brother >= 0) && (person.Brother == this.Brother))))
                 {
                     person.ProhibitedFactionID = this.LocationArchitecture.BelongedFaction.Leader.ID;
                 }
             }
         }
         this.Alive = false;
         this.ArrivingDays = 0;
         this.Status = PersonStatus.None;
         this.LocationArchitecture = null;
     }
     else if ((this.TargetArchitecture != null) && (this.BelongedFaction == null))
     {
         if (this.OnBeKilled != null)
         {
             this.OnBeKilled(this, this.TargetArchitecture);
         }
         if ((this.TargetArchitecture.BelongedFaction != null) && (this.TargetArchitecture.BelongedFaction.Leader != null))
         {
             foreach (Person person in base.Scenario.AvailablePersons)
             {
                 if ((person != this) && (((person.Father >= 0) && (person.Father == base.ID)) || ((person.Brother >= 0) && (person.Brother == this.Brother))))
                 {
                     person.ProhibitedFactionID = this.TargetArchitecture.BelongedFaction.Leader.ID;
                 }
             }
         }
         this.Alive = false;
         this.ArrivingDays = 0;
         this.status = PersonStatus.None;
         base.Scenario.AvailablePersons.Remove(this);
     }
 }
コード例 #39
0
        /// <summary>
        /// Updates the person status asynchronous.
        /// </summary>
        /// <param name="personStatus">The person status.</param>
        /// <param name="isOnlineMode">if set to <c>true</c> [is on line mode].</param>
        /// <returns>
        /// status string
        /// </returns>
        public async Task<string> UpdatePersonStatusAsync(PersonStatus personStatus, bool isOnlineMode)
        {
            if (!isOnlineMode)
            {
                /*Code for handle BT Sync duplicate records*/
                var response = await this.personEventClientRepository.CreateAsync(personStatus.PersonEvent);
                var result = response != null ? JsonConvert.DeserializeObject<bool>(response) : default(bool);
                if (result)
                {
                    return await this.UpdatePersonStatus(personStatus, isOnlineMode);
                }

                return SuccessStatus;
            }

            return await this.UpdatePersonStatus(personStatus, isOnlineMode);
        }
コード例 #40
0
 /// <summary>
 /// Setups the retrieve person status list asynchronous.
 /// </summary>
 private void SetupRetrievePersonStatusListAsync()
 {
     var personStatusList = new ListResult<PersonStatus>();
     var personStatus = new PersonStatus { GangwayLocation = "GangwayLocation", Status = "True", MachineName = Environment.MachineName, Port = "Port", StatusChangedDate = DateTime.Now, StatusTypeId = "1", PersonId = "212", PersonTypeId = "1" };
     var personStatus1 = new PersonStatus { GangwayLocation = "GangwayLocation", Status = "True", MachineName = Environment.MachineName, Port = "Port", StatusChangedDate = DateTime.Now, StatusTypeId = "2", PersonId = "600001", PersonTypeId = "2" };
     var personStatus2 = new PersonStatus { GangwayLocation = "GangwayLocation", Status = "True", MachineName = Environment.MachineName, Port = "Port", StatusChangedDate = DateTime.Now, StatusTypeId = "1", PersonId = "600001", PersonTypeId = "2" };
     var personStatus3 = new PersonStatus { GangwayLocation = "GangwayLocation", Status = "True", MachineName = Environment.MachineName, Port = "Port", StatusChangedDate = DateTime.Now, PersonId = "22", PersonTypeId = "3" };
     personStatusList.Items.Add(personStatus);
     personStatusList.Items.Add(personStatus1);
     personStatusList.Items.Add(personStatus2);
     personStatusList.Items.Add(personStatus3);
     this.personRepository.Setup(a => a.RetrievePersonStatusListAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsNotNull<PersonSearchParameter>(), It.IsAny<int?>(), It.IsAny<int?>())).Returns(Task.FromResult(personStatusList));
 }
コード例 #41
0
        /// <summary>
        /// Maps the person status.
        /// </summary>
        /// <param name="dataReader">The data reader.</param>
        /// <returns>Person Status List.</returns>
        internal static async Task<List<PersonStatus>> MapPersonStatus(SqlDataReader dataReader)
        {
            var personStatusList = new List<PersonStatus>();

            if (dataReader != null)
            {
                while (await dataReader.ReadAsync())
                {
                    var personStatus = new PersonStatus();
                    personStatus.PersonId = dataReader.Int32Field(PersonId);
                    personStatus.Status = dataReader.StringField(Status);
                    personStatus.StatusChangedDate = dataReader.DateTimeNullableField(StatusChangedDate);
                    personStatusList.Add(personStatus);
                }

                if (!dataReader.IsClosed)
                {
                    dataReader.Close();
                }
            }

            return personStatusList;
        }