Socail非同期イベントとは、SocailAPIのコールバックによってトリガされたサブインベントです
このイベントは、様々なSocial API関数によってトリガし、そのコールバックにより変数"sync_load"に格納されたds_map(キー・値のペア)を返します。
The ds_map will contain a number of keys, the most important of which is the "id" key. This will return a constant which can then be checked in code to determine which of the many callbacks the event has received. Once you have parsed this key and compared the value returned with the available constants, you can then continue to extract the rest of the information from the map.
The function pages on Social Gaming - Achievements and Leaderboards in the Reference section detail the functions and callbacks as well as the constants used to trigger this event, but there are also certain circumstances in which it will be triggered without a function call from the game that is running:
Any of the above callbacks will trigger the Social Event and an async_load map will be generated with the following details (note that there is a different "id" key value to define each of the different reasons that the event was called, but all other contents of the map are the same):
var ident = ds_map_find_value(async_load, "id" ); if ident == achievement_challenge_completed; { player_id = ds_map_find_value(async_load, "playerid"); issuer_id = ds_map_find_value(async_load, "issuerid"); state = ds_map_find_value(async_load, "state"); date_completed = ds_map_find_value(async_load, "completeddate"); date_issued = ds_map_find_value(async_load, "issueddate"); ach_type = ds_map_find_value(async_load, "type"); ach_ident = ds_map_find_value(async_load, "identifier"); ach_score = ds_map_find_value(async_load, "score"); }
変数"async_load"は非同期イベントのみ有効です。 そしてds_mapはイベント開始時に作成され、イベント終了後-1にリセットされます。 ただしイベントにより作成されたすべてのデータ構造は、適切にクリーンアップ(削除)する必要があります。そうでないとメモリリークの原因となり、ゲームをクラッシュさせる可能性があります