public void Press(int index) { CharCreator.cc.SelectColour(bodyPart, colouredButtons[index]); currentButton.image.sprite = inactiveSprite; currentButton = colouredButtons[index]; currentButton.image.sprite = activeSprite; }
public void LoadInfo(Theme theme) { GetTheme = new Theme(theme.name, true) { cColours = theme.cColours }; Font lblFont = new Font("Segoe UI", 12.0f); for (int i = 0; i < theme.ColourCount; i++) { string key = theme.ColourAt(i).Key; Label label = new Label { Location = new Point(3, 10 + i * 30), AutoSize = true, Font = lblFont, Text = key + ":" }; ColourPanel.Controls.Add(label); } int buttonLeft = ColourPanel.PreferredSize.Width + 6; for (int i = 0; i < theme.ColourCount; i++) { //MessageBox.Show(theme.cColours.Keys.ElementAt(i)); ColourButton button = new ColourButton { Location = new Point(buttonLeft, 10 + i * 30), Text = "", Size = new Size(100, 23), FlatStyle = FlatStyle.Flat, BackColor = theme.ColourAt(i).Value, Tag = theme.ColourAt(i).Key }; button.FlatAppearance.BorderSize = 1; button.FlatAppearance.BorderColor = Color.Black; button.FlatAppearance.CheckedBackColor = Color.Black; button.Click += (s, e) => { //getTheme.cColours[((Button)sender).Tag.ToString()] = button.BackColor; GetTheme.SetColour(((Button)s).Tag.ToString(), button.BackColor); }; ColourPanel.Controls.Add(button); } ColourPanel.Width = ColourPanel.PreferredSize.Width + 22; CancelBtn.Left = ColourPanel.Right - CancelBtn.Width; OKBtn.Left = CancelBtn.Left - OKBtn.Width - 6; Width = PreferredSize.Width + 6; }
private void Start() { foreach (ColourButton b in colouredButtons) { //ColorBlock cb = b.button.colors; //cb.normalColor = b.colour; //b.button.colors = cb; b.image.color = b.colour; } nameText.text = bodyPart; nameTextBG.text = bodyPart; currentButton = colouredButtons[0]; Press(Random.Range(0, colouredButtons.Length)); }
public void SelectColour(string part, ColourButton button) { swapper.SetColour(charMap[part], button.colour); player.Hop(); }