public static void OpenWindow(HybridInformations info)
        {
            Dialog_EditHybrid window = (Dialog_EditHybrid)Find.WindowStack.Windows.FirstOrDefault(x => x.GetType().Equals(typeof(Dialog_EditHybrid)));

            if (window != null)
            {
                if (window.info != info)
                {
                    SoundDefOf.TabOpen.PlayOneShotOnCamera();
                    window.ChangeExtension(info);
                }
            }
            else
            {
                SoundDefOf.TabClose.PlayOneShotOnCamera();
                Find.WindowStack.Add(new Dialog_EditHybrid(info));
            }
        }
Beispiel #2
0
        public PawnKindDef GetHybrid(Pawn first, Pawn second)
        {
            PawnKindDef        res      = null;
            Pawn               opposite = second;
            HybridInformations info     = null;


            if (!Configurations.HybridOverride.NullOrEmpty())
            {
                info = Configurations.HybridOverride.FirstOrDefault(x => x.defName == first.def?.defName && (x.hybridExtension?.Exists(y => y.defName == second.def?.defName) ?? false));
                if (info == null)
                {
                    info     = Configurations.HybridOverride.FirstOrDefault(x => x.defName == second.def?.defName && (x.hybridExtension?.Exists(y => y.defName == first.def?.defName) ?? false));
                    opposite = first;
                }
            }

            if (info != null)
            {
                res = info.GetHybridWith(opposite.def.defName) ?? null;
            }
            if (res != null)
            {
                return(res);
            }


            PawnDNAModExtension dna;

            dna = first.def.GetModExtension <PawnDNAModExtension>();
            if (dna != null)
            {
                res = dna.GetHybridWith(second.def.defName) ?? null;
            }
            else
            {
                dna = second.def.GetModExtension <PawnDNAModExtension>();
                if (dna != null)
                {
                    res = dna.GetHybridWith(first.def.defName) ?? null;
                }
            }
            return(res);
        }
        protected void DoRow(Rect rect, HybridInformations extension, int index)
        {
            Rect buttonRect = new Rect(rect.xMax - 90f, rect.y, 80f, rect.height);

            Widgets.Label(rect, extension.GetDef?.label ?? "Undefined");
            if (Widgets.ButtonText(buttonRect, "Delete"))
            {
                removeList.Add(extension);
                //raceList.Add(new FloatMenuOption(extension.GetDef.label, delegate { AddHybridOverride(extension.GetDef); }));
            }
            buttonRect.x -= 80f;
            if (Widgets.ButtonText(buttonRect, "Edit"))
            {
                Dialog_EditHybrid.OpenWindow(extension);
            }


            Widgets.DrawHighlightIfMouseover(rect);
        }
 protected void ChangeExtension(HybridInformations info)
 {
     this.info = info;
     BuildRaceList();
 }
 public Dialog_EditHybrid(HybridInformations info)
 {
     this.info = info;
     BuildRaceList();
 }