示例#1
0
        private void TryToConnectToPylon(Building_LaserFencePylon linkedPylon, Rot4 direction, int fenceLength, bool forceConnection)
        {
            Rot4 linkedPylonDirection = direction;

            linkedPylonDirection.Rotate(RotationDirection.Clockwise); // Rotate 2 times to get the opposite direction.
            linkedPylonDirection.Rotate(RotationDirection.Clockwise);
            // Check connection is allowed.
            if (forceConnection)
            {
                linkedPylon.connectionIsAllowedByUser[linkedPylonDirection.AsInt]       = true;
                linkedPylon.cachedConnectionIsAllowedByUser[linkedPylonDirection.AsInt] = true;
            }
            if (linkedPylon.connectionIsAllowedByUser[linkedPylonDirection.AsInt] == false)
            {
                this.connectionIsAllowedByUser[direction.AsInt]       = false;
                this.cachedConnectionIsAllowedByUser[direction.AsInt] = false;
                return;
            }
            // Check linkedPylon is powered.
            CompPowerTrader linkedPowerComp = linkedPylon.TryGetComp <CompPowerTrader>();

            if ((linkedPowerComp != null) &&
                linkedPowerComp.PowerOn)
            {
                if (linkedPylon.linkedPylons[linkedPylonDirection.AsInt] != null)
                {
                    // If linkedPylon is already connected to a third pylon, first disconnect from it.
                    linkedPylon.DisconnectFromPylon(linkedPylonDirection);
                }
                this.linkedPylons[direction.AsInt] = linkedPylon;
                this.ActivateFence(direction, fenceLength);
                linkedPylon.linkedPylons[linkedPylonDirection.AsInt] = this;
                linkedPylon.ActivateFence(linkedPylonDirection, fenceLength);
            }
        }
示例#2
0
 public void DoExtraGuiControls()
 {
     if (allowRotating)
     {
         Rect winRect = new Rect(0, Verse.UI.screenHeight - 35 - 90f, 200f, 90f);
         Find.WindowStack.ImmediateWindow(73095, winRect, WindowLayer.GameUI, delegate
         {
             RotationDirection rotationDirection = RotationDirection.None;
             Text.Anchor = TextAnchor.MiddleCenter;
             Text.Font   = GameFont.Medium;
             Rect rect   = new Rect(winRect.width / 2f - 64f - 5f, 15f, 64f, 64f);
             if (Widgets.ButtonImage(rect, TexUI.RotLeftTex, true))
             {
                 SoundDefOf.DragSlider.PlayOneShotOnCamera(null);
                 rotationDirection = RotationDirection.Counterclockwise;
                 Event.current.Use();
             }
             Widgets.Label(rect, KeyBindingDefOf.Designator_RotateLeft.MainKeyLabel);
             Rect rect2 = new Rect(winRect.width / 2f + 5f, 15f, 64f, 64f);
             if (Widgets.ButtonImage(rect2, TexUI.RotRightTex, true))
             {
                 SoundDefOf.DragSlider.PlayOneShotOnCamera(null);
                 rotationDirection = RotationDirection.Clockwise;
                 Event.current.Use();
             }
             Widgets.Label(rect2, KeyBindingDefOf.Designator_RotateRight.MainKeyLabel);
             if (rotationDirection != RotationDirection.None)
             {
                 landingRotation.Rotate(rotationDirection);
             }
             Text.Anchor = TextAnchor.UpperLeft;
             Text.Font   = GameFont.Small;
         }, true, false, 1f);
     }
 }
示例#3
0
 private void DisconnectFromPylon(Rot4 direction)
 {
     if (this.linkedPylons[direction.AsInt] != null)
     {
         this.DeactivateFence(direction);
         Rot4 linkedPylonDirection = direction;
         linkedPylonDirection.Rotate(RotationDirection.Clockwise); // Rotate 2 times to get the opposite direction.
         linkedPylonDirection.Rotate(RotationDirection.Clockwise);
         this.linkedPylons[direction.AsInt].DeactivateFence(linkedPylonDirection);
         this.linkedPylons[direction.AsInt].linkedPylons[linkedPylonDirection.AsInt] = null;
         this.linkedPylons[direction.AsInt] = null;
     }
 }
示例#4
0
 public void DeactivateFence(Rot4 direction)
 {
     if (this.linkedPylons[direction.AsInt] != null)
     {
         this.RemoveFenceElements(direction);
         Rot4 linkedPylonDirection = direction;
         linkedPylonDirection.Rotate(RotationDirection.Clockwise); // Rotate 2 times to get the opposite direction.
         linkedPylonDirection.Rotate(RotationDirection.Clockwise);
         this.linkedPylons[direction.AsInt].RemoveFenceElements(linkedPylonDirection);
         this.linkedPylons[direction.AsInt].linkedPylons[linkedPylonDirection.AsInt] = null;
         this.linkedPylons[direction.AsInt] = null;
     }
 }
        public override void Draw()
        {
            base.Rotation = Building_Door.DoorRotationAt(base.Position, base.Map);
            float num = Mathf.Clamp01((float)base.visualTicksOpen / (float)base.TicksToOpenNow);
            float d   = 0.45f * num;

            for (int i = 0; i < 2; i++)
            {
                Vector3 vector = default(Vector3);
                Mesh    mesh;
                if (i == 0)
                {
                    Log.Message("i == 0 " + def.defName + " open.");
                    vector = new Vector3(0f, 0f, -1f);
                    mesh   = MeshPool.plane10;
                }
                else
                {
                    Log.Message("i != 0 " + def.defName + " close.");
                    vector = new Vector3(0f, 0f, 1f);
                    mesh   = MeshPool.plane10Flip;
                }
                Rot4 rotation = base.Rotation;
                rotation.Rotate(RotationDirection.Clockwise);
                vector = rotation.AsQuat * vector;
                Vector3 vector2 = this.DrawPos;
                vector2.y = AltitudeLayer.DoorMoveable.AltitudeFor();
                vector2  += vector * d;
                Graphics.DrawMesh(mesh, vector2, base.Rotation.AsQuat, this.Graphic.MatAt(base.Rotation, null), 0);
            }
            base.Comps_PostDraw();
        }
示例#6
0
        private static void GetModifiedValue(RaceAddonComp racomp, ref Quaternion bodyQuat, ref Quaternion headQuat, ref Vector3 bodyLoc, ref Vector3 headLoc,
                                             Pawn pawn, ref bool renderBody, ref Rot4 bodyFacing, ref Rot4 headFacing, bool portrait)
        {
            bool headAnimation = false;

            if (!portrait && pawn.Awake())
            {
                if (racomp.raceAddonGraphicSet.headRotator != null && !pawn.Drafted)
                {
                    headQuat *= racomp.raceAddonGraphicSet.headRotator.GetQuat();
                }
                if (racomp.raceAddonGraphicSet.headTargeter != null && !pawn.Downed)
                {
                    var initialRot = headFacing;
                    headFacing.Rotate(racomp.raceAddonGraphicSet.headTargeter.RotDirection);
                    if (initialRot != headFacing)
                    {
                        headAnimation = true;
                    }
                }
            }
            if (!portrait && headAnimation)
            {
                racomp.torsoDef.headTargetingOffsets.Correction(ref headLoc, bodyFacing, headFacing);
            }
            if (portrait || renderBody)
            {
                headLoc.x *= racomp.raceAddonGraphicSet.presentAgeSetting.drawSize.head.x;
                headLoc.z *= racomp.raceAddonGraphicSet.presentAgeSetting.drawSize.head.y;
            }
            headLoc = bodyLoc + (bodyQuat * headLoc);
        }
 public override void PostDraw()
 {
     base.PostDraw();
     if (!allowAutoRefuel)
     {
         parent.Map.overlayDrawer.DrawOverlay(parent, OverlayTypes.ForbiddenRefuel);
     }
     else if (!HasFuel && Props.drawOutOfFuelOverlay)
     {
         parent.Map.overlayDrawer.DrawOverlay(parent, OverlayTypes.OutOfFuel);
     }
     if (Props.drawFuelGaugeInMap)
     {
         GenDraw.FillableBarRequest r = default(GenDraw.FillableBarRequest);
         r.center      = parent.DrawPos + Vector3.up * 0.1f;
         r.size        = FuelBarSize;
         r.fillPercent = FuelPercentOfMax;
         r.filledMat   = FuelBarFilledMat;
         r.unfilledMat = FuelBarUnfilledMat;
         r.margin      = 0.15f;
         Rot4 rotation = parent.Rotation;
         rotation.Rotate(RotationDirection.Clockwise);
         r.rotation = rotation;
         GenDraw.DrawFillableBar(r);
     }
 }
示例#8
0
        public static void DesignatorRotate(Designator_Place designator, RotationDirection direction)
        {
            Rot4 rotation = GetDesignatorRotation(designator);

            rotation.Rotate(direction);
            SetDesignatorRotation(designator, rotation);
        }
        // Token: 0x060012B1 RID: 4785 RVA: 0x0008FCBC File Offset: 0x0008E0BC
        public override void PostDraw()
        {
            base.PostDraw();
            GenDraw.FillableBarRequest r = default(GenDraw.FillableBarRequest);
            r.center      = this.parent.DrawPos + Vector3.up * 0.1f;
            r.center.x   += 0.45f;
            r.size        = CompPowerPlantSolarCell.BarSize;
            r.fillPercent = this.DesiredPowerOutput / this.Props.solarEnergyMax;
            r.filledMat   = CompPowerPlantSolarCell.PowerPlantSolarBarFilledMat;
            r.unfilledMat = CompPowerPlantSolarCell.PowerPlantSolarBarUnfilledMat;
            r.margin      = 0.07f;
            Rot4 rotation = this.parent.Rotation;

            rotation.Rotate(RotationDirection.Clockwise);
            r.rotation = rotation;
            GenDraw.DrawFillableBar(r);

            GenDraw.FillableBarRequest r2 = default(GenDraw.FillableBarRequest);
            r2.center      = this.parent.DrawPos + Vector3.up * 0.1f;
            r2.center.x   -= 0.45f;
            r2.size        = CompPowerPlantSolarCell.BarSize;
            r2.fillPercent = StoredEnergyPct;
            r2.filledMat   = CompPowerPlantSolarCell.BatterySolarBarFilledMat;
            r2.unfilledMat = CompPowerPlantSolarCell.BatterySolarBarUnfilledMat;
            r2.margin      = 0.07f;
            Rot4 rotation2 = this.parent.Rotation;

            rotation2.Rotate(RotationDirection.Clockwise);
            r2.rotation = rotation2;
            GenDraw.DrawFillableBar(r2);
        }
示例#10
0
        public override void Draw()
        {
            base.Rotation = Building_Door.DoorRotationAt(base.Position, base.Map);
            float num = Mathf.Clamp01((float)this.visualTicksOpen / (float)this.VisualTicksToOpen);
            float d   = (float)(0.44999998807907104 * num);

            for (int i = 0; i < 2; i++)
            {
                Vector3 vector = default(Vector3);
                Mesh    mesh;
                if (i == 0)
                {
                    vector = new Vector3(0f, 0f, -1f);
                    mesh   = MeshPool.plane10;
                }
                else
                {
                    vector = new Vector3(0f, 0f, 1f);
                    mesh   = MeshPool.plane10Flip;
                }
                Rot4 rotation = base.Rotation;
                rotation.Rotate(RotationDirection.Clockwise);
                vector = rotation.AsQuat * vector;
                Vector3 vector2 = this.DrawPos;
                vector2.y = Altitudes.AltitudeFor(AltitudeLayer.DoorMoveable);
                vector2  += vector * d;
                Graphics.DrawMesh(mesh, vector2, base.Rotation.AsQuat, this.Graphic.MatAt(base.Rotation, null), 0);
            }
            base.Comps_PostDraw();
        }
示例#11
0
        public override void Draw()
        {
            base.Draw();
            if (compWaterTank == null)
            {
                compWaterTank = base.GetComp <CompWaterTank>();
            }
            GenDraw.FillableBarRequest r = default(GenDraw.FillableBarRequest);
            r.center = (this.DrawPos + Vector3.up * 0.1f) + compWaterTank.Props.indicatorOffset;
            r.size   = new Vector2
                           (Building_Boiler.WaterBarSize.x * compWaterTank.Props.indicatorDrawSize.x,
                           Building_Boiler.WaterBarSize.y * compWaterTank.Props.indicatorDrawSize.y);
            r.fillPercent = compWaterTank.StoredWater / compWaterTank.Props.storedWaterMax;
            r.filledMat   = Building_Boiler.WaterFilledMat;
            r.unfilledMat = Building_Boiler.WaterUnfilledMat;
            r.margin      = 0.15f;
            Rot4 rotation = base.Rotation;

            rotation.Rotate(RotationDirection.Clockwise);
            r.rotation = rotation;
            GenDraw.DrawFillableBar(r);
            if (this.ticksToExplode > 0 && base.Spawned)
            {
                base.Map.overlayDrawer.DrawOverlay(this, OverlayTypes.BurningWick);
            }
        }
示例#12
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            foreach (Gizmo baseGizmo in base.GetGizmos())
            {
                yield return(baseGizmo);
            }
            yield return(new Command_Action
            {
                action = MakeMatchingGrowZone,
                hotKey = KeyBindingDefOf.Misc2,
                defaultDesc = "CommandSunLampMakeGrowingZoneDesc".Translate(),
                icon = ContentFinder <Texture2D> .Get("UI/Designators/ZoneCreate_Growing"),
                defaultLabel = "CommandSunLampMakeGrowingZoneLabel".Translate()
            });

            yield return(new Command_Action
            {
                icon = TexUI.RotRightTex,
                defaultIconColor = Color.green,
                defaultLabel = "CultivatorTools_AdjustDirection_Output".Translate(),
                defaultDesc = "CultivatorTools_AdjustDirection_Desc".Translate(outputRotation.AsCompassDirection()),
                activateSound = SoundDefOf.Click,
                action = () => outputRotation.Rotate(RotationDirection.Clockwise)
            });
        }
示例#13
0
        public void Rotate(RotationDirection direction)
        {
            // update position within blueprint
            // for a clock wise rotation
            if (direction == RotationDirection.Clockwise)
            {
                _position = _position.RotatedBy(Rot4.East);
            }

            // counter clock wise is the reverse
            else
            {
                _position = _position.RotatedBy(Rot4.West);
            }

            // update rotation of item
            // if there's no thingdef, there's no point.
            if (_thingDef == null)
            {
                return;
            }

            // if it's not rotatable AND not a linked building (e.g. walls, sandbags), don't rotate.
            if (!_thingDef.rotatable && !_thingDef.graphicData.Linked)
            {
                return;
            }
            // NOTE: this may prove problematic with oddly sized items that are not rotatable - their relative positions may change.

            // internal rotation
            _rotation.Rotate(direction);

            // reflect changes in designator
            Resources.SetDesignatorRotation(Designator, _rotation);
        }
        //[ReloadMethod]
        public void DrawStretchParams(DoorExpandedDef thingDef, Vector3 drawPos, Rot4 rotation, out Mesh mesh, out Matrix4x4 matrix, float mod = 1, bool flipped = false)
        {
            base.Rotation = Building_Door.DoorRotationAt(base.Position, base.Map);
            bool    verticalRotation = base.Rotation.IsHorizontal;
            Vector3 rotationVector   = default(Vector3);

            if (!flipped)
            {
                rotationVector = new Vector3(0f, 0f, -1f);
                mesh           = MeshPool.plane10;
            }
            else
            {
                rotationVector = new Vector3(0f, 0f, 1f);
                mesh           = MeshPool.plane10Flip;
            }
            rotation.Rotate(RotationDirection.Clockwise);
            rotationVector = rotation.AsQuat * rotationVector;

            Vector3 graphicVector = drawPos;

            graphicVector.y = Altitudes.AltitudeFor(AltitudeLayer.DoorMoveable);
            graphicVector  += rotationVector * (mod * 1.15f);

            //Vector3 scaleVector = new Vector3(thingDef.graphicData.drawSize.x, 1f, thingDef.graphicData.drawSize.y);
            float   persMod     = (thingDef.fixedPerspective) ? 2f : 1f;
            Vector3 scaleVector = (verticalRotation) ?
                                  new Vector3((thingDef.graphicData.drawSize.x * persMod) - mod * 1.3f, 1f, thingDef.graphicData.drawSize.y * persMod) :
                                  new Vector3((thingDef.graphicData.drawSize.x) - mod * 1.3f, 1f, thingDef.graphicData.drawSize.y);


            matrix = default(Matrix4x4);
            matrix.SetTRS(graphicVector, base.Rotation.AsQuat, scaleVector);
        }
        public override void PostDraw()
        {
            base.PostDraw();
            GenDraw.FillableBarRequest r = new GenDraw.FillableBarRequest();
            r.center      = this.parent.DrawPos + Vector3.up * 0.1f;
            r.size        = BarSize;
            r.fillPercent = gas.totalPressure / MaxPressure;
            //if()

            if (BarType == 1)
            {
                r.filledMat = PowerPlantSolarBarFilledMatDispersing;
            }
            else if (BarType == 2)
            {
                r.filledMat   = PowerPlantSolarBarFilledMatIonizingGasPressure;
                r.fillPercent = gas.totalPressure / (MaxPressure * 0.005f);
            }
            else if (BarType == 3)
            {
                r.filledMat = PowerPlantSolarBarFilledMatCo2Hazard;
            }
            else
            {
                r.filledMat = PowerPlantSolarBarFilledMat;
            }

            r.unfilledMat = PowerPlantSolarBarUnfilledMat;
            r.margin      = 0.15f;
            Rot4 rotation = this.parent.Rotation;

            rotation.Rotate(RotationDirection.Clockwise);
            r.rotation = rotation;
            GenDraw.DrawFillableBar(r);
        }
示例#16
0
        public override void Draw()
        {
            base.Draw();
            float num = -3.5f * Mathf.Clamp01((float)ticksSinceOpen / (float)TicksToOpenNow);
            float d   = 0f + (0f * num);

            for (int i = 0; i < 2; i++)
            {
                Vector3 vector;
                Mesh    mesh;
                if (i == 0)
                {
                    vector = new Vector3(0f, 0f, 0f);
                    mesh   = doorOne;
                }
                else
                {
                    vector = new Vector3(0f, 0f, 0f);
                    mesh   = doorTwo;
                }
                Rot4 rotation = Rotation;
                rotation.Rotate(RotationDirection.Clockwise);
                vector = rotation.AsQuat * vector;
                Vector3 drawPos = DrawPos;
                drawPos.y = AltitudeLayer.MapDataOverlay.AltitudeFor();
                drawPos  += vector * d;
                if (i == 0 || def.size.x > 3)
                {
                    Graphics.DrawMesh(mesh, drawPos, Rotation.AsQuat, torpedoBayDoor.MatSingle, 0);
                }
            }
        }
示例#17
0
        public Rot4 Rotation(Rot4 headFacing, bool renderBody)
        {
            if (this._possessed)
            {
                return(this._currentRot);
            }

            Rot4 rot  = headFacing;
            bool flag = false;

            if (renderBody)
            {
                flag = true;
            }
            else if (!rot.IsHorizontal)
            {
                flag = true;
            }

            if (flag)
            {
                rot.Rotate(this._rotationMod);
            }

            this._currentRot = rot;
            return(this._currentRot);
        }
示例#18
0
        public static void DrawDoor(Building_Door door, int baseLevel, int curLevel)
        {
            door.Rotation = Building_Door.DoorRotationAt(door.Position, door.Map);
            float num = Mathf.Clamp01((float)door.ticksSinceOpen / (float)door.TicksToOpenNow);
            float d   = 0f + 0.45f * num;

            for (int i = 0; i < 2; i++)
            {
                Vector3 vector = default(Vector3);
                Mesh    mesh;
                if (i == 0)
                {
                    vector = new Vector3(0f, 0f, -1f);
                    mesh   = MeshPool.plane10;
                }
                else
                {
                    vector = new Vector3(0f, 0f, 1f);
                    mesh   = MeshPool.plane10Flip;
                }
                Rot4 rotation = door.Rotation;
                rotation.Rotate(RotationDirection.Clockwise);
                vector = rotation.AsQuat * vector;
                Vector3 drawPos = door.DrawPos;
                drawPos.y  = AltitudeLayer.DoorMoveable.AltitudeFor();
                drawPos   += vector * d;
                drawPos.z += (baseLevel - curLevel) / 2f;
                drawPos.y -= (baseLevel - curLevel) / 2f + 10f;
                Graphics.DrawMesh(mesh, drawPos, door.Rotation.AsQuat, door.Graphic.MatAt(door.Rotation), 0);
            }
            door.Comps_PostDraw();
        }
        // Token: 0x06000017 RID: 23 RVA: 0x000027B8 File Offset: 0x000009B8
        public override void Draw()
        {
            base.Draw();
            float temperature = this.GetRoom(RegionType.Set_Passable).Temperature;

            GenDraw.FillableBarRequest r = default(GenDraw.FillableBarRequest);
            r.center      = this.DrawPos + Vector3.up * 0.05f;
            r.size        = new Vector2(0.7f, 0.1f);
            r.margin      = 0.05f;
            r.fillPercent = ((this.compFlickable == null || this.compFlickable.SwitchIsOn) ? (Mathf.Clamp(Mathf.Abs(temperature), 1f, 50f) / 50f) : 0f);
            r.unfilledMat = Building_TemperatureSwitch.GaugeUnfilledMat;
            bool flag = temperature > 0f;

            if (flag)
            {
                r.filledMat = Building_TemperatureSwitch.GaugeFillHotMat;
            }
            else
            {
                r.filledMat = Building_TemperatureSwitch.GaugeFillColdMat;
            }
            Rot4 rotation = base.Rotation;

            rotation.Rotate(RotationDirection.Clockwise);
            r.rotation = rotation;
            GenDraw.DrawFillableBar(r);
        }
示例#20
0
        public override void Draw()
        {
            base.Rotation = DoorRotationAt(base.Position, base.Map);
            float num = Mathf.Clamp01((float)visualTicksOpen / (float)VisualTicksToOpen);
            float d   = 0.45f * num;

            for (int i = 0; i < 2; i++)
            {
                Vector3 vector = default(Vector3);
                Mesh    mesh;
                if (i == 0)
                {
                    vector = new Vector3(0f, 0f, -1f);
                    mesh   = MeshPool.plane10;
                }
                else
                {
                    vector = new Vector3(0f, 0f, 1f);
                    mesh   = MeshPool.plane10Flip;
                }
                Rot4 rotation = base.Rotation;
                rotation.Rotate(RotationDirection.Clockwise);
                vector = rotation.AsQuat * vector;
                Vector3 vector2 = DrawPos;
                vector2.y = AltitudeLayer.DoorMoveable.AltitudeFor();
                vector2  += vector * d;
                Graphics.DrawMesh(mesh, vector2, base.Rotation.AsQuat, Graphic.MatAt(base.Rotation), 0);
            }
            Comps_PostDraw();
        }
示例#21
0
        public void DrawLedLight()
        {
            MAD.DrawHelper.RectangleRequest r = default(MAD.DrawHelper.RectangleRequest);


            r.size = new Vector2(0.16f, 0.16f);

            if (this.powerComp.PowerOn)
            {
                if (this.IcookingTicking == 0)
                {
                    r.mat = SolidColorMaterials.SimpleSolidColorMaterial(new Color(0f, 0.8f, 0f));
                }
                else
                {
                    r.mat = SolidColorMaterials.SimpleSolidColorMaterial(new Color(0.8f, 0f, 0f));
                }
            }
            else
            {
                r.mat = SolidColorMaterials.SimpleSolidColorMaterial(new Color(0.6f, 0.6f, 0.6f));
            }


            Rot4 rotation2 = base.Rotation;

            rotation2.Rotate(RotationDirection.Clockwise);
            r.rotation = rotation2;

            if (r.rotation == Rot4.West) //North
            {
                r.rotation = Rot4.West;
                r.center   = this.DrawPos + Vector3.up * 0.1f + Vector3.forward * 0.08f;
            }
            if (r.rotation == Rot4.North) //East
            {
                r.rotation = Rot4.North;
                r.center   = this.DrawPos + Vector3.up * 0.1f + Vector3.right * 0.08f;
            }
            if (r.rotation == Rot4.East) //South
            {
                r.rotation = Rot4.East;
                r.center   = this.DrawPos + Vector3.up * 0.1f + Vector3.back * 0.08f;
            }
            if (r.rotation == Rot4.South) //West
            {
                r.rotation = Rot4.South;
                r.center   = this.DrawPos + Vector3.up * 0.1f + Vector3.left * 0.08f;
            }

            MAD.DrawHelper.DrawRectangle(r);
        }
        public override void DoExtraGuiControls(float leftX, float bottomY)
        {
            ThingDef thingDef = PlacingDef as ThingDef;

            if (thingDef == null || !thingDef.rotatable)
            {
                return;
            }
            Rect winRect = new Rect(leftX, bottomY - 90f, 200f, 90f);

            Find.WindowStack.ImmediateWindow(73095, winRect, WindowLayer.GameUI, delegate
            {
                RotationDirection rotationDirection = RotationDirection.None;
                Text.Anchor = TextAnchor.MiddleCenter;
                Text.Font   = GameFont.Medium;
                Rect rect   = new Rect(winRect.width / 2f - 64f - 5f, 15f, 64f, 64f);
                if (Widgets.ButtonImage(rect, TexUI.RotLeftTex))
                {
                    SoundDefOf.DragSlider.PlayOneShotOnCamera();
                    rotationDirection = RotationDirection.Counterclockwise;
                    Event.current.Use();
                }
                Widgets.Label(rect, KeyBindingDefOf.Designator_RotateLeft.MainKeyLabel);
                Rect rect2 = new Rect(winRect.width / 2f + 5f, 15f, 64f, 64f);
                if (Widgets.ButtonImage(rect2, TexUI.RotRightTex))
                {
                    SoundDefOf.DragSlider.PlayOneShotOnCamera();
                    rotationDirection = RotationDirection.Clockwise;
                    Event.current.Use();
                }
                Widgets.Label(rect2, KeyBindingDefOf.Designator_RotateRight.MainKeyLabel);
                if (rotationDirection != 0)
                {
                    placingRot.Rotate(rotationDirection);
                }
                Text.Anchor = TextAnchor.UpperLeft;
                Text.Font   = GameFont.Small;
            });
        }
示例#23
0
        public virtual void LiquidDraw(Color color, float fillPct)
        {
            GenDraw.FillableBarRequest r = default(GenDraw.FillableBarRequest);
            r.center      = DrawPos + waterDrawCenter;
            r.size        = waterDrawOffset;
            r.fillPercent = fillPct;
            r.filledMat   = SolidColorMaterials.SimpleSolidColorMaterial(color, false);
            r.unfilledMat = SolidColorMaterials.SimpleSolidColorMaterial(new Color(0, 0, 0, 0), false);
            r.margin      = 0f;
            Rot4 rotation = Rotation;

            rotation.Rotate(RotationDirection.Clockwise);
            r.rotation = rotation;
            GenDraw.DrawFillableBar(r);
        }
示例#24
0
        public override void PostDraw()
        {
            GenDraw.FillableBarRequest r = default;
            r.center      = this.parent.DrawPos + Vector3.up * 0.1f;
            r.size        = sd_adv_powergen_BarSize;
            r.fillPercent = this.PowerOutput / this.MaxPowerOutput;
            r.filledMat   = BarFilledMat;
            r.unfilledMat = BarUnfilledMat;
            r.margin      = 0.15f;
            Rot4 rotation = this.parent.Rotation;

            rotation.Rotate(RotationDirection.Clockwise);
            r.rotation = rotation;
            GenDraw.DrawFillableBar(r);
        }
示例#25
0
 public void SwitchLaserFence()
 {
     for (int directionAsInt = 0; directionAsInt < 4; directionAsInt++)
     {
         Rot4 direction = new Rot4(directionAsInt);
         this.connectionIsAllowedByUser[directionAsInt] = this.cachedConnectionIsAllowedByUser[directionAsInt];
         if (this.connectionIsAllowedByUser[directionAsInt])
         {
             this.LookForPylonInDirection(direction, true);
         }
         else
         {
             if (this.linkedPylons[directionAsInt] != null)
             {
                 Rot4 linkedPylonDirection = direction;
                 linkedPylonDirection.Rotate(RotationDirection.Clockwise); // Rotate 2 times to get the opposite direction.
                 linkedPylonDirection.Rotate(RotationDirection.Clockwise);
                 this.linkedPylons[directionAsInt].connectionIsAllowedByUser[linkedPylonDirection.AsInt]       = false;
                 this.linkedPylons[directionAsInt].cachedConnectionIsAllowedByUser[linkedPylonDirection.AsInt] = false;
                 this.DisconnectFromPylon(direction);
             }
         }
     }
 }
示例#26
0
        // Token: 0x0600123A RID: 4666 RVA: 0x0009E660 File Offset: 0x0009CA60
        public override void PostDraw()
        {
            base.PostDraw();
            GenDraw.FillableBarRequest r = default(GenDraw.FillableBarRequest);
            r.center = this.parent.DrawPos + Vector3.up * 0.1f;

            r.fillPercent = base.PowerOutput / 400f;

            r.margin = 0.15f;
            Rot4 rotation = this.parent.Rotation;

            rotation.Rotate(RotationDirection.Clockwise);
            r.rotation = rotation;
            GenDraw.DrawFillableBar(r);
        }
示例#27
0
        /// <summary>
        /// 绘制方法
        /// </summary>
        public override void Draw()
        {
            base.Draw();
            GenDraw.FillableBarRequest fbr = default(GenDraw.FillableBarRequest);                                  //初始化一个填充条
            fbr.center      = DrawPos + Vector3.up * 0.1f;                                                         //绘制中心
            fbr.size        = new Vector2(2.3f, 0.14f);                                                            //尺寸
            fbr.fillPercent = realPower / fullSunPower;                                                            //填充比例
            fbr.filledMat   = SolidColorMaterials.SimpleSolidColorMaterial(new Color(0.5f, 0.475f, 0.1f), false);  //填充部分的颜色
            fbr.unfilledMat = SolidColorMaterials.SimpleSolidColorMaterial(new Color(0.15f, 0.15f, 0.15f), false); //未填充部分的颜色
            fbr.margin      = 0.15f;                                                                               //间距
            Rot4 rot4 = Rotation;                                                                                  //旋转

            rot4.Rotate(RotationDirection.Clockwise);                                                              //调整一下素材旋转度
            fbr.rotation = rot4;
            GenDraw.DrawFillableBar(fbr);                                                                          //出来吧电量条!
        }
示例#28
0
        public override void PostDraw()
        {
            base.PostDraw();
            GenDraw.FillableBarRequest r = new GenDraw.FillableBarRequest();
            r.center      = this.parent.DrawPos + Vector3.up * 0.1f;
            r.size        = BarSize;
            r.fillPercent = gas.totalPressure / MaxPressure;
            r.filledMat   = PowerPlantSolarBarFilledMat;
            r.unfilledMat = PowerPlantSolarBarUnfilledMat;
            r.margin      = 0.15f;
            Rot4 rotation = this.parent.Rotation;

            rotation.Rotate(RotationDirection.Clockwise);
            r.rotation = rotation;
            GenDraw.DrawFillableBar(r);
        }
示例#29
0
        public override void PostDraw()
        {
            base.PostDraw();
            GenDraw.FillableBarRequest r = default(GenDraw.FillableBarRequest);
            r.center      = this.parent.DrawPos + Vector3.up * 0.1f;
            r.size        = new Vector2((float)(base.parent.def.graphic.drawSize.x * 0.8), (float)(base.parent.def.graphic.drawSize.y * 0.07));
            r.fillPercent = base.PowerOutput / getFullSunPower();
            r.filledMat   = CompPowerPlantSolar.PowerPlantSolarBarFilledMat;
            r.unfilledMat = CompPowerPlantSolar.PowerPlantSolarBarUnfilledMat;
            r.margin      = 0.15f;
            Rot4 rotation = this.parent.Rotation;

            rotation.Rotate(RotationDirection.Clockwise);
            r.rotation = rotation;
            GenDraw.DrawFillableBar(r);
        }
        public override void PostDraw()
        {
            base.PostDraw();
            GenDraw.FillableBarRequest r = default(GenDraw.FillableBarRequest);
            r.center      = this.parent.DrawPos + Vector3.up * 0.1f;
            r.size        = BarSize;
            r.fillPercent = base.PowerOutput / FullSunPower;
            r.filledMat   = PowerPlantSolarBarFilledMat;
            r.unfilledMat = PowerPlantSolarBarUnfilledMat;
            r.margin      = 0.15f;
            Rot4 rotation = this.parent.Rotation;

            rotation.Rotate(RotationDirection.Clockwise);
            r.rotation = rotation;
            GenDraw.DrawFillableBar(r);
        }