/// <summary> /// Returns a string that represents the current object. /// </summary> /// <returns> /// A string that represents the current object. /// </returns> /// <filterpriority>2</filterpriority> public override string ToString() { if (Name.IsNullOrWhiteSpace() && !Color.HasValue) { return(string.Empty); } return($"{Name} ({Color?.ToString() ?? "No color"})"); }
public void SetMapNameSimple( string _strName, Color _color) { m_strMapName = _strName; m_TempColor = _color; mapName.Text = m_TempColor.ToString() + _strName; RsetSize(); }
public static string FromColor(Color color) { KeyValuePair<string, Color> pair = _colorMap.FirstOrDefault(a => a.Value == color); if (pair.Value == null) throw new Exception("Cannot find BackColorname for: " + color.ToString()); return pair.Key; }
// TODO this method probably belongs somewhere else public static Sprite CreateTileSprite(Color color, int size) { var texture = new Texture2D(size, size); var colors = Enumerable.Repeat<Color>(color, size * size).ToArray(); texture.SetPixels(0, 0, size, size, colors); var sprite = Sprite.Create(texture, new Rect(0f, 0f, texture.width, texture.height), Vector2.zero); sprite.name = color.ToString(); return sprite; }
//generates and enables a point event static void GenerateEvent() { // current_color = colors[0]; current_color = colors[Random.Range(0,colors.Length)]; current_dur = durations[Random.Range(0,durations.Length)]; current_mul = multipliers[Random.Range(0,multipliers.Length)]; event_on = true; last_event_generated = Time.time; Debug.Log("new event generated: "+current_color.ToString()+" "+current_dur+" "+current_mul); }
public override void parse(string curLine) { TextParser tp = new TextParser(); actionType = ActionType.Fade; color = ColorUtils.colorFromHexString(curLine.Substring(6, 6)); color.A = 0; time = int.Parse(tp.seperateWords(curLine)[2]); Console.WriteLine("Parsed a fade! Color " + color.ToString()); elapsed = 0; }
private async void AddNewItem(object sender, RoutedEventArgs e) { if (isAddingItem) { return; } isAddingItem = true; string name = NewItem_Name.Text; string priceString = NewItem_Price.Text; PriceSuffix suffix = (PriceSuffix)NewItem_PriceSuffix.SelectedItem; Color? colour = NewItem_Colour.SelectedColor; string hex = colour?.ToString(); bool isPurchase = (bool)NewItem_IsPurchase.IsChecked; if (string.IsNullOrEmpty(name)) { MessageBox.Show("Item name can't be empty."); return; } if (string.IsNullOrEmpty(priceString)) { Shop.AddNewItem(name, hex); } else { try { Price price = priceString.ToPrice(suffix); Shop.AddNewItem(name, price, isPurchase, hex); } catch (Exception) { MessageBox.Show("Please enter a valid price."); return; } } NewItem_Name.Clear(); NewItem_Price.Clear(); NewItem_PriceSuffix.SelectedIndex = 0; NewItem_Colour.SelectedColor = default; NewItem_IsPurchase.IsChecked = false; Inventory.Items.Refresh(); // hackery to force refresh items MessageBox.Show($"Added {name}!"); await Task.Delay(addItemTimeout); isAddingItem = false; }
public static string FormatColourString(Color colour, ColourRepresentations format) { switch (format) { case ColourRepresentations.RGB: return colour.R.ToString() + "," + colour.G.ToString() + "," + colour.B.ToString(); case ColourRepresentations.Hex: return "#" + colour.ToArgb().ToString("X6"); default: return colour.ToString(); } }
public override string ToString() { if (TextBuilder != null) { return(TextBuilder.ToString()); } else if (Text != null) { return(Text); } else { return($"{(Color?.ToString() ?? "null")} {(Background?.ToString() ?? "null")}"); } }
public SpriteLayer(string mat, Color c) { MatName = mat; LayerColor = c; Material baseMat = Resources.Load(mat) as Material; if (baseMat == null) { Debug.Log("Unable to load material " + mat); return; } LayerMaterial = new Material(baseMat); LayerImage = LayerMaterial.mainTexture; LayerMaterial.name += c.ToString(); LayerMaterial.color = c; }
public void Button_PicColor(UnityEngine.UI.Button f_button) { Debug.Log("Picking Color"); UnityEngine.UI.ColorBlock cb = f_button.colors; playerColor = cb.normalColor; Debug.Log("Picked: " + cb.normalColor.ToString()); cb = colorButton.colors; cb.normalColor = playerColor; cb.pressedColor = playerColor; cb.highlightedColor = playerColor; Debug.Log("New Player Color: "+playerColor.ToString()); colorButton.colors = cb; colorButton.gameObject.SetActive(true); colorPickerPanel.gameObject.SetActive(false); SettingsController.GetInstance().playerFile.Color = playerColor; }
public static Texture2D Create(GraphicsDevice graphicsDevice, int width, int height, Color color) { string key = color.ToString () + width + "x" + height; if (textureCache.ContainsKey (key)) { return textureCache [key]; } else { // create a texture with the specified size Texture2D texture = new Texture2D (graphicsDevice, width, height); // fill it with the specified colors Color[] colors = new Color[width * height]; for (int i = 0; i < colors.Length; i++) { colors [i] = new Color (color.ToVector3 ()); } texture.SetData (colors); textureCache [key] = texture; return texture; } }
public static Color Combine(this Color color, Color otherColor) { // primary combinations if ((color == Red && otherColor == Blue) || (color == Blue && otherColor == Red)) return Purple; if ((color == Blue && otherColor == Yellow) || (color == Yellow && otherColor == Blue)) return Green; if ((color == Red && otherColor == Yellow) || (color == Yellow && otherColor == Red)) return Orange; // redundant color combinations if (color.Contains(otherColor)) return color; if (otherColor.Contains(color)) return otherColor; #if DEBUG Console.WriteLine(String.Format("Possibly unsupported color combination: {0} and {1}", color.ToString(), otherColor.ToString())); #endif return Black; }
void changeColor(GameObject brick) { //Color color = brick.transform.renderer.material.color; SpriteRenderer sr = GetComponent<SpriteRenderer>(); Color color = sr.color; Color ORANGE = new Color(0.934f, 0.409f, 0.124f, 1.00f); Color GOLD = new Color(1.000f, 0.929f, 0.037f, 1.000f); Color BLUE = new Color(0.026f, 0.396f, 0.893f, 1.000f); if (color.ToString().Equals(ORANGE.ToString())) { sr.color = GOLD; } else if (color.ToString().Equals(GOLD.ToString())) { sr.color = BLUE; } else if (color.ToString().Equals(BLUE.ToString())) { sr.color = new Color(1f, 1f, 1f, 1f); } }
public void SetActiveColor(string color) { Color activeColor = new Color(); switch (color) { case "red": activeColor = Color.red; break; case "blue": activeColor = Color.blue; break; case "yellow": activeColor = Color.yellow; break; case "green": activeColor = Color.green; break; case "black": activeColor = Color.black; break; default: activeColor = Color.black; break; } AccessCamera.SendMessage("setColor", activeColor.ToString()); }
public override string ToString() { return(string.Format("GeometryColor" + "(Geometry = {0}, Appearance = {1})", geometry, singleColor != null ? singleColor.ToString() : "Multiple colors.")); }
private void _AppendGoldGet() { if( true == _isOpenMsgBox()) return; if( null == readMailInfo || 0 == readMailInfo.nGold) return; if( true == readMailInfo.bAccount) { Color titleColor = new Color( 1.0f, 0.494f, 0.0f, 1.0f); string title = titleColor.ToString() + AsTableManager.Instance.GetTbl_String(1442); string msg = AsTableManager.Instance.GetTbl_String(1443); m_msgboxItem = AsNotify.Instance.MessageBox( title, msg, this, "OnMsgBox_AppendGoldGet_Ok", "OnMsgBox_AppendGoldGet_Cancel", AsNotify.MSG_BOX_TYPE.MBT_OKCANCEL, AsNotify.MSG_BOX_ICON.MBI_QUESTION); } else { body_CS_POST_GOLD_RECIEVE goldRecieve = new body_CS_POST_GOLD_RECIEVE( readMailInfo.nPostSerial); byte[] data = goldRecieve.ClassToPacketBytes(); AsNetworkMessageHandler.Instance.Send( data); recvGold.Text = "0"; readMailInfo.nGold = 0; } }
private void _AppendItemGet(AsSlot slot, byte slotIndex) { if( true == _isOpenMsgBox()) return; if( true == readMailInfo.bAccount) { Color titleColor = new Color( 1.0f, 0.494f, 0.0f, 1.0f); string title = titleColor.ToString() + AsTableManager.Instance.GetTbl_String(1442); string msg = AsTableManager.Instance.GetTbl_String(1443); m_msgboxItem = AsNotify.Instance.MessageBox( title, msg, this, "OnMsgBox_AppendItemGet_Ok", "OnMsgBox_AppendItemGet_Cancel", AsNotify.MSG_BOX_TYPE.MBT_OKCANCEL, AsNotify.MSG_BOX_ICON.MBI_QUESTION); m_slotBuf = slot; m_slotIndexBuf = slotIndex; } else { // server packet RecieveMailItem( slotIndex); slot.SetEmpty(); } if( false == _isGetItemInReadMailInfo()) { btnTakeAll.SetControlState( UIButton.CONTROL_STATE.DISABLED); btnTakeAll.spriteText.Color = Color.gray; } }
void draw(int points, int cons, int psize, float lsize, int width, int height, int retry, Color bcolor, Color pcolor, Color lcolor, string path) { try { Bitmap b = new Bitmap(width, height); Graphics g = Graphics.FromImage(b as Image); g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; if (stop) { throw new Exception("user canseled."); } log($"set background color to {bcolor.ToString()}"); g.Clear(bcolor); if (stop) { throw new Exception("user canseled."); } Random r = new Random(); if (stop) { throw new Exception("user canseled."); } log("create points list"); List <Point> ps = new List <Point>(); if (stop) { throw new Exception("user canseled."); } for (int i = 0; i < points; i++) { ps.Add(new Point(r.Next(0, width), r.Next(0, height))); } if (stop) { throw new Exception("user canseled."); } log($"{points} points created"); log("creating connections list"); List <Rectangle> ls = new List <Rectangle>(); if (stop) { throw new Exception("user canseled."); } for (int i = 0; i < cons; i++) { if (stop) { throw new Exception("user canseled."); } //maybe all connections are avaliable so app shouldn`t hang. for (int j = 0; j < retry; j++) { if (stop) { throw new Exception("user canseled."); } Point p1 = ps[r.Next(0, points)]; Point p2 = ps[r.Next(0, points)]; if (!ls.Contains(new Rectangle(p1.X, p1.Y, p2.X, p2.Y)) && !ls.Contains(new Rectangle(p2.X, p2.Y, p1.X, p1.Y))) { ls.Add(new Rectangle(p1.X, p1.Y, p2.X, p2.Y)); break; } log($"can`t create line {i}"); } } log($"{ls.Count}connections created"); log("drawing lines"); Pen lp = new Pen(lcolor, lsize); for (int i = 0; i < ls.Count; i++) { if (stop) { throw new Exception("user canseled."); } g.DrawLine(lp, ls[i].X, ls[i].Y, ls[i].Width, ls[i].Height); } log($"{ls.Count} lines drawed with this color : {lcolor.ToString()}"); if (stop) { throw new Exception("user canseled."); } log("drawing points"); for (int i = 0; i < points; i++) { if (stop) { throw new Exception("user canseled."); } g.FillEllipse(new SolidBrush(pcolor), ps[i].X - psize / 2, ps[i].Y - psize / 2, psize, psize); } log($"points drawed with this color : {pcolor.ToString()}"); log("save file"); if (stop) { throw new Exception("user canseled."); } b.Save(path); log($"file saved in {path}"); } catch (Exception ex) { log(ex.Message); log("process ended because of errors."); } log("finish"); stoped(); }
public void labelDoubleClick(object sender, EventArgs e) { Label titleLabel = (Label)sender; Control parent = titleLabel.Parent; Control[] c = Controls.Find("label" + parent.Name.Substring(15), true); string day = c[0].Text; string date = yearLabel.Text + "-" + monthLabel.Text + "-" + day; // 해당 날짜 + 제목의 정보 가져와서 memoForm에 뿌려줌 OracleConnection conn = dbConnect(); OracleCommand cmd = new OracleCommand(); cmd.Connection = conn; cmd.CommandText = "SELECT * FROM memo WHERE memo_date = :memo_date AND title = :title"; cmd.Parameters.Add(new OracleParameter("memo_date", date)); cmd.Parameters.Add(new OracleParameter("title", titleLabel.Text)); OracleDataReader reader = cmd.ExecuteReader(); string title = ""; string contents = ""; Color color = titleLabel.BackColor; if (reader.HasRows) { while (reader.Read()) { title = reader.GetString(1); if (reader.GetOracleString(2).IsNull == false) { contents = reader.GetString(2); } } } else { Console.WriteLine("No rows found."); } reader.Close(); dbClose(conn); MemoForm memoForm = new MemoForm(title, contents, color.ToString(), "Y", date); DialogResult result = memoForm.ShowDialog(); if (result == DialogResult.OK) //메모 수정 { TitleValue = memoForm.TitleValue; ContentsValue = memoForm.ContentsValue; ColorValue = memoForm.ColorValue; conn = dbConnect(); cmd = new OracleCommand(); cmd.Connection = conn; OracleTransaction STrans = null; //오라클 트랜젝션 STrans = conn.BeginTransaction(); cmd.Transaction = STrans; //커맨드에 트랜젝션 명시 cmd.CommandText = "UPDATE memo SET title = '" + TitleValue + "', memo_contents = '" + ContentsValue + "', color = '" + ColorValue + "' WHERE title = '" + title + "' AND memo_date = '" + date + "'"; cmd.ExecuteNonQuery(); cmd.Transaction.Commit(); //커밋 dbClose(conn); titleLabel.Text = TitleValue; titleLabel.BackColor = Color.FromName(ColorValue); return; } else if (result == DialogResult.No) // 메모 삭제 { conn = dbConnect(); cmd = new OracleCommand(); cmd.Connection = conn; OracleTransaction STrans = null; //오라클 트랜젝션 STrans = conn.BeginTransaction(); cmd.Transaction = STrans; //커맨드에 트랜젝션 명시 cmd.CommandText = "DELETE FROM memo WHERE title = '" + title + "' AND memo_date = '" + date + "'"; cmd.ExecuteNonQuery(); cmd.Transaction.Commit(); //커밋 dbClose(conn); parent.Controls.Remove(titleLabel); titleLabel.Dispose(); return; } }
public static void CreateAppStyleBy(Color color, bool changeImmediately = false) { // create a runtime accent resource dictionary var resourceDictionary = new ResourceDictionary(); resourceDictionary.Add("HighlightColor", color); resourceDictionary.Add("AccentBaseColor", color); resourceDictionary.Add("AccentColor", Color.FromArgb((byte)(204), color.R, color.G, color.B)); resourceDictionary.Add("AccentColor2", Color.FromArgb((byte)(153), color.R, color.G, color.B)); resourceDictionary.Add("AccentColor3", Color.FromArgb((byte)(102), color.R, color.G, color.B)); resourceDictionary.Add("AccentColor4", Color.FromArgb((byte)(51), color.R, color.G, color.B)); resourceDictionary.Add("HighlightBrush", GetSolidColorBrush((Color)resourceDictionary["HighlightColor"])); resourceDictionary.Add("AccentBaseColorBrush", GetSolidColorBrush((Color)resourceDictionary["AccentBaseColor"])); resourceDictionary.Add("AccentColorBrush", GetSolidColorBrush((Color)resourceDictionary["AccentColor"])); resourceDictionary.Add("AccentColorBrush2", GetSolidColorBrush((Color)resourceDictionary["AccentColor2"])); resourceDictionary.Add("AccentColorBrush3", GetSolidColorBrush((Color)resourceDictionary["AccentColor3"])); resourceDictionary.Add("AccentColorBrush4", GetSolidColorBrush((Color)resourceDictionary["AccentColor4"])); resourceDictionary.Add("WindowTitleColorBrush", GetSolidColorBrush((Color)resourceDictionary["AccentColor"])); resourceDictionary.Add("ProgressBrush", new LinearGradientBrush( new GradientStopCollection(new[] { new GradientStop((Color)resourceDictionary["HighlightColor"], 0), new GradientStop((Color)resourceDictionary["AccentColor3"], 1) }), // StartPoint="1.002,0.5" EndPoint="0.001,0.5" startPoint: new Point(1.002, 0.5), endPoint: new Point(0.001, 0.5))); resourceDictionary.Add("CheckmarkFill", GetSolidColorBrush((Color)resourceDictionary["AccentColor"])); resourceDictionary.Add("RightArrowFill", GetSolidColorBrush((Color)resourceDictionary["AccentColor"])); resourceDictionary.Add("IdealForegroundColor", IdealTextColor(color)); resourceDictionary.Add("IdealForegroundColorBrush", GetSolidColorBrush((Color)resourceDictionary["IdealForegroundColor"])); resourceDictionary.Add("IdealForegroundDisabledBrush", GetSolidColorBrush((Color)resourceDictionary["IdealForegroundColor"], 0.4)); resourceDictionary.Add("AccentSelectedColorBrush", GetSolidColorBrush((Color)resourceDictionary["IdealForegroundColor"])); resourceDictionary.Add("MetroDataGrid.HighlightBrush", GetSolidColorBrush((Color)resourceDictionary["AccentColor"])); resourceDictionary.Add("MetroDataGrid.HighlightTextBrush", GetSolidColorBrush((Color)resourceDictionary["IdealForegroundColor"])); resourceDictionary.Add("MetroDataGrid.MouseOverHighlightBrush", GetSolidColorBrush((Color)resourceDictionary["AccentColor3"])); resourceDictionary.Add("MetroDataGrid.FocusBorderBrush", GetSolidColorBrush((Color)resourceDictionary["AccentColor"])); resourceDictionary.Add("MetroDataGrid.InactiveSelectionHighlightBrush", GetSolidColorBrush((Color)resourceDictionary["AccentColor2"])); resourceDictionary.Add("MetroDataGrid.InactiveSelectionHighlightTextBrush", GetSolidColorBrush((Color)resourceDictionary["IdealForegroundColor"])); resourceDictionary.Add("MahApps.Metro.Brushes.ToggleSwitchButton.OnSwitchBrush.Win10", GetSolidColorBrush((Color)resourceDictionary["AccentColor"])); resourceDictionary.Add("MahApps.Metro.Brushes.ToggleSwitchButton.OnSwitchMouseOverBrush.Win10", GetSolidColorBrush((Color)resourceDictionary["AccentColor2"])); resourceDictionary.Add("MahApps.Metro.Brushes.ToggleSwitchButton.ThumbIndicatorCheckedBrush.Win10", GetSolidColorBrush((Color)resourceDictionary["IdealForegroundColor"])); // applying theme to MahApps var resDictName = string.Format("ApplicationAccent_{0}.xaml", color.ToString().Replace("#", string.Empty)); var fileName = Path.Combine(Path.GetTempPath(), resDictName); using (var writer = System.Xml.XmlWriter.Create(fileName, new System.Xml.XmlWriterSettings { Indent = true })) { System.Windows.Markup.XamlWriter.Save(resourceDictionary, writer); writer.Close(); } resourceDictionary = new ResourceDictionary() { Source = new Uri(fileName, UriKind.Absolute) }; var newAccent = new Accent { Name = resDictName, Resources = resourceDictionary }; ThemeManager.AddAccent(newAccent.Name, newAccent.Resources.Source); if (changeImmediately) { var application = Application.Current; //var applicationTheme = ThemeManager.AppThemes.First(x => string.Equals(x.Name, "BaseLight")); // detect current application theme Tuple <AppTheme, Accent> applicationTheme = ThemeManager.DetectAppStyle(application); ThemeManager.ChangeAppStyle(application, newAccent, applicationTheme.Item1); } }
void Update() { if (Input.GetMouseButton(0)) { /*rends.Clear(); * * RaycastHit[] hits = Physics.SphereCastAll(cam.ScreenPointToRay(Input.mousePosition), 1f); * * foreach (var hitObject in hits) * { * RaycastHit hit; * * * * Ray ray = new Ray(hitObject.point, hitObject.point - cam.transform.position); * * if (!Physics.Raycast(ray, out hit)) * return; * * Renderer rend = hit.transform.GetComponent<Renderer>(); * Texture2D texture = Instantiate(rend.material.mainTexture) as Texture2D; * rend.material.mainTexture = texture; * MeshCollider meshCollider = hit.collider as MeshCollider; * * if (rend == null || rend.sharedMaterial == null || rend.sharedMaterial.mainTexture == null || meshCollider == null) * return; * * Texture2D tex = rend.material.mainTexture as Texture2D; * Vector2 pixelUV = hit.textureCoord; * pixelUV.x *= tex.width; * pixelUV.y *= tex.height; * * tex.SetPixel((int)pixelUV.x, (int)pixelUV.y, Color.black); * tex.Apply(); * * * }*/ RaycastHit hit; if (!Physics.Raycast(cam.ScreenPointToRay(Input.mousePosition), out hit)) { return; } Renderer rend = hit.transform.GetComponent <Renderer>(); Texture2D texture = Instantiate(rend.material.mainTexture) as Texture2D; rend.material.mainTexture = texture; MeshCollider meshCollider = hit.collider as MeshCollider; if (rend == null || rend.sharedMaterial == null || rend.sharedMaterial.mainTexture == null || meshCollider == null) { return; } Texture2D tex = rend.material.mainTexture as Texture2D; Vector2 pixelUV = hit.textureCoord; pixelUV.x *= tex.width; pixelUV.y *= tex.height; tex.SetPixel((int)pixelUV.x, (int)pixelUV.y, Color.black); tex.Apply(); } else { RaycastHit hit; if (!Physics.Raycast(cam.ScreenPointToRay(Input.mousePosition), out hit)) { return; } Renderer rend = hit.transform.GetComponent <Renderer>(); MeshCollider meshCollider = hit.collider as MeshCollider; if (rend == null || rend.sharedMaterial == null || rend.sharedMaterial.mainTexture == null || meshCollider == null) { return; } Texture2D tex = rend.material.mainTexture as Texture2D; Vector2 pixelUV = hit.textureCoord; pixelUV.x *= tex.width; pixelUV.y *= tex.height; Color col = tex.GetPixel((int)pixelUV.x, (int)pixelUV.y); Debug.Log(col.ToString()); } }
public override string ToString() { //return GeneralToStringProvider.GeneralToString(this); return(string.Format("TheColor: {0}", m_color.ToString())); }
public static void RecolourNeonSign(Color colorA, Color colorB) { TubeBloomPrePassLight[] _prePassLights = UnityEngine.Object.FindObjectsOfType <TubeBloomPrePassLight>(); foreach (var prePassLight in _prePassLights) { if (prePassLight != null) { if (prePassLight.name.Contains("NeonLight (6)")) { if (colorA != Color.clear) { prePassLight.color = colorA; } } if (prePassLight.name.Contains("NeonLight (8)")) { if (prePassLight.gameObject.transform.position.ToString() == "(0.0, 17.2, 24.8)") { if (colorA != Color.clear) { prePassLight.color = colorA; } } } if (prePassLight.name.Contains("BATNeon") || prePassLight.name.Contains("ENeon")) { if (colorB != Color.clear) { prePassLight.color = colorB; } } // Log($"PrepassLight: {prePassLight.name}"); } } SpriteRenderer[] sprites = Resources.FindObjectsOfTypeAll <SpriteRenderer>(); foreach (SpriteRenderer sprite in sprites) { if (sprite != null) { if (sprite.name == "LogoSABER") { if (colorA != Color.clear) { sprite.color = colorA; } } if (sprite.name == "LogoBAT" || sprite.name == "LogoE") { if (colorB != Color.clear) { sprite.color = colorB; } } } } TextMeshPro[] tmps = GameObject.FindObjectsOfType <TextMeshPro>(); foreach (TextMeshPro tmp in tmps) { if (tmp.gameObject.name == "CustomMenuText") { if (colorB != Color.clear) { tmp.color = colorB; } } else if (tmp.gameObject.name == "CustomMenuText-Bot") { if (colorA != Color.clear) { tmp.color = colorA; } } } ChromaLogger.Log("Sign recoloured A:" + colorA.ToString() + " B:" + colorB.ToString()); }
public void StoreValues(Data data, string path) { data.SetValue(@"" + path + @"Color", Color.ToString()); data.SetValue(@"" + path + @"Dpi", Dpi.ToString(System.Globalization.CultureInfo.InvariantCulture)); }
public override string ToString() { return($"ID = {ID.ToString()}, Name = {Name.ToString()}, Type = {PetType.ToString()}, BirthDate = {BirthDate.ToString()}, SoldDate = {SoldDate.ToString()}, Color = {Color.ToString()}, PreviousOwner = {PreviousOwner.ToString()}, Price = {Price.ToString()},\n"); }
public void OnSetColor(Color color) { Debug.Log ("on set color, " + color.ToString ()); foreach (int id in _selectedMaterials) { _materialColors[id] = color; _materialsDict[id].GetComponent<MaterialLineController>().SetColor (color); // TODO refresh mesh color _demo.RefreshMesh(); } }
// For rezising images: // https://resizeimage.net/ // TODO for tomorrow: create prefabs to instantiate and follow along video at 18:00 at https://www.youtube.com/watch?v=ae6mW74FZSU // Start is called before the first frame update void Start() { System.DateTime before = System.DateTime.Now; image = images[imageToRender]; Color[] pix = image.GetPixels(); int worldX = image.width; int worldZ = image.height; Vector3[] spawnPositions = new Vector3[pix.Length]; Vector3 startingSpawnPosition = new Vector3(-Mathf.Round(worldX / 2), 0, -Mathf.Round(worldZ / 2)); Vector3 currentSpawnPosition = startingSpawnPosition; int counter = 0; for (int z = 0; z < worldZ; z++) { for (int x = 0; x < worldX; x++) { spawnPositions[counter] = currentSpawnPosition; counter++; currentSpawnPosition.x++; } currentSpawnPosition.x = startingSpawnPosition.x; currentSpawnPosition.z++; } counter = 0; //int whitePix = 0; //int notWhitePix = 0; // NOTE: removing the last 0.0f in Color in the following line will make Unity break??? Color white = new Color(0.0f, 0.0f, 0.0f, 0.0f); //Color black = new Color(0.0f, 0.0f, 0.0f, 0.0f); foreach (Vector3 pos in spawnPositions) { Color c = pix[counter]; // First check for certain colors that would signify a certain object //if (c.r == 0.0f && c.g == 0.0f && c.b == 0.0f) if (c.b > 252f / 255f) { Debug.Log("Making fridge where color is " + c.ToString() + " at pos " + pos.ToString()); Instantiate(fridge, pos, Quaternion.identity); } else if (c.b > 200f / 255f && c.a > .5) { //Debug.Log("c.b > 200f/255f"); //Instantiate(blueObject, pos, Quaternion.identity); } else if (c.a > .500 && c.b < 100f / 255f) // != white) { //Debug.Log("Not white! Color is " + c.ToString() + " at pos " + pos.ToString()); Instantiate(wallObject, pos, Quaternion.identity); //notWhitePix++; } else { //Debug.Log("White"); //whitePix++; // Not instantiating groundObject for performance purposes //Instantiate(groundObject, pos, Quaternion.identity); } counter++; } System.TimeSpan duration = System.DateTime.Now.Subtract(before); Debug.Log("Generation of map took " + duration.Milliseconds + " milliseconds"); //Debug.Log("Found " + whitePix + " white pixels"); //Debug.Log("Found " + notWhitePix + " non-white pixels"); //foreach (Color c in pix) //{ //} //Color white = new Color(0.0f, 0.0f, 0.0f, 0.0f); //for (int i = 0; i < pix.Length; i++) //{ // //Debug.Log("i == " + i); // if (pix[i] == Color.white) // { // Debug.Log("Pixel is white!"); // } // else // { // if (pix[i] != white) // { // Debug.Log("!!pix[i] == " + pix[i]); // } // } //} //Debug.Log("pix.Length == " + pix.Length); }
public void Initialise(int _maxPoints, float _width, Color _colour, string speciesName) { maxPoints = _maxPoints; width = _width; colour = _colour; name = speciesName + " " + colour.ToString(); }
// Use this for initialization void Start() { playerColor = player.transform.Find("Blow_Chara_Mesh").transform.Find("Blow_Chara_Mesh_Body").GetComponent <Renderer>().material.GetColor("Color_DFC0C2F9"); playerColorHUD.GetComponent <Image>().color = getColorFromRGBA(playerColor.ToString()); }
public void Print(Color val) { Print(val.ToString()); }
public override void OnResponse(NetState sender, RelayInfo info) { Color toSet = Color.Empty; bool shouldSet = false; string name = ""; if (info.ButtonID == 1) { name = info.GetTextEntry(0).Text; } string rgb = ""; if (info.ButtonID == 2) { rgb = info.GetTextEntry(1).Text; } string hex = ""; if (info.ButtonID == 3) { hex = info.GetTextEntry(2).Text; } switch (info.ButtonID) { case 1: // Name { string toapply = name != string.Empty ? name : m_OldColor.IsNamedColor ? m_OldColor.Name : m_OldColor.IsEmpty ? "Empty" : ""; toSet = Color.FromName(toapply); shouldSet = true; } break; case 2: // RGB { string toapply = rgb != string.Empty ? rgb : string.Format("{0},{1},{2}", m_OldColor.R, m_OldColor.G, m_OldColor.B); string[] args = toapply.Split(','); if (args.Length >= 3) { byte r, g, b; if (byte.TryParse(args[0], out r) && byte.TryParse(args[1], out g) && byte.TryParse(args[2], out b)) { toSet = Color.FromArgb(r, g, b); shouldSet = true; } } } break; case 3: // Hex { string toapply = hex != string.Empty ? hex : string.Format("#{0:X6}", m_OldColor.ToArgb() & 0x00FFFFFF); int val; if (int.TryParse(toapply.TrimStart('#'), NumberStyles.HexNumber, CultureInfo.CurrentCulture, out val)) { toSet = Color.FromArgb(val); shouldSet = true; } } break; case 4: // Empty { toSet = Color.Empty; shouldSet = true; } break; } if (shouldSet) { try { CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, toSet.ToString()); m_Property.SetValue(m_Object, toSet, null); PropertiesGump.OnValueChanged(m_Object, m_Property, m_Stack); } catch { m_Mobile.SendMessage("An exception was caught. The property may not have changed."); } } m_Mobile.SendGump(new PropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page)); }
void DrawDebugInfo(Rect rect) { GUI.BeginGroup(rect); GUILayout.BeginVertical(GUILayout.MaxWidth(rect.width-6)); GUILayout.Label("Object: " + nearestElement.ToString()); int t_channel = channel; channel = EditorGUILayout.IntPopup(channel, new string[] {"1", "2"}, UV_CHANNELS); if(channel != t_channel) RefreshUVCoordinates(); if(GUILayout.Button("Dump Times")) Debug.Log( profiler.ToString() ); if(GUILayout.Button("Clear Profiler")) profiler.Reset(); GUILayout.Label("m_mouseDragging: " + m_mouseDragging); GUILayout.Label("m_rightMouseDrag: " + m_rightMouseDrag); GUILayout.Label("m_draggingCanvas: " + m_draggingCanvas); GUILayout.Label("modifyingUVs: " + modifyingUVs); BasicBackgroundColor = EditorGUILayout.ColorField("BACKGROUND", BasicBackgroundColor); GUILayout.Label(BasicBackgroundColor.ToString("F2")); UVColorGroupIndicator = EditorGUILayout.ColorField("Groups", UVColorGroupIndicator); GUILayout.Label("Canvas Zoom: " + uvGraphScale, GUILayout.MaxWidth(rect.width-6)); GUILayout.Label("Canvas Offset: " + uvCanvasOffset, GUILayout.MaxWidth(rect.width-6)); debug_showCoordinates = EditorGUILayout.Toggle("Show UV coordinates", debug_showCoordinates); float tmp = pref_gridSnapValue; pref_gridSnapValue = EditorGUILayout.FloatField("Grid Snap", pref_gridSnapValue, GUILayout.MaxWidth(rect.width-6)); if(tmp != pref_gridSnapValue) { pref_gridSnapValue = Mathf.Clamp(pref_gridSnapValue, .015625f, 2f); EditorPrefs.SetFloat(pb_Constant.pbUVGridSnapValue, pref_gridSnapValue); } GUI.EndGroup(); }
public PointDTO(int x, int y, Color color) { this.x = x; this.y = y; this.color = color.ToString().ToLowerInvariant(); }
private void _AppendItemGetAll() { if( false == _isGetItemInReadMailInfo()) return; if( true == _isOpenMsgBox()) return; //if( -1 == ItemMgr.HadItemManagement.Inven.GetEmptyInvenSlot()) if( _isGetItemCountInReadMailInfo() > ItemMgr.HadItemManagement.Inven.GetEmptyInvenSlotCount()) { AsMessageBox msgBox = AsNotify.Instance.MessageBox( AsTableManager.Instance.GetTbl_String(126), AsTableManager.Instance.GetTbl_String(103), AsNotify.MSG_BOX_TYPE.MBT_OK, AsNotify.MSG_BOX_ICON.MBI_NOTICE); msgBox.SetOkText( AsTableManager.Instance.GetTbl_String(1152)); return; } if( true == readMailInfo.bAccount) { Color titleColor = new Color( 1.0f, 0.494f, 0.0f, 1.0f); string title = titleColor.ToString() + AsTableManager.Instance.GetTbl_String(1442); string msg = AsTableManager.Instance.GetTbl_String(1443); m_msgboxItem = AsNotify.Instance.MessageBox( title, msg, this, "OnMsgBox_AppendItemGetAll_Ok", "OnMsgBox_AppendItemGetAll_Cancel", AsNotify.MSG_BOX_TYPE.MBT_OKCANCEL, AsNotify.MSG_BOX_ICON.MBI_QUESTION); m_slotBuf = null; m_slotIndexBuf = 0; } else { // server packet RecieveMailItem( 4, true); for( int i = 0; i < 4; i++) recvItemSlots[i].SetEmpty(); if( readMailInfo.nGold > 0) { recvGold.Text = "0"; readMailInfo.nGold = 0; } } if( false == _isGetItemInReadMailInfo()) { btnTakeAll.SetControlState( UIButton.CONTROL_STATE.DISABLED); btnTakeAll.spriteText.Color = Color.gray; return; } }
public void AddText(string text, Vector2 position, Color color, float fadeOutTime) { Console.WriteLine("Adding BubbleText: " + text + ":" + color.ToString()); this.BubbleTexts.Add(new BubbleText() { Text = text, Position = position, Color = color, TotalTime = fadeOutTime }); }
public void Create( AsBaseEntity baseEntity, string strName, Color nameColor, eNamePanelType eType, uint uiUserUniqueKey, float fSize) { m_bShowCommand = true; m_eNamePanelType = eType; m_uiUserUniqueKey = uiUserUniqueKey; m_baseEntity = baseEntity; m_strSubTitleName = _GetSubTitleName( eType); m_strName = strName; m_strGroupName = _GetGroupName( eType); m_strPvpGrade = _GetPvpGrade(); #if !NEW_DELEGATE_IMAGE m_bShowPvpGrade = AsGameMain.GetOptionState( OptionBtnType.OptionBtnType_PvpGrade); #endif gameObject.SetActiveRecursively( true); string strNameRes = string.Empty; string strNameBuf = string.Empty; // StringBuilder sb = new StringBuilder( ""); m_sbName.Remove( 0, m_sbName.Length); if( m_strPvpGrade.Length > 0) { m_sbName.Append( m_strPvpGradeColor); m_sbName.Append( m_strPvpGrade); } if( m_strSubTitleName.Length > 0) { m_sbName.Append( " "); m_sbName.Append( _GetSubTitleColor( eType)); m_sbName.Append( m_strSubTitleName); } if( m_strPvpGrade.Length > 0 || m_strSubTitleName.Length > 0) m_sbName.Append( " "); m_sbName.Append( nameColor.ToString()); m_sbName.Append( strName); strNameBuf = m_sbName.ToString(); if( m_strGroupName.Length > 0) strNameRes = strNameBuf + "\n<" + m_strGroupName + ">"; else strNameRes = strNameBuf; NameText.name = strName; NameText.Text = strNameRes; NameText.Color = nameColor; m_vUIPosRevision.x = 0.0f; m_vUIPosRevision.y = NameText.BaseHeight; m_vUIPosRevision.z = m_fNamePanelLayer; if( AsUserInfo.Instance.SavedCharStat.uniqKey_ == uiUserUniqueKey) m_vUIPosRevision.z -= 1.0f; if( eNamePanelType.eNamePanelType_Npc == eType) m_vUIPosRevision.y = 0.0f; Transform dummyLeadTop = m_baseEntity.GetDummyTransform( "DummyLeadTop"); if( null == dummyLeadTop) { if( true == m_baseEntity.isKeepDummyObj) { Vector3 vPos = m_baseEntity.transform.position; vPos.y += m_baseEntity.characterController.height; transform.position = _WorldToUIPoint( vPos, m_vUIPosRevision); } else Debug.LogWarning( "DummyLeadTop is not found: " + strName); } else { transform.position = _WorldToUIPoint( dummyLeadTop.position, m_vUIPosRevision); } if( eNamePanelType.eNamePanelType_Npc == eType) _CreateImage(); if( eNamePanelType.eNamePanelType_Monster == eType || eNamePanelType.eNamePanelType_Collect == eType ) NameText.renderer.enabled = false; NameImage_bg.renderer.enabled = false; NameImage_img.renderer.enabled = false; authorityMark.renderer.enabled = false; btnTargetMark.collider.enabled = false; //$yde imgTargetMark.renderer.enabled = false; //$yde btnTargetMark.SetInputDelegate( OnTargetMark); //$yde UpdateMonsterTarkMark(); SetRankMark(); SetGenderMark( eType, baseEntity); SetDelegateImage( eType, baseEntity); baseEntity.namePanel = this; }
/** * \brief Sets the color preference in vertex color window. * */ private void SetColorPreference(int index, Color col) { EditorPrefs.SetString(pb_Constant.pbVertexColorPrefs+index, col.ToString()); }
/// <summary> /// 現在のオブジェクトを表す文字列を返す /// </summary> /// <returns>現在のオブジェクトを表す文字列</returns> public override string ToString() => $"{Name} ({Size}-{Color.ToString()}-{OutLineSize}-{OutLineColor.ToString()})";
private void MoveChessPiece(object sender, MouseButtonEventArgs e) { Border border = (Border)sender; Border highlighted = (Border)mainWindow.FindName("highlighted"); if (highlighted != null) { int originX = Grid.GetRow(highlighted); int originY = Grid.GetColumn(highlighted); ChessPiece currentChessPiece = GetBoard[originX, originY]; if (border.Child == null || currentChessPiece.GetColor == currentTurnColor) { bool kingIsChecked = KingIsChecked(currentTurnColor); int destinationX = Grid.GetRow(border); int destinationY = Grid.GetColumn(border); if (currentChessPiece.MoveResolvesCheck(currentTurnColor, new Point(destinationX, destinationY))) { List <Point> validMoves = null; if (!KingIsChecked(currentTurnColor)) { validMoves = currentChessPiece.GetValidMoves(); } else { validMoves = currentChessPiece.GetValidMovesIfKingIsChecked(); } if (validMoves.Where(point => point.X == destinationX && point.Y == destinationY).Any()) { if (currentChessPiece.GetType().Name == "Pawn") { ((Pawn)currentChessPiece).SetHasStepped = true; } currentChessPiece.SetCoordinates = new Point(destinationX, destinationY); GetBoard[destinationX, destinationY] = GetBoard[originX, originY]; GetBoard[originX, originY] = null; currentTurnColor = currentTurnColor == Color.White ? Color.Black : Color.White; UpdateBoard(); mainWindow.UnregisterName(highlighted.Name); if (IsCheckMate(currentTurnColor)) { MessageBox.Show(currentTurnColor.ToString() + " has lost"); } } else { ColorTile(highlighted); List <Point> highlightedValidMoves = null; if (!KingIsChecked(currentTurnColor)) { highlightedValidMoves = currentChessPiece.GetValidMoves(); } else { highlightedValidMoves = currentChessPiece.GetValidMovesIfKingIsChecked(); } UnshowValidMoves(highlightedValidMoves); mainWindow.UnregisterName(highlighted.Name); } } else { ColorTile(highlighted); List <Point> highlightedValidMoves = null; if (!KingIsChecked(currentTurnColor)) { highlightedValidMoves = currentChessPiece.GetValidMoves(); } else { highlightedValidMoves = currentChessPiece.GetValidMovesIfKingIsChecked(); } UnshowValidMoves(highlightedValidMoves); mainWindow.UnregisterName(highlighted.Name); } } } }
public override string ToString() { return(String.Format("card color: {0} , value: {1}", Color.ToString(), CardName)); }
public override string ToString() { return(Offset + ": " + Color.ToString()); }
public static bool onChat(String text) { try { if (text.Substring(0, 1) == "/") { var count = 0; var command = text.Substring(1); var chat = ""; bool isNumber = false; int firstPar = 0; List<String> par = new List<String>(); if (text.Contains(' ')) { command = text.Substring(1, text.IndexOf(' ') - 1); text = text.Substring(text.IndexOf(' ') + 1); while (text.IndexOf(' ') != -1) { par.Add(text.Substring(0, text.IndexOf(' '))); text = text.Substring(text.IndexOf(' ') + 1); // = int.Parse(text.Substring(text.LastIndexOf(' ') + 1)); } par.Add(text.Substring(0)); count = par.Count; isNumber = int.TryParse(par[0], out firstPar); } switch (command) { #region BUILD // Allows infinity blockreach case "build": chat = "Buildmode is now " + toggleBuildMode() + "."; break; #endregion #region COLOR: allows to change default chat color case "color": int newR,newG,newB; if (int.TryParse(par[0], out newR) && int.TryParse(par[1], out newG) && int.TryParse(par[2], out newB)) { defaultColor = new Color(newR, newG, newB); chat = "Chat color succesfully changed to " + defaultColor.ToString(); sendMessage("New color", defaultColor); } else { sendError("Wrong usage; syntax is /color R G B (R,G,B equal a number between 0 and 255)"); } break; #endregion #region GIVE // Still necessary to check if item exists case "give": var itemname = ""; int amount = 1; if (count == 0) { break; } else { foreach (var x in par) { if (x == par.First()) itemname = x; //check for number, if not add text to item name else if (int.TryParse(x, out amount)) break; else itemname += " " + x; } if (amount == 0) { amount++; } } bool check = give(itemname, amount); if (check) chat = "" + Main.player[Main.myPlayer].name + " received " + amount + "x " + Capitalize(itemname) + "."; else { sendError("GIVE: ERROR, item does not exist!"); } break; #endregion #region HEAL // Working perfectly, also negative values allowed atm case "heal": if (count == 0) { Main.player[Main.myPlayer].statLife = Main.player[Main.myPlayer].statLifeMax; } else { Math.Max(Main.player[Main.myPlayer].statLife += int.Parse(par[0]), 1); } break; #endregion #region TELEPORT // OK, improve with 'guided' teleport to item/gate/person .. case "teleport": int displacemX = int.Parse(par[0]); int displacemY = int.Parse(par[1]); Main.player[Main.myPlayer].position.X = Main.player[Main.myPlayer].position.X - displacemX; Main.player[Main.myPlayer].position.Y = Main.player[Main.myPlayer].position.Y - displacemY; chat = "TELEPORT: moved player by { " + par[0] + ", " + par[1] + "}"; break; #endregion #region TIME //OK case "time": // time commands server: main.cs 19574 String[] serverTimeCommands = { "dawn", "dusk", "noon", "midnight" }; if (count == 1) { if (isNumber) { Main.time += int.Parse(par[0]) * 60; chat = "TIME: shifted by " + par[0] + " minutes."; } else if (serverTimeCommands.Contains(par[0])) { serverCommand(par[0]); chat = "TIME: changed to " + par[0]; } else { // Show fault-message sendError("ERROR- usage: /time minutes"); sendError("or use /time dawn,dusk,noon or midnight."); } } else { // Show fault-message sendError("ERROR- usage: /time minutes"); sendError("or use /time dawn,dusk,noon or midnight."); } break; #endregion case "kill": chat = "TODO, why don't you jump of a cliff if you really want to die."; break; default: serverCommand(command); break; } if (chat.Length != 0) sendMessage(chat,commandColor); return false; } else { // Normal chatmode! sendMessage(text); } } catch (Exception) { return false; } return true; }
public void CheckGetQuestItem(int iItemID) { Item nowItem = ItemMgr.ItemManagement.GetItem(iItemID); if (nowItem.ItemData.GetItemType() != Item.eITEM_TYPE.UseItem) return; if (nowItem.ItemData.GetSubType() != (int)Item.eUSE_ITEM.GetQuest) return; Color textColor = new Color(1.0f, 0.717f, 0.0627f, 1.0f); System.Text.StringBuilder sb = new System.Text.StringBuilder(textColor.ToString()); sb.Append(AsTableManager.Instance.GetTbl_String(2134)); ArkQuestmanager.instance.ShowBalloonRewardMsgBox(sb.ToString(), AsTableManager.Instance.GetTbl_String(2134), 10.0f); }
public override void SetColor( int face, Color newcolor ) { LogFile.WriteLine( "setting color to " + newcolor.ToString() ); if( face == FractalSpline.Primitive.AllFaces ) { for( int i = 0; i < facecolors.GetUpperBound(0) + 1; i++ ) { facecolors[i] = new Color( newcolor ); _SetColor( face, newcolor ); } } else { facecolors[ face ] = new Color( newcolor ); _SetColor( face, newcolor ); } }
static YamlObject FromColor(Color value) => (YamlScalar)value?.ToString();
/// <summary> /// Recuperation du nom de l'objet par sa couleur /// </summary> /// <param name="c">couleur de l'objet</param> /// <returns>le nom de l'objet, ou null</returns> public String Get(Color c) { String temp = null; try { temp = dicolor[c.ToString()]; } catch { }; return temp; }
// Update is called once per frame void Update() { updateCounter++; if (updateCounter >= Settings.statusUpdateNumber) { string status = "invalid"; string objectName; string[] nameSubstrings; objectName = gameObject.transform.parent.name; nameSubstrings = objectName.Split('_'); int pos = objectName.IndexOf('_'); string cleanedName = objectName.Substring(pos + 1); Item i = ItemManager.getInstance().getItem(cleanedName); if (i != null) { status = i.state; if (i.type.Equals("Sensor")) { status += " " + ((Sensor)i).unit; if (cleanedName.Contains("idscan")) { status = ((NfcReader)i).getName(); } } updateCounter = 0; this.transform.GetChild(0).GetChild(1).GetComponent <Text>().text = i.shortName; //if(objectName.Contains("dimmer")) // Debug.Log("shortname of " + objectName + " is " + i.shortName + " with status " + status); } if (i is ColorSensor || i is HueDimmer || i is CoffeeMachineActuator) { if (i is ColorSensor || i is HueDimmer) { byte r, g, b; if (i is ColorSensor) { ColorSensor c = (ColorSensor)i; r = Convert.ToByte(c.r); g = Convert.ToByte(c.g); b = Convert.ToByte(c.b); this.transform.GetChild(0).GetChild(1).GetChild(0).GetComponent <Image>().color = new Color32(r, g, b, 255); } else { HueDimmer hd = (HueDimmer)i; HueColor c = hd.hueColor; float hf = (float)c.h / 360; float sf = (float)c.s / 100; float vf = (float)c.v / 100; Color rgbColor = Color.HSVToRGB(hf, sf, vf, false); this.transform.GetChild(0).GetChild(1).GetChild(0).GetComponent <Image>().color = rgbColor; string RGBstring = rgbColor.ToString(); int Ri = (int)(rgbColor.r * 255); int Bi = (int)(rgbColor.b * 255); int Gi = (int)(rgbColor.g * 255); string RGBstr = Ri.ToString() + "," + Gi.ToString() + "," + Bi.ToString(); Debug.Log(RGBstr); this.transform.GetChild(0).GetChild(1).GetChild(1).GetComponent <Text>().text = RGBstr; } this.transform.GetChild(0).GetChild(2).GetComponent <Text>().text = status; } else { CoffeeMachineActuator c = (CoffeeMachineActuator)i; this.transform.GetChild(0).GetChild(3).GetChild(1).GetComponent <Text>().text = c.getWaterLevel(); this.transform.GetChild(0).GetChild(2).GetComponent <Text>().text = status; } } else { this.transform.GetChild(0).GetChild(2).GetComponent <Text>().text = status; } } }
private static string GetStringValue(Color?value) { return(value?.ToString(CultureInfo.InvariantCulture)); }
void Start() { playerColor = SettingsController.GetInstance().playerFile.Color; fieldNameInput = SettingsController.GetInstance().playerFile.Name; SettingsController.GetInstance().loadMap = false; //set it false when entering the startMenu //set color of button Debug.Log("Loaded Saved Player Color: " + playerColor.ToString()); UnityEngine.UI.ColorBlock cb = colorButton.colors; cb.normalColor = playerColor; cb.pressedColor = playerColor; cb.highlightedColor = playerColor; colorButton.colors = cb; //set name playerName.text = fieldNameInput; Toggle_DisableDependElement(planetSlider); //read the value from the ui elements and set them in the settingscontroller so the match. Slider_OnChangePlanets(planetSlider); SettingsController.GetInstance().kiCount = System.Int32.Parse(kiCount.text); loadingScene = false; }
public List <IData3DSet> AddGalMapObjectsToDataset(GalacticMapping galmap, Bitmap target, float widthly, float heightly, Vector3 rotation, bool namethem, Color textc) { var datasetbks = Data3DSetClass <TexturedQuadData> .Create("galobj", Color.White, 1f); if (galmap != null && galmap.Loaded) { long gmotarget = TargetClass.GetTargetGMO(); foreach (GalacticMapObject gmo in galmap.galacticMapObjects) { if (gmo.galMapType.Enabled) { Bitmap touse = gmo.galMapType.Image; // under our control, so must have it if (touse != null && gmo.points.Count > 0) // if it has an image its a point object , and has co-ord { Vector3 pd = gmo.points[0].Convert(); string tucachename = "GalMapType:" + gmo.galMapType.Typeid; TexturedQuadData tubasetex = null; if (_cachedTextures.ContainsKey(tucachename)) { tubasetex = _cachedTextures[tucachename]; } else { tubasetex = TexturedQuadData.FromBitmap(touse, pd, rotation, widthly, heightly); _cachedTextures[tucachename] = tubasetex; } TexturedQuadData newtexture = TexturedQuadData.FromBaseTexture(tubasetex, pd, rotation, widthly, heightly); newtexture.Tag = gmo; newtexture.Tag2 = 0; datasetbks.Add(newtexture); if (gmo.id == gmotarget) { TexturedQuadData ntag = TexturedQuadData.FromBitmap(target, pd, rotation, widthly, heightly, 0, heightly * gmotargetoff); ntag.Tag = gmo; ntag.Tag2 = 2; datasetbks.Add(ntag); } } } } if (namethem) { bool useaggregate = true; if (useaggregate) { foreach (GalMapType t in galmap.galacticMapTypes) { if (t.Enabled) { Bitmap bmp = null; TexturedQuadData nbasetex = null; List <TexturedQuadData> ntex = new List <TexturedQuadData>(); string ncachename = "GalMapNames:" + t.Typeid + textc.ToString(); if (_cachedBitmaps.ContainsKey(ncachename) && _cachedTextures.ContainsKey(ncachename)) { bmp = _cachedBitmaps[ncachename]; nbasetex = _cachedTextures[ncachename]; ntex = nbasetex.Children.ToList(); } else { List <GalacticMapObject> tgmos = galmap.galacticMapObjects.Where(o => o.galMapType.Typeid == t.Typeid && o.points.Count > 0).ToList(); float maxheight = 32; List <Rectangle> bounds = new List <Rectangle>(); List <float> widths = new List <float>(); Bitmap stringstarmeasurebitmap = new Bitmap(1, 1); using (Graphics g = Graphics.FromImage(stringstarmeasurebitmap)) { foreach (GalacticMapObject gmo in tgmos) { SizeF sz = g.MeasureString(gmo.name, gmostarfont); if (sz.Height > maxheight) { maxheight = sz.Height; } widths.Add(sz.Width); } } int textheight = (int)(maxheight + 4); int x = 0; int y = 0; foreach (float twidth in widths) { int w = (int)(twidth + 4); if ((w + x) > 1024) { x = 0; y = y + textheight; if (((y + textheight) % 1024) < (y % 1024)) { y = y + ((1024 - y) % 1024); } } bounds.Add(new Rectangle(x, y, w, textheight)); x = x + w; } y = y + textheight; bmp = new Bitmap(1024, y); nbasetex = new TexturedQuadData(null, null, bmp); using (Graphics g = Graphics.FromImage(bmp)) { for (int i = 0; i < tgmos.Count; i++) { GalacticMapObject gmo = tgmos[i]; string cachename = gmo.name + textc.ToString(); Vector3 pd = gmo.points[0].Convert(); Rectangle clip = bounds[i]; Point pos = clip.Location; g.SetClip(clip); g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None; using (Brush br = new SolidBrush(textc)) g.DrawString(gmo.name, gmostarfont, br, pos); g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.Default; TexturedQuadData tex = TexturedQuadData.FromBaseTexture(nbasetex, pd, rotation, clip, (widthly / 10 * gmo.name.Length), (heightly / 3), 0, heightly * gmonameoff); tex.Tag = gmo; tex.Tag2 = 1; _cachedTextures[cachename] = tex; ntex.Add(tex); } } _cachedBitmaps[ncachename] = bmp; _cachedTextures[ncachename] = nbasetex; } foreach (TexturedQuadData tex in ntex) { datasetbks.Add(tex); } } } } else { foreach (GalacticMapObject gmo in galmap.galacticMapObjects) { if (gmo.galMapType.Enabled && gmo.points.Count > 0) { Vector3 pd = gmo.points[0].Convert(); Bitmap map = null; string cachename = gmo.name + textc.ToString(); if (_cachedBitmaps.ContainsKey(cachename)) // cache them, they take a long time to compute.. { map = _cachedBitmaps[cachename]; } else { map = DrawString(gmo.name, textc, gmostarfont); _cachedBitmaps.Add(cachename, map); } TexturedQuadData ntext = TexturedQuadData.FromBitmap(map, pd, rotation, (widthly / 10 * gmo.name.Length), (heightly / 3), 0, heightly * gmonameoff); ntext.Tag = gmo; ntext.Tag2 = 1; datasetbks.Add(ntext); } } } } } _datasets.Add(datasetbks); return(_datasets); }
public string Serialize() { string state = turn.ToString() + "\n"; }
/// <summary>Returns a string that represents the current object.</summary> /// <returns>A string that represents the current object.</returns> public override string ToString() { return(Name.IsNullOrWhiteSpace() ? $"({Color?.ToString() ?? "No color"})" : $"{Name} ({Color?.ToString() ?? "No color"})"); }
public void WildCardHasColor(int colorID) //萬用卡在指定顏色後變色 { GameObject card = IDtoGameobeject(LastCardID); int[] cardIDmanager = CardIDManager(LastCardID); int FunctionID = cardIDmanager[1]; Color NewColor = cardColor[colorID]; var children = card.GetComponentsInChildren <Transform>(); if (FunctionID == 13) { children[3].GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>("graphic/" + NewColor.ToString() + "Wild"); card.GetComponent <Card>().cardState = CardState.Used; } else if (FunctionID == 14) { children[3].GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>("graphic/" + NewColor.ToString() + "WildDrawFour"); } card.GetComponent <Card>().color = NewColor; }
public string toString() { return("X: " + X + " Y: " + Y + " " + Color.ToString() + ";"); }
private void UpdateControls(Color color, bool hsv, bool rgb, bool predifined) { if (Updating) { return; } try { BeginUpdate(); // HSV if (hsv) { double h = ColorHelper.GetHSV_H(color); double s = ColorHelper.GetHSV_S(color); double v = ColorHelper.GetHSV_V(color); sliderHSV.Value = h; gradientStopHSVColor.Color = ColorHelper.HSV2RGB(h, 1d, 1d); double x = s * (rectangleHSV.ActualWidth - 1); double y = (1 - v) * (rectangleHSV.ActualHeight - 1); ellipseHSV.SetValue(Canvas.LeftProperty, x - ellipseHSV.ActualWidth / 2); ellipseHSV.SetValue(Canvas.TopProperty, y - ellipseHSV.ActualHeight / 2); } if (rgb) { byte a = color.A; byte r = color.R; byte g = color.G; byte b = color.B; sliderA.Value = a; gradientStopA0.Color = Color.FromArgb(0, r, g, b); gradientStopA1.Color = Color.FromArgb(255, r, g, b); textBoxA.Text = a.ToString("X2"); sliderR.Value = r; gradientStopR0.Color = Color.FromArgb(255, 0, g, b); gradientStopR1.Color = Color.FromArgb(255, 255, g, b); textBoxR.Text = r.ToString("X2"); sliderG.Value = g; gradientStopG0.Color = Color.FromArgb(255, r, 0, b); gradientStopG1.Color = Color.FromArgb(255, r, 255, b); textBoxG.Text = g.ToString("X2"); sliderB.Value = b; gradientStopB0.Color = Color.FromArgb(255, r, g, 0); gradientStopB1.Color = Color.FromArgb(255, r, g, 255); textBoxB.Text = b.ToString("X2"); } if (predifined) { brushColor.Color = color; if (dictionaryColor.ContainsKey(color)) { comboBoxColor.SelectedItem = dictionaryColor[color]; textBoxColor.Text = ""; } else { comboBoxColor.SelectedItem = null; textBoxColor.Text = color.ToString(); } } Color = color; } finally { EndUpdate(); } }
/// <summary> /// Retrieves a <see cref="TextureAsset"/> (creating it if necessary) filled with the given color. /// </summary> /// <param name="color">The color to fill the texture with.</param> /// <returns>A texture asset filled with the given color.</returns> public TextureAsset GetColorTexture(Color color) { string key = ':' + color.ToString(); // The ':' is to make absolutely sure that the key isn't a valid filename. return GetCreateAsset(AssetType.Texture, key, assetCore => new TextureAsset(assetCore as TextureAssetCore), () => new ColorTextureAssetCore(color)) as TextureAsset; }
public string GetDescription() { return("Fancy Body " + Color.ToString() + " Type: " + Type.ToString()); }
public ColorTextureAssetCore(Color color) : base(color.ToString()) { _color = color; _maxU = 1.0f; _maxV = 1.0f; }
private void ClearColour_ClickHandle( object p_Sender, EventArgs p_Args) { DialogResult Result = m_ColourPicker.ShowDialog( ); if( Result == DialogResult.OK ) { m_ClearColour = new Color( m_ColourPicker.Color.R, m_ColourPicker.Color.G, m_ColourPicker.Color.B, m_ColourPicker.Color.A ); System.Diagnostics.Debug.Write( "Clear colour: " + m_ClearColour.ToString( ) ); if( m_NetworkSession != null ) { foreach( LocalNetworkGamer Local in m_NetworkSession.LocalGamers ) { uint MessageType = 1; m_PacketWriter.Write( MessageType ); m_PacketWriter.Write( m_ClearColour.ToVector3( ) ); Local.SendData( m_PacketWriter, SendDataOptions.ReliableInOrder ); } } } }