public void ChangingButtonTextColorDoesNotChangeLatexPropertyValue() { var latexContent = @"1\leq 2"; var newColor = Color.Gray; var mathButton = new MathButton { Content = new MathView { LaTeX = latexContent } }; mathButton.TextColor = newColor; Assert.Equal(mathButton.TextColor, newColor); Assert.Equal(latexContent, mathButton.Content.LaTeX); var textButton = new TextButton { Content = new TextView { LaTeX = latexContent } }; textButton.TextColor = newColor; Assert.Equal(mathButton.TextColor, newColor); Assert.Equal(latexContent, textButton.Content.LaTeX); }
//Relaese Handling private void ScreenClickEndedHandle() { if (lastClickedBtn == null) { return; } MathButton btnComp = lastClickedBtn.GetComponent <MathButton> (); if (btnComp == null) { return; } btnComp.isBegan = false; if (btnComp.resetIconOnRelease) { if (btnComp.normalIcon != null) { btnComp.spriteRendererComp.sprite = btnComp.normalIcon; } } if (!string.IsNullOrEmpty(btnComp.message)) { eventOb.SendMessage(btnComp.message, btnComp.messageObject); //call the given method which is inside Events.Cs } else { Debug.LogWarning("empty message on <i>" + lastClickedBtn.name + "</i>click"); //you missed to add event name } lastClickedBtn = null; }
public MathViewModel() { Buttons = new MathButton[3]; for (var i = 0; i < Buttons.Length; i++) { Buttons[i] = new MathButton(0, (Color)Resources["Color.Surface"]); } InitializeGame(); AnswerCommand = new Command <string>(HandleClick); }
public void ButtonTextColorPropertyChangesImageColor() { var mathButton = new MathButton { TextColor = Color.Blue, Content = new MathView { LaTeX = "1" } }; Assert.True(mathButton.ImageSourceEquals("files/buttons/MathButton_1_Blue.png")); }
public void DefaultButtonImageTextColorIsBlack() { var mathButton = new MathButton { Content = new MathView { LaTeX = "1" } }; Assert.True(mathButton.ImageSourceEquals("files/buttons/MathButton_1_Black.png")); }
//General Handling private void ScreenClickHandle(GameObject ob, bool isTouchBegain) { string objname = ""; // name of button that ray hit it if (ob != null) { objname = ob.name; } foreach (GameObject btn in buttons) { if (btn == null) { continue; } MathButton btnComp = btn.GetComponent <MathButton> (); if (btnComp == null) { continue; } if (objname == btn.name) { if (!btnComp.isBegan) { btnComp.isBegan = true; lastClickedBtn = btn; if (btnComp.hoverIcon != null) { btnComp.spriteRendererComp.sprite = btnComp.hoverIcon; } if (btnComp.clickReleaseSFx != null) { AudioSource.PlayClipAtPoint(btnComp.clickReleaseSFx, Vector3.zero); } } } else { if (!isTouchBegain && btnComp.isBegan) { lastClickedBtn = null; btnComp.isBegan = false; if (btnComp.normalIcon != null) { btnComp.spriteRendererComp.sprite = btnComp.normalIcon; } } } } }
public void MathButtonTextColorCanChangeMultipleTimes() { var mathButton = new MathButton { Content = new MathView { LaTeX = "1" } }; Assert.True(mathButton.ImageSourceEquals("files/buttons/MathButton_1_Black.png")); mathButton.TextColor = Color.Blue; Assert.True(mathButton.ImageSourceEquals("files/buttons/MathButton_1_Blue.png")); mathButton.TextColor = Color.Black; Assert.True(mathButton.ImageSourceEquals("files/buttons/MathButton_1_Black.png")); }
public InputButtonViewModel(int rowIndex, int columnIndex, MathButton mathButton) { RowIndex = rowIndex; ColumnIndex = columnIndex; MathButton = mathButton; }
public InputButtonViewModel(MathButton mathButton) { MathButton = mathButton; }