Ejemplo n.º 1
0
        public bool UpdateLinkState(bool checkFileChanged)
        {
            PrefabLinkState lastState = this.linkState;

            ComponentNode  cmpNode = this as ComponentNode;
            GameObjectNode objNode = (cmpNode != null ? cmpNode.Parent : this) as GameObjectNode;

            PrefabLink prefabLink           = objNode != null ? objNode.Obj.AffectedByPrefabLink : null;
            bool       affectedByPrefabLink = prefabLink != null;

            if (cmpNode != null)
            {
                affectedByPrefabLink = affectedByPrefabLink && prefabLink.AffectsObject(cmpNode.Component);
            }
            if (objNode != null)
            {
                affectedByPrefabLink = affectedByPrefabLink && prefabLink.AffectsObject(objNode.Obj);
            }

            string filePath   = affectedByPrefabLink ? prefabLink.Prefab.Path : null;
            bool   fileExists = this.linkLastExisted;

            if (checkFileChanged || this.linkLastPath != filePath)
            {
                fileExists = File.Exists(filePath);
            }

            // Prefab-linked entities
            if (affectedByPrefabLink && fileExists)             //prefabLink.Prefab.IsAvailable) // Not sufficient - might be loaded but with a broken path
            {
                this.linkState = PrefabLinkState.Active;
            }
            else if (cmpNode == null && objNode.Obj.PrefabLink != null)
            {
                this.linkState = PrefabLinkState.Broken;
            }
            else
            {
                this.linkState = PrefabLinkState.None;
            }

            this.linkLastExisted = fileExists;
            this.linkLastPath    = filePath;
            return(this.linkState != lastState);
        }
Ejemplo n.º 2
0
 protected ComponentNode ScanComponent(Component cmp)
 {
     if (cmp == null) return null;
     if (!this.buttonShowComponents.Checked) return null;
     ComponentNode thisNode = new ComponentNode(cmp);
     return thisNode;
 }