MCPcopy Create free account
hub / github.com/SolarLune/masterplan / Update

Method Update

contents.go:2607–3044  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2605}
2606
2607func (mc *MapContents) Update() {
2608
2609 if mc.Tool == MapEditToolNone {
2610 mc.Card.Draggable = true
2611 // mc.Card.Depth = -10000000 // Depth is lower when not editing the map so it's always behind lines
2612 } else {
2613 mc.Card.Draggable = false
2614 // mc.Card.Depth = 10000000 // Depth is higher when editing the map so it's always in front
2615 }
2616
2617 changed := false
2618
2619 colorButtons := []*IconButton{}
2620
2621 mapPaletteMenu := globals.MenuSystem.Get("map palette menu")
2622
2623 if mapPaletteMenu.Opened {
2624
2625 for _, row := range mapPaletteMenu.Pages["root"].Rows {
2626 for _, element := range row.ElementOrder {
2627 if strings.Contains(row.FindElementName(element), "paletteColor") {
2628 colorButtons = append(colorButtons, element.(*IconButton))
2629 }
2630 }
2631 }
2632
2633 for index, button := range colorButtons {
2634 if MapDrawingColor == index+1 {
2635 button.IconSrc.X = 48
2636 button.IconSrc.Y = 160
2637 } else {
2638 button.IconSrc.X = 512
2639 button.IconSrc.Y = 0
2640 }
2641 }
2642
2643 for patternType, button := range mc.PatternButtons {
2644 if MapPattern == patternType {
2645 button.IconSrc.X = 48
2646 button.IconSrc.Y = 160
2647 } else {
2648 if patternType == MapPatternSolid {
2649 button.IconSrc.Y = 0
2650 } else if patternType == MapPatternCrossed {
2651 button.IconSrc.Y = 32
2652 } else if patternType == MapPatternDotted {
2653 button.IconSrc.Y = 64
2654 } else if patternType == MapPatternChecked {
2655 button.IconSrc.Y = 96
2656 } else if patternType == MapPatternTerrain {
2657 button.IconSrc.Y = 128
2658 }
2659 button.IconSrc.X = 512
2660 }
2661 }
2662
2663 }
2664

Callers

nothing calls this directly

Calls 15

GridCursorPositionMethod · 0.95
ColorIndexToColorMethod · 0.95
ColorIndexToPatternMethod · 0.95
UsingLineToolMethod · 0.95
ColorIndexMethod · 0.95
UpdateTextureMethod · 0.95
RecreateTextureMethod · 0.95
PlayUISoundFunction · 0.85
FindElementNameMethod · 0.80
IsSelectedMethod · 0.80
CloseMethod · 0.80
WorldPositionMethod · 0.80

Tested by

no test coverage detected