public override void SpawnSetup()
 {
     targetAnimal = new CremationTarget(animalLabel, animalPredicate, 2, Parent);
     targetHumanLike = new CremationTarget(humanLabel, humanPredicate, 1, Parent);
     targetMechanoid = new CremationTarget(mechanoidLabel, mechanoidPredicate, 3, Parent);
 }
        private void DrawItemRow(CremationTarget target, float y)
        {
            Rect itemRect = new Rect(0, y, ItemSize.x, ItemSize.y);

            try
            {
                GUI.BeginGroup(itemRect);
                Text.Font = GameFont.Tiny;
                Text.Anchor = TextAnchor.MiddleCenter;
                float currentX = 0f;

                Rect labelRect = new Rect(currentX, 0, ButtonSize.x, ButtonSize.y);
                Widgets.Label(labelRect, target.Label);
                currentX += ButtonSize.x + buttonMargin;

                //Off selection button
                Rect offButtonRect = new Rect(currentX, 0, ButtonSize.x, ButtonSize.y);
                GUI.DrawTexture(offButtonRect, offButtonTexture);
                if (offButtonRect.Contains(Event.current.mousePosition))
                {
                    Widgets.DrawHighlight(offButtonRect);
                }
                if (target.Mode == CremationOperationMode.Off)
                {
                    Widgets.DrawBox(offButtonRect);
                }
                Widgets.Label(offButtonRect, "Off".Translate());
                if (Widgets.InvisibleButton(offButtonRect))
                {
                    target.Mode = CremationOperationMode.Off;
                    SoundDefOf.Click.PlayOneShotOnCamera();
                }
                currentX += ButtonSize.x + buttonMargin;

                //Cremate selection button
                Rect cremateButtonRect = new Rect(currentX, 0, ButtonSize.x, ButtonSize.y);
                GUI.DrawTexture(cremateButtonRect, cremateButtonTexture);
                if (cremateButtonRect.Contains(Event.current.mousePosition))
                {
                    Widgets.DrawHighlight(cremateButtonRect);
                }
                if (target.Mode == CremationOperationMode.Cremate)
                {
                    Widgets.DrawBox(cremateButtonRect);
                }
                Widgets.Label(cremateButtonRect, "Cremate".Translate());
                if (Widgets.InvisibleButton(cremateButtonRect))
                {
                    target.Mode = CremationOperationMode.Cremate;
                    SoundDefOf.Click.PlayOneShotOnCamera();
                }
                currentX += ButtonSize.x + buttonMargin;

                //Butcher selection button
                Rect butcherButtonRect = new Rect(currentX, 0f, ButtonSize.x, ButtonSize.y);
                GUI.DrawTexture(butcherButtonRect, butcherButtonTexture);
                if (butcherButtonRect.Contains(Event.current.mousePosition))
                {
                    Widgets.DrawHighlight(butcherButtonRect);
                }
                if (target.Mode == CremationOperationMode.Butcher)
                {
                    Widgets.DrawBox(butcherButtonRect);
                }
                Widgets.Label(butcherButtonRect, "Butcher".Translate());
                if (Widgets.InvisibleButton(butcherButtonRect))
                {
                    target.Mode = CremationOperationMode.Butcher;
                    SoundDefOf.Click.PlayOneShotOnCamera();
                }
                currentX += ButtonSize.x + buttonMargin;

                //Do the rotten only check box
                //Rect onlyRottenRect = new Rect(currentX, 0, ButtonSize.x, ButtonSize.y);
                //Widgets.LabelCheckbox(onlyRottenRect, "Only rotten".Translate(), ref target.OnlyRotten);
                //if (onlyRottenRect.Contains(Event.current.mousePosition))
                //{
                //    Widgets.DrawHighlight(onlyRottenRect);
                //}
                //currentX += ButtonSize.x + buttonMargin;
            }
            finally
            {
                GUI.EndGroup();
                Text.Font = GameFont.Small;
                Text.Anchor = TextAnchor.UpperLeft;
                GUI.color = Color.white;
            }
        }
Exemple #3
0
        private void DrawItemRow(CremationTarget target, float y)
        {
            Rect itemRect = new Rect(0, y, ItemSize.x, ItemSize.y);

            try
            {
                GUI.BeginGroup(itemRect);
                Text.Font   = GameFont.Tiny;
                Text.Anchor = TextAnchor.MiddleCenter;
                float currentX = 0f;

                Rect labelRect = new Rect(currentX, 0, ButtonSize.x, ButtonSize.y);
                Widgets.Label(labelRect, target.Label);
                currentX += ButtonSize.x + buttonMargin;

                //Off selection button
                Rect offButtonRect = new Rect(currentX, 0, ButtonSize.x, ButtonSize.y);
                GUI.DrawTexture(offButtonRect, offButtonTexture);
                if (offButtonRect.Contains(Event.current.mousePosition))
                {
                    Widgets.DrawHighlight(offButtonRect);
                }
                if (target.Mode == CremationOperationMode.Off)
                {
                    Widgets.DrawBox(offButtonRect);
                }
                Widgets.Label(offButtonRect, "Off".Translate());
                if (Widgets.InvisibleButton(offButtonRect))
                {
                    target.Mode = CremationOperationMode.Off;
                    SoundDefOf.Click.PlayOneShotOnCamera();
                }
                currentX += ButtonSize.x + buttonMargin;

                //Cremate selection button
                Rect cremateButtonRect = new Rect(currentX, 0, ButtonSize.x, ButtonSize.y);
                GUI.DrawTexture(cremateButtonRect, cremateButtonTexture);
                if (cremateButtonRect.Contains(Event.current.mousePosition))
                {
                    Widgets.DrawHighlight(cremateButtonRect);
                }
                if (target.Mode == CremationOperationMode.Cremate)
                {
                    Widgets.DrawBox(cremateButtonRect);
                }
                Widgets.Label(cremateButtonRect, "Cremate".Translate());
                if (Widgets.InvisibleButton(cremateButtonRect))
                {
                    target.Mode = CremationOperationMode.Cremate;
                    SoundDefOf.Click.PlayOneShotOnCamera();
                }
                currentX += ButtonSize.x + buttonMargin;

                //Butcher selection button
                Rect butcherButtonRect = new Rect(currentX, 0f, ButtonSize.x, ButtonSize.y);
                GUI.DrawTexture(butcherButtonRect, butcherButtonTexture);
                if (butcherButtonRect.Contains(Event.current.mousePosition))
                {
                    Widgets.DrawHighlight(butcherButtonRect);
                }
                if (target.Mode == CremationOperationMode.Butcher)
                {
                    Widgets.DrawBox(butcherButtonRect);
                }
                Widgets.Label(butcherButtonRect, "Butcher".Translate());
                if (Widgets.InvisibleButton(butcherButtonRect))
                {
                    target.Mode = CremationOperationMode.Butcher;
                    SoundDefOf.Click.PlayOneShotOnCamera();
                }
                currentX += ButtonSize.x + buttonMargin;

                //Do the rotten only check box
                //Rect onlyRottenRect = new Rect(currentX, 0, ButtonSize.x, ButtonSize.y);
                //Widgets.LabelCheckbox(onlyRottenRect, "Only rotten".Translate(), ref target.OnlyRotten);
                //if (onlyRottenRect.Contains(Event.current.mousePosition))
                //{
                //    Widgets.DrawHighlight(onlyRottenRect);
                //}
                //currentX += ButtonSize.x + buttonMargin;
            }
            finally
            {
                GUI.EndGroup();
                Text.Font   = GameFont.Small;
                Text.Anchor = TextAnchor.UpperLeft;
                GUI.color   = Color.white;
            }
        }