Hello guys,
im in trouble right now, because i stuck on a ( maybe ) a simple problem?!
So i have a GuiClass.cs with in this class i create my Button/Textbox, all the GUI stuff.
So i trigger the button/textbox with a event like in WinForms. But i need to exchange Data tgrough different Classes without a reference.
For case2 i create Singleton Class with a Dictionary<string, Action>, now in the OhterClass i can register a event like:
EventManager.Instance.AddAction("test", () => a = 3);
and in the GuiClass i can trigger this event like:
button.OnClick += () => { EventManager.Instance.TriggerEvent("test"); };
so i solved case2.
But now when i change the variable in the OtherClass, how can i transfer the new value back to the GUI-Class? I can create a second event in the EventManager, but is there a better way to do this? - case 1
And in general, is my approach a goad Idea? How do you solve to seperate GUI/Gamescreen,...
I dont use WPF/Winform i wrote my own Textbox/Button rendered with Direct3D.
hope you can help me :(