Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
TestAsset.cs
Go to the documentation of this file.
1 using System;
2 using System.Collections.Generic;
3 
4 using SiliconStudio.Assets;
5 using SiliconStudio.Core.IO;
6 using SiliconStudio.Core.Serialization;
7 
8 using YamlDotNet.Serialization;
9 
10 namespace SiliconStudio.Paradox.Assets
11 {
12  [DataContract("TestAsset")]
13  [AssetAlias("AssetTest")]
14  [AssetFileExtension(FileExtension)]
15  [AssetFactory(typeof(TestAssetFactory))]
16  [AssetDescription("Test asset", "A test assets, containing every supported types of property.")]
17  public class TestAsset : Asset<TestAsset, AssetReference>
18  {
19  public enum TestEnum
20  {
21  DefaultValue,
22  FirstValue,
23  SecondValue,
24  ThirdValue
25  }
26 
27  public const string FileExtension = ".pdxtest";
28 
29  public TestAsset()
30  {
31  StringList = new List<string>();
32  IntList = new List<int>();
33  UPathList = new List<UPath>();
34  StringUPathDictionary = new Dictionary<string, UPath>();
35  UPathIntDictionary = new Dictionary<UPath, int>();
36  StringEnumDictionary = new Dictionary<string, TestEnum>();
37  }
38 
39  [YamlMember(10)]
40  public UPath UPathValue { get; set; }
41  [YamlMember(20)]
42  public float FloatValue { get; set; }
43  [YamlMember(30)]
44  public float? NullableFloatValue { get; set; }
45  [YamlMember(40)]
46  public bool BoolValue { get; set; }
47  [YamlMember(50)]
48  public bool? NullableBoolValue { get; set; }
49 
50  [YamlMember(60)]
51  public int IntValue { get; set; }
52  [YamlMember(70)]
53  public UInt16 UShortValue { get; set; }
54 
55  [YamlMember(80)]
56  public string StringValue { get; set; }
57 
58  [YamlMember(90)]
59  public TestEnum EnumValue { get; set; }
60  [YamlMember(100)]
61  public TestEnum NullableEnumValue { get; set; }
62 
63  [YamlMember(110)]
64  public List<string> StringList { get; set; }
65  [YamlMember(120)]
66  public List<int> IntList { get; set; }
67  [YamlMember(130)]
68  public List<UPath> UPathList { get; set; }
69  [YamlMember(140)]
70  public Dictionary<string, UPath> StringUPathDictionary { get; set; }
71  [YamlMember(150)]
72  public Dictionary<UPath, int> UPathIntDictionary { get; set; }
73  [YamlMember(160)]
74  public Dictionary<string, TestEnum> StringEnumDictionary { get; set; }
75 
76  public static TestAsset New()
77  {
78  var testAsset = new TestAsset
79  {
80  StringValue = Guid.NewGuid().ToString()
81  };
82  return testAsset;
83  }
84 
85  private class TestAssetFactory : IAssetFactory
86  {
87  public IAsset New()
88  {
89  return TestAsset.New();
90  }
91  }
92 
93  }
94 }
Base class for Asset.
Definition: Asset.cs:14
Interface to create default instance of an asset type.
Definition: IAssetFactory.cs:8
Base class that describes a uniform path and provides method to manipulate them. Concrete class are U...
Definition: UPath.cs:21
Contains user-friendly names and descriptions of an asset type.