Example #1
0
        internal void AddBehavior(BehaviorSave behavior)
        {
            AppState.Self.GumProjectSave.Behaviors.Add(behavior);
            var behaviorReference = new BehaviorReference
            {
                Name = behavior.Name
            };

            AppState.Self.GumProjectSave.BehaviorReferences.Add(behaviorReference);
            AppState.Self.GumProjectSave.BehaviorReferences.Sort((first, second) => first.Name.CompareTo(second.Name));
            FlatRedBall.Glue.Plugins.PluginManager.ReceiveOutput("Added Gum behavior " + behavior.Name);
        }
        private static void OutputBehaviorReference(BehaviorReference behavior)
        {
            Log.Warn("		***BehaviorReference***");

            if (behavior.Reference != null)
            {
                OutputArtifactReference(behavior.Reference);
                Log.Info(" 			-IsExternal: "+ behavior.IsExternal);
                Log.Info(" 			-Constructor: "+ behavior.ConstructorType);
                OutputInvocations(behavior.Invocations);
                OutputBehaviorProperties(behavior.Properties);
            }

            Log.Warn("		***Behavior End***");
        }
        public static void AddBehaviorReferenceProperties(WordprocessingDocument document, BehaviorReference behavior)
        {
            _log.Info("Printing Behavior Properties: " + behavior.Reference.Id);
            var body  = document.MainDocumentPart.Document.Body;
            var name  = Utils.GetNameForId(behavior.Reference.Id, ArtifactType.Behavior);
            var aDef  = body.AppendChild(new Paragraph());
            var adRun = aDef.AppendChild(new Run());

            adRun.AppendChild(new Text("Behavior Reference: " + name));
            Utils.ApplyStyleToParagraph(document, "Heading2", "Heading2", aDef);

            var rDef = body.AppendChild(new Paragraph());
            var rRun = rDef.AppendChild(new Run());

            rRun.AppendChild(new Text("Reference Notes: " + behavior.Reference.ReferenceNotes));
            Utils.ApplyStyleToParagraph(document, "Quote", "Quote", rDef);

            var basicProps = new[, ]
            {
                { "Is External:", behavior.IsExternal.ToString() },
                { "Constructor:", behavior.ConstructorType }
            };

            Utils.AddTable(document, basicProps); //"PlainTable3"

            var appDef = body.AppendChild(new Paragraph());
            var appRun = appDef.AppendChild(new Run());

            appRun.AppendChild(new Text("Applies To"));
            Utils.ApplyStyleToParagraph(document, "Heading3", "Heading3", appDef);
            foreach (var a in behavior.AppliesTo)
            {
                ArtifactPrinter.GenerateArtifactSymbol(document, a);
            }

            CommonPrinter.BuildInvocationsTable(document, behavior.Invocations);

            CommonPrinter.BuildInfluenceBindings(document, behavior.InfluenceBindings, ArtifactType.Behavior);

            if (behavior.Properties.Any())
            {
                CommonPrinter.BuildPropertiesTable(document, behavior.Properties, false);
            }
        }