예제 #1
0
        public void OnGUI()
        {
            if (!showButtons)
            {
                return;
            }

            if (GUI.Button(new Rect(10, 10, 50, 25), "Save"))
            {
                PlanetSave.SaveCells(EarthManager.Instance.Cells, EarthManager.Instance.playingPlanetName);
            }
            if (GUI.Button(new Rect(10, 45, 120, 25), "Save Player"))
            {
                PlanetSave.SavePlayer(EarthManager.Instance.playingPlanetName);
            }
            if (GUI.Button(new Rect(70, 10, 50, 25), "Light"))
            {
                RecalulateNormals();
            }
            if (GUI.Button(new Rect(130, 10, 50, 25), "UVs"))
            {
                EarthManager.Instance.RecalculateUVMap();
            }
            if (GUI.Button(new Rect(300, 10, 120, 25), "Save Pnjs"))
            {
                PlanetSave.SavePnjs(EarthManager.Instance.playingPlanetName);
            }
            if (GUI.Button(new Rect(430, 10, 120, 25), "Save Citizens"))
            {
                PlanetSave.SaveCitizens(EarthManager.Instance.playingPlanetName);
            }
            if (GUI.Button(new Rect(430, 70, 50, 25), "Load"))
            {
                EarthManager.Instance.CreateOnlyPlanet();
            }

            float y = 100;

            if (_selectedCells.Count > 0)
            {
                foreach (CellState state in Enum.GetValues(typeof(CellState)))
                {
                    if (GUI.Button(new Rect(10, y, 90, 25), state.ToString()))
                    {
                        foreach (Cell lCell in _selectedCells)
                        {
                            lCell.SetCellState(lCell.GroundMesh, state);
                        }
                    }

                    y += 35;
                }

                biomeIDEdit = GUI.TextField(new Rect(10, y, 20, 20), biomeIDEdit, 25);
                bool apply = GUI.Button(new Rect(35, y, 60, 20), "Apply");
                if (string.Empty != biomeIDEdit && apply)
                {
                    foreach (Cell lCell in _selectedCells)
                    {
                        lCell.BiomeID = int.Parse(biomeIDEdit);
                    }
                }

                if (GUI.Button(new Rect(10, y + 35, 20, 20), "X"))
                {
                    _selectedCells.Clear();
                    _selectedCell = null;
                }
            }

            if (_selectedProps.Count > 0)
            {
                if (GUI.Button(new Rect(10, 100, 70, 25), "DELETE"))
                {
                    foreach (Props p in _selectedProps)
                    {
                        Destroy(p.transform.gameObject.GetComponent <Props>());
                    }

                    _selectedProp = null;
                    _selectedProps.Clear();
                }

                if (GUI.Button(new Rect(10, 160, 20, 20), "X") || Input.GetKeyDown(KeyCode.Q))
                {
                    _selectedProp = null;
                    _selectedProps.Clear();
                }
            }
        }