(msg *Message)
| 3350 | } |
| 3351 | |
| 3352 | func (mc *MapContents) ReceiveMessage(msg *Message) { |
| 3353 | |
| 3354 | if msg.Type == MessageThemeChange || msg.Type == MessageRenderTextureRefresh { |
| 3355 | mc.UpdateTexture() |
| 3356 | } else if msg.Type == MessageUndoRedo { |
| 3357 | |
| 3358 | // Recreate texture first so the MapData has the correct size before deserialization |
| 3359 | mc.RecreateTexture() |
| 3360 | if msg.Type == MessageUndoRedo { |
| 3361 | mc.MapData.Clip() // We call Clip() here so if you undo or redo and the size changes, values outside of that range are deleted |
| 3362 | } |
| 3363 | mc.MapData.Deserialize(mc.Card.Properties.Get("contents").AsString()) |
| 3364 | mc.Card.Properties.Get("contents").SetRaw(mc.MapData.Serialize()) |
| 3365 | mc.UpdateTexture() |
| 3366 | |
| 3367 | } else if msg.Type == MessageCardResizeCompleted { |
| 3368 | |
| 3369 | // Recreate texture first so the MapData has the correct size before deserialization |
| 3370 | mc.RecreateTexture() |
| 3371 | |
| 3372 | px := mc.Card.RectPreResize.X - mc.Card.Rect.X |
| 3373 | py := mc.Card.RectPreResize.Y - mc.Card.Rect.Y |
| 3374 | if px != 0 || py != 0 { |
| 3375 | mc.MapData.Push(int(px/globals.GridSize), int(py/globals.GridSize), false) |
| 3376 | } |
| 3377 | mc.MapData.Clip() // We call Clip() here so if you undo or redo and the size changes, values outside of that range are deleted |
| 3378 | |
| 3379 | mc.UpdateTexture() |
| 3380 | |
| 3381 | } else if msg.Type == MessageContentSwitched { |
| 3382 | mc.Card.Draggable = true |
| 3383 | mc.Tool = MapEditToolNone |
| 3384 | } |
| 3385 | |
| 3386 | } |
| 3387 | |
| 3388 | func (mc *MapContents) Color() Color { |
| 3389 | return getThemeColor(GUIMapColor) // No color for maps |
nothing calls this directly
no test coverage detected