Ejemplo n.º 1
0
        // End road construction mode for player interface.
        public void BuildRoadEnd()
        {
            mapCursorSprites[1].Sprite = 32;
            mapCursorSprites[2].Sprite = 32;
            mapCursorSprites[3].Sprite = 32;
            mapCursorSprites[4].Sprite = 32;
            mapCursorSprites[5].Sprite = 32;
            mapCursorSprites[6].Sprite = 32;

            ClearBuildingRoadSegments();
            buildingRoad.Invalidate();
            UpdateMapCursorPosition(mapCursorPosition);

            PanelBar?.Update();
        }
Ejemplo n.º 2
0
        // Open popup box
        public void OpenPopup(PopupBox.Type box)
        {
            if (PopupBox == null)
            {
                PopupBox = new PopupBox(this);
            }

            if (initBox != null)
            {
                initBox.AddChild(PopupBox, 0, 0);
            }
            else
            {
                AddChild(PopupBox, 0, 0);
            }

            Layout();
            PopupBox.Show(box);
            PanelBar?.Update();
        }
Ejemplo n.º 3
0
        // Close the current popup.
        public void ClosePopup()
        {
            if (PopupBox == null)
            {
                return;
            }

            PopupBox.Hide();

            if (initBox != null)
            {
                initBox.DeleteChild(PopupBox);
            }
            else
            {
                DeleteChild(PopupBox);
            }

            UpdateMapCursorPosition(mapCursorPosition);
            PanelBar?.Update();
        }
Ejemplo n.º 4
0
        // Start road construction mode for player interface.
        public void BuildRoadBegin()
        {
            DetermineMapCursorType();

            if (mapCursorType != CursorType.Flag &&
                mapCursorType != CursorType.RemovableFlag)
            {
                UpdateInterface();
                return;
            }

            if (buildingRoad == null)
            {
                buildingRoad = new Road();
            }

            buildingRoad.Invalidate();
            buildingRoad.Start(mapCursorPosition);
            UpdateMapCursorPosition(mapCursorPosition);

            PanelBar?.Update();
        }
Ejemplo n.º 5
0
        // Set the appropriate sprites for the panel buttons and the map cursor.
        void UpdateInterface()
        {
            if (!IsBuildingRoad)
            {
                switch (mapCursorType)
                {
                case CursorType.None:
                    mapCursorSprites[0].Sprite = 31u;
                    mapCursorSprites[2].Sprite = 32u;
                    break;

                case CursorType.Flag:
                    mapCursorSprites[0].Sprite = 50u;
                    mapCursorSprites[2].Sprite = 32u;
                    break;

                case CursorType.RemovableFlag:
                    mapCursorSprites[0].Sprite = 50u;
                    mapCursorSprites[2].Sprite = 32u;
                    break;

                case CursorType.Building:
                    mapCursorSprites[0].Sprite = 31u;
                    mapCursorSprites[2].Sprite = 32u;
                    break;

                case CursorType.Path:
                    mapCursorSprites[0].Sprite = 51u;
                    mapCursorSprites[2].Sprite = 32u;
                    if (buildPossibility != BuildPossibility.None)
                    {
                        mapCursorSprites[0].Sprite = 46u;
                    }
                    break;

                case CursorType.ClearByFlag:
                    if (buildPossibility < BuildPossibility.Mine)
                    {
                        mapCursorSprites[0].Sprite = 31u;
                        mapCursorSprites[2].Sprite = 32u;
                    }
                    else
                    {
                        mapCursorSprites[0].Sprite = 45u + (uint)buildPossibility;
                        mapCursorSprites[2].Sprite = 32u;
                    }
                    break;

                case CursorType.ClearByPath:
                    if (buildPossibility != BuildPossibility.None)
                    {
                        mapCursorSprites[0].Sprite = 45u + (uint)buildPossibility;

                        if (buildPossibility == BuildPossibility.Flag)
                        {
                            mapCursorSprites[2].Sprite = 32u;
                        }
                        else
                        {
                            mapCursorSprites[2].Sprite = 46u;
                        }
                    }
                    else
                    {
                        mapCursorSprites[0].Sprite = 31u;
                        mapCursorSprites[2].Sprite = 32u;
                    }
                    break;

                case CursorType.Clear:
                    if (buildPossibility != BuildPossibility.None)
                    {
                        if (buildPossibility == BuildPossibility.Castle)
                        {
                            mapCursorSprites[0].Sprite = 49u;
                        }
                        else
                        {
                            mapCursorSprites[0].Sprite = 45u + (uint)buildPossibility;
                        }
                        if (buildPossibility == BuildPossibility.Flag)
                        {
                            mapCursorSprites[2].Sprite = 32u;
                        }
                        else
                        {
                            mapCursorSprites[2].Sprite = 46u;
                        }
                    }
                    else
                    {
                        mapCursorSprites[0].Sprite = 31u;
                        mapCursorSprites[2].Sprite = 32u;
                    }
                    break;

                default:
                    Debug.NotReached();
                    break;
                }
            }

            PanelBar?.Update();
        }