Ejemplo n.º 1
0
        private void CreateDrillableSettingsFields(DrillData dd, int rowIdx)
        {
            // Icon
            Widgets.ThingIcon(Table.GetFieldRect(0, rowIdx).Replace_Width(ICON_SIZE), dd.ThingDefToDrill, null, 1f);

            // ThingDef.label
            Widgets.Label(Table.GetFieldRect(0, rowIdx).Add_X(ICON_SIZE + 2), dd.ThingDefToDrill.label);

            // Work Amount
            string bufferWorkAmount = dd.WorkAmount.ToString();

            Widgets.TextFieldNumeric(Table.GetFieldRect(1, rowIdx).Replace_Width(NUMERIC_INPUT_WIDTH), ref dd.WorkAmount, ref bufferWorkAmount, WORK_AMOUNT_MIN, WORK_AMOUNT_MAX);
            int count = (int)Widgets.HorizontalSlider(GetSliderField(1, rowIdx), dd.WorkAmount, WORK_AMOUNT_MIN, WORK_AMOUNT_MAX);

            if (count != dd.WorkAmount)
            {
                dd.WorkAmount = count;
            }

            // Yield Amount
            string bufferYieldAmount = dd.YieldAmount.ToString();

            Widgets.TextFieldNumeric(Table.GetFieldRect(2, rowIdx).Replace_Width(NUMERIC_INPUT_WIDTH), ref dd.YieldAmount, ref bufferYieldAmount, YIELD_AMOUNT_MIN, dd.MaxYieldAmount);
            int countYield = (int)Widgets.HorizontalSlider(GetSliderField(2, rowIdx), dd.YieldAmount, YIELD_AMOUNT_MIN, dd.MaxYieldAmount);

            if (countYield != dd.YieldAmount)
            {
                dd.YieldAmount = countYield;
            }

            // Row Mouse Hover
            Table.ApplyMouseOverEntireRow(rowIdx);
            TooltipHandler.TipRegion(Table.GetRowRect(rowIdx).LeftHalf(), dd.ThingDefToDrill.description);
        }
        public static void CreateDrillableSettingsFields(DrillData dd, int rowIdx, ref TableData tableData, float iconSize,
                                                         float numericInputWidth, float workAmountMin, float workAmountMax, float yieldAmountMin)
        {
            // Icon
            Widgets.ThingIcon(tableData.GetFieldRect(0, rowIdx).Replace_Width(iconSize), dd.ThingDefToDrill);

            // ThingDef.label
            Widgets.Label(tableData.GetFieldRect(0, rowIdx).Add_X(iconSize + 2), dd.ThingDefToDrill.label);

            // Work Amount
            string bufferWorkAmount = dd.WorkAmount.ToString();

            Widgets.TextFieldNumeric(tableData.GetFieldRect(1, rowIdx).Replace_Width(numericInputWidth), ref dd.WorkAmount, ref bufferWorkAmount, workAmountMin, workAmountMax);
            int count = (int)Widgets.HorizontalSlider(GetSliderField(1, rowIdx, tableData, numericInputWidth), dd.WorkAmount, workAmountMin, workAmountMax);

            if (count != dd.WorkAmount)
            {
                dd.WorkAmount = count;
            }

            // Yield Amount
            string bufferYieldAmount = dd.YieldAmount.ToString();

            Widgets.TextFieldNumeric(tableData.GetFieldRect(2, rowIdx).Replace_Width(numericInputWidth), ref dd.YieldAmount, ref bufferYieldAmount, yieldAmountMin, dd.MaxYieldAmount);
            int countYield = (int)Widgets.HorizontalSlider(GetSliderField(2, rowIdx, tableData, numericInputWidth), dd.YieldAmount, yieldAmountMin, dd.MaxYieldAmount);

            if (countYield != dd.YieldAmount)
            {
                dd.YieldAmount = countYield;
            }

            // Row Mouse Hover
            tableData.ApplyMouseOverEntireRow(rowIdx);
            TooltipHandler.TipRegion(tableData.GetRowRect(rowIdx).LeftHalf(), dd.ThingDefToDrill.description);
        }