public void Draw(float x, ref float y, float width)
        {
            WindowUtil.DrawLabel(x, y, width, this.DisplayLabel, true);
            y += 30;

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

            WindowUtil.PlusMinusLabel(x, ref y, width, "Skill Gains", this.skillGainsArgs);
            foreach (var v in this.skillGains)
            {
                v.Draw(x + 20, ref y, width);
            }

            WindowUtil.PlusMinusLabel(x, ref y, width, "Stat Offsets", this.statOffsetsArgs);
            foreach (var v in this.statOffsets)
            {
                v.Draw(x + 20, ref y, width);
            }

            WindowUtil.PlusMinusLabel(x, ref y, width, "Stat Factors", this.statFactorsArgs);
            foreach (var v in this.statFactors)
            {
                v.Draw(x + 20, ref y, width);
            }
        }
 private void DrawTerrainPatchMakers(float x, ref float y, float width)
 {
     WindowUtil.PlusMinusLabel(x, ref y, width, "Patch Maker",
                               delegate
     {
         Find.WindowStack.Add(new Dialog_Name(
                                  "Perlin Frequency",
                                  delegate(string name)
         {
             TerrainPatchMaker m = new TerrainPatchMaker()
             {
                 perlinFrequency = float.Parse(name)
             };
             base.Def.terrainPatchMakers.Add(m);
             this.terrainPatchMakers.Add(new TerrainPatchMakerWidget(m));
         },
                                  delegate(string name)
         {
             if (!float.TryParse(name, out float freq))
             {
                 return("Must be a number");
             }
             foreach (var v in base.Def.terrainPatchMakers)
             {
                 if (v.perlinFrequency == freq)
                 {
                     return("Perlin Frequency must be unique");
                 }
             }
             return(true);
         }));
     },
        public override void DrawLeft(float x, ref float y, float width)
        {
            foreach (var v in this.inputWidgets)
            {
                v.Draw(x, ref y, width);
            }

            WindowUtil.PlusMinusLabel(x, ref y, width, "Required Work Tags", this.requiredWorkTags);
            foreach (var v in this.workTags)
            {
                if ((base.Def.requiredWorkTags & v) == v)
                {
                    WindowUtil.DrawLabel(x + 20, ref y, width, "- " + v.ToString(), 30);
                }
            }

            WindowUtil.PlusMinusLabel(x, ref y, width, "Disabled Work Tags", this.disabledWorkTags);
            foreach (var v in this.workTags)
            {
                if ((base.Def.disabledWorkTags & v) == v)
                {
                    WindowUtil.DrawLabel(x + 20, ref y, width, "- " + v.ToString(), 30);
                }
            }
        }
        private void DrawStatModifiers(float x, ref float y, float width)
        {
            WindowUtil.PlusMinusLabel(x, ref y, width, "Base Modifiers", this.statBasesPlusMinus);

            x += 10;
            foreach (var w in this.statBases)
            {
                w.Draw(x, ref y, width);
            }
        }
예제 #5
0
        public void Draw(float x, ref float y, float width)
        {
            foreach (var v in this.inputWidgets)
            {
                v.Draw(x, ref y, width);
            }

            WindowUtil.PlusMinusLabel(x, ref y, width, "Food Type Flags", this.foodTypePlusMinus);
            WindowUtil.DrawFlagList(x, ref y, width, this.foodTypeSortedFlags, (int)this.Parent.foodType, v => v == FoodTypeFlags.None);
        }
예제 #6
0
        public void Draw(float x, ref float y, float width)
        {
            WindowUtil.DrawLabel(x, y, 300, this.DisplayLabel, true);
            y += 40;

            foreach (IInputWidget w in this.inputWidgets)
            {
                w.Draw(x, ref y, width);
            }

            x += 20;
            WindowUtil.PlusMinusLabel(
                x, ref y, width, "Capabilities",
                new WindowUtil.FloatOptionsArgs <ToolCapacityDef>()
            {
                // Add
                getDisplayName = delegate(ToolCapacityDef d) { return(d.defName); },
                updateItems    = delegate()
                {
                    HashSet <ToolCapacityDef> lookup = new HashSet <ToolCapacityDef>();
                    if (this.Tool.capacities != null)
                    {
                        this.Tool.capacities.ForEach((ToolCapacityDef d) => lookup.Add(d));
                    }

                    IEnumerable <ToolCapacityDef> defs = DefDatabase <ToolCapacityDef> .AllDefs;
                    List <ToolCapacityDef> list        = new List <ToolCapacityDef>(defs.Count());
                    foreach (var tool in defs)
                    {
                        if (!lookup.Contains(tool))
                        {
                            list.Add(tool);
                        }
                    }
                    return(list);
                },
                onSelect = delegate(ToolCapacityDef d) { this.Tool.capacities.Add(d); }
            },
                new WindowUtil.FloatOptionsArgs <ToolCapacityDef>()
            {
                // Remove
                items          = this.Tool.capacities,
                getDisplayName = delegate(ToolCapacityDef d) { return(d.defName); },
                onSelect       = delegate(ToolCapacityDef d) { this.Tool.capacities.Remove(d); }
            });

            x += 10;
            foreach (ToolCapacityDef d in this.Tool.capacities)
            {
                Widgets.Label(new Rect(x, y, 150, 32), "- " + d.defName);
                y += 40;
            }
        }
        public void Draw(float x, ref float y, float width)
        {
            WindowUtil.PlusMinusLabel(x, ref y, width, label, this.args);
            IEnumerable <string> beingUsed = this.args.beingUsed.Invoke();

            x += 10;
            foreach (var s in beingUsed)
            {
                WindowUtil.DrawLabel(x, y, width, $"- {s}");
                y += 30;
            }
        }
예제 #8
0
        public void Draw(float x, ref float y, float width)
        {
            foreach (var v in this.inputWidgets)
            {
                v.Draw(x, ref y, width);
            }

            WindowUtil.PlusMinusLabel(x, ref y, width, "Body Part Groups", this.bodyPartGroupArgs);
            WindowUtil.DrawList(x, ref y, width, this.apparelProperties.bodyPartGroups);

            WindowUtil.PlusMinusLabel(x, ref y, width, "Apparel Layers", this.apparelLayerArgs);
            WindowUtil.DrawList(x, ref y, width, this.apparelProperties.layers);
        }
예제 #9
0
        protected override void DrawInputs(float x, ref float y, float width)
        {
            foreach (var v in this.inputWidgets)
            {
                v.Draw(x, ref y, width);
            }

            if (this.Props is StorytellerCompProperties_RandomMain rm &&
                this.categoryWeightArgs != null)
            {
                WindowUtil.PlusMinusLabel(x, ref y, width, "Category Weights", this.categoryWeightArgs);
                if (rm.categoryWeights != null)
                {
                    foreach (var v in rm.categoryWeights)
                    {
                        WindowUtil.DrawLabel(x + 20, ref y, width, "- " + Util.GetLabel(v.category), 30);
                    }
                }
            }

            if (this.allowedTargetTags != null)
            {
                WindowUtil.PlusMinusLabel(x, ref y, width, "Allowed Target Tags", this.allowedTargetTags);
                if (this.Props.allowedTargetTags != null)
                {
                    foreach (var v in this.Props.allowedTargetTags)
                    {
                        WindowUtil.DrawLabel(x + 20, ref y, width, "- " + Util.GetLabel(v), 30);
                    }
                }
            }

            if (this.disallowedTargetTags != null)
            {
                WindowUtil.PlusMinusLabel(x, ref y, width, "Disallowed Target Tags", this.disallowedTargetTags);
                if (this.Props.disallowedTargetTags != null)
                {
                    foreach (var v in this.Props.disallowedTargetTags)
                    {
                        WindowUtil.DrawLabel(x + 20, ref y, width, "- " + Util.GetLabel(v), 30);
                    }
                }
            }

            foreach (var v in this.simpleCurveWidgets)
            {
                v.Draw(x, ref y, width);
            }
        }
예제 #10
0
        public override void DrawMiddle(float x, ref float y, float width)
        {
            WindowUtil.PlusMinusLabel(x, ref y, width, "Components",
                                      delegate
            {
                Find.WindowStack.Add(new Dialog_StoryTellerComponentDialog(v =>
                {
                    if (v == null)
                    {
                        return("Component must be set");
                    }
                    AcceptanceReport r = this.IsUnique(v);
                    if (!r.Accepted)
                    {
                        return(r);
                    }

                    this.comps.Add(new StorytellerCompPropertiesWidget(v));
                    base.Def.comps.Add(v);

                    return(true);
                }));
            },
                                      delegate
            {
                WindowUtil.DrawFloatingOptions(
                    new WindowUtil.FloatOptionsArgs <StorytellerCompPropertiesWidget>()
                {
                    items          = this.comps,
                    getDisplayName = c => c.DisplayLabel,
                    onSelect       = c =>
                    {
                        for (int i = 0; i < this.comps.Count; ++i)
                        {
                            if (this.comps[i] == c)
                            {
                                this.comps.RemoveAt(i);
                                base.Def.comps.RemoveAt(i);
                            }
                        }
                    }
                });
            });

            foreach (var v in this.comps)
            {
                v.Draw(x + 10, ref y, width);
            }
        }
        public void Draw(float x, ref float y, float width)
        {
            WindowUtil.PlusMinusLabel(x, ref y, width, label, this.args);
            IEnumerable <D> beingUsed = this.args.beingUsed.Invoke();

            x += 10;
            if (beingUsed != null)
            {
                foreach (var def in beingUsed)
                {
                    WindowUtil.DrawLabel(x, y, width, "- " + Util.GetLabel(def));
                    y += 30;
                }
            }
        }
예제 #12
0
        private void DrawEquipmentStatOffsets(float x, ref float y, float width)
        {
            WindowUtil.PlusMinusLabel(x, ref y, width, "Equipped Stat Offsets",
                                      new WindowUtil.FloatOptionsArgs <StatDef>()
            {
                items          = base.GetPossibleStatModifiers(base.Def.equippedStatOffsets),
                getDisplayName = delegate(StatDef d) { return(d.label); },
                onSelect       = delegate(StatDef d)
                {
                    StatModifier m = new StatModifier()
                    {
                        stat  = d,
                        value = 0
                    };
                    base.Def.equippedStatOffsets.Add(m);
                    this.EquipmentModifiers.Add(this.CreateFloatInput(m));
                }
            },
                                      new WindowUtil.FloatOptionsArgs <StatModifier>()
            {
                items          = base.Def.equippedStatOffsets,
                getDisplayName = delegate(StatModifier s) { return(s.stat.defName); },
                onSelect       = delegate(StatModifier s)
                {
                    for (int i = 0; i < this.EquipmentModifiers.Count; ++i)
                    {
                        if (this.EquipmentModifiers[i].Parent.stat == s.stat)
                        {
                            this.EquipmentModifiers.RemoveAt(i);
                            break;
                        }
                    }
                    for (int i = 0; i < base.Def.equippedStatOffsets.Count; ++i)
                    {
                        if (base.Def.equippedStatOffsets[i].stat == s.stat)
                        {
                            base.Def.equippedStatOffsets.RemoveAt(i);
                            break;
                        }
                    }
                }
            });

            foreach (var w in this.EquipmentModifiers)
            {
                w.Draw(x, ref y, width);
            }
        }
        public void Draw(float x, ref float y, float width)
        {
            WindowUtil.DrawLabel(x, y, width, "Perlin Frequency " + this.Parent.perlinFrequency, true);
            y += 40;

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

            WindowUtil.PlusMinusLabel(x, ref y, width, "Thresholds", this.thresholdsArgs);

            x += 10;
            foreach (var v in this.thresholds)
            {
                v.Draw(x, ref y, width);
            }
        }
        protected override void DrawInputs(float x, ref float y, float width)
        {
            if (this.curve != null)
            {
                WindowUtil.PlusMinusLabel(x, ref y, width, this.name,
                                          () =>
                {
                    MinMaxFloatStats p = new MinMaxFloatStats(0, 0);
                    this.points.Add(p);
                    this.pointsInputs.Add(this.CreateFloatInput(p));
                },
                                          () => WindowUtil.DrawFloatingOptions(pointsArgs));
                SimpleCurveDrawer.DrawCurve(new Rect(x + 20, y, width, 100), curve);
                y += 110;

                if (this.innerY > 300)
                {
                    Widgets.BeginScrollView(
                        new Rect(x + 20, y, width - 16, 300),
                        ref this.scroll,
                        new Rect(0, 0, width - 32, this.innerY));
                    this.innerY = 0;

                    foreach (var v in this.pointsInputs)
                    {
                        v.Draw(10, ref this.innerY, width - 60);
                    }

                    Widgets.EndScrollView();
                    y += 332;
                }
                else
                {
                    this.innerY = 0;
                    foreach (var v in this.pointsInputs)
                    {
                        float orig = y;
                        v.Draw(10, ref y, width - 60);
                        this.innerY += y - orig;
                    }
                }
            }
        }
예제 #15
0
 public override void DrawMiddle(float x, ref float y, float width)
 {
     WindowUtil.PlusMinusLabel(x, ref y, width, "Nullifying Own Tales", this.nullifyingOwnTales);
     foreach (var v in this.Def.nullifyingOwnTales)
     {
         WindowUtil.DrawLabel(x + 20, y, width, "- " + Util.GetLabel(v));
         y += 30;
     }
     WindowUtil.PlusMinusLabel(x, ref y, width, "Required Traits", this.requiredTraits);
     foreach (var v in this.Def.requiredTraits)
     {
         WindowUtil.DrawLabel(x + 20, y, width, "- " + Util.GetLabel(v));
         y += 30;
     }
     WindowUtil.PlusMinusLabel(x, ref y, width, "Nullifying Traits", this.nullifyingTraits);
     foreach (var v in this.Def.nullifyingTraits)
     {
         WindowUtil.DrawLabel(x + 20, y, width, "- " + Util.GetLabel(v));
         y += 30;
     }
 }
예제 #16
0
 public override void DrawRight(float x, ref float y, float width)
 {
     WindowUtil.PlusMinusLabel(x, ref y, width, "Required Work Types", this.requiredWorkTypes);
     foreach (var v in this.Def.requiredWorkTypes)
     {
         WindowUtil.DrawLabel(x + 20, y, width, "- " + Util.GetLabel(v));
         y += 30;
     }
     WindowUtil.PlusMinusLabel(x, ref y, width, "Disabled Work Types", this.disabledWorkTypes);
     foreach (var v in this.Def.disabledWorkTypes)
     {
         WindowUtil.DrawLabel(x + 20, y, width, "- " + Util.GetLabel(v));
         y += 30;
     }
     WindowUtil.PlusMinusLabel(x, ref y, width, "Confliting Traits", this.conflictingTraits);
     foreach (var v in this.Def.conflictingTraits)
     {
         WindowUtil.DrawLabel(x + 20, y, width, "- " + Util.GetLabel(v));
         y += 30;
     }
 }
        public override void DrawMiddle(float x, ref float y, float width)
        {
            if (this.ingredients.Count > 0)
            {
                WindowUtil.DrawLabel(x, ref y, width, "Ingredients", 30, true);
                foreach (var v in this.ingredients)
                {
                    v.Draw(x + 10, ref y, width);
                }
            }
            y += 8;

            if (this.products.Count > 0)
            {
                WindowUtil.DrawLabel(x, ref y, 150, "Products", 30, true);
                foreach (var v in this.products)
                {
                    v.Draw(x + 10, ref y, width);
                }
            }
            y += 8;

            WindowUtil.PlusMinusLabel(x, ref y, width, "Skill Requirements", this.skillRequirementsPlusMinusArgs);
            foreach (var v in this.skillRequirements)
            {
                v.Draw(x + 10, ref y, width);
            }
            y += 8;

            WindowUtil.PlusMinusLabel(x, ref y, width, "Force Hidden Special Filters", this.forceHiddenSpecialFilters);
            if (base.Def.forceHiddenSpecialFilters != null)
            {
                foreach (var v in base.Def.forceHiddenSpecialFilters)
                {
                    WindowUtil.DrawLabel(x + 10, y, width - 10, "- " + v);
                    y += 32;
                }
            }
            y += 8;

            WindowUtil.PlusMinusLabel(x, ref y, width, "Applied On Fixed Body Parts", this.appliedOnFixedBodyParts);
            if (base.Def.appliedOnFixedBodyParts != null)
            {
                foreach (var v in base.Def.appliedOnFixedBodyParts)
                {
                    WindowUtil.DrawLabel(x + 10, y, width - 10, "- " + v);
                    y += 32;
                }
            }
            y += 8;

            //foreach(var v in this.)

            /*WindowUtil.PlusMinusLabel(x, ref y, 150, "Ingredients",
             *      delegate ()
             *      {
             *              IngredientCount c = new IngredientCount() { filter = new ThingFilter() };
             *              IngredientCountStats.SetIngredientCount(c, 0);
             *              base.Def.ingredients.Add(c);
             *              this.ingredients.Add(new IngredientCountWidget(c));
             *      },
             *      delegate ()
             *      {
             *              List<string> items = new List<string>(this.ingredients.Count);
             *              foreach (var v in this.ingredients)
             *                      items.Add(v.DisplayLabel);
             *              WindowUtil.DrawFloatingOptions(new FloatOptionsArgs<string>()
             *              {
             *                      items = items,
             *                      getDisplayName = (s) => s,
             *                      onSelect = (s) => this.ingredients.RemoveAll((i) => i.DisplayLabel.Equals(s)),
             *              });
             *      });
             * foreach (var v in this.ingredients)
             * {
             *      WindowUtil.DrawLabel(x + 10, y, width - 10, "- " + v.DisplayLabel, true);
             *      y += 32;
             *      v.Draw(x + 20, ref y, width - 20);
             * }
             * y += 8;*/

            /*WindowUtil.PlusMinusLabel(x, ref y, 150, "Special Products", this.specialProducts);
             * if (base.Def.specialProducts != null)
             * {
             * foreach (var v in base.Def.specialProducts)
             * {
             * WindowUtil.DrawLabel(x + 10, y, width - 10, "- " + v);
             * y += 32;
             * }
             * y += 8;
             * }*/

            /*WindowUtil.PlusMinusLabel(x, ref y, 150, "Recipe Users", this.recipeUsers);
             * foreach (var v in base.Def.recipeUsers)
             * {
             *      WindowUtil.DrawLabel(x + 10, y, width - 10, "- " + v);
             *      y += 40;
             * }*/
        }
예제 #18
0
        private void DrawTools(float x, ref float y, float width)
        {
            WindowUtil.PlusMinusLabel(x, ref y, width, "Tools",
                                      delegate
            {
                Find.WindowStack.Add(new Dialog_Name(
                                         "Name the new tool",
                                         delegate(string name)
                {
                    Tool t = new Tool()
                    {
                        label = name
                    };
                    base.Def.tools.Add(t);
                    this.ToolWidgets.Add(new ToolWidget(t));
                },
                                         delegate(string name)
                {
                    foreach (Tool t in base.Def.tools)
                    {
                        if (t.label.Equals(name))
                        {
                            return("Tool with name \"" + name + "\" already exists.");
                        }
                    }
                    return(true);
                }));
            },
                                      delegate
            {
                WindowUtil.DrawFloatingOptions(
                    new WindowUtil.FloatOptionsArgs <Tool>()
                {
                    items          = base.Def.tools,
                    getDisplayName = delegate(Tool t) { return(t.label); },
                    onSelect       = delegate(Tool t)
                    {
                        for (int i = 0; i < base.Def.tools.Count; ++i)
                        {
                            if (base.Def.tools[i].label.Equals(t.label))
                            {
                                base.Def.tools.RemoveAt(i);
                                break;
                            }
                        }
                        for (int i = 0; i < this.ToolWidgets.Count; ++i)
                        {
                            if (this.ToolWidgets[i].Tool.label.Equals(t.label))
                            {
                                this.ToolWidgets.RemoveAt(i);
                                break;
                            }
                        }
                    }
                });
            });
            y += 10;

            x += 10;

            foreach (ToolWidget w in this.ToolWidgets)
            {
                w.Draw(x, ref y, width - x);
            }
        }