Exemplo n.º 1
0
    public void SetCheckpointStatus(CheckpointStatus status, string source = "default")
    {
//		WebGLComm.inst.Debug("Set chkpt;"+status.ToString()+", source;"+source);
        if (status == CheckpointStatus.Current)
        {
            Player.inst.AddPlayerStartPriority(PlayerStartType.Checkpoint, playerStart.transform);
            PostActivatedFX();
            AudioManager.inst.PlaySuccessBeep();
            foreach (Checkpoint c in FindObjectsOfType <Checkpoint>())
            {
                // Deactivate the previous current checkpoint if applicable.
                if (c == this)
                {
                    continue;                            // don't deactivate yourself.
                }
                if (c.GetCheckpointStatus() == CheckpointStatus.Current)
                {
                    c.SetCheckpointStatus(CheckpointStatus.Used, " nother checkp activated");
                }
            }
        }
        else if (status == CheckpointStatus.Used)
        {
            PostActivatedFX();
            checkMark.GetComponent <Renderer>().material.color = new Color(.3f, .3f, .3f, .5f);
        }
        checkpointStatus = status;
//		Debug.Log("setstatus;"+status.ToString());
    }
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = (Status != null ? Status.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Enabled.GetHashCode();
         hashCode = (hashCode * 397) ^ (int)MasterStatus;
         hashCode = (hashCode * 397) ^ (StateReason != null ? StateReason.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ ProjectionId.GetHashCode();
         hashCode = (hashCode * 397) ^ Epoch.GetHashCode();
         hashCode = (hashCode * 397) ^ Version.GetHashCode();
         hashCode = (hashCode * 397) ^ (int)Mode;
         hashCode = (hashCode * 397) ^ (Position != null ? Position.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Progress.GetHashCode();
         hashCode = (hashCode * 397) ^ (LastCheckpoint != null ? LastCheckpoint.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ EventsProcessedAfterRestart;
         hashCode = (hashCode * 397) ^ BufferedEvents;
         hashCode = (hashCode * 397) ^ (CheckpointStatus != null ? CheckpointStatus.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ WritePendingEventsBeforeCheckpoint;
         hashCode = (hashCode * 397) ^ WritePendingEventsAfterCheckpoint;
         hashCode = (hashCode * 397) ^ PartitionsCached;
         hashCode = (hashCode * 397) ^ ReadsInProgress;
         hashCode = (hashCode * 397) ^ WritesInProgress;
         hashCode = (hashCode * 397) ^ (EffectiveName != null ? EffectiveName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ResultStreamName != null ? ResultStreamName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ CoreProcessingTime.GetHashCode();
         return(hashCode);
     }
 }
        public async Task <CheckpointStatus> CheckpointStatus(TextReader reader, Dictionary <string, CloudQueue> queues, ILogger log)
        {
            var json = await reader.ReadToEndAsync();

            var checkpoint = JsonConvert.DeserializeObject <Checkpoint>(json);

            var status = new CheckpointStatus();

            status.TotalAllMatches = checkpoint.Total;
            status.TotalADMatches  = checkpoint.ADTotal;
            status.Delta           = (DateTimeOffset.UtcNow - checkpoint.Timestamp).Humanize(3);

            foreach (var item in queues)
            {
                await item.Value.FetchAttributesAsync();

                status.Queues.Add(item.Key, item.Value.ApproximateMessageCount.GetValueOrDefault());
            }

            return(status);
        }