Example #1
0
        private void DrawSaveLoadButtons()
        {
            Event e = Event.current;

            for (int i = 0, n = _otherMenuStrings.Length; i < n; i++)
            {
                var buttonRect = new Rect(_location.Offset.x - 180, 70 + i * 90, 150, 75);

                if (e.isMouse && buttonRect.Contains(e.mousePosition))
                {
                    if (e.type == EventType.mouseDown)
                    {
                        _onGui = true;

                        switch (i)
                        {
                        case 0:
                            GameGrid.SaveDataToXML(MapName);
                            break;

                        case 1:
                            GameGrid.LoadDataFromXML(MapName, _deployableDictionary);
                            break;

                        case 2:
                            GameGrid.ClearEntireGrid();
                            break;
                        }
                    }
                    else
                    {
                        _onGui = false;
                    }
                }

                GUI.Button(buttonRect, _otherMenuStrings[i]);
            }
        }