Added serverSocketChannel for game creation
This commit is contained in:
parent
546e341433
commit
48705f7e76
30 changed files with 1787 additions and 606 deletions
15
Commons/src/interfaces/IAuth.java
Normal file
15
Commons/src/interfaces/IAuth.java
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
package interfaces;
|
||||
import models.Response;
|
||||
|
||||
import java.rmi.Remote;
|
||||
import java.rmi.RemoteException;
|
||||
|
||||
/**
|
||||
* Created by loke on 15/06/2017.
|
||||
*/
|
||||
public interface IAuth extends Remote {
|
||||
Response login(String userName, String password) throws RemoteException;
|
||||
Response register(String userName, String password) throws RemoteException;
|
||||
Response logout(String userName, String token) throws RemoteException;
|
||||
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
package interfaces;
|
||||
import models.TTResponse;
|
||||
|
||||
import java.rmi.Remote;
|
||||
import java.rmi.RemoteException;
|
||||
|
||||
/**
|
||||
* Created by loke on 15/06/2017.
|
||||
*/
|
||||
public interface ITTAuth extends Remote {
|
||||
TTResponse login(String userName, String password) throws RemoteException;
|
||||
TTResponse register(String userName, String password) throws RemoteException;
|
||||
TTResponse logout(String userName, String token) throws RemoteException;
|
||||
|
||||
}
|
||||
17
Commons/src/models/Account.java
Normal file
17
Commons/src/models/Account.java
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
package models;
|
||||
|
||||
/**
|
||||
* Created by loke on 18/06/2017.
|
||||
*/
|
||||
public class Account {
|
||||
public String userName;
|
||||
public String password;
|
||||
|
||||
public Account(String userName, String password){
|
||||
this.userName = userName;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -5,12 +5,12 @@ import java.io.Serializable;
|
|||
/**
|
||||
* Created by loke on 15/06/2017.
|
||||
*/
|
||||
public class TTResponse implements Serializable{
|
||||
public class Response implements Serializable{
|
||||
public String message;
|
||||
public Integer code;
|
||||
public JsonObject data;
|
||||
|
||||
public TTResponse(String message, Integer code, JsonObject data) {
|
||||
public Response(String message, Integer code, JsonObject data) {
|
||||
this.message = message;
|
||||
this.code = code;
|
||||
this.data = data;
|
||||
|
|
@ -3,11 +3,11 @@ package models;
|
|||
/**
|
||||
* Created by loke on 17/06/2017.
|
||||
*/
|
||||
public class TTAccount {
|
||||
public class Session {
|
||||
public String userName;
|
||||
public String token;
|
||||
|
||||
public TTAccount(String userName, String token){
|
||||
public Session(String userName, String token){
|
||||
this.userName = userName;
|
||||
this.token = token;
|
||||
}
|
||||
15
Commons/src/models/User.java
Normal file
15
Commons/src/models/User.java
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
package models;
|
||||
|
||||
/**
|
||||
* Created by loke on 18/06/2017.
|
||||
*/
|
||||
public class User {
|
||||
public String userName;
|
||||
|
||||
public User(String userName){
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -10,29 +10,28 @@ import java.util.Date;
|
|||
/**
|
||||
* Created by loke on 15/06/2017.
|
||||
*/
|
||||
public class TTLogger {
|
||||
public class Logger {
|
||||
|
||||
|
||||
private static File logFile;
|
||||
private static String name;
|
||||
private static PrintWriter out;
|
||||
private static BufferedWriter bw;
|
||||
private static FileWriter fw;
|
||||
|
||||
public TTLogger(File logFile) throws IOException {
|
||||
public Logger(File logFile, String name) throws IOException {
|
||||
this.logFile = logFile;
|
||||
|
||||
this.name = name;
|
||||
}
|
||||
public static void write(String msg){
|
||||
|
||||
public synchronized static void write(String msg){
|
||||
try {
|
||||
fw = new FileWriter(logFile, true);
|
||||
bw = new BufferedWriter(fw);
|
||||
out = new PrintWriter(bw);
|
||||
System.out.println(msg);
|
||||
Date d = new Date();
|
||||
out.append(d.toString());
|
||||
out.append(" - ");
|
||||
out.append(msg);
|
||||
out.append("\n");
|
||||
out.append("LOGGER ("+name+"): " + d.toString() + " - " + msg + "\n");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
@ -49,6 +48,5 @@ public class TTLogger {
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue