当前位置: 首页>>代码示例>>C#>>正文


C# ContentRef类代码示例

本文整理汇总了C#中ContentRef的典型用法代码示例。如果您正苦于以下问题:C# ContentRef类的具体用法?C# ContentRef怎么用?C# ContentRef使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ContentRef类属于命名空间,在下文中一共展示了ContentRef类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DrawTechnique

 /// <summary>
 /// Creates a new DrawTechnique using the specified <see cref="BlendMode"/> and <see cref="Duality.Resources.ShaderProgram"/>.
 /// </summary>
 /// <param name="blendType"></param>
 /// <param name="shader"></param>
 /// <param name="formatPref"></param>
 public DrawTechnique(BlendMode blendType, ContentRef<ShaderProgram> shader, VertexDeclaration formatPref = null)
 {
     this.blendType = blendType;
     this.shader = shader;
     this.prefFormat = formatPref;
     this.prefType = formatPref != null ? formatPref.DataType : null;
 }
开发者ID:SirePi,项目名称:duality,代码行数:13,代码来源:DrawTechnique.cs

示例2: ReImportFile

 public void ReImportFile(ContentRef<Resource> r, string srcFile)
 {
     PixelData pixelData = LoadPixelData(srcFile);
     Pixmap res = r.Res as Pixmap;
     res.MainLayer = pixelData;
     res.SourcePath = srcFile;
 }
开发者ID:ninja2003,项目名称:duality,代码行数:7,代码来源:PixmapFileImporter.cs

示例3: CreatureContainer

 public CreatureContainer(CreatureType type, bool forwardOnSpecial, ContentRef<Material> combatSprite, params NameOfAbility[] abilities)
 {
     this.CombatSprite = combatSprite;
     this.forwardOnSpecial = forwardOnSpecial;
     this.CreatureType = type;
     this.AbilityNameStorage = new List<NameOfAbility>(abilities);
 }
开发者ID:ellertsmari,项目名称:testrepo2,代码行数:7,代码来源:CreatureContainer.cs

示例4: SoundInstance

 internal SoundInstance(ContentRef<Sound> sound, GameObject attachObj)
 {
     this.attachedTo = attachObj;
     this.is3D = true;
     this.sound = sound;
     this.audioData = this.sound.IsAvailable ? this.sound.Res.FetchData() : null;
 }
开发者ID:ninja2003,项目名称:duality,代码行数:7,代码来源:SoundInstance.cs

示例5: ReImportFile

 public void ReImportFile(ContentRef<Resource> r, string srcFile)
 {
     Font font = r.Res as Font;
     font.SourcePath = srcFile;
     font.EmbeddedTrueTypeFont = File.ReadAllBytes(srcFile);
     font.RenderGlyphs();
 }
开发者ID:ninja2003,项目名称:duality,代码行数:7,代码来源:FontFileImporter.cs

示例6: ApplyToPrefabAction

 public ApplyToPrefabAction(GameObject obj, ContentRef<Prefab> target)
     : base(new[] { obj })
 {
     this.targetPrefab = new ContentRef<Prefab>[this.targetObj.Length];
     for (int i = 0; i < this.targetPrefab.Length; i++)
         this.targetPrefab[i] = target;
 }
开发者ID:SirePi,项目名称:duality,代码行数:7,代码来源:ApplyToPrefabAction.cs

示例7: TilesetSelectionChangedEventArgs

 public TilesetSelectionChangedEventArgs(ContentRef<Tileset> prev, ContentRef<Tileset> next, SelectionChangeReason reason)
     : base()
 {
     this.prev = prev;
     this.next = next;
     this.reason = reason;
 }
开发者ID:SirePi,项目名称:duality,代码行数:7,代码来源:TilesetSelectionChangedEventArgs.cs

示例8: Switch

 // We are going to use ContentRefs instead of using Scene Resources directly
 /// <summary>
 /// Function to switch to another scene.
 /// </summary>
 /// <param name="scene">The ContentRef of the scene to switch to.</param>
 public static void Switch(ContentRef<Scene> scene)
 {
     // Note that we are not doing any scene disposal here. This means that
     // the current scene will not be removed from memory, and that it will
     // retain changes made to it.
     Scene.SwitchTo(scene);
 }
开发者ID:hsnabn,项目名称:duality-samples,代码行数:12,代码来源:SceneSwitcher.cs

示例9: SaveSceneCopy

        /// <summary>
        /// Function to save a copy of the specified scene.
        /// </summary>
        /// <param name="scene">The scene to be saved.</param>
        public static void SaveSceneCopy(ContentRef<Scene> scene)
        {
            // This is the path to which the file will be saved. It is constructed by
            // combining the Duality Data directory path with the sample name, which
            // results in the actual directory the file will be saved to.
            // This result is concatenated with the actual file name.
            // The file name is constructed by concatenating the specified scene's name,
            // along with "_Copy" and the Scene Resource file extension.
            string filePath = Duality.IO.PathOp.Combine(DualityApp.DataDirectory, "SceneTransitions")
                                + (scene.Name + "_Copy" + Resource.GetFileExtByType<Scene>());

            // Here we save the scene.
            scene.Res.Save(filePath);

            // The "Press to save" object's TextRenderer.
            TextRenderer textRenderer = scene.Res.FindGameObject("Text5").GetComponent<TextRenderer>();

            // Set the "Press to save" object's TextRenderer's source text and color tint,
            // if the TextRenderer was found.
            if (textRenderer != null)
            {
                textRenderer.Text.ApplySource("The saved scene can be found in the Duality Data directory.");
                textRenderer.ColorTint = ColorRgba.Green;
            }
        }
开发者ID:hsnabn,项目名称:duality-samples,代码行数:29,代码来源:SceneSwitcher.cs

示例10: CreateFromAudioData

		/// <summary>
		/// Creates a new Sound Resource based on the specified AudioData, saves it and returns a reference to it.
		/// </summary>
		/// <param name="baseRes"></param>
		/// <returns></returns>
		public static ContentRef<Sound> CreateFromAudioData(ContentRef<AudioData> baseRes)
		{
			string resPath = PathHelper.GetFreePath(baseRes.FullName, FileExt);
			Sound res = new Sound(baseRes);
			res.Save(resPath);
			return res;
		}
开发者ID:KSLcom,项目名称:duality,代码行数:12,代码来源:Sound.cs

示例11: ReImportFile

 public void ReImportFile(ContentRef<Resource> r, string srcFile)
 {
     AbstractShader s = r.Res as AbstractShader;
     string sourceCode = File.ReadAllText(srcFile);
     s.Source = sourceCode;
     s.SourcePath = srcFile;
     s.Compile();
 }
开发者ID:ninja2003,项目名称:duality,代码行数:8,代码来源:ShaderFileImporter.cs

示例12: CanReImportFile

 public bool CanReImportFile(ContentRef<Resource> r, string srcFile)
 {
     string ext = Path.GetExtension(srcFile);
     if (r.Is<VertexShader>() && string.Equals(ext, SourceFileExtVertex, StringComparison.InvariantCultureIgnoreCase))
         return true;
     else if (r.Is<FragmentShader>() && string.Equals(ext, SourceFileExtFragment, StringComparison.InvariantCultureIgnoreCase))
         return true;
     else
         return false;
 }
开发者ID:sinithwar,项目名称:duality,代码行数:10,代码来源:ShaderFileImporter.cs

示例13: SceneContainsTileset

        public static bool SceneContainsTileset(Scene scene, ContentRef<Tileset> tileset)
        {
            foreach (Tilemap tilemap in scene.FindComponents<Tilemap>())
            {
                if (tilemap.Tileset == tileset)
                    return true;
            }

            return false;
        }
开发者ID:SirePi,项目名称:duality,代码行数:10,代码来源:TilemapsEditorSelectionParser.cs

示例14: DisposeAndSwitch

        /// <summary>
        /// Function to switch to another scene after disposing the specified scene.
        /// </summary>
        /// <param name="nextScene">The ContentRef of the scene to dispose.</param>
        /// <param name="nextScene">The ContentRef of the scene to switch to.</param>
        public static void DisposeAndSwitch(ContentRef<Scene> disposeScene, 
                                            ContentRef<Scene> nextScene)
        {
            // In this function, the current scene will be disposed, or removed
            // from memory, before the switch to the next scene commences.

            // We are using DisposeLater() for safety, it will only dispose the
            // scene after the current update cycle is over.
            disposeScene.Res.DisposeLater();
            Scene.SwitchTo(nextScene);
        }
开发者ID:hsnabn,项目名称:duality-samples,代码行数:16,代码来源:SceneSwitcher.cs

示例15: InitDefaultContent

		internal static void InitDefaultContent()
		{
			const string VirtualContentPath				= ContentProvider.VirtualContentPath + "Texture:";
			const string ContentPath_DualityIcon		= VirtualContentPath + "DualityIcon";
			const string ContentPath_DualityIconB		= VirtualContentPath + "DualityIconB";
			const string ContentPath_DualityLogoBig		= VirtualContentPath + "DualityLogoBig";
			const string ContentPath_DualityLogoMedium	= VirtualContentPath + "DualityLogoMedium";
			const string ContentPath_DualityLogoSmall	= VirtualContentPath + "DualityLogoSmall";
			const string ContentPath_White				= VirtualContentPath + "White";
			const string ContentPath_Checkerboard		= VirtualContentPath + "Checkerboard";

			ContentProvider.AddContent(ContentPath_DualityIcon, new Texture(Pixmap.DualityIcon));
			ContentProvider.AddContent(ContentPath_DualityIconB, new Texture(Pixmap.DualityIconB));
			ContentProvider.AddContent(ContentPath_DualityLogoBig, new Texture(Pixmap.DualityLogoBig));
			ContentProvider.AddContent(ContentPath_DualityLogoMedium, new Texture(Pixmap.DualityLogoMedium));
			ContentProvider.AddContent(ContentPath_DualityLogoSmall, new Texture(Pixmap.DualityLogoSmall));
			ContentProvider.AddContent(ContentPath_White, new Texture(Pixmap.White));
			ContentProvider.AddContent(ContentPath_Checkerboard, new Texture(Pixmap.Checkerboard, wrapX: TextureWrapMode.Repeat, wrapY: TextureWrapMode.Repeat));

			DualityIcon			= ContentProvider.RequestContent<Texture>(ContentPath_DualityIcon);
			DualityIconB		= ContentProvider.RequestContent<Texture>(ContentPath_DualityIconB);
			DualityLogoBig		= ContentProvider.RequestContent<Texture>(ContentPath_DualityLogoBig);
			DualityLogoMedium	= ContentProvider.RequestContent<Texture>(ContentPath_DualityLogoMedium);
			DualityLogoSmall	= ContentProvider.RequestContent<Texture>(ContentPath_DualityLogoSmall);
			White				= ContentProvider.RequestContent<Texture>(ContentPath_White);
			Checkerboard		= ContentProvider.RequestContent<Texture>(ContentPath_Checkerboard);
		}
开发者ID:swtrse,项目名称:duality,代码行数:27,代码来源:Texture.cs


注:本文中的ContentRef类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。