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

C# SaveClasses.NamedObjectSave类代码示例

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

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



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

示例1: Initialize

        public void Initialize()
        {
            OverallInitializer.Initialize();

            mBaseEntity = new EntitySave();
            mBaseEntity.Name = "BaseEntityInheritanceTests";
            ObjectFinder.Self.GlueProject.Entities.Add(mBaseEntity);

            NamedObjectSave nos = new NamedObjectSave();
            nos.InstanceName = "SpriteInstance";
            nos.SourceType = SourceType.FlatRedBallType;
            nos.SourceClassType = "Sprite";
            nos.SetByDerived = true;
            mBaseEntity.NamedObjects.Add(nos);

            nos = new NamedObjectSave();
            nos.InstanceName = "RectInstance";
            nos.SourceType = SourceType.FlatRedBallType;
            nos.SourceClassType = "AxisAlignedRectangle";
            nos.ExposedInDerived = true;
            mBaseEntity.NamedObjects.Add(nos);

            mDerivedEntity = new EntitySave();
            mDerivedEntity.Name = "DerivedentityInheritanceTests";
            mDerivedEntity.BaseEntity = mBaseEntity.Name;
            mDerivedEntity.UpdateFromBaseType();
            ObjectFinder.Self.GlueProject.Entities.Add(mDerivedEntity);

            mDerivedElementRuntime = new ElementRuntime(mDerivedEntity, null, null, null, null);
        }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:30,代码来源:InheritanceTests.cs


示例2: CreateEntitySaves

        private void CreateEntitySaves()
        {
            mEntitySave = new EntitySave();
            mEntitySave.Name = "StateTestEntity";

            ObjectFinder.Self.GlueProject.Entities.Add(mEntitySave);

            CreateNamedObjectWithSetVariable();

            CreateEntityVariables();

            CreateEntitySaveState();

            mContainer = new EntitySave();
            mContainer.Name = "StateTestContainerEntity";


            NamedObjectSave nos = new NamedObjectSave();
            nos.InstanceName = mEntitySave.Name + "Instance";
            nos.SourceType = SourceType.Entity;
            nos.SourceClassType = mEntitySave.Name;
            mContainer.NamedObjects.Add(nos);


            CustomVariable stateTunnel = new CustomVariable();
            stateTunnel.SourceObject = nos.InstanceName;
            stateTunnel.SourceObjectProperty = "CurrentState";
            stateTunnel.Type = "VariableState";
            stateTunnel.Name = "StateTunnelVariable";
            mContainer.CustomVariables.Add(stateTunnel);

            CreateContainerEntityState();

        }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:34,代码来源:StateTests.cs


示例3: AddVariablesForAllProperties

        public virtual void AddVariablesForAllProperties(object saveObject, NamedObjectSave toAddTo)
        {
            toAddTo.InstructionSaves.Clear();

            foreach (var field in saveObject.GetType().GetFields(BindingFlags.Public | BindingFlags.Instance))
            {
                object currentValue = field.GetValue(saveObject);

                if (!MemberInvestigator.IsDefault(saveObject, field.Name, currentValue))
                {
                    string memberName = field.Name;

                    AddVariableToNos(toAddTo, memberName, currentValue);
                }
            }

            foreach (var property in saveObject.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance))
            {
                object currentValue = property.GetValue(saveObject, null);

                if (!MemberInvestigator.IsDefault(saveObject, property.Name, currentValue))
                {
                    string memberName = property.Name;

                    AddVariableToNos(toAddTo, memberName, currentValue);
                }
            }
        }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:28,代码来源:GeneralSaveConverter.cs


示例4: AddVariableToNos

 protected virtual void AddVariableToNos(NamedObjectSave toReturn, string memberName, object currentValue)
 {
     CustomVariableInNamedObject cvino = new CustomVariableInNamedObject();
     cvino.Member = memberName;
     cvino.Value = currentValue;
     toReturn.InstructionSaves.Add(cvino);
 }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:7,代码来源:GeneralSaveConverter.cs


示例5: CreateContainerEntitySave

        private void CreateContainerEntitySave()
        {
            mEntitySaveInstance = new NamedObjectSave();
            mEntitySaveInstance.InstanceName = "StateEntityInstance";
            mEntitySaveInstance.SourceType = SourceType.Entity;
            mEntitySaveInstance.SourceClassType = mEntitySave.Name;

            mDerivedSaveInstance = new NamedObjectSave();
            mDerivedSaveInstance.InstanceName = "StateDerivedEntityInstance";
            mDerivedSaveInstance.SourceType = SourceType.Entity;
            mDerivedSaveInstance.SourceClassType = mDerivedEntitySave.Name;

            mContainerEntitySave = new EntitySave();
            mContainerEntitySave.Name = "StateEntityContainer";

            mContainerEntitySave.NamedObjects.Add(mEntitySaveInstance);
            mContainerEntitySave.NamedObjects.Add(mDerivedSaveInstance);


            mTunneledUncategorizedStateInContainer = new CustomVariable();
            mTunneledUncategorizedStateInContainer.Name = "TunneledUncategorizedStateVariable";
            mTunneledUncategorizedStateInContainer.SourceObject = mEntitySaveInstance.InstanceName;
            mTunneledUncategorizedStateInContainer.SourceObjectProperty = mRenamedExposedUncategorizedStateVariable.Name;
            mContainerEntitySave.CustomVariables.Add(mTunneledUncategorizedStateInContainer);


            ObjectFinder.Self.GlueProject.Entities.Add(mContainerEntitySave);

            
        }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:30,代码来源:StateTests.cs


示例6: PerformStandardVariableAssignments

        private static void PerformStandardVariableAssignments(NamedObjectSave instance, TypedMemberBase typedMember, object value, DataGridItem instanceMember, Type memberType)
        {
            // If we ignore the next refresh, then AnimationChains won't update when the user
            // picks an AnimationChainList from a combo box:
            //RefreshLogic.IgnoreNextRefresh();
            GlueCommands.Self.GluxCommands.SetVariableOn(
                instance,
                typedMember.MemberName,
                memberType,
                value);


            GlueCommands.Self.RefreshCommands.RefreshPropertyGrid();

            // let's make the UI faster:

            // Get this on the UI thread, but use it in the async call below
            var currentElement = GlueState.Self.CurrentElement;

            TaskManager.Self.AddAsyncTask(() =>
            {
                GlueCommands.Self.GluxCommands.SaveGlux();

                GlueCommands.Self.GenerateCodeCommands.GenerateElementCode(currentElement);
            },
            "Saving .glux and regenerating the code for the current element");
        }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:27,代码来源:NamedObjectVariableChangeLogic.cs


示例7: AssignTextureCoordinateValues

        private static void AssignTextureCoordinateValues(TextureCoordinateSelectionWindow selectionWindow, NamedObjectSave nos)
        {
            var texture = selectionWindow.CurrentTexture;
            var rectangle = selectionWindow.RectangleSelector;

            if (texture != null)
            {
                GlueCommands.Self.GluxCommands.SetVariableOn(
                    nos,
                    "LeftTexturePixel",
                    typeof(float),
                    rectangle.Left);

                GlueCommands.Self.GluxCommands.SetVariableOn(
                    nos,
                    "RightTexturePixel",
                    typeof(float),
                    rectangle.Right);

                GlueCommands.Self.GluxCommands.SetVariableOn(
                    nos,
                    "TopTexturePixel",
                    typeof(float),
                    rectangle.Top);

                GlueCommands.Self.GluxCommands.SetVariableOn(
                    nos,
                    "BottomTexturePixel",
                    typeof(float),
                    rectangle.Bottom);
            }
        }
开发者ID:gitter-badger,项目名称:FlatRedBall,代码行数:32,代码来源:TextureCoordinateSelectionLogic.cs


示例8: TryToRemoveInvalidState

        private static void TryToRemoveInvalidState(this GlueProjectSave glueProjectSave, bool showPopupsOnFixedErrors, IElement containingElement, NamedObjectSave nos)
        {
            if (nos.SourceType == SourceType.Entity && !string.IsNullOrEmpty(nos.SourceClassType) && !string.IsNullOrEmpty(nos.CurrentState))
            {
                EntitySave foundEntitySave = glueProjectSave.GetEntitySave(nos.SourceClassType);

                if (foundEntitySave != null)
                {
                    bool hasFoundState = false;

                    hasFoundState = foundEntitySave.GetStateRecursively(nos.CurrentState) != null;

                    if (!hasFoundState)
                    {
                        if (showPopupsOnFixedErrors)
                        {
                            MessageBox.Show("The Object " + nos.InstanceName + " in " + containingElement.Name + " uses the invalid state " + nos.CurrentState +
                                "\nRemoving this current State");
                        }

                        nos.CurrentState = null;

                    }
                }
            }
        }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:26,代码来源:GlueProjectSaveExtensionMethods.cs


示例9: AdjustLayer

 private void AdjustLayer(NamedObjectSave nos, IElement element)
 {
     if (Is2D(element))
     {
         nos.Is2D = true;
     }
 }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:7,代码来源:NewNamedObjectPlugin.cs


示例10: AdjustNewNamedObject

        void AdjustNewNamedObject(NamedObjectSave nos)
        {
            IElement element = EditorLogic.CurrentElement;

            if (element != null)
            {
                if(nos.SourceType == SourceType.FlatRedBallType)
                {
                    switch (nos.SourceClassType)
                    {
                        case "Sprite":
                            AdjustSprite(nos, element);
                            break;
                        case "Circle":
                            AdjustCircle(nos, element);
                            break;
                        case "SpriteFrame":
                            AdjustSpriteFrame(nos, element);
                            break;
                        case "AxisAlignedRectangle":
                            AdjustAxisAlignedRectangle(nos, element);
                            break;
                        case "Layer":
                            AdjustLayer(nos, element);
                            break;


                    }

                }
            }

        }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:33,代码来源:NewNamedObjectPlugin.cs


示例11: CreateEntitySave

        private void CreateEntitySave()
        {
            mEntitySave = ExposedVariableTests.CreateEntitySaveWithStates("CustomVariableEntity");
            mExposedStateInCategoryVariable = new CustomVariable();
            mExposedStateInCategoryVariable.Name = "CurrentStateCategoryState";
            mExposedStateInCategoryVariable.Type = "StateCategory";
            mExposedStateInCategoryVariable.SetByDerived = true;
            mEntitySave.CustomVariables.Add(mExposedStateInCategoryVariable);

            mSetByDerivedVariable = new CustomVariable();
            mSetByDerivedVariable.Type = "float";
            mSetByDerivedVariable.Name = "SomeVariable";
            mSetByDerivedVariable.SetByDerived = true;
            mEntitySave.CustomVariables.Add(mSetByDerivedVariable);

            mTextInBase = new NamedObjectSave();
            mTextInBase.InstanceName = "TextObject";
            mTextInBase.SourceType = SourceType.FlatRedBallType;
            mTextInBase.SourceClassType = "Text";
            mEntitySave.NamedObjects.Add(mTextInBase);


            CustomVariable customVariable = new CustomVariable();
            customVariable.Name = "TunneledDisplayText";
            customVariable.SourceObject = mTextInBase.InstanceName;
            customVariable.SourceObjectProperty = "DisplayText";
            customVariable.Type = "string";
            customVariable.OverridingPropertyType = "int";
            mEntitySave.CustomVariables.Add(customVariable);


            ObjectFinder.Self.GlueProject.Entities.Add(mEntitySave);
        }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:33,代码来源:CustomVariableTests.cs


示例12: GenerateTimedEmit

 public static void GenerateTimedEmit(ICodeBlock codeBlock, NamedObjectSave nos)
 {
     if (!nos.IsDisabled && nos.AddToManagers && !nos.DefinedByBase && nos.IsEmitter())
     {
         codeBlock.Line(nos.InstanceName + ".TimedEmit();");
     }
 }
开发者ID:gitter-badger,项目名称:FlatRedBall,代码行数:7,代码来源:ParticleCodeGenerator.cs


示例13: ScalableElementRuntime

        public ScalableElementRuntime(IElement elementSave, Layer layerProvidedByContainer,
            NamedObjectSave namedObjectSave, EventHandler<VariableSetArgs> onBeforeVariableSet,
            EventHandler<VariableSetArgs> onAfterVariableSet)
            : base(elementSave, layerProvidedByContainer, namedObjectSave, onBeforeVariableSet, onAfterVariableSet)
        {

        }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:7,代码来源:ScalableElementRuntime.cs


示例14: AdjustCircle

        private void AdjustCircle(NamedObjectSave nos, IElement element)
        {
            if (Is2D(element))
            {

                nos.SetPropertyValue("Radius", 16f);
            }
        }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:8,代码来源:NewNamedObjectPlugin.cs


示例15: AvailableStates

        public AvailableStates(NamedObjectSave currentNamedObject, IElement currentElement, CustomVariable currentCustomVariable, StateSave currentStateSave) : base()
        {
            CurrentNamedObject = currentNamedObject;
            CurrentElement = currentElement;
            CurrentCustomVariable = currentCustomVariable;
            CurrentStateSave = currentStateSave;

        }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:8,代码来源:AvailableStates.cs


示例16: AddVariableToNos

        protected override void AddVariableToNos(NamedObjectSave toReturn, string memberName, object currentValue)
        {
            if (memberName == "Texture" && !string.IsNullOrEmpty((string)currentValue))
            {
                currentValue = FileManager.RemoveExtension( FileManager.RemovePath(currentValue as string));
            }
            base.AddVariableToNos(toReturn, memberName, currentValue);

        }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:9,代码来源:SpriteSaveConverter.cs


示例17: ReactToValueSet

        public static void ReactToValueSet(NamedObjectSave instance, TypedMemberBase typedMember, object value, DataGridItem instanceMember, Type memberType)
        {
            instanceMember.IsDefault = false;

            TryAdjustingValue(instance, typedMember, ref value, instanceMember);

            PerformStandardVariableAssignments(instance, typedMember, value, instanceMember, memberType);

        }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:9,代码来源:NamedObjectVariableChangeLogic.cs


示例18: CreateNamedObject

        public void CreateNamedObject(SourceType sourceType, string namedObjectType)
        {
            IElement element = GlueViewState.Self.CurrentElement;
            ///////////////////////Early Out//////////////////////
            if (element == null)
            {
                return;
            }
            /////////////////////End Early Out////////////////////

            //PositionedObject whatToAdd = null;

            NamedObjectSave newNos = new NamedObjectSave();
            newNos.SourceType = sourceType;
            newNos.SourceClassType = namedObjectType;

            if (newNos.SourceType == SourceType.FlatRedBallType)
            {
                newNos.InstanceName = namedObjectType;
            }
            else if (newNos.SourceType == SourceType.Entity)
            {
                newNos.InstanceName = FileManager.RemovePath(namedObjectType) + "Instance";
            }
            newNos.AddToManagers = true;
            newNos.AttachToContainer = true;
            newNos.CallActivity = true;

            StringFunctions.MakeNameUnique<NamedObjectSave>(newNos, element.NamedObjects);

            element.NamedObjects.Add(newNos);

            bool is2D = (element is EntitySave && ((EntitySave)element).Is2D) || SpriteManager.Camera.Orthogonal;

            //// This will need to change as the plugin grows in complexity
            if (namedObjectType == typeof(AxisAlignedRectangle).Name)
            {
                AddAxisAlignedRectangleValues(newNos, is2D);
            }
            else if (namedObjectType == typeof(Circle).Name)
            {
                AddCircleValues(newNos, is2D);
            }
            else if (namedObjectType == typeof(Sprite).Name)
            {
                AddSpriteValues(newNos, is2D);
            }
            else if (namedObjectType == typeof(Text).Name)
            {
                AddTextValues(newNos, is2D);
            }

            GlueViewCommands.Self.GlueProjectSaveCommands.SaveGlux();
            GlueViewCommands.Self.ElementCommands.ReloadCurrentElement();

        }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:56,代码来源:ObjectCreator.cs


示例19: HandleCoordinateChanged

        internal void HandleCoordinateChanged(TextureCoordinateSelectionWindow selectionWindow, NamedObjectSave nos)
        {
            AssignTextureCoordinateValues(selectionWindow, nos);

            GlueCommands.Self.GluxCommands.SaveGlux();

            GlueCommands.Self.RefreshCommands.RefreshPropertyGrid();

            GlueCommands.Self.GenerateCodeCommands.GenerateCurrentElementCode();
        }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:10,代码来源:TextureCoordinateSelectionLogic.cs


示例20: AdjustSpriteFrame

        private void AdjustSpriteFrame(NamedObjectSave nos, IElement element)
        {

            if (Is2D(element))
            {

                nos.SetPropertyValue("PixelSize", .5f);

            }
        }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:10,代码来源:NewNamedObjectPlugin.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# SaveClasses.ReferencedFileSave类代码示例发布时间:2022-05-24
下一篇:
C# FlatBuffers.FlatBufferBuilder类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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