Exemple #1
0
 public override void DoWindowContents(Rect inRect)
 {
     base.DoWindowContents(inRect);
     if (GUI.changed)
     {
         GameComponent_FacialStuff.BuildPoseCycles();
     }
 }
Exemple #2
0
        // public static float horHeadOffset;
        protected override void DoBasicSettingsMenu(Listing_Standard listing)
        {
            base.DoBasicSettingsMenu(listing);

            GetBodyAnimDef();

            // 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(CompAnim.BodyAnim.offCenterX.ToString("N2"));
            CompAnim.BodyAnim.offCenterX = listing.Slider(CompAnim.BodyAnim.offCenterX, -0.2f, 0.2f);

            if (listing.ButtonText(EditorPoseCycle?.LabelCap))
            {
                List <string>          exists = new List <string>();
                List <FloatMenuOption> list   = new List <FloatMenuOption>();
                CompAnim.BodyAnim.poseCycles.Clear();

                foreach (PoseCycleDef posecycle in (from bsm in DefDatabase <PoseCycleDef> .AllDefs
                                                    orderby bsm.LabelCap
                                                    select bsm)
                         .TakeWhile(current => CompAnim.BodyAnim.PoseCycleType != "None")
                         .Where(current => current.PoseCycleType ==
                                CompAnim.BodyAnim.PoseCycleType))
                {
                    list.Add(new FloatMenuOption(posecycle.LabelCap, delegate { EditorPoseCycle = posecycle; }));
                    exists.Add(posecycle.pawnPosture.ToString());
                    CompAnim.BodyAnim.poseCycles.Add(posecycle);
                }

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

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

                    list.Add(
                        new FloatMenuOption(
                            "Add new " + CompAnim.BodyAnim.PoseCycleType + "_" + myenum,
                            delegate
                    {
                        PoseCycleDef newCycle = new PoseCycleDef();
                        newCycle.defName      =
                            newCycle.label    =
                                CompAnim.BodyAnim.PoseCycleType + "_" + name;
                        newCycle.pawnPosture   = myenum;
                        newCycle.PoseCycleType = CompAnim.BodyAnim.PoseCycleType;
                        GameComponent_FacialStuff.BuildPoseCycles(newCycle);
                        EditorPoseCycle = newCycle;

                        CompAnim.BodyAnim.poseCycles.Add(newCycle);
                    }));
                }

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

            listing.Gap();
            string configFolder = DefPath;

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

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

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

                // BodyAnimDef animDef = this.bodyAnimDef;
            }

            if (listing.ButtonText("Export PoseCycle"))
            {
                string path = configFolder + "/PoseCycleDefs/" + EditorPoseCycle?.defName + ".xml";

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

                    DirectXmlSaver.SaveDataObject(
                        cycle,
                        path);
                },
                        true));
            }
        }
Exemple #3
0
 protected override void BuildEditorCycle()
 {
     base.BuildEditorCycle();
     GameComponent_FacialStuff.BuildPoseCycles(EditorPoseCycle);
 }