project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/EngineProtocol/GameConfig.java
changeset 6436 f1a42ba9cab2
parent 6047 10011f051f9c
child 6488 c356ddebab84
equal deleted inserted replaced
6435:356fbb672f84 6436:f1a42ba9cab2
    32 	public Map map = null;
    32 	public Map map = null;
    33 	public String theme = null;
    33 	public String theme = null;
    34 	public Scheme scheme = null;
    34 	public Scheme scheme = null;
    35 	public Weapon weapon = null;
    35 	public Weapon weapon = null;
    36 	
    36 	
    37 	public String mission = null;
    37 	public String style = null;
       
    38 	public String training = null;
    38 	public String seed = null;
    39 	public String seed = null;
    39 	
    40 	
    40 	public ArrayList<Team> teams = new ArrayList<Team>();
    41 	public ArrayList<Team> teams = new ArrayList<Team>();
    41 	
    42 	
    42 	public GameConfig(){
    43 	public GameConfig(){
    51 	
    52 	
    52 	public void sendToEngine(EngineProtocolNetwork epn) throws IOException{
    53 	public void sendToEngine(EngineProtocolNetwork epn) throws IOException{
    53 		Log.d("HW_Frontend", "Sending Gameconfig...");
    54 		Log.d("HW_Frontend", "Sending Gameconfig...");
    54 		int teamCount = 4;
    55 		int teamCount = 4;
    55 		epn.sendToEngine("TL"); //Write game mode
    56 		epn.sendToEngine("TL"); //Write game mode
    56 		if(mission != null) epn.sendToEngine(mission);
    57 		if(training != null) epn.sendToEngine(String.format("escript Scripts/Training/%s.lua", training));
       
    58 		else if(style != null) epn.sendToEngine(String.format("escript Scripts/Multiplayer/%s.lua", style));
    57 		
    59 		
    58 		//seed info
    60 		//seed info
    59 		epn.sendToEngine(String.format("eseed {%s}", UUID.randomUUID().toString()));
    61 		epn.sendToEngine(String.format("eseed {%s}", UUID.randomUUID().toString()));
    60 		
    62 		
    61 		map.sendToEngine(epn);
    63 		map.sendToEngine(epn);
    83 		dest.writeString(mode.name());
    85 		dest.writeString(mode.name());
    84 		dest.writeParcelable(map, flags);
    86 		dest.writeParcelable(map, flags);
    85 		dest.writeString(theme);
    87 		dest.writeString(theme);
    86 		dest.writeParcelable(scheme, flags);
    88 		dest.writeParcelable(scheme, flags);
    87 		dest.writeParcelable(weapon, flags);
    89 		dest.writeParcelable(weapon, flags);
    88 		dest.writeString(mission);
    90 		dest.writeString(style);
       
    91 		dest.writeString(training);
    89 		dest.writeString(seed);
    92 		dest.writeString(seed);
    90 		dest.writeParcelableArray((Team[])teams.toArray(new Team[1]), 0);
    93 		dest.writeParcelableArray((Team[])teams.toArray(new Team[1]), 0);
    91 	}
    94 	}
    92 	
    95 	
    93 	private void readFromParcel(Parcel src){
    96 	private void readFromParcel(Parcel src){
    94 		mode = GameMode.valueOf(src.readString());
    97 		mode = GameMode.valueOf(src.readString());
    95 		map = src.readParcelable(Map.class.getClassLoader());
    98 		map = src.readParcelable(Map.class.getClassLoader());
    96 		theme = src.readString();
    99 		theme = src.readString();
    97 		scheme = src.readParcelable(Scheme.class.getClassLoader());
   100 		scheme = src.readParcelable(Scheme.class.getClassLoader());
    98 		weapon = src.readParcelable(Weapon.class.getClassLoader());
   101 		weapon = src.readParcelable(Weapon.class.getClassLoader());
    99 		mission = src.readString();
   102 		style = src.readString();
       
   103 		training = src.readString();
   100 		seed = src.readString();
   104 		seed = src.readString();
   101 		Parcelable[] parcelables = src.readParcelableArray(Team[].class.getClassLoader());
   105 		Parcelable[] parcelables = src.readParcelableArray(Team[].class.getClassLoader());
   102 		for(Parcelable team : parcelables){
   106 		for(Parcelable team : parcelables){
   103 			teams.add((Team)team);
   107 			teams.add((Team)team);
   104 		}
   108 		}