Ejemplo n.º 1
0
 public virtual bool Initialize()
 {
     if (this.def == null)
     {
         if (!DefLookupUtil.TryGetDef(this.defName, out this.def))
         {
             Log.Error("Could not load def " + this.defName);
         }
     }
     return(this.def != null);
 }
Ejemplo n.º 2
0
        public void Draw(float x, ref float y, float width)
        {
            WindowUtil.DrawLabel(x, y, 300, this.DisplayLabel, true);
            y += 40;

            x += 10;
            foreach (var w in this.inputWidgets)
            {
                w.Draw(x, ref y, width);
            }

            WindowUtil.DrawInput(x, ref y, width, "InGameDefEditor.SoundCast".Translate(), 100, (VerbProperties.soundCast != null) ? VerbProperties.soundCast.defName : "None",
                                 new WindowUtil.FloatOptionsArgs <SoundDef>()
            {
                items             = DefLookupUtil.GetSortedDefs(DefDatabase <SoundDef> .AllDefs),
                getDisplayName    = delegate(SoundDef d) { return(d.defName); },
                onSelect          = delegate(SoundDef d) { VerbProperties.soundCast = d; },
                includeNullOption = true
            });
            WindowUtil.DrawInput(x, ref y, width, "InGameDefEditor.SoundCastTail".Translate(), 100, (VerbProperties.soundCastTail != null) ? VerbProperties.soundCastTail.defName : "None",
                                 new WindowUtil.FloatOptionsArgs <SoundDef>()
            {
                items             = DefLookupUtil.GetSortedDefs(DefDatabase <SoundDef> .AllDefs),
                getDisplayName    = delegate(SoundDef d) { return(d.defName); },
                onSelect          = delegate(SoundDef d) { VerbProperties.soundCastTail = d; },
                includeNullOption = true
            });

            y += 10;

            if (VerbProperties.defaultProjectile != null)
            {
                WindowUtil.DrawInput(x, ref y, width, "InGameDefEditor.Projectiles".Translate(), 100, this.VerbProperties.defaultProjectile.label,
                                     new WindowUtil.FloatOptionsArgs <ThingDef>()
                {
                    items          = Defs.ProjectileDefs.Values,
                    getDisplayName = delegate(ThingDef d) { return(d.label); },
                    onSelect       = delegate(ThingDef d)
                    {
                        this.VerbProperties.defaultProjectile = d;
                        this.projectileWidget = new ProjectileDefWidget(d, DefType.Projectile);
                    }
                }, true);

                x += 20;
                this.projectileWidget.Draw(x, ref y, width - x);
            }
        }
Ejemplo n.º 3
0
        public override bool Initialize()
        {
            if (!base.Initialize())
            {
                return(false);
            }

            if (this.def2 == null && !string.IsNullOrEmpty(this.defName2))
            {
                if (!DefLookupUtil.TryGetDef(this.defName2, out this.def2))
                {
                    Log.Error("Could not load def " + this.defName2);
                }
                return(this.def2 != null);
            }
            return(true);
        }
Ejemplo n.º 4
0
        public override void DrawLeft(float x, ref float y, float width)
        {
            foreach (var w in this.inputWidgets)
            {
                w.Draw(x, ref y, width);
            }

            WindowUtil.DrawInput(x, ref y, width, "Foraged Food", 100, (this.Def.foragedFood != null) ? this.Def.foragedFood.defName : "None",
                                 new WindowUtil.FloatOptionsArgs <ThingDef>()
            {
                items             = DefLookupUtil.GetSortedDefs(DefDatabase <ThingDef> .AllDefs),
                getDisplayName    = delegate(ThingDef d) { return(d.defName); },
                onSelect          = delegate(ThingDef d) { this.Def.foragedFood = d; },
                includeNullOption = true
            });

            this.DrawTerrainPatchMakers(x, ref y, width);
        }