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

C# Quest.Element类代码示例

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

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



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


示例16: SaveObjectAndChildren

            private void SaveObjectAndChildren(GameXmlWriter writer, IEnumerable<Element> allObjects, Element e, ObjectSaver saver)
            {
                saver.StartSave(writer, e);
                IEnumerable<Element> orderedChildren = from child in allObjects
                                                       where child.Parent == e
                                                       orderby child.MetaFields[MetaFieldDefinitions.SortIndex]
                                                       select child;

                foreach (Element child in orderedChildren)
                {
                    SaveObjectAndChildren(writer, allObjects, child, saver);
                }

                saver.EndSave(writer, e);
            }
开发者ID:JatinR,项目名称:quest,代码行数:15,代码来源:ObjectSaver.cs


示例17: EditorTab

        public EditorTab(EditorDefinition parent, WorldModel worldModel, Element source)
        {
            m_controls = new Dictionary<string, IEditorControl>();
            m_caption = source.Fields.GetString("caption");
            IsTabVisibleInSimpleMode = !source.Fields.GetAsType<bool>("advanced");

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


示例18: EditorControl

        public EditorControl(EditorDefinition parent, WorldModel worldModel, Element source)
        {
            m_parent = parent;
            m_worldModel = worldModel;
            m_source = source;
            m_controlType = source.Fields.GetString("controltype");
            m_caption = source.Fields.GetString("caption");
            m_attribute = source.Fields.GetString("attribute");
            if (source.Fields.HasType<int>("height")) m_height = source.Fields.GetAsType<int>("height");
            if (source.Fields.HasType<int>("width")) m_width = source.Fields.GetAsType<int>("width");
            if (source.Fields.HasType<bool>("expand")) m_expand = source.Fields.GetAsType<bool>("expand");            
            m_visibilityHelper = new EditorVisibilityHelper(parent, worldModel, source);
            IsControlVisibleInSimpleMode = !source.Fields.GetAsType<bool>("advanced");
            m_id = source.Name;

            if (source.Fields.HasString("filtergroup"))
            {
                parent.RegisterFilter(source.Fields.GetString("filtergroup"), source.Fields.GetString("filter"), m_attribute);
            }
        }
开发者ID:JatinR,项目名称:quest,代码行数:20,代码来源:EditorControl.cs


示例19: EditorVisibilityHelper

        public EditorVisibilityHelper(EditorDefinition parent, WorldModel worldModel, Element source)
        {
            m_parent = parent;
            m_worldModel = worldModel;
            m_relatedAttribute = source.Fields.GetString("relatedattribute");
            if (m_relatedAttribute != null) m_alwaysVisible = false;
            m_visibleIfRelatedAttributeIsType = source.Fields.GetString("relatedattributedisplaytype");
            m_visibleIfElementInheritsType = source.Fields.GetAsType<QuestList<string>>("mustinherit");
            m_notVisibleIfElementInheritsType = source.Fields.GetAsType<QuestList<string>>("mustnotinherit");
            if (m_visibleIfElementInheritsType != null || m_notVisibleIfElementInheritsType != null) m_alwaysVisible = false;
            m_filterGroup = source.Fields.GetString("filtergroup");
            m_filter = source.Fields.GetString("filter");
            if (m_filter != null) m_alwaysVisible = false;

            string expression = source.Fields.GetString("onlydisplayif");
            if (expression != null)
            {
                m_visibilityExpression = new Expression<bool>(Utility.ConvertVariablesToFleeFormat(expression), new TextAdventures.Quest.Scripts.ScriptContext(worldModel, true));
                m_alwaysVisible = false;
            }
        }
开发者ID:JatinR,项目名称:quest,代码行数:21,代码来源:EditorVisibilityHelper.cs


示例20: SaveElementFields

        protected void SaveElementFields(string name, Element e, GameWriter writer)
        {
            string mappedName = e.MetaFields[MetaFieldDefinitions.MappedName];

            writer.AddLine(mappedName + " = {");
            e.Fields.Set("_js_name", mappedName);
            e.Fields.Set("_types", new QuestList<string>(e.Fields.TypeNames));

            int count = 0;
            int length = e.Fields.FieldNames.Count();

            foreach (string field in e.Fields.FieldNames)
            {
                count++;
                object value = ConvertField(e, field, e.Fields.Get(field));
                fieldSaver.Save(writer, e, field, value, count == length);
            }

            writer.AddLine("};");
            writer.AddLine(string.Format("elementsNameMap[\"{0}\"] = {1};", e.Name, e.MetaFields[MetaFieldDefinitions.MappedName]));
            writer.MarkElementWritten(e);
        }
开发者ID:jaynabonne,项目名称:quest,代码行数:22,代码来源:ElementSavers.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# TgcGeometry.TgcBoundingBox类代码示例发布时间:2022-05-26
下一篇:
C# Data.DBAccess类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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