static void Postfix(PlayerTab __instance) { int columns = 5; float xMin = 1.45f; float scale = 0.65f; float add = 0.45f; float x = xMin; float y = -0.05f; for (int i = 0; i < __instance.ColorChips.Count; ++i) { if (i % columns == 0) { x = xMin; y -= add; } else { x += add; } ColorChip chip = __instance.ColorChips[i]; chip.transform.localPosition = new Vector3(x, y, -1f); chip.transform.localScale *= scale; } }
public static void Postfix(PlayerTab __instance) // Replace instead { Il2CppArrayBase <ColorChip> chips = __instance.ColorChips.ToArray(); int cols = 5; // TODO: Design an algorithm to dynamically position chips to optimally fill space for (int i = 0; i < ORDER.Count; i++) { int pos = ORDER[i]; if (pos < 0 || pos > chips.Length) { continue; } ColorChip chip = chips[pos]; int row = i / cols, col = i % cols; // Dynamically do the positioning chip.transform.localPosition = new Vector3(-0.975f + (col * 0.485f), 1.475f - (row * 0.49f), chip.transform.localPosition.z); chip.transform.localScale *= 0.78f; } for (int j = ORDER.Count; j < chips.Length; j++) // If number isn't in order, hide it { ColorChip chip = chips[j]; chip.transform.localScale *= 0f; chip.enabled = false; chip.Button.enabled = false; chip.Button.OnClick.RemoveAllListeners(); } }
public ColorParser(ITexture2D tex, ColorChip colorChip, IColor magenta, bool unique = false, bool ignoreTransparent = true) { this.tex = tex; this.colorChip = colorChip; this.unique = unique; this.magenta = magenta; }
private AbstractParser LoadColorMap(Dictionary <string, byte[]> files) { var fileName = "color-map.png"; if (files.ContainsKey(fileName)) { // UnityEngine.Debug.Log("Create color map"); // var tex = ReadTexture(files[fileName]); // Create new color map chip var colorMapChip = new ColorChip(); // Add the chip to the engine targetEngine.chipManager.ActivateChip(ColorMapParser.chipName, colorMapChip, false); // targetEngine.colorMapChip = colorMapChip; var imageParser = new PNGReader(files[fileName], targetEngine.colorChip.maskColor); // Pass the chip to the new parser return(new ColorMapParser(imageParser, colorMapChip, maskColor)); } return(null); }
public FontParser(IImageParser parser, ColorChip colorChip, FontChip fontChip) : base(parser, colorChip, fontChip) { this.fontChip = fontChip; // imageParser.ReadStream(); name = parser.FileName.Split('.').First(); }
public ColorPaletteExporter(string fileName, ColorChip colorChip, ITextureFactory textureFactory) { fullFileName = fileName; this.colorChip = colorChip; this.textureFactory = textureFactory; }
public static void Postfix(PlayerTab __instance) { var columns = 5; var xMin = 1.45F; var scale = 0.65F; var add = 0.45F; float x = xMin; float y = -0.05F; for (var i = 0; i < __instance.ColorChips.Count; i++) { if (i % columns == 0) { x = xMin; y -= add; } else { x += add; } ColorChip chip = __instance.ColorChips.ToArray()[i]; Transform transform = chip.transform; transform.localPosition = new Vector3(x, y, -1F); transform.localScale *= scale; } }
public TilemapParser(IImageParser parser, ColorChip colorChip, SpriteChip spriteChip, TilemapChip tilemapChip) : base(parser, colorChip, spriteChip) { this.tilemapChip = tilemapChip; autoImport = tilemapChip.autoImport; }
public FlagColorParser(IImageParser imageParser, IEngineChips chips) : base(imageParser) { flagColorChip = new ColorChip(); chips.chipManager.ActivateChip(flagColorChipName, flagColorChip, false); maskColor = new ColorData(chips.colorChip.maskColor); }
public ColorPaletteExporter(string fileName, ColorChip colorChip, IImageExporter imageExporter) { fullFileName = fileName; this.colorChip = colorChip; this.imageExporter = imageExporter; }
public FlagColorParser(ITexture2D tex, IEngineChips chips) { flagColorChip = new ColorChip(); chips.chipManager.ActivateChip(flagColorChipName, flagColorChip, false); maskColor = new ColorData(chips.colorChip.maskColor); flagTex = tex; }
public SpriteImageParser(IImageParser parser, ColorChip colorChip, SpriteChip spriteChip = null) : base(parser) { // this.chips = chips; this.spriteChip = spriteChip; this.colorChip = colorChip; if (spriteChip != null) { spriteWidth = this.spriteChip.width; spriteHeight = this.spriteChip.height; } }
public static float createHatPackage(List <System.Tuple <HatData, HatExtension> > hats, string packageName, float YStart, HatsTab __instance) { float offset = YStart; if (textTemplate != null) { TMPro.TMP_Text title = UnityEngine.Object.Instantiate <TMPro.TMP_Text>(textTemplate, __instance.scroller.Inner); title.transform.parent = __instance.scroller.Inner; title.transform.localPosition = new Vector3(headerX, YStart, inventoryZ); title.alignment = TMPro.TextAlignmentOptions.Center; title.fontSize *= 1.25f; title.fontWeight = TMPro.FontWeight.Thin; title.enableAutoSizing = false; title.autoSizeTextContainer = true; title.text = ModTranslation.getString(packageName); offset -= headerSize * __instance.YOffset; hatsTabCustomTexts.Add(title); } var numHats = hats.Count; for (int i = 0; i < hats.Count; i++) { HatData hat = hats[i].Item1; HatExtension ext = hats[i].Item2; float xpos = __instance.XRange.Lerp((i % __instance.NumPerRow) / (__instance.NumPerRow - 1f)); float ypos = offset - (i / __instance.NumPerRow) * __instance.YOffset; ColorChip colorChip = UnityEngine.Object.Instantiate <ColorChip>(__instance.ColorTabPrefab, __instance.scroller.Inner); int color = __instance.HasLocalPlayer() ? PlayerControl.LocalPlayer.Data.DefaultOutfit.ColorId : SaveManager.BodyColor; colorChip.transform.localPosition = new Vector3(xpos, ypos, inventoryZ); if (ActiveInputManager.currentControlType == ActiveInputManager.InputType.Keyboard) { colorChip.Button.OnMouseOver.AddListener((UnityEngine.Events.UnityAction)(() => __instance.SelectHat(hat))); colorChip.Button.OnMouseOut.AddListener((UnityEngine.Events.UnityAction)(() => __instance.SelectHat(DestroyableSingleton <HatManager> .Instance.GetHatById(SaveManager.LastHat)))); colorChip.Button.OnClick.AddListener((UnityEngine.Events.UnityAction)(() => __instance.ClickEquip())); } else { colorChip.Button.OnClick.AddListener((UnityEngine.Events.UnityAction)(() => __instance.SelectHat(hat))); } colorChip.Inner.SetHat(hat, color); colorChip.Inner.transform.localPosition = hat.ChipOffset; colorChip.Tag = hat; colorChip.Button.ClickMask = __instance.scroller.Hitbox; __instance.ColorChips.Add(colorChip); } return(offset - ((numHats - 1) / __instance.NumPerRow) * __instance.YOffset - headerSize); }
private void SerializeColorChip(ColorChip colorChip) { if (colorChip.export == false) { return; } // TODO this needs to be moved into the chip so it can be correctly overriden JsonUtil.GetLineBreak(sb); sb.Append("\"ColorChip\":"); JsonUtil.GetLineBreak(sb); sb.Append("{"); JsonUtil.GetLineBreak(sb, 1); sb.Append("\"maxColors\":"); sb.Append(colorChip.maxColors); sb.Append(","); JsonUtil.GetLineBreak(sb, 1); sb.Append("\"backgroundColor\":"); sb.Append(colorChip.backgroundColor); sb.Append(","); JsonUtil.GetLineBreak(sb, 1); sb.Append("\"maskColor\":\""); sb.Append(colorChip.maskColor); sb.Append("\""); sb.Append(","); JsonUtil.GetLineBreak(sb, 1); sb.Append("\"unique\":"); sb.Append(colorChip.unique.ToString().ToLower()); sb.Append(","); JsonUtil.GetLineBreak(sb, 1); sb.Append("\"debug\":"); sb.Append(colorChip.debugMode.ToString().ToLower()); sb.Append(","); JsonUtil.GetLineBreak(sb, 1); JsonUtil.GetLineBreak(sb); sb.Append("}"); sb.Append(","); currentStep++; }
public TilemapParser(ITexture2D tex, ITexture2D tileFlagTex, IEngineChips chips) : base(tex, chips) { //Debug.Log("Parse Tilemap"); tilemapChip = chips.tilemapChip; this.tileFlagTex = tileFlagTex; autoImport = tilemapChip.autoImport; flagColorChip = chips.chipManager.GetChip(FlagColorParser.flagColorChipName, false) as ColorChip; clear = new ColorData { a = 0 }; maskColor = new ColorData(chips.colorChip.maskColor); }
public FlagColorExporter(string fileName, IEngineChips engineChips, ITextureFactory textureFactory) { fullFileName = fileName; // tilemapChip = engineChips.tilemapChip; totalFlags = engineChips.tilemapChip.totalFlags; gameChip = engineChips.gameChip; flagColorChip = engineChips.chipManager.GetChip(FlagColorParser.flagColorChipName, false) as ColorChip; tileSize = gameChip.SpriteSize(); this.textureFactory = textureFactory; }
public Image ReadImage(WorkspacePath src, string maskHex = "#ff00ff", string[] colorRefs = null) { PNGReader reader = null; using (var memoryStream = new MemoryStream()) { using (var fileStream = workspace.OpenFile(src, FileAccess.Read)) { fileStream.CopyTo(memoryStream); fileStream.Close(); } reader = new PNGReader(memoryStream.ToArray(), maskHex); } var tmpColorChip = new ColorChip(); var imageParser = new SpriteImageParser(reader, tmpColorChip); // Manually call each step imageParser.ParseImageData(); // If no colors are passed in, used the image's palette if (colorRefs == null) { colorRefs = reader.colorPalette.Select(c => ColorUtils.RgbToHex(c.R, c.G, c.B)).ToArray(); } // Resize the color chip tmpColorChip.total = colorRefs.Length; // Add the colors for (int i = 0; i < colorRefs.Length; i++) { tmpColorChip.UpdateColorAt(i, colorRefs[i]); } // Parse the image with the new colors imageParser.CreateImage(); // Return the new image from the parser return(imageParser.image); }
public static void Postfix(PlayerTab __instance) // Replace instead { Il2CppArrayBase <ColorChip> chips = __instance.ColorChips.ToArray(); int cols = 4; // TODO: Design an algorithm to dynamically position chips to optimally fill space for (int i = 0; i < chips.Length; i++) { ColorChip chip = chips[i]; int row = i / cols, col = i % cols; // Dynamically do the positioning chip.transform.localPosition = new Vector3(1.46f + (col * 0.6f), -0.43f - (row * 0.55f), chip.transform.localPosition.z); chip.transform.localScale *= 0.9f; if (i >= pickableColors) { chip.transform.localScale *= 0f; // Needs to exist for PlayerTab } } }
protected AbstractParser LoadColorMap(string[] files) { // var fileName = "color-map.png"; var file = files.FirstOrDefault(x => x.EndsWith("color-map.png")); if (!string.IsNullOrEmpty(file)) { // Create new color map chip var colorMapChip = new ColorChip(); // Add the chip to the engine targetEngine.ActivateChip(ColorMapParser.chipName, colorMapChip, false); // targetEngine.colorMapChip = colorMapChip; var imageParser = new PNGFileReader(file, _fileLoadHelper, targetEngine.ColorChip.maskColor); // Pass the chip to the new parser return(new ColorMapParser(imageParser, colorMapChip, maskColor)); } return(null); }
public ColorMapParser(IImageParser parser, ColorChip colorChip, Color magenta, bool unique = false) : base( parser, colorChip) { }
public void Dispose() { exporter.Dispose(); colorChip = null; exporter = null; }
public ColorParser(IImageParser imageParser, ColorChip colorChip) : base(imageParser) { this.colorChip = colorChip; unique = colorChip.unique; magenta = ColorUtils.HexToColor(colorChip.maskColor); }
public SpriteBuilderExporter(string fileName, ColorChip colorChip, SpriteChip spriteChip, Dictionary <string, byte[]> files) : base(fileName) { this.files = files; this.spriteChip = spriteChip; this.colorChip = colorChip; }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { //Endogine.ColorEx.ColorRgb colorRgb3 = new Endogine.ColorEx.ColorRgb(); //Endogine.Vector4 vector49 = new Endogine.Vector4(); //Endogine.Vector4 vector410 = new Endogine.Vector4(); //Endogine.Vector4 vector411 = new Endogine.Vector4(); //Endogine.ColorEx.ColorRgb colorRgb4 = new Endogine.ColorEx.ColorRgb(); //Endogine.Vector4 vector412 = new Endogine.Vector4(); //Endogine.Vector4 vector413 = new Endogine.Vector4(); //Endogine.Vector4 vector414 = new Endogine.Vector4(); //Endogine.ColorEx.ColorHsb colorHsb2 = new Endogine.ColorEx.ColorHsb(); //Endogine.Vector4 vector415 = new Endogine.Vector4(); //Endogine.Vector4 vector416 = new Endogine.Vector4(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ColorPickerForm)); this.btnMore = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); this.tbColorText = new System.Windows.Forms.TextBox(); this.numAlpha = new Endogine.Editors.NumericSlider(); this.colorNumericHSB = new Endogine.Editors.ColorNumeric(); this.colorNumericRGB = new Endogine.Editors.ColorNumeric(); this.colorChip1 = new Endogine.Editors.ColorEditors.ColorChip(); this.colorPickerPainter1 = new Endogine.Editors.ColorEditors.ColorPickerPainter(); this.SuspendLayout(); // // btnMore // this.btnMore.Location = new System.Drawing.Point(148, 148); this.btnMore.Margin = new System.Windows.Forms.Padding(2); this.btnMore.Name = "btnMore"; this.btnMore.Size = new System.Drawing.Size(52, 19); this.btnMore.TabIndex = 4; this.btnMore.Text = "More =>"; this.btnMore.UseVisualStyleBackColor = true; this.btnMore.Click += new System.EventHandler(this.btnMore_Click); // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(4, 151); this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(34, 13); this.label1.TabIndex = 16; this.label1.Text = "Alpha"; // // tbColorText // this.tbColorText.Location = new System.Drawing.Point(135, 2); this.tbColorText.Margin = new System.Windows.Forms.Padding(2); this.tbColorText.Name = "tbColorText"; this.tbColorText.Size = new System.Drawing.Size(62, 20); this.tbColorText.TabIndex = 1; this.tbColorText.TextChanged += new System.EventHandler(this.tbColorText_TextChanged); this.tbColorText.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tbColorText_KeyDown); // // numAlpha // this.numAlpha.Location = new System.Drawing.Point(35, 149); this.numAlpha.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.numAlpha.Max = 255F; this.numAlpha.Min = 0F; this.numAlpha.Name = "numAlpha"; this.numAlpha.Size = new System.Drawing.Size(38, 18); this.numAlpha.StepSize = 1F; this.numAlpha.TabIndex = 5; this.numAlpha.UIMax = 0F; this.numAlpha.UIMin = 0F; this.numAlpha.Value = 0F; // // colorNumericHSB // //colorRgb3.A = 0; //colorRgb3.B = 0; //colorRgb3.ColorRGBA = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); //colorRgb3.G = 0; //colorRgb3.R = 0; //colorRgb3.Vector = vector49; //colorRgb3.VectorRGBA = vector410; //this.colorNumericHSB.ColorObject = colorRgb3; this.colorNumericHSB.Horizontal = false; this.colorNumericHSB.Labels = ""; this.colorNumericHSB.Location = new System.Drawing.Point(148, 89); this.colorNumericHSB.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.colorNumericHSB.Name = "colorNumericHSB"; this.colorNumericHSB.NumControls = 3; this.colorNumericHSB.Size = new System.Drawing.Size(50, 64); this.colorNumericHSB.SlidersRange = ((Endogine.EPointF)(resources.GetObject("colorNumericHSB.SlidersRange"))); this.colorNumericHSB.SlidersStepSize = 0.003921569F; this.colorNumericHSB.Spacing = ((Endogine.EPoint)(resources.GetObject("colorNumericHSB.Spacing"))); this.colorNumericHSB.TabIndex = 3; //this.colorNumericHSB.Vector = vector411; // // colorNumericRGB // //colorRgb4.A = 0; //colorRgb4.B = 0; //colorRgb4.ColorRGBA = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); //colorRgb4.G = 0; //colorRgb4.R = 0; //colorRgb4.Vector = vector412; //colorRgb4.VectorRGBA = vector413; //this.colorNumericRGB.ColorObject = colorRgb4; this.colorNumericRGB.Horizontal = false; this.colorNumericRGB.Labels = ""; this.colorNumericRGB.Location = new System.Drawing.Point(148, 25); this.colorNumericRGB.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.colorNumericRGB.Name = "colorNumericRGB"; this.colorNumericRGB.NumControls = 3; this.colorNumericRGB.Size = new System.Drawing.Size(50, 64); this.colorNumericRGB.SlidersRange = ((Endogine.EPointF)(resources.GetObject("colorNumericRGB.SlidersRange"))); this.colorNumericRGB.SlidersStepSize = 0.003921569F; this.colorNumericRGB.Spacing = ((Endogine.EPoint)(resources.GetObject("colorNumericRGB.Spacing"))); this.colorNumericRGB.TabIndex = 2; //this.colorNumericRGB.Vector = vector414; // // colorChip1 // this.colorChip1.BackColor = System.Drawing.SystemColors.Control; this.colorChip1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("colorChip1.BackgroundImage"))); this.colorChip1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; //this.colorChip1.Color = System.Drawing.SystemColors.Control; this.colorChip1.Location = new System.Drawing.Point(96, 145); this.colorChip1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.colorChip1.Name = "colorChip1"; this.colorChip1.Size = new System.Drawing.Size(21, 22); this.colorChip1.TabIndex = 8; this.colorChip1.TabStop = false; // // colorPickerPainter1 // this.colorPickerPainter1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; //this.colorPickerPainter1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); //colorHsb2.A = 0; //colorHsb2.B = 0F; //colorHsb2.ColorRGBA = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); //colorHsb2.H = 0F; //colorHsb2.S = 0F; //colorHsb2.Vector = vector415; //colorHsb2.VectorRGBA = vector416; //this.colorPickerPainter1.HSB = colorHsb2; this.colorPickerPainter1.Location = new System.Drawing.Point(2, 2); this.colorPickerPainter1.Margin = new System.Windows.Forms.Padding(2); this.colorPickerPainter1.Name = "colorPickerPainter1"; this.colorPickerPainter1.Size = new System.Drawing.Size(144, 147); this.colorPickerPainter1.TabIndex = 0; this.colorPickerPainter1.TabStop = false; // // ColorPickerForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(205, 172); this.Controls.Add(this.tbColorText); this.Controls.Add(this.numAlpha); this.Controls.Add(this.label1); this.Controls.Add(this.btnMore); this.Controls.Add(this.colorNumericHSB); this.Controls.Add(this.colorNumericRGB); this.Controls.Add(this.colorChip1); this.Controls.Add(this.colorPickerPainter1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; this.Margin = new System.Windows.Forms.Padding(2); this.Name = "ColorPickerForm"; this.Text = "ColorPicker"; this.ResumeLayout(false); this.PerformLayout(); }
public ColorMapParser(ITexture2D tex, ColorChip colorChip, IColor magenta, bool unique = false, bool ignoreTransparent = true) : base(tex, colorChip, magenta, unique, ignoreTransparent) { }
private void SerializeColorChip(ColorChip colorChip) { if (colorChip.export == false) { return; } // TODO this needs to be moved into the chip so it can be correctly overriden JsonUtil.GetLineBreak(sb); sb.Append("\"ColorChip\":"); JsonUtil.GetLineBreak(sb); sb.Append("{"); JsonUtil.GetLineBreak(sb, 1); sb.Append("\"total\":"); sb.Append(colorChip.total); sb.Append(","); JsonUtil.GetLineBreak(sb, 1); // sb.Append("\"pages\":"); // sb.Append(colorChip.pages); // sb.Append(","); // JsonUtil.GetLineBreak(sb, 1); // // sb.Append("\"colorsPerPage\":"); // sb.Append(colorChip.colorsPerPage); // sb.Append(","); // JsonUtil.GetLineBreak(sb, 1); // Rebuild calculated colors value // colorChip.RecalculateSupportedColors(); // sb.Append("\"totalSupportedColors\":"); // sb.Append(colorChip.totalSupportedColors); // sb.Append(","); // JsonUtil.GetLineBreak(sb, 1); sb.Append("\"maxColors\":"); sb.Append(colorChip.maxColors); sb.Append(","); JsonUtil.GetLineBreak(sb, 1); sb.Append("\"backgroundColor\":"); sb.Append(colorChip.backgroundColor); sb.Append(","); JsonUtil.GetLineBreak(sb, 1); sb.Append("\"maskColor\":\""); sb.Append(colorChip.maskColor); sb.Append("\""); sb.Append(","); JsonUtil.GetLineBreak(sb, 1); sb.Append("\"unique\":"); sb.Append(colorChip.unique.ToString().ToLower()); sb.Append(","); JsonUtil.GetLineBreak(sb, 1); sb.Append("\"debug\":"); sb.Append(colorChip.debugMode.ToString().ToLower()); sb.Append(","); JsonUtil.GetLineBreak(sb, 1); // sb.Append("\"paletteMode\":"); // sb.Append(colorChip.paletteMode.ToString().ToLower()); // sb.Append(","); // JsonUtil.GetLineBreak(sb, 1); JsonUtil.GetLineBreak(sb); sb.Append("}"); sb.Append(","); currentStep++; }
public static void Postfix(HatsTab __instance) { var allHats = DestroyableSingleton <HatManager> .Instance.GetUnlockedHats(); var hatGroups = new SortedList <string, List <HatBehaviour> >( new PaddedComparer <string>("Vanilla", "") ); foreach (var hat in allHats) { if (!hatGroups.ContainsKey(hat.StoreName)) { hatGroups[hat.StoreName] = new List <HatBehaviour>(); } hatGroups[hat.StoreName].Add(hat); } foreach (ColorChip instanceColorChip in __instance.ColorChips) { instanceColorChip.gameObject.Destroy(); } __instance.ColorChips.Clear(); var groupNameText = __instance.transform.parent.parent.GetComponentInChildren <GameSettingMenu>(true).GetComponentInChildren <TextMeshPro>(true); int hatIdx = 0; foreach ((string groupName, List <HatBehaviour> hats) in hatGroups) { var text = Object.Instantiate(groupNameText.gameObject); text.transform.localScale = Vector3.one; text.transform.parent = __instance.scroller.Inner; var tmp = text.GetComponent <TextMeshPro>(); tmp.text = groupName; tmp.alignment = TextAlignmentOptions.Center; tmp.fontSize = 3f; tmp.fontSizeMax = 3f; tmp.fontSizeMin = 0f; hatIdx = (hatIdx + 3) / 4 * 4; float xLerp = __instance.XRange.Lerp(0.5f); float yLerp = __instance.YStart - (hatIdx / __instance.NumPerRow) * __instance.YOffset; text.transform.localPosition = new Vector3(xLerp, yLerp, -1f); hatIdx += 4; foreach (var hat in hats.OrderBy(HatManager.Instance.GetIdFromHat)) { float num = __instance.XRange.Lerp(hatIdx % __instance.NumPerRow / (__instance.NumPerRow - 1f)); float num2 = __instance.YStart - hatIdx / __instance.NumPerRow * __instance.YOffset; ColorChip colorChip = Object.Instantiate(__instance.ColorTabPrefab, __instance.scroller.Inner); colorChip.transform.localPosition = new Vector3(num, num2, -1f); colorChip.Button.OnClick.AddListener((Action)(() => __instance.SelectHat(hat))); colorChip.Inner.SetHat(hat, PlayerControl.LocalPlayer.Data.ColorId); colorChip.Inner.transform.localPosition = hat.ChipOffset + new Vector2(0f, -0.3f); colorChip.Tag = hat; __instance.ColorChips.Add(colorChip); hatIdx += 1; } } __instance.scroller.YBounds.max = -(__instance.YStart - (hatIdx + 1) / __instance.NumPerRow * __instance.YOffset) - 3f; }
public override void Dispose() { base.Dispose(); colorChip = null; spriteChip = null; }
private void SerializeColorChip(ColorChip colorChip) { if (colorChip.export == false) { return; } JsonUtil.GetLineBreak(sb); sb.Append("\"ColorChip\":"); JsonUtil.GetLineBreak(sb); sb.Append("{"); JsonUtil.GetLineBreak(sb, 1); sb.Append("\"pages\":"); sb.Append(colorChip.pages); sb.Append(","); JsonUtil.GetLineBreak(sb, 1); sb.Append("\"colorsPerPage\":"); sb.Append(colorChip.colorsPerPage); sb.Append(","); JsonUtil.GetLineBreak(sb, 1); // Rebuild calculated colors value // colorChip.RecalculateSupportedColors(); sb.Append("\"supportedColors\":"); sb.Append(colorChip.supportedColors); sb.Append(","); JsonUtil.GetLineBreak(sb, 1); sb.Append("\"maxColors\":"); sb.Append(colorChip.maxColors); sb.Append(","); JsonUtil.GetLineBreak(sb, 1); sb.Append("\"backgroundColor\":"); sb.Append(colorChip.backgroundColor); sb.Append(","); JsonUtil.GetLineBreak(sb, 1); sb.Append("\"maskColor\":\""); sb.Append(colorChip.maskColor); sb.Append("\""); sb.Append(","); JsonUtil.GetLineBreak(sb, 1); sb.Append("\"unique\":"); sb.Append(colorChip.unique.ToString().ToLower()); sb.Append(","); JsonUtil.GetLineBreak(sb, 1); sb.Append("\"debug\":"); sb.Append(colorChip.debugMode.ToString().ToLower()); sb.Append(","); JsonUtil.GetLineBreak(sb, 1); JsonUtil.GetLineBreak(sb); sb.Append("}"); sb.Append(","); currentStep++; }
private void OpenOptionsDialogue() { FontsAndColorsItems faci = ColUtils.GetTextEditorFontAndColorsItems(IDEUtils.DTE); Color back = ColUtils.GetBackgroundColourOf(faci, "Plain Text"); ColorChip colChip_Options = new ColorChip(); colChip_Options.Name = "Colours_Options"; colChip_Options.Color = ColUtils.ConvertToMediaColor(ColUtils.IsLightTheme(back) ? Settings.Default.OptionColorLight : Settings.Default.OptionColorDark); prevOptionColour = colChip_Options.Color; Label colChipLabel_Options = new Label(); colChipLabel_Options.Content = "Options"; colChipLabel_Options.Foreground = new SolidColorBrush(ColUtils.GetForegroundColourOf(faci, "Plain Text")); DockPanel.SetDock(colChip_Options, Dock.Left); DockPanel.SetDock(colChipLabel_Options, Dock.Left); ColoursDock_Options.Children.Add(colChip_Options); ColoursDock_Options.Children.Add(colChipLabel_Options); ColorChip colChip_SubOptions = new ColorChip(); colChip_SubOptions.Name = "Colours_SubOptions"; colChip_SubOptions.Color = ColUtils.ConvertToMediaColor(ColUtils.IsLightTheme(back) ? Settings.Default.SubOptionColorLight : Settings.Default.SubOptionColorDark); prevSubOptionColour = colChip_SubOptions.Color; Label colChipLabel_SubOptions = new Label(); colChipLabel_SubOptions.Content = "Sub Options"; colChipLabel_SubOptions.Foreground = new SolidColorBrush(ColUtils.GetForegroundColourOf(faci, "Plain Text")); DockPanel.SetDock(colChip_SubOptions, Dock.Left); DockPanel.SetDock(colChipLabel_SubOptions, Dock.Left); ColoursDock_SubOptions.Children.Add(colChip_SubOptions); ColoursDock_SubOptions.Children.Add(colChipLabel_SubOptions); ColorChip colChip_Arguments = new ColorChip(); colChip_Arguments.Name = "Colours_Arguments"; colChip_Arguments.Color = ColUtils.ConvertToMediaColor(ColUtils.IsLightTheme(back) ? Settings.Default.ArgumentColorLight : Settings.Default.ArgumentColorDark); prevArgumentColour = colChip_Arguments.Color; Label colChipLabel_Arguments = new Label(); colChipLabel_Arguments.Content = "Arguments"; colChipLabel_Arguments.Foreground = new SolidColorBrush(ColUtils.GetForegroundColourOf(faci, "Plain Text")); DockPanel.SetDock(colChip_Arguments, Dock.Left); DockPanel.SetDock(colChipLabel_Arguments, Dock.Left); ColoursDock_Arguments.Children.Add(colChip_Arguments); ColoursDock_Arguments.Children.Add(colChipLabel_Arguments); ColorChip colChip_Digits = new ColorChip(); colChip_Digits.Name = "Colours_Digits"; colChip_Digits.Color = ColUtils.ConvertToMediaColor(ColUtils.IsLightTheme(back) ? Settings.Default.DigitColorLight : Settings.Default.DigitColorDark); prevDigitColour = colChip_Digits.Color; Label colChipLabel_Digits = new Label(); colChipLabel_Digits.Content = "Digits"; colChipLabel_Digits.Foreground = new SolidColorBrush(ColUtils.GetForegroundColourOf(faci, "Plain Text")); DockPanel.SetDock(colChip_Digits, Dock.Left); DockPanel.SetDock(colChipLabel_Digits, Dock.Left); ColoursDock_Digits.Children.Add(colChip_Digits); ColoursDock_Digits.Children.Add(colChipLabel_Digits); ColorChip colChip_Strings = new ColorChip(); colChip_Strings.Name = "Colours_Strings"; colChip_Strings.Color = ColUtils.ConvertToMediaColor(ColUtils.IsLightTheme(back) ? Settings.Default.StringColorLight : Settings.Default.StringColorDark); prevStringColour = colChip_Strings.Color; Label colChipLabel_Strings = new Label(); colChipLabel_Strings.Content = "Strings"; colChipLabel_Strings.Foreground = new SolidColorBrush(ColUtils.GetForegroundColourOf(faci, "Plain Text")); DockPanel.SetDock(colChip_Strings, Dock.Left); DockPanel.SetDock(colChipLabel_Strings, Dock.Left); ColoursDock_Strings.Children.Add(colChip_Strings); ColoursDock_Strings.Children.Add(colChipLabel_Strings); ColorPickerStandard colPicker = new ColorPickerStandard(); colPicker.InitialColor = colChip_Options.Color; colPicker.SelectedColor = colChip_Options.Color; colPicker.SelectedColorChanged += colPicker_SelectedColorChanged; colPicker.Foreground = new SolidColorBrush(ColUtils.GetForegroundColourOf(faci, "Plain Text")); ColourPanel.Children.Add(colPicker); Colours_Options.IsChecked = true; HistorySize.Text = Settings.Default.HistorySize.ToString(CultureInfo.CurrentCulture); prevFontName = Settings.Default.Font.Name; prevFontSize = Settings.Default.Font.SizeInPoints; FontCombo.ItemsSource = Fonts.SystemFontFamilies.OrderBy(s => s.ToString()); FontCombo.SelectedItem = Fonts.SystemFontFamilies.OrderBy(s => s.ToString()).First(s => s.Source == Settings.Default.Font.Name); FontSizeSlider.Value = Settings.Default.Font.SizeInPoints; }
public ColorMapParser(IImageParser imageParser, ColorChip colorChip, IColor magenta, bool unique = false) : base(imageParser, colorChip, magenta, unique) { }