protected override void Logic(ValidationTarget target)
        {
            var assets = target.GetAllAssets();

            List <Object> foundAssets = new List <Object>();

            foreach (var asset in assets)
            {
                if (asset.GetType() == type &&
                    !excludedAssetGUIDs.Contains(GetGUID(asset)))
                {
                    foundAssets.Add(asset);
                }
            }

            if (foundAssets.Count > limit)
            {
                var message  = LocalizedMessage.Get("AssetTypeLimitRule.Overuse", type.Name, limit, foundAssets.Count);
                var solution = LocalizedMessage.Get("AssetTypeLimitRule.Overuse.Solution", type.Name);

                AddIssue(new Issue(
                             null,
                             IssueLevel.Error,
                             message,
                             solution));
            }
        }
Exemplo n.º 2
0
        protected override void Logic(ValidationTarget target)
        {
            foreach (var asset in target.GetAllAssets())
            {
                var clip = asset as AnimationClip;
                if (clip == null)
                {
                    continue;
                }

                LogicForAnimationClip(clip);
            }
        }
        protected override void Logic(ValidationTarget target)
        {
            AddIssue(new Issue(
                         null,
                         IssueLevel.Info,
                         "gameObjects = " + ArrayToString(target.GetAllObjects())
                         ));

            AddIssue(new Issue(
                         null,
                         IssueLevel.Info,
                         "assets = " + ArrayToString(target.GetAllAssets())
                         ));
        }
Exemplo n.º 4
0
        protected override void Logic(ValidationTarget target)
        {
            var rootObjects  = target.GetRootObjects();
            var rootPath     = target.GetBaseFolderPath();
            var assetObjects = target.GetAllAssets();
            var assetPaths   = target.GetAllAssetPaths();

            for (var i = 0; i < assetObjects.Length; i++)
            {
                var asset = assetObjects[i];
                var path  = assetPaths[i];
                if (!(path.IndexOf(rootPath, StringComparison.Ordinal) == 0 && path.Length > rootPath.Length))
                {
                    continue;
                }
                var localPath = path.Substring(rootPath.Length + 1);
                // UdonScript以下のみ探索
                if (localPath.IndexOf(_scriptAssetPath, StringComparison.Ordinal) == 0 && asset is MonoScript src)
                {
                    // U# スクリプトは UdonSharpBehaviour を直接継承していなければならない
                    Type srcType  = src.GetClass();
                    var  baseType = srcType.UnderlyingSystemType.BaseType;
                    if (baseType == null || baseType.FullName != _baseClassName)
                    {
                        AddIssue(new Issue(asset, IssueLevel.Error, LocalizedMessage.Get("UdonSharpScriptNamespaceRule.NotUdonSharp", src.GetClass())));
                    }
                    // U# スクリプトは 正しい名前空間で定義されなければならない
                    if (srcType.Namespace == null || srcType.Namespace.IndexOf(namespaceString, StringComparison.Ordinal) == -1)
                    {
                        AddIssue(
                            new Issue(
                                asset,
                                IssueLevel.Error,
                                LocalizedMessage.Get("UdonSharpScriptNamespaceRule.InvalidNamespace"),
                                LocalizedMessage.Get("UdonSharpScriptNamespaceRule.InvalidNamespace.solution", src.GetClass())
                                )
                            );
                    }
                }
            }
        }