c# - Unity4 and Prime31 Game Center Plug-in Event -


i'm still new when comes c# programming (i use unityscript). have game center plugin , running successfully, except 1 thing...

when achievement accomplished, banner appears should achievement unlocked game center. however, if same requirements achievement met again during game, banner appears again, though it's been fulfilled.

now i've been told should getachievements() update list of achievements met, , read data, should "loop through event":

public static event action<list<gamecenterachievement>> achievementsloaded; 

problem is, have no idea how loop through event. feedback i've received despite several desperate pleas on topic on unity forums.

thanks advice.

what original answer meant should loop through list of achievements returned event. more familiarity events , how work please see msdn events tutorial.

essentially want associate function appropriate signature event appending subscribers list. association this:

achievementsloaded += (list) => {     foreach(var achievement in list)     {          ....     } } 

or, if you'd prefer use member function:

void achievementsloadedsubscriber(list<gamecenterachievement> list) {     foreach(var achievement in list)     {         ...     } } 

in class body. then, elsewhere when setting system:

achievementsloaded += achievementsloadedsubscriber; 

notice lack of parentheses because literally adding function list, not calling function.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -