package com.bartlomiejpluta.base.proto;

option java_package = "com.bartlomiejpluta.base.proto";
option java_outer_classname = "GameMapProto";

message GameMap {
  required string uid = 1;
  required uint32 rows = 2;
  required uint32 columns = 3;
  required uint32 tileWidth = 4;
  required uint32 tileHeight = 5;
  repeated Layer layers = 6;
  required string handler = 7;
  required string javaImports = 8;
}

message Layer {
  required string name = 1;

  oneof layer {
    TileLayer tileLayer = 2;
    AutoTileLayer autoTileLayer = 3;
    ObjectLayer objectLayer = 4;
    ColorLayer colorLayer = 5;
    ImageLayer imageLayer = 6;
  }
}

message TileLayer {
  required string tilesetUID = 1;
  repeated uint32 tiles = 2;
}

message AutoTileLayer {
  required string autotileUID = 1;
  repeated uint32 tiles = 2;
  required bool animated = 3;
  required double animationDuration = 4;
  required bool connect = 5;
}

message ObjectLayer {
  repeated PassageAbility passageMap = 1;
  repeated MapObject objects = 2;
  repeated MapLabel labels = 3;
}

enum PassageAbility {
  ALLOW = 0;
  BLOCK = 1;
}

message MapObject {
  required uint32 x = 1;
  required uint32 y = 2;
  required string code = 3;
}

message MapLabel {
  required string label = 1;
  required uint32 x = 2;
  required uint32 y = 3;
}

message ColorLayer {
  required uint32 red = 1;
  required uint32 green = 2;
  required uint32 blue = 3;
  required uint32 alpha = 4;
}

message ImageLayer {
  required string imageUID = 1;
  required uint32 opacity = 2;
  required int32 x = 3;
  required int32 y = 4;
  required double scaleX = 5;
  required double scaleY = 6;
  required ImageLayerMode mode = 7;
  required bool parallax = 8;
}

enum ImageLayerMode {
  NORMAL = 1;
  FIT_MAP = 2;
  FIT_SCREEN = 3;
}