private void InitDatas() { DiskCenterPos = new PointF(181.5f, 184.0f); DiskArmCenterInDisImage = new PointF(388.0f, 227.5f); DiskArmCenterPos = new PointF(175.0f, 37.5f); DiskArmLength = 173.0; MinDiskRadius = 63.12289600454022; TrackNum = 200; MaxDiskRadius = 169.8035629779305; BaseAngle = MathHelper.GetAngleOfTwoVector(new PointF(-1.0f, 0), new PointF(DiskCenterPos.X - DiskArmCenterInDisImage.X, DiskCenterPos.Y - DiskArmCenterInDisImage.Y)); ArmCenterToDiskCenterLength = MathHelper.GetVectorLength(new PointF(DiskCenterPos.X - DiskArmCenterInDisImage.X, DiskCenterPos.Y - DiskArmCenterInDisImage.Y)); TextPos = new PointF(525.0f, 220.0f); DiskArmPosPointsLeftOn = new PointF(525, 10); DiskArmPosPointsRightDown = new PointF(670, 210); List <DiskState> a = new List <DiskState>(); DiskState _ds = new DiskState(); _ds.MoveIn = false; _ds.Now = 200; _ds.Target = 0; _ds.TotalAccessTime = 0; _ds.TotalRunTime = 0; _ds.TotalSeekTime = 0; _ds.Track = new int[200]; a.Add(_ds); for (int i = 0; i != 4; ++i) { IsBot[i] = false; DiskStatesIterator[i] = a.GetEnumerator(); } }
private void OnRebot(object sender, EventArgs e) { S = Disk.GetS(20); IEnumerable <DiskState>[] DiskStates = new IEnumerable <DiskState> [4]; List <DiskState> a = new List <DiskState>(); DiskState _ds = new DiskState(); _ds.MoveIn = false; _ds.Now = 200; _ds.Target = 0; _ds.TotalAccessTime = 0; _ds.TotalRunTime = 0; _ds.TotalSeekTime = 0; _ds.Track = new int[200]; a.Add(_ds); for (int i = 0; i != 4; ++i) { IsBot[i] = false; DiskStatesIterator[i] = a.GetEnumerator(); for (int j = 0; j != QueueSize; ++j) { DiskArmPosQueue[i][j] = 0; } } }
public void SetDiskColor(DiskState change) { state = change; if (state == DiskState.White) { transform.eulerAngles = Vector3.zero; } else { transform.eulerAngles = new Vector3(180, 0, 0); } }
static DiskState[,] CreateDiskGrid(string input) { var grid = new DiskState[128, 128]; for (int i = 0; i < 128; i++) { var key = input + "-" + i; var hash = KnotHash.KnotHash(key); var rowString = string.Join("", hash.SelectMany(ToBinaryString)); for (int j = 0; j < 128; j++) { grid[i, j] = rowString[j] == '1' ? DiskState.UsedUnvisited : DiskState.Free; } } return(grid); }
protected void Draw(Bitmap _RenderTarget, DiskState _In, int[] _DiskArmPosQueue) { float extraAngle = (float)(MathHelper.GetAngleOfTrigle(ArmCenterToDiskCenterLength, DiskArmLength, MathHelper.Lerp((double)MaxDiskRadius, (double)MinDiskRadius, (double)_In.Now / TrackNum))[2]); Graphics g = Graphics.FromImage(_RenderTarget); g.Clear(Color.FromArgb(0)); g.TranslateTransform(DiskArmCenterInDisImage.X, DiskArmCenterInDisImage.Y); g.RotateTransform((float)BaseAngle + extraAngle); g.TranslateTransform(-DiskArmCenterInDisImage.X, -DiskArmCenterInDisImage.Y); g.DrawImage(DiskArmImage, new PointF(DiskArmCenterInDisImage.X - DiskArmCenterPos.X, DiskArmCenterInDisImage.Y - DiskArmCenterPos.Y)); g.ResetTransform(); g.DrawString(string.Format( "移动方向:{0}\n目标磁道编号:{1}\n当前磁道:{2}\n总寻道时间:{3}\n总传输时间:{4}\n平均传输时间:{5}\n总运行时间:{6}", _In.MoveIn ? "向内" : "向外", _In.Target, _In.Now, _In.TotalSeekTime, _In.TotalAccessTime, _disk.ArgAccessDelay, _In.TotalRunTime), TextFont, TextBrush, TextPos.X, TextPos.Y); for (float i = DiskArmPosPointsLeftOn.X; i <= DiskArmPosPointsRightDown.X; i += 1) { _RenderTarget.SetPixel((int)i, (int)DiskArmPosPointsLeftOn.Y, Color.BlanchedAlmond); _RenderTarget.SetPixel((int)i, (int)DiskArmPosPointsRightDown.Y, Color.BlanchedAlmond); } for (int i = 0; i != QueueSize; ++i) { _RenderTarget.SetPixel((int)MathHelper.Lerp(DiskArmPosPointsLeftOn.X, DiskArmPosPointsRightDown.X, (double)i / QueueSize), (int)MathHelper.Lerp(DiskArmPosPointsRightDown.Y, DiskArmPosPointsLeftOn.Y, (double)(_DiskArmPosQueue[(CurrutQueueBegin + i) % QueueSize]) / TrackNum), Color.Black); } for (int i = 0; i != TrackNum; ++i) { if (_In.Track[i] != 0) { _RenderTarget.SetPixel((int)DiskArmPosPointsRightDown.X, (int)MathHelper.Lerp(DiskArmPosPointsRightDown.Y, DiskArmPosPointsLeftOn.Y, (double)i / TrackNum), Color.Red); _RenderTarget.SetPixel((int)DiskArmPosPointsRightDown.X, (int)MathHelper.Lerp(DiskArmPosPointsRightDown.Y, DiskArmPosPointsLeftOn.Y, (double)i / TrackNum) + 1, Color.Red); _RenderTarget.SetPixel((int)DiskArmPosPointsRightDown.X + 1, (int)MathHelper.Lerp(DiskArmPosPointsRightDown.Y, DiskArmPosPointsLeftOn.Y, (double)i / TrackNum), Color.Red); _RenderTarget.SetPixel((int)DiskArmPosPointsRightDown.X + 1, (int)MathHelper.Lerp(DiskArmPosPointsRightDown.Y, DiskArmPosPointsLeftOn.Y, (double)i / TrackNum) + 1, Color.Red); } } g.Dispose(); }
internal static SnapshotData DeserializeSnapshotData(JsonElement element) { Optional <string> managedBy = default; Optional <SnapshotSku> sku = default; Optional <ExtendedLocation> extendedLocation = default; IDictionary <string, string> tags = default; AzureLocation location = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; Optional <DateTimeOffset> timeCreated = default; Optional <OperatingSystemTypes> osType = default; Optional <HyperVGeneration> hyperVGeneration = default; Optional <DiskPurchasePlan> purchasePlan = default; Optional <SupportedCapabilities> supportedCapabilities = default; Optional <CreationData> creationData = default; Optional <int> diskSizeGB = default; Optional <long> diskSizeBytes = default; Optional <DiskState> diskState = default; Optional <string> uniqueId = default; Optional <EncryptionSettingsCollection> encryptionSettingsCollection = default; Optional <string> provisioningState = default; Optional <bool> incremental = default; Optional <Encryption> encryption = default; Optional <NetworkAccessPolicy> networkAccessPolicy = default; Optional <string> diskAccessId = default; Optional <DiskSecurityProfile> securityProfile = default; Optional <bool> supportsHibernation = default; Optional <PublicNetworkAccess> publicNetworkAccess = default; Optional <float> completionPercent = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("managedBy")) { managedBy = property.Value.GetString(); continue; } if (property.NameEquals("sku")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } sku = SnapshotSku.DeserializeSnapshotSku(property.Value); continue; } if (property.NameEquals("extendedLocation")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } extendedLocation = ExtendedLocation.DeserializeExtendedLocation(property.Value); continue; } if (property.NameEquals("tags")) { Dictionary <string, string> dictionary = new Dictionary <string, string>(); foreach (var property0 in property.Value.EnumerateObject()) { dictionary.Add(property0.Name, property0.Value.GetString()); } tags = dictionary; continue; } if (property.NameEquals("location")) { location = property.Value.GetString(); continue; } if (property.NameEquals("id")) { id = new ResourceIdentifier(property.Value.GetString()); continue; } if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("type")) { type = property.Value.GetString(); continue; } if (property.NameEquals("systemData")) { systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString()); continue; } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("timeCreated")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } timeCreated = property0.Value.GetDateTimeOffset("O"); continue; } if (property0.NameEquals("osType")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } osType = property0.Value.GetString().ToOperatingSystemTypes(); continue; } if (property0.NameEquals("hyperVGeneration")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } hyperVGeneration = new HyperVGeneration(property0.Value.GetString()); continue; } if (property0.NameEquals("purchasePlan")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } purchasePlan = DiskPurchasePlan.DeserializeDiskPurchasePlan(property0.Value); continue; } if (property0.NameEquals("supportedCapabilities")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } supportedCapabilities = SupportedCapabilities.DeserializeSupportedCapabilities(property0.Value); continue; } if (property0.NameEquals("creationData")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } creationData = CreationData.DeserializeCreationData(property0.Value); continue; } if (property0.NameEquals("diskSizeGB")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } diskSizeGB = property0.Value.GetInt32(); continue; } if (property0.NameEquals("diskSizeBytes")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } diskSizeBytes = property0.Value.GetInt64(); continue; } if (property0.NameEquals("diskState")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } diskState = new DiskState(property0.Value.GetString()); continue; } if (property0.NameEquals("uniqueId")) { uniqueId = property0.Value.GetString(); continue; } if (property0.NameEquals("encryptionSettingsCollection")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } encryptionSettingsCollection = EncryptionSettingsCollection.DeserializeEncryptionSettingsCollection(property0.Value); continue; } if (property0.NameEquals("provisioningState")) { provisioningState = property0.Value.GetString(); continue; } if (property0.NameEquals("incremental")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } incremental = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("encryption")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } encryption = Encryption.DeserializeEncryption(property0.Value); continue; } if (property0.NameEquals("networkAccessPolicy")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } networkAccessPolicy = new NetworkAccessPolicy(property0.Value.GetString()); continue; } if (property0.NameEquals("diskAccessId")) { diskAccessId = property0.Value.GetString(); continue; } if (property0.NameEquals("securityProfile")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } securityProfile = DiskSecurityProfile.DeserializeDiskSecurityProfile(property0.Value); continue; } if (property0.NameEquals("supportsHibernation")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } supportsHibernation = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("publicNetworkAccess")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } publicNetworkAccess = new PublicNetworkAccess(property0.Value.GetString()); continue; } if (property0.NameEquals("completionPercent")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } completionPercent = property0.Value.GetSingle(); continue; } } continue; } } return(new SnapshotData(id, name, type, systemData, tags, location, managedBy.Value, sku.Value, extendedLocation.Value, Optional.ToNullable(timeCreated), Optional.ToNullable(osType), Optional.ToNullable(hyperVGeneration), purchasePlan.Value, supportedCapabilities.Value, creationData.Value, Optional.ToNullable(diskSizeGB), Optional.ToNullable(diskSizeBytes), Optional.ToNullable(diskState), uniqueId.Value, encryptionSettingsCollection.Value, provisioningState.Value, Optional.ToNullable(incremental), encryption.Value, Optional.ToNullable(networkAccessPolicy), diskAccessId.Value, securityProfile.Value, Optional.ToNullable(supportsHibernation), Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(completionPercent))); }
internal static DiskData DeserializeDiskData(JsonElement element) { Optional <string> managedBy = default; Optional <IReadOnlyList <string> > managedByExtended = default; Optional <DiskSku> sku = default; Optional <IList <string> > zones = default; Optional <ExtendedLocation> extendedLocation = default; IDictionary <string, string> tags = default; AzureLocation location = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; Optional <DateTimeOffset> timeCreated = default; Optional <OperatingSystemTypes> osType = default; Optional <HyperVGeneration> hyperVGeneration = default; Optional <DiskPurchasePlan> purchasePlan = default; Optional <SupportedCapabilities> supportedCapabilities = default; Optional <CreationData> creationData = default; Optional <int> diskSizeGB = default; Optional <long> diskSizeBytes = default; Optional <string> uniqueId = default; Optional <EncryptionSettingsCollection> encryptionSettingsCollection = default; Optional <string> provisioningState = default; Optional <long> diskIOPSReadWrite = default; Optional <long> diskMBpsReadWrite = default; Optional <long> diskIOPSReadOnly = default; Optional <long> diskMBpsReadOnly = default; Optional <DiskState> diskState = default; Optional <Encryption> encryption = default; Optional <int> maxShares = default; Optional <IReadOnlyList <ShareInfoElement> > shareInfo = default; Optional <NetworkAccessPolicy> networkAccessPolicy = default; Optional <string> diskAccessId = default; Optional <string> tier = default; Optional <bool> burstingEnabled = default; Optional <PropertyUpdatesInProgress> propertyUpdatesInProgress = default; Optional <bool> supportsHibernation = default; Optional <DiskSecurityProfile> securityProfile = default; Optional <float> completionPercent = default; Optional <PublicNetworkAccess> publicNetworkAccess = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("managedBy")) { managedBy = property.Value.GetString(); continue; } if (property.NameEquals("managedByExtended")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <string> array = new List <string>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(item.GetString()); } managedByExtended = array; continue; } if (property.NameEquals("sku")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } sku = DiskSku.DeserializeDiskSku(property.Value); continue; } if (property.NameEquals("zones")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <string> array = new List <string>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(item.GetString()); } zones = array; continue; } if (property.NameEquals("extendedLocation")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } extendedLocation = ExtendedLocation.DeserializeExtendedLocation(property.Value); continue; } if (property.NameEquals("tags")) { Dictionary <string, string> dictionary = new Dictionary <string, string>(); foreach (var property0 in property.Value.EnumerateObject()) { dictionary.Add(property0.Name, property0.Value.GetString()); } tags = dictionary; continue; } if (property.NameEquals("location")) { location = property.Value.GetString(); continue; } if (property.NameEquals("id")) { id = new ResourceIdentifier(property.Value.GetString()); continue; } if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("type")) { type = property.Value.GetString(); continue; } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("timeCreated")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } timeCreated = property0.Value.GetDateTimeOffset("O"); continue; } if (property0.NameEquals("osType")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } osType = property0.Value.GetString().ToOperatingSystemTypes(); continue; } if (property0.NameEquals("hyperVGeneration")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } hyperVGeneration = new HyperVGeneration(property0.Value.GetString()); continue; } if (property0.NameEquals("purchasePlan")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } purchasePlan = DiskPurchasePlan.DeserializeDiskPurchasePlan(property0.Value); continue; } if (property0.NameEquals("supportedCapabilities")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } supportedCapabilities = SupportedCapabilities.DeserializeSupportedCapabilities(property0.Value); continue; } if (property0.NameEquals("creationData")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } creationData = CreationData.DeserializeCreationData(property0.Value); continue; } if (property0.NameEquals("diskSizeGB")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } diskSizeGB = property0.Value.GetInt32(); continue; } if (property0.NameEquals("diskSizeBytes")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } diskSizeBytes = property0.Value.GetInt64(); continue; } if (property0.NameEquals("uniqueId")) { uniqueId = property0.Value.GetString(); continue; } if (property0.NameEquals("encryptionSettingsCollection")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } encryptionSettingsCollection = EncryptionSettingsCollection.DeserializeEncryptionSettingsCollection(property0.Value); continue; } if (property0.NameEquals("provisioningState")) { provisioningState = property0.Value.GetString(); continue; } if (property0.NameEquals("diskIOPSReadWrite")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } diskIOPSReadWrite = property0.Value.GetInt64(); continue; } if (property0.NameEquals("diskMBpsReadWrite")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } diskMBpsReadWrite = property0.Value.GetInt64(); continue; } if (property0.NameEquals("diskIOPSReadOnly")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } diskIOPSReadOnly = property0.Value.GetInt64(); continue; } if (property0.NameEquals("diskMBpsReadOnly")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } diskMBpsReadOnly = property0.Value.GetInt64(); continue; } if (property0.NameEquals("diskState")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } diskState = new DiskState(property0.Value.GetString()); continue; } if (property0.NameEquals("encryption")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } encryption = Encryption.DeserializeEncryption(property0.Value); continue; } if (property0.NameEquals("maxShares")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } maxShares = property0.Value.GetInt32(); continue; } if (property0.NameEquals("shareInfo")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <ShareInfoElement> array = new List <ShareInfoElement>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(ShareInfoElement.DeserializeShareInfoElement(item)); } shareInfo = array; continue; } if (property0.NameEquals("networkAccessPolicy")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } networkAccessPolicy = new NetworkAccessPolicy(property0.Value.GetString()); continue; } if (property0.NameEquals("diskAccessId")) { diskAccessId = property0.Value.GetString(); continue; } if (property0.NameEquals("tier")) { tier = property0.Value.GetString(); continue; } if (property0.NameEquals("burstingEnabled")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } burstingEnabled = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("propertyUpdatesInProgress")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } propertyUpdatesInProgress = PropertyUpdatesInProgress.DeserializePropertyUpdatesInProgress(property0.Value); continue; } if (property0.NameEquals("supportsHibernation")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } supportsHibernation = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("securityProfile")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } securityProfile = DiskSecurityProfile.DeserializeDiskSecurityProfile(property0.Value); continue; } if (property0.NameEquals("completionPercent")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } completionPercent = property0.Value.GetSingle(); continue; } if (property0.NameEquals("publicNetworkAccess")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } publicNetworkAccess = new PublicNetworkAccess(property0.Value.GetString()); continue; } } continue; } } return(new DiskData(id, name, type, tags, location, managedBy.Value, Optional.ToList(managedByExtended), sku.Value, Optional.ToList(zones), extendedLocation.Value, Optional.ToNullable(timeCreated), Optional.ToNullable(osType), Optional.ToNullable(hyperVGeneration), purchasePlan.Value, supportedCapabilities.Value, creationData.Value, Optional.ToNullable(diskSizeGB), Optional.ToNullable(diskSizeBytes), uniqueId.Value, encryptionSettingsCollection.Value, provisioningState.Value, Optional.ToNullable(diskIOPSReadWrite), Optional.ToNullable(diskMBpsReadWrite), Optional.ToNullable(diskIOPSReadOnly), Optional.ToNullable(diskMBpsReadOnly), Optional.ToNullable(diskState), encryption.Value, Optional.ToNullable(maxShares), Optional.ToList(shareInfo), Optional.ToNullable(networkAccessPolicy), diskAccessId.Value, tier.Value, Optional.ToNullable(burstingEnabled), propertyUpdatesInProgress.Value, Optional.ToNullable(supportsHibernation), securityProfile.Value, Optional.ToNullable(completionPercent), Optional.ToNullable(publicNetworkAccess))); }
/**********************************AGENTS******************************************/ public void AgentsUpdate(GameTime gameTime) { previousState = displayState; if (!_isSinglePlayer || _playerWithDisk == null) { if (!displayState.IsColliding) { UpdateVelocityX(ref displayState, drag, moreDrag); UpdateVelocityY(ref displayState, drag, moreDrag); } displayState.IsColliding = false; Vector2 normalizedVelocity = normalizeVelocity(displayState.Velocity); float time = (float)gameTime.ElapsedGameTime.TotalSeconds; displayState.Position.X += time * displayState.Velocity.Y * normalizedVelocity.Y; displayState.Position.Z += time * displayState.Velocity.X * normalizedVelocity.X; displayState.CollisionArea.Center.X = displayState.Position.X; displayState.CollisionArea.Center.Z = displayState.Position.Z; notify(); } else { displayState.Position = _playerWithDisk.getPlayer().getStickPosition(); displayState.CollisionArea.Center = _playerWithDisk.getPlayer().getStickPosition(); displayState.Velocity = Vector2.Zero; } simulationState = displayState; }
private void UpdateVelocityY(ref DiskState state, float drag, float moreDrag) { if (Math.Abs(state.Velocity.Y) > _maxVelocity) { if (state.Velocity.Y >= moreDrag) state.Velocity.Y -= moreDrag; else if (state.Velocity.Y <= -moreDrag) state.Velocity.Y += moreDrag; else state.Velocity.Y = 0; } else { if (state.Velocity.Y >= drag) state.Velocity.Y -= drag; else if (state.Velocity.Y <= -drag) state.Velocity.Y += drag; else state.Velocity.Y = 0; } }
private void UpdateVelocityX(ref DiskState state, float drag, float moreDrag) { if (Math.Abs(state.Velocity.X) <= _maxVelocity) { if (state.Velocity.X >= drag) state.Velocity.X -= drag; else if (state.Velocity.X <= -drag) state.Velocity.X += drag; else state.Velocity.X = 0; } else { if (state.Velocity.X >= moreDrag) state.Velocity.X -= moreDrag; else if (state.Velocity.X <= -moreDrag) state.Velocity.X += moreDrag; else state.Velocity.X = 0; } }
void UpdateState(ref DiskState state, GameTime gameTime) { if (!_isSinglePlayer || _playerWithDisk == null) { if (!state.IsColliding) { UpdateVelocityX(ref state, drag, moreDrag); UpdateVelocityY(ref state, drag, moreDrag); } state.IsColliding = false; Vector2 normalizedVelocity = normalizeVelocity(state.Velocity); float time = (float)gameTime.ElapsedGameTime.TotalSeconds; state.Position.X += time * state.Velocity.Y * normalizedVelocity.Y; state.Position.Z += time * state.Velocity.X * normalizedVelocity.X; state.CollisionArea.Center.X = state.Position.X; state.CollisionArea.Center.Z = state.Position.Z; notify(); } else { state.Position = _playerWithDisk.getPlayer().getStickPosition(); state.CollisionArea.Center = _playerWithDisk.getPlayer().getStickPosition(); state.Velocity = Vector2.Zero; } }
public void UpdateRemote(int framesBetweenPackets, bool enablePrediction, GameTime gameTime) { float smoothingDecay = 1.0f / framesBetweenPackets; _currentSmoothing -= smoothingDecay; if (_currentSmoothing < 0) _currentSmoothing = 0; if (enablePrediction) { UpdateState(ref simulationState, gameTime); if (_currentSmoothing > 0) UpdateState(ref previousState, gameTime); } if (_currentSmoothing > 0) ApplySmoothing(); else displayState = simulationState; }
/// <summary> /// Updates a local disk /// </summary> /// <param name="positionInput"></param> /// <param name="rotationInput"></param> public void UpdateLocal(GameTime gameTime) { UpdateState(ref simulationState, gameTime); displayState = simulationState; }
public void ReadNetworkPacket(PacketReader packetReader, GameTime gameTime, TimeSpan latency, bool enablePrediction, bool enableSmoothing, float packetSendTime) { if (enableSmoothing) { previousState = displayState; _currentSmoothing = 1; } else _currentSmoothing = 0; //float packetSendTime = packetReader.ReadSingle(); simulationState.Position = packetReader.ReadVector3(); simulationState.Velocity = packetReader.ReadVector2(); if (enablePrediction) ApplyPrediction(gameTime, latency, packetSendTime); }
public override void Initialize() { simulationState.Velocity = Vector2.Zero; _maxVelocity = 12; simulationState.Position = new Vector3(4, 1, 0); simulationState.IsColliding = false; Matrix pos = Matrix.CreateTranslation(4, 1, 0); _rotation = Matrix.CreateRotationX(MathHelper.PiOver2); _scale = Matrix.CreateScale(0.5f); world = world * _rotation * _scale * pos; simulationState.CollisionArea = new BoundingSphere(new Vector3(4, 1, 0), 0.45f); previousState = simulationState; displayState = simulationState; CollisionManager cm = (CollisionManager)_gameManager.getGameEntity("collisionManager"); DebugManager dm = (DebugManager)_gameManager.getGameEntity("debugManager"); Ice ice = (Ice)_gameManager.getGameEntity("ice"); ice.register(this); cm.register(this); dm.registerDebugEntities(this); base.Initialize(); }