-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from SDIDSA/online
Online
- Loading branch information
Showing
46 changed files
with
3,082 additions
and
388 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package org.luke.diminou.abs.api; | ||
|
||
import android.util.Log; | ||
|
||
import org.json.JSONObject; | ||
import org.luke.diminou.abs.api.json.Param; | ||
import org.luke.diminou.abs.api.multipart.Part; | ||
import org.luke.diminou.abs.utils.functional.ObjectConsumer; | ||
import org.luke.diminou.data.SessionManager; | ||
|
||
public class AuthRoute { | ||
|
||
static void call(String path, String action, ObjectConsumer<JSONObject> onResult, Param... params) { | ||
String session = SessionManager.getSession(); | ||
Log.i("session", session); | ||
API.asyncJsonPost(path, action, onResult, session, params); | ||
} | ||
|
||
static void callMulti(String path, String action, ObjectConsumer<JSONObject> onResult, Part... parts) { | ||
API.asyncMultiPost(path, action, onResult, SessionManager.getSession(), parts); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.luke.diminou.abs.api; | ||
|
||
import org.json.JSONObject; | ||
import org.luke.diminou.abs.api.json.Param; | ||
import org.luke.diminou.abs.utils.functional.ObjectConsumer; | ||
import org.luke.diminou.app.pages.game.piece.Move; | ||
|
||
public class GameRoute extends AuthRoute { | ||
public static void deal(String roomId, ObjectConsumer<JSONObject> onResult) { | ||
call(API.Game.DEAL, "request deal from server", onResult, | ||
new Param("room_id", roomId)); | ||
} | ||
|
||
public static void play(String roomId, Move move, ObjectConsumer<JSONObject> onResult) { | ||
call(API.Game.PLAY, "play move", onResult, | ||
new Param("room_id", roomId), | ||
new Param("move", move.serialize())); | ||
} | ||
} |
Oops, something went wrong.