public void InEditorAssetsProtocolHandlerVerification() { // Unit tests are run in the editor (or visual studio which reports itself to be editor) string editorTestPath = ProtocolUtility.ResolvePath(@"assets://some/Asset.fbx"); Assert.IsTrue(editorTestPath.StartsWith("file://" + Application.dataPath)); }
public StationInfo(XmlNode stationNode, GameObject assetsPrototypeRoot) { // Type (Mandatory) XmlNode typeNode = stationNode.SelectSingleNode("@type"); if (typeNode != null) { mType = typeNode.InnerText; if (mType != "Hair" && mType != "Makeup" && mType != "Sewing" && mType != "Holding") { throw new Exception("Unknown Fashion Game Station Type (" + mType + ")"); } } else { throw new Exception("No type attribute found on Station node. Cannot create station info."); } // Asset (Mandatory) XmlNode assetNode = stationNode.SelectSingleNode("@asset"); if (assetNode != null) { mAssetPrototype = GameObjectUtility.GetNamedChild(assetNode.InnerText, assetsPrototypeRoot); } else { throw new Exception("No asset attribute found on Station node. Cannot create station info."); } // Time (Optional) XmlNode timeNode = stationNode.SelectSingleNode("@time"); if (timeNode != null) { mTime = Rangef.Parse(timeNode.InnerText).RandomValue(); } else { mTime = 0.0f; } // Icon (Mandatory) XmlNode imagePathNode = stationNode.SelectSingleNode("Icon/@path"); if (imagePathNode != null) { mImagePath = ProtocolUtility.ResolvePath(imagePathNode.InnerText); } else { mImagePath = null; } // Gui Offset (Optional) XmlNode guiOffsetNode = stationNode.SelectSingleNode("@guiOffset"); if (guiOffsetNode != null) { mGuiOffset = SerializationUtility.ToVector3(guiOffsetNode.InnerText); } else { mGuiOffset = Vector3.zero; } // Sounds (Optional, Multiple Supported) XmlNodeList soundNodes = stationNode.SelectNodes("ActivationSound/@path"); foreach (XmlNode soundNode in soundNodes) { mSoundPaths.Add(soundNode.InnerText); } // WorkingAnimation (Optional) XmlNode workingAnimationNode = stationNode.SelectSingleNode("WorkingAnimation/@path"); if (workingAnimationNode != null) { mWorkingAnimationPath = workingAnimationNode.InnerText; } else { mWorkingAnimationPath = null; } // IdleAnimation (Optional) XmlNode idleAnimationNode = stationNode.SelectSingleNode("IdleAnimation/@path"); if (idleAnimationNode != null) { mIdleAnimationPath = idleAnimationNode.InnerText; } else { mIdleAnimationPath = null; } }