feat(Materials): 更新CoreBattleGround材质贴图和缩放参数
更换了CoreBattleGround材质的主纹理,将纹理GUID从73e4d6cf089824c0cadfcefa5b15d306
更新为c6af6f473739fb546ac7775e5c957da1,并调整纹理缩放参数从{x: 3, y: 4}修改为
{x: 1, y: 1},同时移除了多余的_MetallicGlossMap配置项。
```
42 lines
1.7 KiB
C#
42 lines
1.7 KiB
C#
using System.Linq;
|
|
using Codely.Microsoft.CodeAnalysis;
|
|
using Codely.Microsoft.CodeAnalysis.CSharp;
|
|
using Codely.Microsoft.CodeAnalysis.CSharp.Syntax;
|
|
using Codely.Microsoft.CodeAnalysis.Text;
|
|
using SyntaxTree = Codely.Microsoft.CodeAnalysis.SyntaxTree;
|
|
|
|
namespace UnityTcp.Editor.Tools
|
|
{
|
|
internal static class ScriptSyntaxUtils
|
|
{
|
|
internal static SyntaxTree InsertTextAtLocation(this SyntaxTree tree, Location location, string text)
|
|
{
|
|
var lineSpan = location.GetLineSpan().Span;
|
|
var sourceText = SourceText.From(tree.ToString());
|
|
var position = sourceText.Lines.GetPosition(lineSpan.Start);
|
|
var newSource = tree.ToString().Insert(position, text);
|
|
return SyntaxFactory.ParseSyntaxTree(newSource);
|
|
}
|
|
|
|
internal static SyntaxTree AddUsingAliasDirective(this SyntaxTree tree, string namespaceName, string aliasName)
|
|
{
|
|
if (!(tree.GetRoot() is CompilationUnitSyntax root))
|
|
return tree;
|
|
|
|
bool exists = root.Usings.Any(u =>
|
|
u.Name.ToString() == namespaceName && u.Alias?.Name.ToString() == aliasName);
|
|
if (exists)
|
|
return tree;
|
|
|
|
var usingDirective = SyntaxFactory
|
|
.UsingDirective(SyntaxFactory.ParseName(namespaceName))
|
|
.WithAlias(SyntaxFactory.NameEquals(SyntaxFactory.IdentifierName(aliasName)))
|
|
.NormalizeWhitespace()
|
|
.WithTrailingTrivia(SyntaxFactory.CarriageReturnLineFeed);
|
|
|
|
var newRoot = root.AddUsings(usingDirective).NormalizeWhitespace();
|
|
return CSharpSyntaxTree.Create(newRoot);
|
|
}
|
|
}
|
|
}
|