186 |
186 |
187 public void disconnect() { sendToNet(MSG_DISCONNECT, "User Quit"); } |
187 public void disconnect() { sendToNet(MSG_DISCONNECT, "User Quit"); } |
188 |
188 |
189 private static Netplay instance; |
189 private static Netplay instance; |
190 |
190 |
|
191 public static boolean hasAppInstance() { |
|
192 return instance != null; |
|
193 } |
|
194 |
191 /** |
195 /** |
192 * Retrieve the single app-wide instance of the netplay interface, creating it if it |
196 * Retrieve the single app-wide instance of the netplay interface, creating it if it |
193 * does not exist yet. |
197 * does not exist yet. |
194 * |
198 * |
195 * @param applicationContext |
199 * @param applicationContext |
196 * @return |
200 * @return |
197 */ |
201 */ |
198 public static Netplay getAppInstance(Context applicationContext) { |
202 public static Netplay getAppInstance(Context applicationContext) { |
199 if(instance == null) { |
203 if (!hasAppInstance()) { |
200 // We will need some default values for rooms, best load them here |
204 // We will need some default values for rooms, best load them here |
201 Scheme defaultScheme = null; |
205 Scheme defaultScheme = null; |
202 Weaponset defaultWeaponset = null; |
206 Weaponset defaultWeaponset = null; |
203 try { |
207 try { |
204 List<Scheme> schemes = Schemes.loadBuiltinSchemes(applicationContext); |
208 List<Scheme> schemes = Schemes.loadBuiltinSchemes(applicationContext); |