public override string ToString() { string summary = Color1.ToString().Substring(0, 1) + Color2.ToString().Substring(0, 1) + Color3.ToString().Substring(0, 1); summary = summary.Replace("N", "") + "+"; if (Stats.Agility > 0) { summary += Stats.Agility.ToString() + "Agi"; } if (Stats.Stamina > 0) { summary += Stats.Stamina.ToString() + "Sta"; } if (Stats.DodgeRating > 0) { summary += Stats.DodgeRating.ToString() + "Dodge"; } if (Stats.DefenseRating > 0) { summary += Stats.DefenseRating.ToString() + "Def"; } if (Stats.Resilience > 0) { summary += Stats.Resilience.ToString() + "Res"; } if (summary.EndsWith("+")) { summary = summary.Substring(0, summary.Length - 1); } return(summary); }
public override string ToString() { string text = ItemClass + "\n" + Name + "\n" + R.Package + ":" + Collection + "(" + Slot + ")" + "\n" + R.Category + ":" + MainCategory + "," + SubCategory + ""; text += "\n" + R.MaxStackCount + ":" + (MaxStack < 0? R.UnLimit :"" + MaxStack); if (Color1 != 0) { text += "\n" + R.Color + ":" + "#" + Color1.ToString("X") + "," + (Color2 == 0 ? "-" : "#" + Color2.ToString("X")) + "," + (Color3 == 0 ? "-" : "#" + Color3.ToString("X")); } text += "\n" + R.ClassRestriction + ":" + ClassInfoEx.GetClassText(this.RequiredClass); if (Stat != null) { text += Stat.ToString(); } if (Attributes != null) { foreach (ItemAttribute attr in Attributes) { text += "\n" + attr.ToString(); } } text += "\n" + Desc; if (Time != "-") { text += "\n" + R.TimeDate + ":" + Time; } return(text); }
public override string ToString() { string text = "物品ID:" + ItemClass + "\n物品名:" + ItemName + "\n背包:" + Collection + ",格子:" + Slot + "\n类型:" + MainCategory + " [" + SubCategory + "]"; text += "\n最大堆叠数量:" + (MaxStack < 0?"不限":"" + MaxStack); if (Color1 != 0) { text += "\n颜色:" + (Color1 == 0 ? "无" : "#" + Color1.ToString("X")) + "," + (Color2 == 0 ? "无" : "#" + Color2.ToString("X")) + "," + (Color3 == 0 ? "无" : "#" + Color3.ToString("X")); } text += "\n职业限制:" + ClassInfoEx.GetClassText(this.RequiredClass); if (Stat != null) { text += Stat.ToString(); } if (Attributes != null) { foreach (ItemAttribute attr in Attributes) { text += "\n" + attr.ToString(); } } text += "\n物品描述:" + ItemDesc; if (Time != "无限期") { text += "\n到期时间:" + Time; } return(text); }
protected override byte QuantizePixel(Color2 pixel) { byte colorIndex = 0; string colorHash = pixel.ToString(); if (colorMap.ContainsKey(colorHash)) { colorIndex = colorMap[colorHash]; } else { byte[] bytes = pixel.ToBytes(); if (!(bytes[3] > Threshold)) { for (int index = 0; index < colors.Length; index++) { if (colors[index].ToBytes()[3] == 0) { colorIndex = (byte)index; TransparentIndex = colorIndex; break; } } } else { int leastDistance = int.MaxValue; int red = bytes[0]; int green = bytes[1]; int blue = bytes[2]; for (int index = 0; index < colors.Length; index++) { byte[] paletteColor = colors[index].ToBytes(); int redDistance = paletteColor[0] - red; int greenDistance = paletteColor[1] - green; int blueDistance = paletteColor[2] - blue; int distance = (redDistance * redDistance) + (greenDistance * greenDistance) + (blueDistance * blueDistance); if (distance < leastDistance) { colorIndex = (byte)index; leastDistance = distance; if (distance == 0) { break; } } } } colorMap.TryAdd(colorHash, colorIndex); } return(colorIndex); }
public List <TextMenu.Item> CreateMenu(TextMenu menu, bool inGame) { List <TextMenu.Item> colorMenus = new List <TextMenu.Item>(); colorMenus.Add(new TextMenu.Button("Color 1: " + Color1.ToString()).Pressed(() => { Audio.Play(SFX.ui_main_savefile_rename_start); menu.SceneAs <Overworld>().Goto <OuiModOptionString>().Init <OuiModOptions>(Color1.ToString(), v => { Color1 = new HSVColor(v); }, 9); })); colorMenus.Add(new TextMenu.Button("Color 2: " + Color2.ToString()).Pressed(() => { Audio.Play(SFX.ui_main_savefile_rename_start); menu.SceneAs <Overworld>().Goto <OuiModOptionString>().Init <OuiModOptions>(Color2.ToString(), v => { Color2 = new HSVColor(v); }, 9); })); colorMenus.Add(new TextMenu.OnOff("Rgb Gradient", doRgbGradient).Change(v => doRgbGradient = v)); return(colorMenus); }
protected override byte QuantizePixel(Color2 pixel) { byte colorIndex = 0; string colorHash = pixel.ToString(); if (colorMap.ContainsKey(colorHash)){ colorIndex = colorMap[colorHash]; } else{ byte[] bytes = pixel.ToBytes(); if (!(bytes[3] > Threshold)){ for (int index = 0; index < colors.Length; index++){ if (colors[index].ToBytes()[3] == 0){ colorIndex = (byte) index; TransparentIndex = colorIndex; break; } } } else{ int leastDistance = int.MaxValue; int red = bytes[0]; int green = bytes[1]; int blue = bytes[2]; for (int index = 0; index < colors.Length; index++){ byte[] paletteColor = colors[index].ToBytes(); int redDistance = paletteColor[0] - red; int greenDistance = paletteColor[1] - green; int blueDistance = paletteColor[2] - blue; int distance = (redDistance*redDistance) + (greenDistance*greenDistance) + (blueDistance*blueDistance); if (distance < leastDistance){ colorIndex = (byte) index; leastDistance = distance; if (distance == 0){ break; } } } } colorMap.TryAdd(colorHash, colorIndex); } return colorIndex; }
public string PatternColors(char separator) { return((Color1 == -1 ? "-1" : Color1.ToString("x")) + separator + (Color2 == -1 ? "-1" : Color2.ToString("x")) + separator + (Color3 == -1 ? "-1" : Color3.ToString("x"))); }
public String ParseMountColor() { return((Color1 == -1 ? "" : Color1.ToString("X")) + "," + (Color2 == -1 ? "" : Color2.ToString("X")) + "," + (Color3 == -1 ? "" : Color3.ToString("X"))); }