Advertisement
dreitn

Untitled

May 22nd, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 1.33 KB | None | 0 0
  1.  
  2.  
  3. package messages;
  4.  
  5. import map.Fields
  6. import map.Fields.Castle
  7. import map.Fields.Grass
  8. import map.Map
  9. import java.util.*
  10. import javax.xml.bind.annotation.XmlAccessType
  11. import javax.xml.bind.annotation.XmlAccessorType
  12. import javax.xml.bind.annotation.XmlElement
  13. import javax.xml.bind.annotation.XmlRootElement
  14.  
  15.  
  16. @XmlRootElement(name = "halfMap")
  17. @XmlAccessorType(XmlAccessType.FIELD)
  18. class HalfMap {
  19.  
  20.     @XmlElement(name = "uniquePlayerID")
  21.     var playerIdentifier: String = ""
  22.  
  23.     @XmlElement(name = "newMapNode")
  24.     var nodes = ArrayList<NewMapNode>(32);
  25.  
  26.  
  27.     constructor()
  28.     constructor(gameID: String, map: Map) {
  29.         playerIdentifier = gameID
  30.         var iter = map.iterator();
  31.  
  32.         while (iter.hasNext()) {
  33.             nodes.add(NewMapNode(iter.next()));
  34.         }
  35.     }
  36. };
  37.  
  38. class NewMapNode {
  39.     constructor()
  40.     companion object {
  41.         var count = 0
  42.     }
  43.  
  44.     var x = 0
  45.     var y = 0
  46.  
  47.     var fortPresent = false
  48.  
  49.     var terrain = "";
  50.  
  51.  
  52.     constructor(fields: Fields?) {
  53.         if (fields != null) {
  54.             if (fields == Castle) {
  55.                 fortPresent = true
  56.                 terrain = Grass.name
  57.             } else {
  58.                 terrain = fields.name
  59.             }
  60.         }
  61.  
  62.         x = count % 8;
  63.         y = count / 8;
  64.         count++;
  65.     }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement