Пример #1
0
        private void updateFullMap()
        {
            if (GUIHandler.fullMapChanged())
            {
                //remove previous full map
                FullMapGrid.Children.Clear();
                RenderOptions.SetEdgeMode(FullMapGrid, EdgeMode.Aliased);

                RectangleUpdate[,] fullMap = GUIHandler.getFullMap();

                //repopulate completely
                for (int row = 0; row < fullMap.GetLength(0); row++)
                {
                    for (int col = 0; col < fullMap.GetLength(1); col++)
                    {
                        Rectangle newRect = new Rectangle()
                        {
                            Width               = 1,
                            Height              = 1,
                            Fill                = fullMap[row, col].color,
                            Stroke              = fullMap[row, col].color,
                            StrokeThickness     = 0,
                            Margin              = new Thickness(col, row, 0, 0),
                            HorizontalAlignment = HorizontalContentAlignment,
                            VerticalAlignment   = VerticalAlignment.Top
                        };
                        FullMapGrid.Children.Add(newRect);
                    }
                }
            }
        }
Пример #2
0
 private void updateMapText()
 {
     if (GUIHandler.mapTextChanged())
     {
         MapText.Text = GUIHandler.getMapText();
     }
 }
Пример #3
0
 private void updateTitle()
 {
     if (GUIHandler.titleChanged())
     {
         TitleText.Text = GUIHandler.getTitle();
     }
 }
Пример #4
0
 private void updateDescription()
 {
     if (GUIHandler.descriptionChanged())
     {
         MainText.Text = GUIHandler.getDescription();
     }
 }
Пример #5
0
        public void runFullGUIUpdate()
        {
            //GUIHandler.setDescription("You are wandering the world... ");
            GUIHandler.setTitle("Livimon");
            GUIHandler.setMapText(MapSystem.getTileName());
            GUIHandler.setMapGrid(MapSystem.getCurrentMapListView());
            if (MapSystem.getFullMapListNeedsUpdate())
            {
                GUIHandler.setFullMap(MapSystem.getFullMapListView());
            }

            GUIHandler.screenUpdatePrepared();
        }
Пример #6
0
        /*
         * _____ _    _ _____    _____  _____       __          __   ______ _    _ _   _  _____ _______ _____ ____  _   _  _____
         * / ____| |  | |_   _|  |  __ \|  __ \     /\ \        / /  |  ____| |  | | \ | |/ ____|__   __|_   _/ __ \| \ | |/ ____|
         | |  __| |  | | | |    | |  | | |__) |   /  \ \  /\  / /   | |__  | |  | |  \| | |       | |    | || |  | |  \| | (___
         | | |_ | |  | | | |    | |  | |  _  /   / /\ \ \/  \/ /    |  __| | |  | | . ` | |       | |    | || |  | | . ` |\___ \
         | |__| | |__| |_| |_   | |__| | | \ \  / ____ \  /\  /     | |    | |__| | |\  | |____   | |   _| || |__| | |\  |____) |
         \_____|\____/|_____|  |_____/|_|  \_\/_/    \_\/  \/      |_|     \____/|_| \_|\_____|  |_|  |_____\____/|_| \_|_____/
         |
         */

        //consider rewriting this to use onPropertyChanged(?) so people don't laugh at bad code
        //15ms = 60 frames per second, but don't expect that to actually be 60, it could take an extra frame to update
        private void runGuiUpdate()
        {
            while (true)
            {
                Thread.Sleep(5);
                Dispatcher.Invoke(() =>
                {
                    if (GUIHandler.isReadyToUpdate())
                    {
                        updateGUI();
                    }
                });
            }
        }
Пример #7
0
        /*
         * __  __          _____     _____ _____  _____ _____
         |  \/  |   /\   |  __ \   / ____|  __ \|_   _|  __ \
         | \  / |  /  \  | |__) | | |  __| |__) | | | | |  | |
         | |\/| | / /\ \ |  ___/  | | |_ |  _  /  | | | |  | |
         | |  | |/ ____ \| |      | |__| | | \ \ _| |_| |__| |
         |_|  |_/_/    \_\_|       \_____|_|  \_\_____|_____/
         |
         */

        private void updateMapGrid()
        {
            if (GUIHandler.mapGridChanged())
            {
                RectangleUpdate[,] newRects = GUIHandler.getMapGrid();
                if (newRects.GetLength(0) != mapCellGrid.GetLength(0) || newRects.GetLength(1) != mapCellGrid.GetLength(1))
                {
                    throw new System.ArgumentException("BAD MATRIX SIZED FOR MAP");
                }
                for (int row = 0; row < mapCellGrid.GetLength(0); row++)
                {
                    for (int col = 0; col < mapCellGrid.GetLength(1); col++)
                    {
                        Rectangle       currentRectangle = mapCellGrid[row, col];
                        RectangleUpdate currentUpdate    = newRects[row, col];
                        if (currentUpdate == null)
                        {
                            throw new System.ArgumentException("updateMapGrid failed at row " + row + " col " + col);
                        }

                        if (currentUpdate.turnOffRectangle)
                        {
                            if (currentRectangle.StrokeThickness > 0)
                            {
                                if (currentRectangle.Stroke != null)
                                {
                                    removeClickableRectsClick(currentRectangle);
                                }
                            }

                            if (currentUpdate.color != null)
                            {
                                currentRectangle.Fill = currentUpdate.color;
                            }
                            else
                            {
                                currentRectangle.Fill = Brushes.Black;
                            }
                            if (!string.IsNullOrEmpty(currentUpdate.tooltip))
                            {
                                currentRectangle.ToolTip = currentUpdate.tooltip;
                            }
                        }
                        else
                        {
                            if (currentRectangle.StrokeThickness > 0)
                            {
                                if (currentRectangle.Stroke == null)
                                {
                                    addClickableRectsClick(currentRectangle);
                                }
                            }

                            currentRectangle.Fill = currentUpdate.color;
                            if (!string.IsNullOrEmpty(currentUpdate.tooltip))
                            {
                                currentRectangle.ToolTip = currentUpdate.tooltip;
                            }
                        }
                    }
                }
            }
        }
Пример #8
0
 public void runInitialLogic()
 {
     MapSystem.initializeWorldMap();
     GUIHandler.setFullMap(MapSystem.getFullMapListView());
     runFullGUIUpdate();
 }