private ColorMenu(ColorChosenDelegate colorChosenCallback, Action colorClearedCallback) : base("Anomalous.GuiFramework.GUI.ColorMenu.ColorMenu.layout") { this.colorChosenCallback = colorChosenCallback; this.colorClearedCallback = colorClearedCallback; colorGrid = new SingleSelectButtonGrid(widget.findWidget("ColorGrid") as ScrollView); for (int i = 0; i < 77; ++i) { ButtonGridItem item = colorGrid.addItem("Main", "", "Colors/" + i); item.UserObject = i; } colorGrid.SelectedValueChanged += new EventHandler(colorGrid_SelectedValueChanged); Button moreColorsButton = widget.findWidget("MoreColorsButton") as Button; if (RuntimePlatformInfo.ShowMoreColors) { moreColorsButton.MouseButtonClick += new MyGUIEvent(moreColorsButton_MouseButtonClick); } else { moreColorsButton.Visible = false; widget.setSize(widget.Width, widget.Height - (widget.Height - moreColorsButton.Top)); } this.Hidden += new EventHandler(ColorMenu_Hidden); Button clearColorButton = (Button)widget.findWidget("ClearColorButton"); clearColorButton.Visible = colorClearedCallback != null; clearColorButton.MouseButtonClick += clearColorButton_MouseButtonClick; }
public static ColorMenu ShowColorMenu(int left, int top, ColorChosenDelegate colorChosenCallback, Action colorClearedCallback = null) { ColorMenu colorMenu = new ColorMenu(colorChosenCallback, colorClearedCallback); colorMenu.show(left, top); return(colorMenu); }
public FormGameManager(int i_NumberOfChances) { m_GameManager = new GameManager(); m_ChosenColorSequence = new ChosenColorSequence(k_NumberOfColorsToChoose); m_Turns = new Turn[i_NumberOfChances]; m_FormChooseColor = new FormChooseColor(); initializeColorDictionery(); initializeFeedbackDictionery(); m_GameManager.GenerateColorSequence(); m_ChosenColorSequence.InitializeColorSequence(); for (int i = 0; i < k_NumberOfColorsToChoose; i++) { this.Controls.Add(m_ChosenColorSequence.ColorSequence[i]); } for (int i = 0; i < i_NumberOfChances; i++) { m_Turns[i] = new Turn(k_NumberOfColorsToChoose, i); m_Turns[i].InitializeTurn(); m_ColorChosen += m_Turns[i].ColorButton_Clicked; m_CheckGuess += m_Turns[i].CheckGuessButton_Clicked; for (int j = 0; j < k_NumberOfColorsToChoose; j++) { this.Controls.Add(m_Turns[i].UserGuess[j]); this.m_Turns[i].UserGuess[j].Click += new System.EventHandler(this.chooseColorBotton_Clicked); this.Controls.Add(m_Turns[i].UserFeedback[j]); } this.Controls.Add(m_Turns[i].CheckGuessButton); this.m_Turns[i].CheckGuessButton.Click += new System.EventHandler(this.checkGuessButton_Clicked); } this.AutoSize = true; this.MaximizeBox = false; this.MinimizeBox = false; }