• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ContentRef类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



ContentRef类属于命名空间,在下文中一共展示了ContentRef类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: ScreenCaptureStream

        public ScreenCaptureStream(BlockingCollection<CapturedFrame> frames, string streamName, ContentRef<RenderTarget> output, int numberOfCachedFrames)
        {
            _frames = frames;
            _output = output;
            StreamName = streamName;

            _numberOfCachedFrames = numberOfCachedFrames;

            _pboIds[0] = GL.GenBuffer();
            _pboIds[1] = GL.GenBuffer();
        }
开发者ID:BraveSirAndrew,项目名称:DualityScreenCapturePlugin,代码行数:11,代码来源:ScreenCaptureStream.cs


示例16: GenerateSourceFilePath

 public static string GenerateSourceFilePath(ContentRef<Resource> r, string srcFileExt)
 {
     string filePath = PathHelper.MakeFilePathRelative(r.Path, DualityApp.DataDirectory);
     string fileDir = Path.GetDirectoryName(filePath);
     if (filePath.Contains(".."))
     {
         filePath = Path.GetFileName(filePath);
         fileDir = ".";
     }
     return PathHelper.GetFreePath(Path.Combine(Path.Combine(EditorHelper.SourceMediaDirectory, fileDir), r.Name), srcFileExt);
 }
开发者ID:hbcameleon,项目名称:duality,代码行数:11,代码来源:FileImportProvider.cs


示例17: SetupTilemap

        /// <summary>
        /// Prepares the specified <see cref="Tilemap"/> for user editing using the specified size.
        /// </summary>
        /// <param name="tilemap"></param>
        /// <param name="tilesetRef"></param>
        /// <param name="width"></param>
        /// <param name="height"></param>
        /// <param name="isUpperLayer"></param>
        public static void SetupTilemap(Tilemap tilemap, ContentRef<Tileset> tilesetRef, int width, int height, bool isUpperLayer)
        {
            Tileset tileset = tilesetRef.Res;

            // Determine the first tile index that matches the layer type.
            int fillTileIndex = GetDefaultTileIndex(tileset, isUpperLayer);

            // Resize the Tilemap and fill it with the first visually non-empty tile.
            tilemap.Tileset = tileset;
            tilemap.Resize(width, height);
            tilemap.BeginUpdateTiles().Fill(
                new Tile(fillTileIndex),
                0,
                0,
                tilemap.Size.X,
                tilemap.Size.Y);
            tilemap.EndUpdateTiles();
        }
开发者ID:SirePi,项目名称:duality,代码行数:26,代码来源:TilemapsSetupUtility.cs


示例18: 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


示例19: ApplyToPrefabAction

		public ApplyToPrefabAction(IEnumerable<GameObject> obj) : base(obj.Where(
			o => o != null && 
			o.PrefabLink != null && 
			o.PrefabLink.Prefab.IsAvailable))
		{
			this.targetPrefab = this.targetObj.Select(o => o.PrefabLink.Prefab).ToArray();
		}
开发者ID:ChrisLakeZA,项目名称:duality,代码行数:7,代码来源:ApplyToPrefabAction.cs


示例20: InitDefaultContent

		internal static void InitDefaultContent()
		{
			const string VirtualContentPath		= ContentProvider.VirtualContentPath + "AudioData:";
			const string ContentPath_Beep		= VirtualContentPath + "Beep";

			ContentProvider.AddContent(ContentPath_Beep, new AudioData(DefaultContent.Beep));

			Beep = ContentProvider.RequestContent<AudioData>(ContentPath_Beep);
		}
开发者ID:undue,项目名称:duality,代码行数:9,代码来源:AudioData.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ContentSection类代码示例发布时间:2022-05-24
下一篇:
C# ContentProcessorContext类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap