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


C# Quest.Element类代码示例

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


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

示例1: EditableCommandPattern

 public EditableCommandPattern(EditorController controller, EditorCommandPattern pattern, Element parent, string attribute)
 {
     m_pattern = pattern;
     m_controller = controller;
     m_parent = parent;
     m_attribute = attribute;
 }
开发者ID:JatinR,项目名称:quest,代码行数:7,代码来源:EditableCommandPattern.cs

示例2: Save

 public override void Save(GameXmlWriter writer, Element e)
 {
     writer.WriteStartElement("template");
     writer.WriteAttributeString("name", e.Fields[FieldDefinitions.TemplateName]);
     writer.WriteString(e.Fields[FieldDefinitions.Text]);
     writer.WriteEndElement();
 }
开发者ID:JatinR,项目名称:quest,代码行数:7,代码来源:ElementSavers.cs

示例3: EditableObjectReference

 public EditableObjectReference(EditorController controller, Element obj, Element parent, string attribute)
 {
     m_object = obj;
     m_controller = controller;
     m_parent = parent;
     m_attribute = attribute;
 }
开发者ID:JatinR,项目名称:quest,代码行数:7,代码来源:EditableObjectReference.cs

示例4: Add

        public void Add(ElementType t, string key, Element e)
        {
            if (string.IsNullOrEmpty(key))
            {
                throw new ArgumentException("Invalid object name");
            }

            if (m_allElements.ContainsKey(key))
            {
                // An element with this name already exists. This is OK if the new element
                // is of the same type - then it will just override the previous element.

                if (!m_elements[t].ContainsKey(key))
                {
                    throw new Exception(string.Format(
                        "Element '{0}' of type '{1}' cannot override the existing element of type '{2}'",
                        key,
                        t,
                        m_allElements[key].ElemType));
                }

                // element is being overridden, so detach the event handler
                m_allElements[key].Fields.NameChanged -= ElementNameChanged;

                // remove old element from ordered elements list
                m_elementsLists[t].Remove(m_elements[t][key]);
            }

            m_allElements[key] = e;
            m_elements[t][key] = e;
            m_elementsLists[t].Add(e);

            e.Fields.NameChanged += ElementNameChanged;
        }
开发者ID:JatinR,项目名称:quest,代码行数:34,代码来源:Elements.cs

示例5: EditorDefinition

        public EditorDefinition(WorldModel worldModel, Element source)
        {
            m_tabs = new Dictionary<string, IEditorTab>();
            m_controls = new Dictionary<string, IEditorControl>();
            m_appliesTo = source.Fields.GetString("appliesto");
            m_pattern = source.Fields.GetString("pattern");
            m_originalPattern = source.Fields.GetString(FieldDefinitions.OriginalPattern.Property);
            m_description = source.Fields.GetString("description");
            m_create = source.Fields.GetString("create");
            m_expressionType = source.Fields.GetString("expressiontype");

            foreach (Element e in worldModel.Elements.GetElements(ElementType.EditorTab))
            {
                if (e.Parent == source)
                {
                    m_tabs.Add(e.Name, new EditorTab(this, worldModel, e));
                }
            }

            foreach (Element e in worldModel.Elements.GetElements(ElementType.EditorControl))
            {
                if (e.Parent == source)
                {
                    m_controls.Add(e.Name, new EditorControl(this, worldModel, e));
                }
            }
        }
开发者ID:JatinR,项目名称:quest,代码行数:27,代码来源:EditorDefinition.cs

示例6: CreateObject

 public Element CreateObject(string name, Element parent, ObjectType type)
 {
     Element result = CreateElement(ElementType.Object, name);
     result.Parent = parent;
     result.Type = type;
     result.Fields.AddTypeName(m_defaultTypeNames[type]);
     return result;
 }
开发者ID:jaynabonne,项目名称:quest,代码行数:8,代码来源:ElementFactory.cs

示例7: GetPostElementScript

 public string GetPostElementScript(Element element)
 {
     if (!postElementScript.ContainsKey(element))
     {
         return string.Empty;
     }
     return postElementScript[element];
 }
开发者ID:jaynabonne,项目名称:quest,代码行数:8,代码来源:GameWriter.cs

示例8: EditorData

        public EditorData(Element element, EditorController controller)
        {
            m_element = element;
            m_controller = controller;

            element.Fields.AttributeChanged += Fields_AttributeChanged;
            element.Fields.AttributeChangedSilent += Fields_AttributeChanged;
        }
开发者ID:JatinR,项目名称:quest,代码行数:8,代码来源:EditorData.cs

示例9: Setup

        public void Setup()
        {
            m_worldModel = new WorldModel();

            a = m_worldModel.GetElementFactory(ElementType.Object).Create("a");
            b = m_worldModel.GetElementFactory(ElementType.Object).Create("b");
            c = m_worldModel.GetElementFactory(ElementType.Object).Create("c");
        }
开发者ID:JatinR,项目名称:quest,代码行数:8,代码来源:QuestListTest.cs

示例10: CreateElement

 public Element CreateElement(ElementType type, string name)
 {
     string mappedName = m_loader.NameMapper.AddToMap(name);
     Element result = new Element(type, m_loader);
     result.Name = name;
     result.MetaFields[MetaFieldDefinitions.MappedName] = mappedName;
     m_loader.AddElement(result);
     return result;
 }
开发者ID:jaynabonne,项目名称:quest,代码行数:9,代码来源:ElementFactory.cs

示例11: Save

 public void Save(Element e, GameWriter writer)
 {
     string paramNames = string.Join(", ", e.Fields[FieldDefinitions.ParamNames]);
     paramNames = Utility.ReplaceReservedVariableNames(paramNames);
     writer.AddLine("function " + e.Name.Replace(" ", Utility.SpaceReplacementString) + "(" + paramNames + ")");
     writer.AddLine("{");
     writer.AddLine(e.Fields[FieldDefinitions.Script].Save());
     writer.AddLine("}");
 }
开发者ID:jaynabonne,项目名称:quest,代码行数:9,代码来源:FunctionSaver.cs

示例12: AddPostElementScript

        public void AddPostElementScript(Element element, string script)
        {
            string result = string.Empty;
            if (postElementScript.ContainsKey(element))
            {
                result = postElementScript[element] + Environment.NewLine;
            }
            result += script;

            postElementScript[element] = result;
        }
开发者ID:jaynabonne,项目名称:quest,代码行数:11,代码来源:GameWriter.cs

示例13: Setup

        public void Setup()
        {
            m_worldModel = new WorldModel();

            m_object = m_worldModel.GetElementFactory(ElementType.Object).Create("object");
            var list = new QuestList<object> {"string1"};
            var dictionary = new QuestDictionary<object> {{"key1", "nested string"}};
            list.Add(dictionary);
            m_object.Fields.Set("list", list);
            m_object.Fields.Resolve(null);
        }
开发者ID:JatinR,项目名称:quest,代码行数:11,代码来源:ComplexTypesTests.cs

示例14: Setup

        public void Setup()
        {
            m_worldModel = new WorldModel();

            m_original = m_worldModel.GetElementFactory(ElementType.Object).Create("original");
            m_original.Fields.Set(attributeName, attributeValue);
            m_original.Fields.Set(listAttributeName, new QuestList<string>(listAttributeValue));
            m_original.Fields.Resolve(null);
            Assert.AreEqual(attributeValue, m_original.Fields.GetString(attributeName));
            Assert.AreEqual(3, m_original.Fields.GetAsType<QuestList<string>>(listAttributeName).Count);
        }
开发者ID:JatinR,项目名称:quest,代码行数:11,代码来源:CloneTests.cs

示例15: EditableScriptData

 public EditableScriptData(Element editor, WorldModel worldModel)
 {
     DisplayString = editor.Fields.GetString("display");
     Category = editor.Fields.GetString("category");
     CreateString = editor.Fields.GetString("create");
     AdderDisplayString = editor.Fields.GetString("add");
     IsVisibleInSimpleMode = !editor.Fields.GetAsType<bool>("advanced");
     IsDesktopOnly = editor.Fields.GetAsType<bool>("desktop");
     CommonButton = editor.Fields.GetString("common");
     var expression = editor.Fields.GetString("onlydisplayif");
     if (expression != null)
     {
         m_visibilityExpression = new Expression<bool>(Utility.ConvertVariablesToFleeFormat(expression), new ScriptContext(worldModel, true));
     }
 }
开发者ID:JatinR,项目名称:quest,代码行数:15,代码来源:EditableScriptFactory.cs


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