Ejemplo n.º 1
0
 public Command_SetBrainTemplate(Building_SleeveGrower building, bool removeActiveBrain = false)
 {
     this.building = building;
     this.map      = building.Map;
     this.allowRemoveActiveBrain = removeActiveBrain;
 }
        public CustomizeSleeveWindow(Building_SleeveGrower sleeveGrower)
        {
            this.sleeveGrower  = sleeveGrower;
            currentPawnKindDef = PawnKindDefOf.Colonist;
            var gender = Gender.Male;

            if (Rand.Chance(0.5f))
            {
                gender = Gender.Female;
            }
            newSleeve = GetNewPawn(gender);


            //860x570
            //init Rects
            //gender
            lblGender           = new Rect(leftOffset, topOffset, labelWidth, buttonHeight);
            btnGenderMale       = lblGender;
            btnGenderMale.width = buttonWidth;
            btnGenderMale.x    += returnButtonOffset(lblGender);
            btnGenderFemale     = btnGenderMale;
            btnGenderFemale.x  += btnGenderMale.width + buttonOffsetFromButton;

            //skin colour
            lblSkinColour              = new Rect(leftOffset, returnYfromPrevious(lblGender), labelWidth, buttonHeight);
            btnSkinColourOutline       = lblSkinColour;
            btnSkinColourOutline.x    += returnButtonOffset(lblGender);
            btnSkinColourOutline.width = 10 + (smallButtonOptionWidth + 5) * 5; //5 on each side + (buttonoptionwidth + offset) * number of buttons
            btnSkinColour1             = new Rect(btnSkinColourOutline.x + 5, btnSkinColourOutline.y + 5, smallButtonOptionWidth, btnSkinColourOutline.height - 10);
            btnSkinColour2             = new Rect(btnSkinColour1.x + 5 + smallButtonOptionWidth, btnSkinColourOutline.y + 5, smallButtonOptionWidth, btnSkinColourOutline.height - 10);
            btnSkinColour3             = new Rect(btnSkinColour2.x + 5 + smallButtonOptionWidth, btnSkinColourOutline.y + 5, smallButtonOptionWidth, btnSkinColourOutline.height - 10);
            btnSkinColour4             = new Rect(btnSkinColour3.x + 5 + smallButtonOptionWidth, btnSkinColourOutline.y + 5, smallButtonOptionWidth, btnSkinColourOutline.height - 10);
            btnSkinColour5             = new Rect(btnSkinColour4.x + 5 + smallButtonOptionWidth, btnSkinColourOutline.y + 5, smallButtonOptionWidth, btnSkinColourOutline.height - 10);

            //head shape
            lblHeadShape              = new Rect(leftOffset, returnYfromPrevious(lblSkinColour), labelWidth, buttonHeight);
            btnHeadShapeOutline       = lblHeadShape;
            btnHeadShapeOutline.x    += returnButtonOffset(lblHeadShape);
            btnHeadShapeOutline.width = buttonWidth * 2 + buttonOffsetFromButton;
            btnHeadShapeArrowLeft     = new Rect(btnHeadShapeOutline.x + 2, btnHeadShapeOutline.y, btnHeadShapeOutline.height, btnHeadShapeOutline.height);
            btnHeadShapeArrowRight    = new Rect(btnHeadShapeOutline.x + btnHeadShapeOutline.width - btnHeadShapeOutline.height - 2, btnHeadShapeOutline.y, btnHeadShapeOutline.height, btnHeadShapeOutline.height);
            btnHeadShapeSelection     = new Rect(btnHeadShapeOutline.x + 5 + btnHeadShapeArrowLeft.width, btnHeadShapeOutline.y, btnHeadShapeOutline.width - 2 * (btnHeadShapeArrowLeft.width) - 10, btnHeadShapeOutline.height);


            //body shape
            lblBodyShape              = new Rect(leftOffset, returnYfromPrevious(lblHeadShape), labelWidth, buttonHeight);
            btnBodyShapeOutline       = lblBodyShape;
            btnBodyShapeOutline.x    += returnButtonOffset(lblBodyShape);
            btnBodyShapeOutline.width = buttonWidth * 2 + buttonOffsetFromButton;
            btnBodyShapeArrowLeft     = new Rect(btnBodyShapeOutline.x + 2, btnBodyShapeOutline.y, btnBodyShapeOutline.height, btnBodyShapeOutline.height);
            btnBodyShapeArrowRight    = new Rect(btnBodyShapeOutline.x + btnBodyShapeOutline.width - btnBodyShapeOutline.height - 2, btnBodyShapeOutline.y, btnBodyShapeOutline.height, btnBodyShapeOutline.height);
            btnBodyShapeSelection     = new Rect(btnBodyShapeOutline.x + 5 + btnBodyShapeArrowLeft.width, btnBodyShapeOutline.y, btnBodyShapeOutline.width - 2 * (btnBodyShapeArrowLeft.width) - 10, btnBodyShapeOutline.height);

            //hair colour
            lblHairColour = new Rect(leftOffset, returnYfromPrevious(lblBodyShape), labelWidth, buttonHeight);
            btnHairColourOutlinePremade       = lblHairColour;
            btnHairColourOutlinePremade.x    += returnButtonOffset(lblHairColour);
            btnHairColourOutlinePremade.width = buttonWidth * 2 + buttonOffsetFromButton;
            btnHairColourOutline    = btnHairColourOutlinePremade;
            btnHairColourOutline.y  = returnYfromPrevious(btnHairColourOutlinePremade);
            btnHairColourOutline2   = btnHairColourOutline;
            btnHairColourOutline2.y = returnYfromPrevious(btnHairColourOutline);
            btnHairColour1          = new Rect(btnHairColourOutlinePremade.x + 5, btnHairColourOutlinePremade.y + 5, smallButtonOptionWidthHair, btnHairColourOutlinePremade.height - 10);
            btnHairColour2          = new Rect(btnHairColour1.x + 5 + smallButtonOptionWidthHair, btnHairColourOutlinePremade.y + 5, smallButtonOptionWidthHair, btnHairColourOutlinePremade.height - 10);
            btnHairColour3          = new Rect(btnHairColour2.x + 5 + smallButtonOptionWidthHair, btnHairColourOutlinePremade.y + 5, smallButtonOptionWidthHair, btnHairColourOutlinePremade.height - 10);
            btnHairColour4          = new Rect(btnHairColour3.x + 5 + smallButtonOptionWidthHair, btnHairColourOutlinePremade.y + 5, smallButtonOptionWidthHair, btnHairColourOutlinePremade.height - 10);
            btnHairColour5          = new Rect(btnHairColour4.x + 5 + smallButtonOptionWidthHair, btnHairColourOutlinePremade.y + 5, smallButtonOptionWidthHair, btnHairColourOutlinePremade.height - 10);
            btnHairColour6          = new Rect(btnHairColour5.x + 5 + smallButtonOptionWidthHair, btnHairColourOutlinePremade.y + 5, smallButtonOptionWidthHair, btnHairColourOutlinePremade.height - 10);
            btnHairColour7          = new Rect(btnHairColour6.x + 5 + smallButtonOptionWidthHair, btnHairColourOutlinePremade.y + 5, smallButtonOptionWidthHair, btnHairColourOutlinePremade.height - 10);
            btnHairColour8          = new Rect(btnHairColour7.x + 5 + smallButtonOptionWidthHair, btnHairColourOutlinePremade.y + 5, smallButtonOptionWidthHair, btnHairColourOutlinePremade.height - 10);


            //hairtype
            lblHairType              = new Rect(leftOffset, returnYfromPrevious(btnHairColourOutline2), labelWidth, buttonHeight);
            btnHairTypeOutline       = lblHairType;
            btnHairTypeOutline.x    += returnButtonOffset(lblHairType);
            btnHairTypeOutline.width = buttonWidth * 2 + buttonOffsetFromButton;
            btnHairTypeArrowLeft     = new Rect(btnHairTypeOutline.x + 2, btnHairTypeOutline.y, btnHairTypeOutline.height, btnHairTypeOutline.height);
            btnHairTypeArrowRight    = new Rect(btnHairTypeOutline.x + btnHairTypeOutline.width - btnHairTypeOutline.height - 2, btnHairTypeOutline.y, btnHairTypeOutline.height, btnHairTypeOutline.height);
            btnHairTypeSelection     = new Rect(btnHairTypeOutline.x + 5 + btnHairTypeArrowLeft.width, btnHairTypeOutline.y, btnHairTypeOutline.width - 2 * (btnHairTypeArrowLeft.width) - 10, btnHairTypeOutline.height);



            //timetogrow
            lblTimeToGrow = new Rect(leftOffset, returnYfromPrevious(lblHairType), labelWidth * 3, buttonHeight);

            //biomass
            lblRequireBiomass = new Rect(leftOffset, lblTimeToGrow.y + lblTimeToGrow.height, labelWidth * 3, buttonHeight);

            //Pawn
            pawnBox     = new Rect(labelWidth + buttonOffsetFromText + buttonWidth * 2 + buttonOffsetFromButton + 30 + leftOffset, topOffset, pawnBoxSide, pawnBoxSide);
            pawnBoxPawn = new Rect(pawnBox.x + pawnSpacingFromEdge, pawnBox.y + pawnSpacingFromEdge, pawnBox.width - pawnSpacingFromEdge * 2, pawnBox.height - pawnSpacingFromEdge * 2);

            //Levels of Beauty
            lblLevelOfBeauty     = new Rect(pawnBox.x, pawnBox.y + pawnBox.height + optionOffset, pawnBox.width, buttonHeight);
            btnLevelOfBeauty1    = new Rect(lblLevelOfBeauty.x, lblLevelOfBeauty.y + lblLevelOfBeauty.height + 2, (pawnBox.width - 9) / 3, buttonHeight);
            btnLevelOfBeauty2    = btnLevelOfBeauty1;
            btnLevelOfBeauty2.x += (pawnBox.width) / 3;
            btnLevelOfBeauty3    = btnLevelOfBeauty2;
            btnLevelOfBeauty3.x += (pawnBox.width) / 3;

            //Levels of Quality
            lblLevelOfQuality     = new Rect(lblLevelOfBeauty.x, btnLevelOfBeauty1.y + btnLevelOfBeauty1.height + optionOffset / 2, pawnBox.width, buttonHeight);
            btnLevelOfQuality1    = new Rect(lblLevelOfQuality.x, lblLevelOfQuality.y + lblLevelOfQuality.height + 2, (pawnBox.width - 9) / 3, buttonHeight);
            btnLevelOfQuality2    = btnLevelOfQuality1;
            btnLevelOfQuality2.x += (pawnBox.width) / 3;
            btnLevelOfQuality3    = btnLevelOfQuality2;
            btnLevelOfQuality3.x += (pawnBox.width) / 3;

            //Accept/Cancel buttons
            btnAccept = new Rect(InitialSize.x * .5f - buttonWidth / 2 - buttonOffsetFromButton / 2 - buttonWidth / 2, InitialSize.y - buttonHeight - 38, buttonWidth, buttonHeight);
            btnCancel = new Rect(InitialSize.x * .5f + buttonWidth / 2 + buttonOffsetFromButton / 2 - buttonWidth / 2, InitialSize.y - buttonHeight - 38, buttonWidth, buttonHeight);

            //Create textures
            updateColors();
        }