Well, off the top of my head, you seem to need to attach another piece of metadata to your button gameobjects. For example, you could add a tiny custom component like this:
using UnityEngine;
using System.Collections;
public class MyButtonData : MonoBehaviour
{
private int _intValue = -1;
public int ButtonIntValue
{
get { return _intValue; }
set { _intValue = value; }
}
void OnClick()
{
MyMainClass.ButtonHandlerFunction(ButtonIntValue);
// or get an instance to a gameobject and call the appropraite class method
}
}
When you instance the button you have to take the gameObject and use .GetComponent<"MyButtonData"> and then set ButtonIntValue to be the integer you want. In OnClick() we are using the int value that is stored in this component (which is a class, really) and then firing some static method that is part of MyMainClass. You can also, instead, also store in a reference to the gameObject that is the panel owner, or whatever else, that might have the master logic handling class attached, and call that instance method.
If this is not making sense to you, then you
really need to learn about C# and OOP at a basic level, because you seem to be trying to attack this via old C++ style functional coding or something.