public Dictionary<string, AsEntityTemplate> GetEntityTemplate()
	{
		if(m_dicEntityTemplate == null)
		{
			m_dicEntityTemplate = new Dictionary<string, AsEntityTemplate>();
			foreach(KeyValuePair<string, Tbl_EntityTemplate_Record> pair in EntityTemplateTable)
			{
				AsEntityTemplate entityTemplate = new AsEntityTemplate(pair.Value);
				m_dicEntityTemplate.Add(pair.Key, entityTemplate);
			}
		}
		
		return m_dicEntityTemplate;
	}
Beispiel #2
0
	bool InitByJnXml( string _path)
	{
		try
		{
			TextAsset xmlFile = Resources.Load( _path) as TextAsset;
			JnXmlReader reader = JnXmlReader.FromString( xmlFile.text);
			if( reader.Goto( "/EntityTemplate/Entity")) do
			{
				AsEntityTemplate entT = new AsEntityTemplate();
				string entityType = reader.ReadAttrAsString( "Type");

				if( reader.FirstChild( "Component"))
				{
					do
					{
						string componentName = reader.ReadAttrAsString( "Name");
						entT.m_listComponent.Add( componentName);
					}
					while( reader.NextSibling());
					reader.Parent();
				}

				if( reader.FirstChild( "AsProperty"))
				{
					do
					{
						string propertyName = reader.ReadAttrAsString( "Name");
						AsProperty prop = entT.m_PropertySet.InitProperty( propertyName, reader.ReadAttrAsString( "VarType"));
						prop.SetDefaultValueAsString( reader.ReadAttrAsString( "Default"));
					}
					while( reader.NextSibling());
					reader.Parent();
				}

				m_dicEntityTemplate.Add( entityType, entT);
			}
			while( reader.NextSibling());
		}
		catch ( System.Exception e)
		{
			Debug.Log( e.Message);
			return false;
		}

		return true;
	}