public Nastaveni() { InitializeComponent(); button1.BackColor = ColorGen.GetRandomColor(); flowLayoutPanel1.Width = flowLayoutPanel1.Width + SystemInformation.VerticalScrollBarWidth; LoadFromXml(); }
public static MeshData GenerateTerrainMesh(float[,] heightMap, float heightMulti, AnimationCurve heightCurve, Vector2 chunkCoords, TerrainType[] regions) { int width = heightMap.GetLength(0); int height = heightMap.GetLength(1); float topLeftX = (width - 1) / -2f; float topLeftZ = (height - 1) / 2f; Texture2D meshTexture = TextureGen.TextureFromColorMap(ColorGen.GenerateColorMapFromHeightMap(heightMap, regions), width, height); Color[] colorMap = ColorGen.GenerateColorMapFromHeightMap(heightMap, regions); MeshData currentMeshData = new MeshData(width, height, chunkCoords, meshTexture, colorMap); int vertexIndex = 0; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { currentMeshData.vertices[vertexIndex] = new Vector3(topLeftX + x, heightCurve.Evaluate(heightMap[x, y]) * heightMulti, topLeftZ - y); currentMeshData.uvs[vertexIndex] = new Vector2(x / (float)width, y / (float)height); if (x < width - 1 && y < height - 1) { currentMeshData.AddTriangle(vertexIndex, vertexIndex + width + 1, vertexIndex + width); currentMeshData.AddTriangle(vertexIndex + width + 1, vertexIndex, vertexIndex + 1); } vertexIndex++; } } return(currentMeshData); }
void SendSK6812RGBW() { if (IsConnected) { byte[] data = ColorGen.GenSK6812RGBW(new Color[] { SK6812RGBW_1, SK6812RGBW_2, SK6812RGBW_3 }, new byte[] { SK6812RGBW_W_1, SK6812RGBW_W_2, SK6812RGBW_W_3 }); if (data != null) { sp.Write(data, 0, data.Length); } } }
void SendWS2812() { if (IsConnected) { byte[] data = ColorGen.GenWS2812(new Color[] { WS2812_1, WS2812_2, WS2812_3 }); if (data != null) { sp.Write(data, 0, data.Length); } } }
public static Color GetColorByKey(string key, string catetory = null) { if (catetory == null) { catetory = string.Empty; } ColorGen colorGen; if (_colorGens.TryGetValue(catetory, out colorGen) == false) { _colorGens.Add(catetory, colorGen = new ColorGen()); } return(colorGen.GetColorByKey(key)); }
private void Init() { // 嘿嘿嘿。 m_pLAClient = new LAClient(); color_map.Add(0, 0.138f); color_map.Add(1, 0.485f); color_map.Add(2, 0.205f); color_map.Add(3, 0.342f); color_map.Add(4, 0.768f); color_map.Add(5, 0.733f); color_map.Add(6, 0.096f); float h; if (color_map.TryGetValue(UnityEngine.Random.Range(0, 7), out h)) { colorGen = new ColorGen(h); } else { colorGen = new ColorGen(0.138f); } Camera.backgroundColor = colorGen.original; TextTools.FindCom(Canvas.transform, ref tList); TextTools.FindCom(Content, ref iList); TextTools.FindCom(MapNode, ref sList); foreach (var item in tList) { item.color = new Color(colorGen.dark_3.r, colorGen.dark_3.g, colorGen.dark_3.b, item.color.a); } foreach (var item in iList) { item.color = new Color(colorGen.dark_1.r, colorGen.dark_1.g, colorGen.dark_1.b, item.color.a); } foreach (var item in sList) { item.color = new Color(colorGen.dark_2.r, colorGen.dark_2.g, colorGen.dark_2.b, item.color.a); } // 初始化。 m_pLAClient.Init(); }
protected void AddDeviceToChart(DeviceDes des) { // Pie Chart FrameworkElement chart = CreatePieCharts(helpers[des.Name]); chart.Tag = des.Name; CentralGraph.Children.Add(chart); // Line Chart Color c = ColorGen.GetColor(); BpsChart.AddLineGraph(helpers[des.Name].Bps, c, 2, des.FriendlyName); PpsChart.AddLineGraph(helpers[des.Name].Pps, c, 2, des.FriendlyName); BpsChart.FitToView(); PpsChart.FitToView(); }
private void Button2_Click(object sender, EventArgs e) { AddPlayer(GameManager.Insatance.AddHrac(textBox1.Text, button1.BackColor)); button1.BackColor = ColorGen.GetRandomColor(); }
// Use this for initialization void Start() { pEffect = GetComponent <ParticleSystem>(); otherScripts = head.GetComponent <ColorGen>(); }