/// <summary> /// Takes an enum, usually from JSON, then returns its appropriate color /// TODO: Try not to have the index's hard coded /// </summary> /// <param name="colorEnum">The color to return</param> /// <returns>NOTE: Returns a material not a color</returns> public Material EnumColorToColor(SBG.Enum.ObjectColor colorEnum) { switch (colorEnum) { case SBG.Enum.ObjectColor.Black: return UsefulPrefabs.Instance.Colors[0]; case SBG.Enum.ObjectColor.Blue: return UsefulPrefabs.Instance.Colors[1]; case SBG.Enum.ObjectColor.Brown: return UsefulPrefabs.Instance.Colors[2]; case SBG.Enum.ObjectColor.Green: return UsefulPrefabs.Instance.Colors[3]; case SBG.Enum.ObjectColor.Purple: return UsefulPrefabs.Instance.Colors[4]; case SBG.Enum.ObjectColor.Orange: return UsefulPrefabs.Instance.Colors[5]; case SBG.Enum.ObjectColor.Red: return UsefulPrefabs.Instance.Colors[6]; case SBG.Enum.ObjectColor.Yellow: return UsefulPrefabs.Instance.Colors[7]; case SBG.Enum.ObjectColor.BlueGray: return UsefulPrefabs.Instance.Colors[8]; case Enum.ObjectColor.DarkRed: return UsefulPrefabs.Instance.Colors[9]; default: Debug.LogError("Color passed into this object has not been set up in this switch case"); return UsefulPrefabs.Instance.Colors[0]; } }
private void Dispose(bool Disposing) { if (!m_isDisposed && Disposing) { try { if (m_rngGenerator != null) { m_rngGenerator.Dispose(); m_rngGenerator = null; } if (m_seedGenerator != null) { m_seedGenerator.Dispose(); m_seedGenerator = null; } if (m_byteBuffer != null) { Array.Clear(m_byteBuffer, 0, m_byteBuffer.Length); m_byteBuffer = null; } if (m_stateSeed != null) { Array.Clear(m_stateSeed, 0, m_stateSeed.Length); m_stateSeed = null; } } catch { } m_isDisposed = true; } }
/// <summary> /// Reset the SP20Prng instance /// </summary> public void Reset() { if (m_seedGenerator != null) { m_seedGenerator.Dispose(); m_seedGenerator = null; } if (m_rngGenerator != null) { m_rngGenerator.Dispose(); m_rngGenerator = null; } m_seedGenerator = GetSeedGenerator(m_seedType); m_rngGenerator = new SBG(m_rndCount); if (m_seedGenerator != null) { m_rngGenerator.Initialize(m_seedGenerator.GetBytes(m_keySize)); } else { m_rngGenerator.Initialize(m_stateSeed); } m_rngGenerator.Generate(m_byteBuffer); m_bufferIndex = 0; }
/// <summary> /// Creates a particle hit with the decided color and pos and rot /// </summary> /// <param name="colorToDisplay">The Color for it to display</param> /// <param name="pos">The Position</param> /// <param name="rot">The Rotation</param> public void CreateParticleHit(SBG.Enum.ObjectColor colorToDisplay, Vector3 pos, Quaternion rot) { pos = new Vector3(pos.x, pos.y, pos.z + 10); //Set the depth a bit GameObject obj = Instantiate(UsefulPrefabs.Instance.ParticleHit, pos, rot) as GameObject; ParticleSystem particleSystem = obj.GetComponent<ParticleSystem>(); particleSystem.GetComponent<Renderer>().material = EnumColorToColor(colorToDisplay); Destroy(obj, 1); }
/// <summary> /// Reinitialize the internal state /// </summary> public void Reset() { if (m_rndGenerator != null) { m_rndGenerator.Dispose(); m_rndGenerator = null; } m_rndGenerator = new SBG(20); m_rndGenerator.Initialize(m_stateSeed); }
public void Update(double dt) { SBG.Update(dt); PM.CheckCollisions(); foreach (var collision in PM.Collisions) { CRM.ResolveCollision(collision); } AS.Update(dt); Scene.Update(dt); }
public void Update(double dt) { SBG.Update(dt); PM.CheckCollisions(); Console.WriteLine(PM.BoxComponents.Count); foreach (var collision in PM.Collisions) { CRM.ResolveCollision(collision); } AS.Update(dt); Scene.Update(dt); }
/// <summary> /// Outputs expected values for the SP20Drbg /// </summary> public string GetSP20Vector(int KeySize) { SBG spd = new SBG(); byte[] key = new byte[KeySize]; byte[] output = new byte[1024]; for (int i = 0; i < KeySize; i++) { key[i] = (byte)i; } spd.Initialize(key); spd.Generate(output); while (output.Length > 32) { output = Reduce(output); } return(HexConverter.ToString(output)); }
private bool UpdateUI() { IsMaskVisible = false; //初始化颜色 if (!LoadingMain(false)) { Application.Current.Shutdown(); } //版本号 Versionon.Text = "Version - " + stVersion; //刷新工具列表 UpdateList.ItemsSource = listall; //工具列表样式 this.UpdateList.Foreground = baseColor.Fg; this.UpdateList.FontFamily = baseColor.Fonts; this.UpdateList.FontSize = 14; //版本号样式 this.Versionon.Foreground = baseColor.Fg; this.Versionon.FontFamily = baseColor.Fonts; this.Versionon.FontSize = 12; //按钮样式 this.Feedback.Foreground = baseColor.FontM; this.Feedback.FontFamily = baseColor.Fonts; this.Feedback.FontSize = 14; this.OpenButton.Foreground = baseColor.FontM; this.OpenButton.Background = baseColor.Main; this.B1.Foreground = baseColor.Fg; this.B2.Foreground = baseColor.Fg; this.TopIcon.Background = baseColor.Main; this.TopIcon.Foreground = baseColor.FontM; ButtonHelper.SetHoverBrush(TopIcon, baseColor.Main); ButtonHelper.SetClickCoverOpacity(TopIcon, 1); //初始化卡片颜色 WindowXCaption.SetBackground(this, baseColor.Main); WindowXCaption.SetForeground(this, baseColor.FontM); CD1.Background = baseColor.Card; CD2.Background = baseColor.Card; SH1.Background = baseColor.Card; SH1.Foreground = baseColor.Font; UpdateList.Background = baseColor.Tran; Versionon.Foreground = baseColor.Fg; UpdateList.ContextMenu.Background = baseColor.Card; UpdateList.ContextMenu.Foreground = baseColor.Fg; ContextMenuHelper.SetShadowColor(UpdateList.ContextMenu, baseColor.DBg.Color); BorderBut.Background = baseColor.DBg; BorderTop.Background = baseColor.Main; BorderTop1.Background = baseColor.Main; BorderTop2.Background = baseColor.Main; BG.BeginInit(); BG.Source = baseColor.Bgp; BG.EndInit(); SBG.BeginInit(); SBG.Source = baseColor.Bgps; SBG.EndInit(); //加载主页 PageMain main = new PageMain(); Page.Content = new Frame() { Content = main }; return(true); }