Ejemplo n.º 1
0
        public TrackerState(TrackerLayoutFile trackerInfo)
        {
            List <string> mapStateNames = new List <string>();

            // Initialize any placed maps and marker sets
            foreach (var layout in trackerInfo.layouts.Values)
            {
                foreach (var mapPlacement in layout.maps)
                {
                    var mapDefinition = trackerInfo.maps[mapPlacement.name];
                    var gridStateName = mapPlacement.stateName;
                    if (gridStateName == null)
                    {
                        gridStateName = mapDefinition.stateName;
                    }

                    InitializeGrid(gridStateName, mapDefinition.gridWidth, mapDefinition.gridHeight);

                    if (mapPlacement.markerSets != null)
                    {
                        foreach (var markerPlacement in mapPlacement.markerSets)
                        {
                            InitializeMarkers(markerPlacement.name, null);
                        }
                    }
                }
            }

            // Initialize all defined maps and marker sets
            // Even though they may not be part of a layout, they might still be referenced in code
            foreach (var map in trackerInfo.maps.Values)
            {
                InitializeGrid(map.stateName, 0, 0);
            }
        }
Ejemplo n.º 2
0
        public LayoutRenderer(TrackerLayoutFile trackerDefinition, string layoutName)
        {
            this.trackerDefinition = trackerDefinition;
            this.layoutName        = layoutName;
            this.layout            = trackerDefinition.layouts[layoutName];

            backgrounds = new Bitmap[layout.backgrounds.Length];
            for (var i = 0; i < layout.backgrounds.Length; i++)
            {
                var bgPath = layout.backgrounds[i];
                backgrounds[i] = trackerDefinition.Meta.GetImage(bgPath);
            }

            if (backgrounds.Length == 0)
            {
                throw new TrackerFileException("Layout " + layoutName + " has no background.");
            }
            width  = backgrounds[0].Width;
            height = backgrounds[0].Height;

            foreach (var placement in layout.maps)
            {
                maps.Add(new MapRenderer(this, placement));
            }

            renderer = new Renderer(width, height);
            RenderInitial();

            trackerDefinition.Meta.State.AddListener(this);
        }
Ejemplo n.º 3
0
 internal void ClearLayout()
 {
     SelectedIndex       = 0;
     _scale              = 1;
     _layoutFile         = null;
     _layoutName         = null;
     _markerSetPlacement = null;
     _mapPlacement       = null;
 }
Ejemplo n.º 4
0
 internal void ApplyEffectiveValues(TrackerLayoutFile file)
 {
     if (this.margin == null)
     {
         this.margin = new LayoutMargin();
     }
     foreach (var map in this.maps)
     {
         map.ApplyEffectiveValues(file);
     }
 }
Ejemplo n.º 5
0
        public void ApplyEffectiveValues(TrackerLayoutFile file, TrackerMarkerSetReference markerSet)
        {
            if (scale == null || scale < 1)
            {
                scale = 1;
            }

            if (width == null || height == null)
            {
                var image = file.Meta.GetImage(markerSet.source);
                width  = width ?? (image.Width * scale);
                height = height ?? (image.Height * scale);
            }
        }
Ejemplo n.º 6
0
        internal void ApplyEffectiveValues(TrackerLayoutFile file)
        {
            var mapBase = file.maps[this.name];

            if (this.stateName == null)
            {
                this.stateName = mapBase.stateName;
            }
            if (this.x == null)
            {
                this.x = mapBase.x;
            }
            if (this.y == null)
            {
                this.y = mapBase.y;
            }
            if (this.cellWidth == null)
            {
                this.cellWidth = mapBase.cellWidth;
            }
            if (this.cellHeight == null)
            {
                this.cellHeight = mapBase.cellHeight;
            }
            if (this.backgrounds == null || this.backgrounds.Length == 0)
            {
                this.backgrounds = mapBase.backgrounds;
            }

            List <TrackerMarkerSetReference> markerSetList = new List <TrackerMarkerSetReference>();

            markerSetList.AddRange(mapBase.markerSets);
            markerSetList.AddRange(this.markerSets);
            this.markerSets = markerSetList.ToArray();

            foreach (var m in this.markerSets)
            {
                if (m.picker != null)
                {
                    m.picker.ApplyEffectiveValues(file, m);
                }
            }
        }
Ejemplo n.º 7
0
        internal void setLayout(TrackerLayoutFile layout)
        {
            this.layout          = layout;
            trackerUI.Tracker    = layout;
            trackerUI.LayoutName = "zelda";
            ApplyLayoutExternalMetrics(layout.layouts["zelda"]);

            mscMarkers.ClearLayout();
            mscMarkers.LayoutFile         = layout;
            mscMarkers.LayoutName         = "zelda";
            mscMarkers.MarkerSetPlacement = layout.layouts["zelda"].maps[0].markerSets[0];
            //mscMarkers.MarkerSetName = mscMarkers.MarkerSetPlacement.name;
            mscMarkers.MapPlacement = layout.layouts["zelda"].maps[0];

            mscMetMarkers.ClearLayout();
            mscMetMarkers.LayoutFile         = layout;
            mscMetMarkers.LayoutName         = "metroid";
            mscMetMarkers.MarkerSetPlacement = layout.layouts["metroid"].maps[0].markerSets[0];
            //mscMetMarkers.MarkerSetName = mscMetMarkers.MarkerSetPlacement.name;
            mscMetMarkers.MapPlacement = layout.layouts["metroid"].maps[0];

            //LoadSettings();
        }
Ejemplo n.º 8
0
 public TrackerMeta(TrackerLayoutFile file)
 {
     this.File = file;
 }