Trying to create logic similar to the game Othello. this has been causing the following error: Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object in Simpl+
?
C#
public class myGame
{
? ? ?public ushort BUTTONID { get; set;}
? ? ?public ushort ButtonId? ? ? // being populated from Simpl+
? ? ?{
? ? ? ? ? ?get { return BUTTONID; }
? ? ? set { BUTTONID = value; }
? ? ? }
? ? ? ?public RootButtons[] _buttons = new RootButtons[64]; // set board array 8x8 playing grid
? ?
? ?public void ButtonPresses()
? ? {
? ? ? ? ButtonClickLogic(ButtonId); // call method
? ? ?}
? ? ?public bool ButtonClickLogic(ushort buttonPress)
? ? {
? ? ? ? ? If( _buttons[buttonPress].BUTTON_FB = 0)
? ? ? ? ? ?{
? ? ? ? ? ? ? ? _buttons[buttonPress].BUTTON_FB = 1;
? ? ? ? ? ?}
? ? ? ? ? else
? ? ? ? ? ?{
? ? ? ? ? ? ? _buttons[buttonPress].BUTTON_FB = 0;
? ? ? ? ? ?}
? ? ?}
}
public class RootButtons
? ? {
? ? ? ? public ushort BUTTON_FB { get; set; }
? ? }
Simpl+
push Button
{
? ? ?x = getlastmodifedarrayindex();
? ? ?myGame.ButtonId = x;
? ? myGame.ButtonPresses();
}
I have an EventHandler for return values from C#