示例#1
0
 public override void DoWindowContents(Rect inRect)
 {
     base.DoWindowContents(inRect);
     if (GUI.changed)
     {
         if (!this.Loop)
         {
             GameComponent_FacialStuff.BuildWalkCycles();
         }
     }
 }
示例#2
0
        // public static float verHeadOffset;

        #endregion Private Properties

        #region Public Methods

        protected override void BuildEditorCycle()
        {
            base.BuildEditorCycle();
            GameComponent_FacialStuff.BuildWalkCycles(EditorWalkcycle);
        }
示例#3
0
        // public static float horHeadOffset;
        protected override void DoBasicSettingsMenu(Listing_Standard listing)
        {
            base.DoBasicSettingsMenu(listing);

            //  listing.CheckboxLabeled("Moving", ref IsMoving);

            // listing_Standard.CheckboxLabeled("Equipment", ref Equipment);

            // listing_Standard.Label(horHeadOffset.ToString("N2") + " - " + verHeadOffset.ToString("N2"));
            // horHeadOffset = listing_Standard.Slider(horHeadOffset, -1f, 1f);
            // verHeadOffset = listing_Standard.Slider(verHeadOffset, -1f, 1f);
            listing.Label(this.BodyAnimDef.offCenterX.ToString("N2"));
            this.BodyAnimDef.offCenterX = listing.Slider(this.BodyAnimDef.offCenterX, -0.2f, 0.2f);

            if (listing.ButtonText(EditorWalkcycle.LabelCap))
            {
                List <string>          exists = new List <string>();
                List <FloatMenuOption> list   = new List <FloatMenuOption>();
                this.BodyAnimDef.walkCycles.Clear();

                foreach (WalkCycleDef walkcycle in (from bsm in DefDatabase <WalkCycleDef> .AllDefs
                                                    orderby bsm.LabelCap
                                                    select bsm)
                         .TakeWhile(current => this.BodyAnimDef.WalkCycleType != "None")
                         .Where(current => current.WalkCycleType ==
                                this.BodyAnimDef.WalkCycleType))
                {
                    list.Add(new FloatMenuOption(walkcycle.LabelCap, delegate { EditorWalkcycle = walkcycle; }));
                    exists.Add(walkcycle.locomotionUrgency.ToString());
                    this.BodyAnimDef.walkCycles.Add(walkcycle.locomotionUrgency, walkcycle);
                }

                string[] names = Enum.GetNames(typeof(LocomotionUrgency));
                for (int index = 0; index < names.Length; index++)
                {
                    string            name   = names[index];
                    LocomotionUrgency myenum = (LocomotionUrgency)Enum.ToObject(typeof(LocomotionUrgency), index);

                    if (exists.Contains(myenum.ToString()))
                    {
                        continue;
                    }

                    list.Add(
                        new FloatMenuOption(
                            "Add new " + this.BodyAnimDef.WalkCycleType + "_" + myenum,
                            delegate
                    {
                        WalkCycleDef newCycle = new WalkCycleDef();
                        newCycle.defName      =
                            newCycle.label    =
                                this.BodyAnimDef.WalkCycleType + "_" + name;
                        newCycle.locomotionUrgency = myenum;
                        newCycle.WalkCycleType     = this.BodyAnimDef.WalkCycleType;
                        GameComponent_FacialStuff.BuildWalkCycles(newCycle);
                        EditorWalkcycle = newCycle;

                        this.BodyAnimDef.walkCycles.Add(myenum, newCycle);
                    }));
                }

                Find.WindowStack.Add(new FloatMenu(list));
            }

            if (listing.ButtonText("This pawn is using: " + this.BodyAnimDef.WalkCycleType))
            {
                List <FloatMenuOption> list = new List <FloatMenuOption>();

                List <WalkCycleDef> listy = DefDatabase <WalkCycleDef> .AllDefsListForReading;

                List <string> stringsy = new List <string>();

                foreach (WalkCycleDef cycleDef in listy)
                {
                    if (!stringsy.Contains(cycleDef.WalkCycleType))
                    {
                        stringsy.Add(cycleDef.WalkCycleType);
                    }
                }

                foreach (string s in stringsy)
                {
                    list.Add(new FloatMenuOption(s, delegate { this.BodyAnimDef.WalkCycleType = s; }));
                }

                Find.WindowStack.Add(new FloatMenu(list));
            }

            listing.Gap();
            string configFolder = DefPath;

            if (listing.ButtonText("Export BodyDef"))
            {
                string filePath = configFolder + "/BodyAnimDefs/" + this.BodyAnimDef.defName + ".xml";

                Find.WindowStack.Add(
                    Dialog_MessageBox.CreateConfirmation(
                        "Confirm overwriting " +
                        filePath,
                        delegate
                {
                    ExportAnimDefs.Defs animDef =
                        new ExportAnimDefs.Defs(this.BodyAnimDef);

                    DirectXmlSaver.SaveDataObject(
                        animDef,
                        filePath);
                },
                        true));

                // BodyAnimDef animDef = this.bodyAnimDef;
            }

            if (listing.ButtonText("Export WalkCycle"))
            {
                string path = configFolder + "/WalkCycleDefs/" + EditorWalkcycle.defName + ".xml";

                Find.WindowStack.Add(
                    Dialog_MessageBox.CreateConfirmation(
                        "Confirm overwriting " + path,
                        delegate
                {
                    ExportWalkCycleDefs.Defs cycle =
                        new ExportWalkCycleDefs.Defs(EditorWalkcycle);

                    DirectXmlSaver.SaveDataObject(
                        cycle,
                        path);
                },
                        true));
            }
        }