-
Notifications
You must be signed in to change notification settings - Fork 150
FlxGameJolt Update #461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
FlxGameJolt Update #461
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- In the future please make a feature branch on your fork, rather than using GamerPablito:dev, but this is fine
- Keep the old
FlxGameJolt
and deprecate it - You should update the FlxPongAPI demo, which is our demonstration of the FlxGameJolt api. this will allow people to learn the new system, and it will allow me to test this branch
/** | ||
* The way the scores are fetched from your game API. | ||
* | ||
* @param score The display text of the Score. | ||
* @param sort The Score value. | ||
* @param extra_data If some extra data is attached to this Score, it'll be shown here. | ||
* @param user The username of the User who achieved this Score, if it's a registered User. | ||
* @param user_id The user ID of the User who achieved this Score, if it's a registered User. | ||
* @param guest The name of the user who achieved this Score, if it's a guest user. | ||
* @param stored A short description about when the Score was achieved by the User or Guest. | ||
* @param stored_timestamp A long time stamp (in seconds) of when the Score was achieved by the User or Guest. | ||
*/ | ||
typedef FlxGameJoltScore = | ||
{ | ||
score:String, | ||
sort:Int, | ||
extra_data:String, | ||
user:String, | ||
user_id:Int, | ||
guest:String, | ||
stored:String, | ||
stored_timestamp:Int | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This style of comment isn't as helpful as the following, which shows a description for each field on hover:
/** | |
* The way the scores are fetched from your game API. | |
* | |
* @param score The display text of the Score. | |
* @param sort The Score value. | |
* @param extra_data If some extra data is attached to this Score, it'll be shown here. | |
* @param user The username of the User who achieved this Score, if it's a registered User. | |
* @param user_id The user ID of the User who achieved this Score, if it's a registered User. | |
* @param guest The name of the user who achieved this Score, if it's a guest user. | |
* @param stored A short description about when the Score was achieved by the User or Guest. | |
* @param stored_timestamp A long time stamp (in seconds) of when the Score was achieved by the User or Guest. | |
*/ | |
typedef FlxGameJoltScore = | |
{ | |
score:String, | |
sort:Int, | |
extra_data:String, | |
user:String, | |
user_id:Int, | |
guest:String, | |
stored:String, | |
stored_timestamp:Int | |
} | |
/** | |
* A score fetched from the gamejolt server. | |
*/ | |
typedef FlxGameJoltScore = | |
{ | |
/** The display text of the Score. */ | |
var score:String; | |
/** The Score value. */ | |
var sort:Int; | |
/** If some extra data is attached to this Score, it'll be shown here. */ | |
var extra_data:String; | |
/** The username of the User who achieved this Score, if it's a registered User. */ | |
var user:String; | |
/** The user ID of the User who achieved this Score, if it's a registered User. */ | |
var user_id:Int; | |
/** The name of the user who achieved this Score, if it's a guest user. */ | |
var guest:String; | |
/** A short description about when the Score was achieved by the User or Guest. */ | |
var stored:String; | |
/** A long time stamp (in seconds) of when the Score was achieved by the User or Guest. */ | |
var stored_timestamp:Int; | |
} |

Also note: Wherever possible you should copy the documentation of these fields directly from gamejolt's api. specifically, the phrasing "The way the ___ are fetched" is not ideal, that describes a process, when these typedefs describe objects
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apply these changes to every typedef
user_id:Int, | ||
guest:String, | ||
stored:String, | ||
stored_timestamp:Int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is described as a "long" does it need to use Int64
* Creates a new section for URL creation. The `requestBatch()` function requires this for its entries to work correctly. | ||
* @param command The command of the call section. | ||
* @param action The action (if there's any) of the call section. | ||
* @param params The parameters the call will take in count when requested. | ||
* @param encode Whether to encode along with a signature at its end or not. | ||
* @return The resulting section. | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the following doc format:
* Creates a new section for URL creation. The `requestBatch()` function requires this for its entries to work correctly. | |
* @param command The command of the call section. | |
* @param action The action (if there's any) of the call section. | |
* @param params The parameters the call will take in count when requested. | |
* @param encode Whether to encode along with a signature at its end or not. | |
* @return The resulting section. | |
*/ | |
* Creates a new section for URL creation. The `requestBatch()` function requires this for its entries to work correctly. | |
* @param command The command of the call section. | |
* @param action The action (if there's any) of the call section. | |
* @param params The parameters the call will take in count when requested. | |
* @param encode Whether to encode along with a signature at its end or not. | |
* @return The resulting section. | |
*/ |
Note: 3 spaces after @param
, all param names have spaces so the descriptions start on the same column, 2 spaces after @return
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've already rewritten the entire FlxGameJolt class, and the descriptions finally fit according to how did you describe it to me, check it out
/** | ||
* Sends multiple calls in a single request to the GameJolt API to process. | ||
* @see https://gamejolt.com/game-api/doc/batch/ | ||
* @param calls The list of calls to send to the batch. You can set up to 50 calls per batch. NOTE: Use `buildURLSection()` with its parameter `encode` set to `true` for the creation of every call you want to add here. | ||
* @param parallel Whether to run every call at once (true) or in the order they were set (false). | ||
* @param break_on_error Whether to return an error message in the main response body if one or more calls fail or not. | ||
* @param onComplete Callback that will contain the requested data, if the request ends successfully. | ||
* @param onError Callback that will contain the error information of the request, if the request fails. | ||
* @param onProgress Callback that will be called while the request is loading results. | ||
* @return The request instance. | ||
*/ | ||
public static function requestBatch(calls:Array<String>, parallel:Bool = false, break_on_error:Bool = true, ?onComplete:Array<FlxGameJoltResponse>->Void, | ||
?onError:String->Void, | ||
?onProgress:Float->Float->Void):URLLoader | ||
{ | ||
var params:Array<Param> = calls.map(c -> {key: "responses[]", value: c.urlEncode()}); | ||
params.push({key: "parallel", value: '$parallel'}); | ||
params.push({key: "break_on_error", value: '$break_on_error'}); | ||
return initRequest(buildURL("batch", params), data -> data.responses, onComplete, onError, onProgress); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the format I gave, never put a tab character unless it's to indent a line
I will keep this in mind |
Co-authored-by: George Kurelic <[email protected]>
Co-authored-by: George Kurelic <[email protected]>
The only thing left is to update the FlxPongAPI demo to fit with the new functions. |
I unresolved a conversation you closed, please read it and apply the requested changes |
/** | ||
* The way the score tables are fetched from your game API. | ||
* | ||
* @param id The ID of the Score Table. | ||
* @param name The name of the Score Table. | ||
* @param description The description of the Score Table. | ||
* @param primary Whether if this is the Primary Score Table in your game (1) or not (0). | ||
*/ | ||
typedef FlxGameJoltScoreTable = | ||
{ | ||
id:Int, | ||
name:String, | ||
description:String, | ||
primary:Bool | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apply the same doc format I requested for FlxGameJoltScore
/** | ||
* The way the trophies are fetched from your game API. | ||
* | ||
* @param id The ID of the Trophy. | ||
* @param title The title of the Trophy. | ||
* @param description The description of the Trophy. | ||
* @param difficulty The difficulty rank of the Trophy. | ||
* @param image_url The link of the image that represents the Trophy. | ||
* @param achieved Whether this Trophy was achieved or not, it can be a string if it was (with info about how much time ago it was achieved) or bool if not (false). | ||
*/ | ||
typedef FlxGameJoltTrophy = | ||
{ | ||
id:Int, | ||
title:String, | ||
description:String, | ||
difficulty:String, | ||
image_url:String, | ||
achieved:String | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apply the same doc format I requested for FlxGameJoltScore
/** | ||
* The way the user data is fetched from the GameJolt API. | ||
* | ||
* @param id The ID of the User. | ||
* @param type The cathegory the User is cataloged like in GameJolt. | ||
* @param username The username of the User. (Also available for guests). | ||
* @param avatar_url The link of the avatar of the User. | ||
* @param signed_up A short description about how long the User have been in GameJolt. | ||
* @param signed_up_timestamp A long time stamp (in seconds) of when the User signed up. | ||
* @param last_logged_in A short description about the last time the User was found active in GameJolt. | ||
* @param last_logged_in_timestamp A long time stamp (in seconds) of the last time the User logged in GameJolt. | ||
* @param status The actual status of the User. | ||
* @param developer_name The display name of the User. (Also available for guests). | ||
* @param developer_website The website of the User. | ||
* @param developer_description The description of the User. | ||
*/ | ||
typedef FlxGameJoltUser = | ||
{ | ||
id:Int, | ||
type:String, | ||
username:String, | ||
avatar_url:String, | ||
signed_up:String, | ||
signed_up_timestamp:Int, | ||
last_logged_in:String, | ||
last_logged_in_timestamp:Int, | ||
status:String, | ||
developer_name:String, | ||
developer_website:String, | ||
developer_description:String | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apply the same doc format I requested for FlxGameJoltScore
Ok, here you go, I fixed descriptions and other stuff as well, I hope this time the changes will suffice your expectations |
I guess nothing else needs to be added at this point. |
Ok, what do you think about this change? |
I'm currently trying to update the FlxPongApi thing at this time. |
@Geokureli check the changes pls |
I keep requesting the same changes, I feel like you're just not fully reading what I've said, I can go in and make these changes myself when I have time, but please reread what I've said numerous times |
I've corrected the spacing in descriptions, I've set them up like you said they have to be, idk what else am I missing, I did everything you told me so far to do. Maybe try to be more specific? |
I don't know how to be any clearer than this:
and
In all of the places I said to use spaces rather than tabs, you have used tabs. I even gave an example I also mentioned that this will not be merged until I can test it in an updated FlxPongApi demo |
Are ya happy now?
Ok, I've removed the tabs and replace them by spaces as you said. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Various doc changes
I'll try to get to this, soon, but I'm kinda swamped right now |
It's ok, thanks for correcting my descriptions btw. |
fixes #406
I've implemented the new functions the GameJolt API v1.2 has to offer, including batch requests and better load of the images.