Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Data.
- public Dictionary<string, Tx> Texts = new Dictionary<string, Tx>();
- public class Tx
- {
- public object updater; // What function to call for updated information.
- }
- //creates a new dictionary entry + what to call for updated information, like the score.
- public void TextAdd(object updater)
- {
- Texts.Add("Score", new Tx());
- Texts[i].updater = updater;
- }
- // The updated score number.
- public int Update_Score()
- {
- return 0; // <--- returns some score number.
- }
- // Simply calls each entry in the dictionary and runs/calls the updater function (from variable), if present.
- private void update()
- {
- foreach (KeyValuePair<string, Tx> i in new Dictionary<string, Tx>(Texts))
- {
- Texts[i.Key].text.text = Texts[i.Key].updater.ToString();
- }
- }
- // Calls TextAdd() to add a new entry for the score.
- private void Start()
- {
- TextAdd(Update_Score());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement