本文整理汇总了C#中FlatRedBall.Glue.SaveClasses.ReferencedFileSave.GetContainerType方法的典型用法代码示例。如果您正苦于以下问题:C# ReferencedFileSave.GetContainerType方法的具体用法?C# ReferencedFileSave.GetContainerType怎么用?C# ReferencedFileSave.GetContainerType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FlatRedBall.Glue.SaveClasses.ReferencedFileSave
的用法示例。
在下文中一共展示了ReferencedFileSave.GetContainerType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetContentManagerString
private static string GetContentManagerString(ReferencedFileSave referencedFile)
{
string contentManagerString = "ContentManagerName";
// If the referencedFile is shared static, then this is needed in LoadStaticContent
if (referencedFile.GetContainerType() == ContainerType.Screen && referencedFile.IsSharedStatic)
{
// If the referenced file is part of a screen, then we need to use the "contentManagerName" (which is an argument to the
// LoadStaticContent method) instead of the "ContentManagerName" which is a member of the Screen. The reason is that the
// content manager for a screen is not static.
contentManagerString = "contentManagerName";
}
return contentManagerString;
}
示例2: GetLoadCallsForRfs
public static ICodeBlock GetLoadCallsForRfs(ReferencedFileSave referencedFile, string fileName, AssetTypeInfo ati, string variableName, ICodeBlock codeBlock, bool useGlobalContent, bool isContentPipeline)
{
var currentBlock = codeBlock;
if (referencedFile.IsCsvOrTreatedAsCsv == false)
{
string modifiedFileName = fileName.ToLower();
string contentManagerString = GetContentManagerString(referencedFile);
string fileNameToLoad = ProjectBase.AccessContentDirectory + modifiedFileName;
// If the file isn't part of the content pipeline we have
// to manually unload it
if (!useGlobalContent && !isContentPipeline)
{
currentBlock = currentBlock
.If(string.Format("!FlatRedBall.FlatRedBallServices.IsLoaded<{2}>(@\"{0}\", {1})", ProjectBase.AccessContentDirectory + modifiedFileName, contentManagerString, ati.QualifiedRuntimeTypeName.QualifiedType));
if (referencedFile.GetContainerType() == ContainerType.Entity)
{
currentBlock.Line("registerUnload = true;");
}
currentBlock = currentBlock.End();
}
ReferencedFileSaveCodeGenerator.GetLoadCallForAtiFile(referencedFile, ati, variableName, contentManagerString, fileNameToLoad, codeBlock);
}
return currentBlock;
}
示例3: ReferencedFileSaveToString
public static string ReferencedFileSaveToString(ReferencedFileSave instance)
{
string containerText = "";
if (instance.GetContainerType() == SaveClasses.ContainerType.None)
{
containerText = " (in GlobalContent)";
}
else
{
containerText = " (in " + instance.GetContainer() + ")";
}
return instance.Name + containerText;
}
示例4: DragAddFileToGlobalContent
private static void DragAddFileToGlobalContent(TreeNode treeNodeMoving, ReferencedFileSave referencedFileSave)
{
if (referencedFileSave.GetContainerType() == ContainerType.None)
{
// This means the user dragged a file from global content onto the global content tree node -
// we shouldn't do anything here. It's not a valid operation, but at the same time, it may have
// happened accidentally and we don't want to burden the user with popups.
}
else
{
bool isAlreadyPartOfReferencedFiles = false;
// If the file is already part of GlobalContent, then warn the user and do nothing
foreach (ReferencedFileSave fileInGlobalContent in ObjectFinder.Self.GlueProject.GlobalFiles)
{
if (fileInGlobalContent.Name == referencedFileSave.Name)
{
isAlreadyPartOfReferencedFiles = true;
break;
}
}
if (isAlreadyPartOfReferencedFiles)
{
MessageBox.Show("The file\n\n" + referencedFileSave.Name + "\n\nis already a Global Content File");
}
else
{
// If we got here, that means that the file that
// the user is dragging in to Global Content Files
// can be added to Global Content Files; however, the
// owner of the file may not be using global content. We
// should ask the user if the containing IElement should use
// global content
IElement container = referencedFileSave.GetContainer();
if (!container.UseGlobalContent)
{
string screenOrEntity = "Screen";
if (container is EntitySave)
{
screenOrEntity = "Entity";
}
DialogResult result = MessageBox.Show("The " + screenOrEntity + " " + container.ToString() +
"does not UseGlobalContent. Would you like " +
" to set UseGlobalContent to true?", "Set UseGlobalContent to true?", MessageBoxButtons.YesNo);
if (result == DialogResult.Yes)
{
container.UseGlobalContent = true;
}
}
bool useFullPathAsName = true;
ElementCommands.Self.AddReferencedFileToGlobalContent(referencedFileSave.Name, useFullPathAsName);
ContentLoadWriter.UpdateLoadGlobalContentCode();
ProjectManager.SaveProjects();
GluxCommands.Self.SaveGlux();
}
}
}
示例5: GenerateInitializationForAssetTypeInfoRfs
private static void GenerateInitializationForAssetTypeInfoRfs(ReferencedFileSave referencedFile, ICodeBlock codeBlock, bool loadsUsingGlobalContentManager, string variableName, string fileName, AssetTypeInfo ati, ProjectBase project)
{
string typeName = ati.RuntimeTypeName;
var vsProject = project as VisualStudioProject;
var isContentPipeline = (vsProject == null || vsProject.AllowContentCompile) &&
(ati.MustBeAddedToContentPipeline || referencedFile.UseContentPipeline);
if (isContentPipeline)
{
fileName = FileManager.RemoveExtension(fileName);
}
bool isSharedStatic = referencedFile.IsSharedStatic;
string referencedFileName = referencedFile.Name;
bool containedByGlobalContentFiles = GlobalContentFilesDictionary.ContainsKey(referencedFileName);
var referencedFileContainerType = referencedFile.GetContainerType();
if (isSharedStatic &&
containedByGlobalContentFiles &&
loadsUsingGlobalContentManager &&
referencedFileContainerType != ContainerType.None)
{
string globalRfsVariable = GlobalContentFilesDictionary[referencedFile.Name].GetInstanceName();
codeBlock.Line(string.Format("{0} = GlobalContent.{1};",
variableName, globalRfsVariable));
}
else
{
ContentLoadWriter.GetLoadCallsForRfs(
referencedFile, fileName, ati, variableName, codeBlock, loadsUsingGlobalContentManager && referencedFile.IsSharedStatic, isContentPipeline);
}
}
示例6: UpdateIncludedAndExcluded
private void UpdateIncludedAndExcluded(ReferencedFileSave instance)
{
ResetToDefault();
AssetTypeInfo ati = instance.GetAssetTypeInfo();
ExcludeMember("InvalidFileNameCharacters");
ExcludeMember("ToStringDelegate");
ExcludeMember("Properties");
ContainerType containerType = instance.GetContainerType();
if (containerType == ContainerType.Entity)
{
// We do this because this is set automatically if the Entity is unique
ExcludeMember("IsSharedStatic");
// We do this because whether the objects from a file are manually updated or not
// should be up to the entity, not the source file.
ExcludeMember("IsManuallyUpdated");
}
if (containerType == ContainerType.Entity || ati == null || ati.QualifiedRuntimeTypeName.QualifiedType != "Microsoft.Xna.Framework.Media.Song")
{
ExcludeMember("DestroyOnUnload");
}
#region Extension-based additions/removals
string extension = FileManager.GetExtension(instance.Name);
if (extension != "csv" && !instance.TreatAsCsv)
{
ExcludeMember("CreatesDictionary");
ExcludeMember("IsDatabaseForLocalizing");
ExcludeMember("UniformRowType");
}
else
{
IncludeMember("UniformRowType", typeof(ReferencedFileSave), new AvailablePrimitiveTypeArraysStringConverter());
}
if ((extension != "txt" && extension != "csv") ||
(extension == "txt" && instance.TreatAsCsv == false)
)
{
ExcludeMember("CsvDelimiter");
}
if (extension != "txt")
{
ExcludeMember("TreatAsCsv");
}
if (extension == "png")
{
Attribute[] fileDetailsCategoryAttribute = new Attribute[]{
new CategoryAttribute("File Details")};
IncludeMember("ImageWidth", typeof(int), null, GetImageWidth, null, fileDetailsCategoryAttribute);
IncludeMember("ImageHeight", typeof(int), null, GetImageHeight, null, fileDetailsCategoryAttribute);
}
if (extension == "emix")
{
Attribute[] fileDetailsCategoryAttribute = new Attribute[]{
new CategoryAttribute("File Details")};
IncludeMember("EquilibriumParticleCount", typeof(float), null, GetEquilibriumParticleCount, null, fileDetailsCategoryAttribute);
IncludeMember("BurstParticleCount", typeof(float), null, GetBurstParticleCount, null, fileDetailsCategoryAttribute);
}
#endregion
AddProjectSpecificFileMember();
if (!instance.LoadedAtRuntime)
{
ExcludeMember("IsSharedStatic");
ExcludeMember("IsManuallyUpdated");
ExcludeMember("LoadedOnlyWhenReferenced");
ExcludeMember("HasPublicProperty");
ExcludeMember("InstanceName");
ExcludeMember("IncludeDirectoryRelativeToContainer");
}
if (ati == null || string.IsNullOrEmpty(ati.MakeManuallyUpdatedMethod))
{
ExcludeMember("IsManuallyUpdated");
}
if (!instance.GetCanUseContentPipeline())
{
ExcludeMember("UseContentPipeline");
}
if (!instance.UseContentPipeline || ati.QualifiedRuntimeTypeName.QualifiedType != "Microsoft.Xna.Framework.Graphics.Texture2D")
{
ExcludeMember("TextureFormat");
}
//.........这里部分代码省略.........