project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Datastructures/Map.java
equal
deleted
inserted
replaced
17 */ |
17 */ |
18 |
18 |
19 package org.hedgewars.hedgeroid.Datastructures; |
19 package org.hedgewars.hedgeroid.Datastructures; |
20 |
20 |
21 import java.io.File; |
21 import java.io.File; |
22 import java.io.IOException; |
|
23 |
|
24 import org.hedgewars.hedgeroid.EngineProtocol.EngineProtocolNetwork; |
|
25 |
|
26 |
22 |
27 import android.content.Context; |
23 import android.content.Context; |
28 import android.graphics.drawable.Drawable; |
24 import android.graphics.drawable.Drawable; |
29 import android.os.Parcel; |
|
30 import android.os.Parcelable; |
|
31 |
25 |
32 public class Map implements Comparable<Map>, Parcelable{ |
26 public class Map implements Comparable<Map> { |
33 |
27 |
34 private static final String MISSION_PREFIX = "Mission: "; |
28 private static final String MISSION_PREFIX = "Mission: "; |
35 |
29 |
36 private String name; |
30 private String name; |
37 private String path; |
31 private String path; |
58 break; |
52 break; |
59 }*/ |
53 }*/ |
60 |
54 |
61 |
55 |
62 } |
56 } |
63 |
|
64 public Map(Parcel in){ |
|
65 readFromParcel(in); |
|
66 } |
|
67 |
57 |
68 public String toString(){ |
58 public String toString(){ |
69 switch(type){ |
59 switch(type){ |
70 default: |
60 default: |
71 case TYPE_DEFAULT: |
61 case TYPE_DEFAULT: |
73 case TYPE_GENERATED: |
63 case TYPE_GENERATED: |
74 return "bla"; |
64 return "bla"; |
75 case TYPE_MISSION: |
65 case TYPE_MISSION: |
76 return MISSION_PREFIX + name; |
66 return MISSION_PREFIX + name; |
77 } |
67 } |
78 } |
|
79 |
|
80 public void sendToEngine(EngineProtocolNetwork epn) throws IOException{ |
|
81 epn.sendToEngine(String.format("emap %s",name)); |
|
82 } |
68 } |
83 |
69 |
84 public MapType getType(){ |
70 public MapType getType(){ |
85 return type; |
71 return type; |
86 } |
72 } |
131 } |
117 } |
132 |
118 |
133 public enum MapType{ |
119 public enum MapType{ |
134 TYPE_DEFAULT, TYPE_MISSION, TYPE_GENERATED |
120 TYPE_DEFAULT, TYPE_MISSION, TYPE_GENERATED |
135 } |
121 } |
136 |
|
137 public int describeContents() { |
|
138 return 0; |
|
139 } |
|
140 |
|
141 public void writeToParcel(Parcel dest, int flags) { |
|
142 dest.writeString(name); |
|
143 dest.writeString(path); |
|
144 dest.writeString(previewPath); |
|
145 dest.writeString(type.name()); |
|
146 } |
|
147 |
|
148 private void readFromParcel(Parcel src){ |
|
149 name = src.readString(); |
|
150 path = src.readString(); |
|
151 previewPath = src.readString(); |
|
152 type = MapType.valueOf(src.readString()); |
|
153 } |
|
154 public static final Parcelable.Creator<Map> CREATOR = new Parcelable.Creator<Map>() { |
|
155 public Map createFromParcel(Parcel source) { |
|
156 return new Map(source); |
|
157 } |
|
158 public Map[] newArray(int size) { |
|
159 return new Map[size]; |
|
160 } |
|
161 |
|
162 }; |
|
163 } |
122 } |