/// <summary> /// Assign or insert a template into the manager. /// </summary> /// <param name="templatename"></param> /// <param name="templ"></param> public void SetTemplate(string templatename, BaseTemplate templ) { if (templ.Type == ETemplateType.Character) { if (m_charTemplates.ContainsKey(templatename)) { m_charTemplates[templatename] = (CharacterTemplate)templ; } else { m_charTemplates.Add(templatename, (CharacterTemplate)templ); } } else if (templ.Type == ETemplateType.Object) { if (m_objTemplates.ContainsKey(templatename)) { m_objTemplates[templatename] = (ObjectTemplate)templ; } else { m_objTemplates.Add(templatename, (ObjectTemplate)templ); } } else { throw new NotImplementedException(); } }
/// <summary> /// Find a named template in the list of global templates and returns the basetemplate. /// </summary> /// <param name="name">Name of the template to find.</param> /// <returns>BaseTemplate found, or null if not found.</returns> public BaseTemplate FindTemplate(string name) { BaseTemplate found = null; if (m_objTemplates.ContainsKey(name)) { found = m_objTemplates[name]; } else if (m_charTemplates.ContainsKey(name)) { found = m_charTemplates[name]; } else { DiagManager.Instance.LogInfo(String.Format("TemplateManager.FindTemplate({0}): Couldn't find template {0}!", name)); } return(found); }