Beispiel #1
0
    private void PreviewName()
    {
        GUIHorizontalGroup(() =>
        {
            GUILayout.Label("File Name");
            int selection = EditorGUILayout.Popup(_jsonSelection, _jsonContent);
            if (selection != _jsonSelection)
            {
                _jsonSelection = selection;
                if (_jsonSelection != 0)
                {
                    HexTileModel data = LoadHexTileModel(_jsonContent[_jsonSelection].text);
                    if (data != null)
                    {
                        _textureIndex = IndexOfTexture(data.TextureName);
                        UpdateTexture(_textureContent[_textureIndex].text);
                        _movementCost  = data.MovementCost;
                        _defenseRating = data.DefenseRating;
                        _terrainType   = data.TerrainType;
                        _scale         = data.Scale.Convert();
                        UpdateScale();
                    }
                }
                _filename = "Hex_" + _textureContent[_textureIndex].text;
            }

            EditorGUILayout.LabelField(_filename, EditorStyles.textArea);
        });
    }
Beispiel #2
0
    private void PreviewDetails()
    {
        GUILayout.Label("Preview Details");
        GUIHorizontalGroup(() =>
        {
            GUILayout.Label("MovementCost:");
            int movement = EditorGUILayout.DelayedIntField(_movementCost);
            if (movement != _movementCost)
            {
                _canSave      = true;
                _movementCost = movement;
                _hexTile.Model.MovementCost = _movementCost;
            }
        });

        GUIHorizontalGroup(() =>
        {
            GUILayout.Label("DefenseRating:");
            int defense = EditorGUILayout.DelayedIntField(_defenseRating);
            if (defense != _defenseRating)
            {
                _canSave       = true;
                _defenseRating = defense;
                _hexTile.Model.DefenseRating = _defenseRating;
            }
        });

        GUIHorizontalGroup(() =>
        {
            GUILayout.Label("TerrainType:");
            System.Enum selection = EditorGUILayout.EnumPopup(_terrainType);
            if ((TerrainType)selection != _terrainType)
            {
                _canSave     = true;
                _terrainType = (TerrainType)selection;
                _hexTile.Model.TerrainType = _terrainType;
            }
        });
    }