public void DrawCaravanSelectionOverlayOnGUI(Caravan caravan, Rect rect)
        {
            float num = 0.4f * TacticUtils.TacticalColonistBar.Scale;

            SelectionDrawerUtility.CalculateSelectionBracketPositionsUI <WorldObject>(textureSize: new Vector2((float)SelectionDrawerUtility.SelectedTexGUI.width * num, (float)SelectionDrawerUtility.SelectedTexGUI.height * num), bracketLocs: bracketLocs, obj: (WorldObject)caravan, rect: rect, selectTimes: WorldSelectionDrawer.SelectTimes, jumpDistanceFactor: 20f * TacticUtils.TacticalColonistBar.Scale);
            DrawSelectionOverlayOnGUI(bracketLocs, num);
        }
Example #2
0
        // RimWorld.ColonistBarColonistDrawer
        private static void DrawCaravanSelectionOverlayOnGUI(Caravan caravan, Rect rect)
        {
            float   num         = 0.4f * Scale;
            Vector2 textureSize = new Vector2(SelectionDrawerUtility.SelectedTexGUI.width * num, SelectionDrawerUtility.SelectedTexGUI.height * num);

            SelectionDrawerUtility.CalculateSelectionBracketPositionsUI(bracketLocs, caravan, rect, WorldSelectionDrawer.SelectTimes, textureSize, 20f * Scale);
            DrawSelectionOverlayOnGUI(bracketLocs, num);
        }
Example #3
0
        private static bool DrawSelectionBracketFor_PreFix(object obj)
        {
            var thing = obj as ThingWithComps;

            if (thing != null && thing?.def?.GetModExtension <DefModExtension_BigBox>() is DefModExtension_BigBox bigBox)
            {
                var bracketLocs         = Traverse.Create(typeof(SelectionDrawer)).Field("bracketLocs").GetValue <Vector3[]>();
                var SelectionBracketMat = Traverse.Create(typeof(SelectionDrawer)).Field("SelectionBracketMat").GetValue <Material>();
                var selectTimes         = Traverse.Create(typeof(SelectionDrawer)).Field("selectTimes").GetValue <Dictionary <object, float> >();

                //Use public variables from DefModExtension_BigBox
                Vector3 drawPos  = thing.DrawPos;
                Vector2 drawSize = new Vector2(1, 1);
                if (!bigBox.directionBased)
                {
                    drawPos  = drawPos + bigBox.offset;
                    drawSize = bigBox.size;
                }
                else
                {
                    if (thing.Rotation == Rot4.East)
                    {
                        drawPos  = drawPos + bigBox.eastOffset;
                        drawSize = bigBox.eastSize;
                    }
                    else if (thing.Rotation == Rot4.North)
                    {
                        drawPos  = drawPos + bigBox.northOffset;
                        drawSize = bigBox.northSize;
                    }
                    else if (thing.Rotation == Rot4.West)
                    {
                        drawPos  = drawPos + bigBox.westOffset;
                        drawSize = bigBox.westSize;
                    }
                    else
                    {
                        drawPos  = drawPos + bigBox.southOffset;
                        drawSize = bigBox.southSize;
                    }
                }

                SelectionDrawerUtility.CalculateSelectionBracketPositionsWorld(bracketLocs, thing, drawPos, drawSize, selectTimes, Vector2.one);
                int num = 0;
                for (int i = 0; i < 4; i++)
                {
                    Quaternion rotation = Quaternion.AngleAxis(num, Vector3.up);
                    Graphics.DrawMesh(MeshPool.plane10, bracketLocs[i], rotation, SelectionBracketMat, 0);
                    num -= 90;
                }
                return(false);
            }
            return(true);
        }
        public void DrawSelectionOverlayOnGUI(Pawn colonist, Rect rect)
        {
            Thing obj = colonist;

            if (colonist.Dead)
            {
                obj = colonist.Corpse;
            }
            float num = 0.4f * TacticUtils.TacticalColonistBar.Scale;

            SelectionDrawerUtility.CalculateSelectionBracketPositionsUI <object>(textureSize: new Vector2((float)SelectionDrawerUtility.SelectedTexGUI.width * num, (float)SelectionDrawerUtility.SelectedTexGUI.height * num), bracketLocs: bracketLocs, obj: (object)obj, rect: rect, selectTimes: SelectionDrawer.SelectTimes, jumpDistanceFactor: 20f * TacticUtils.TacticalColonistBar.Scale);
            DrawSelectionOverlayOnGUI(bracketLocs, num);
        }
Example #5
0
        private static void DrawSelectionOverlayOnGUI(Pawn colonist, Rect rect)
        {
            Thing obj = colonist;

            if (colonist.Dead)
            {
                obj = colonist.Corpse;
            }
            float   num         = 0.4f * Scale;
            Vector2 textureSize = new Vector2(SelectionDrawerUtility.SelectedTexGUI.width * num, SelectionDrawerUtility.SelectedTexGUI.height * num);

            SelectionDrawerUtility.CalculateSelectionBracketPositionsUI(bracketLocs, obj, rect, SelectionDrawer.SelectTimes, textureSize, ColBarSettings.BaseSizeFloat * 0.4f * Scale);
            DrawSelectionOverlayOnGUI(bracketLocs, num);
        }
Example #6
0
        private static bool DrawSelectionBracketFor_PreFix(object obj, Vector3[] ___bracketLocs, Material ___SelectionBracketMat,
                                                           Dictionary <object, float> ___selectTimes)
        {
            if (obj is ThingWithComps thing && thing.def?.GetModExtensionBigBox() is DefModExtension_BigBox bigBox)
            {
                //Use public variables from DefModExtension_BigBox
                var     drawPos = thing.DrawPos;
                Vector2 drawSize;
                if (!bigBox.directionBased)
                {
                    drawPos += bigBox.offset;
                    drawSize = bigBox.size;
                }
                else
                {
                    if (thing.Rotation == Rot4.East)
                    {
                        drawPos += bigBox.eastOffset;
                        drawSize = bigBox.eastSize;
                    }
                    else if (thing.Rotation == Rot4.North)
                    {
                        drawPos += bigBox.northOffset;
                        drawSize = bigBox.northSize;
                    }
                    else if (thing.Rotation == Rot4.West)
                    {
                        drawPos += bigBox.westOffset;
                        drawSize = bigBox.westSize;
                    }
                    else
                    {
                        drawPos += bigBox.southOffset;
                        drawSize = bigBox.southSize;
                    }
                }

                SelectionDrawerUtility.CalculateSelectionBracketPositionsWorld(___bracketLocs, thing, drawPos, drawSize, ___selectTimes, Vector2.one);
                var num = 0;
                for (var i = 0; i < 4; i++)
                {
                    var rotation = Quaternion.AngleAxis(num, Vector3.up);
                    Graphics.DrawMesh(MeshPool.plane10, ___bracketLocs[i], rotation, ___SelectionBracketMat, 0);
                    num -= 90;
                }
                return(false);
            }
            return(true);
        }
Example #7
0
        static void Postfix()
        {
            if (Multiplayer.Client == null || TickPatch.Simulating)
            {
                return;
            }

            foreach (var t in Find.Selector.SelectedObjects.OfType <Thing>())
            {
                drawnThisUpdate.Add(t.thingIDNumber);
            }

            foreach (var player in Multiplayer.session.players)
            {
                foreach (var sel in player.selectedThings)
                {
                    if (!drawnThisUpdate.Add(sel.Key))
                    {
                        continue;
                    }
                    if (!ThingsById.thingsById.TryGetValue(sel.Key, out Thing thing))
                    {
                        continue;
                    }
                    if (thing.Map != Find.CurrentMap)
                    {
                        continue;
                    }

                    selTimes[thing] = sel.Value;
                    SelectionDrawerUtility.CalculateSelectionBracketPositionsWorld(SelectionDrawer.bracketLocs, thing, thing.DrawPos, thing.RotatedSize.ToVector2(), selTimes, Vector2.one, 1f);
                    selTimes.Clear();

                    for (int i = 0; i < 4; i++)
                    {
                        Quaternion rotation = Quaternion.AngleAxis(-i * 90, Vector3.up);
                        propBlock.SetColor("_Color", player.color * new Color(1, 1, 1, 0.5f));
                        Graphics.DrawMesh(MeshPool.plane10, SelectionDrawer.bracketLocs[i], rotation, graySelection, 0, null, 0, propBlock);
                    }
                }
            }

            drawnThisUpdate.Clear();
        }
Example #8
0
        private static void DrawSelectionBracketOnGUIFor(WorldObject obj)
        {
            Vector2 vector = obj.ScreenPos();

            SelectionDrawerUtility.CalculateSelectionBracketPositionsUI <WorldObject>(rect: new Rect(vector.x - 17.5f, vector.y - 17.5f, 35f, 35f), textureSize: new Vector2((float)SelectionDrawerUtility.SelectedTexGUI.width * 0.4f, (float)SelectionDrawerUtility.SelectedTexGUI.height * 0.4f), bracketLocs: bracketLocs, obj: obj, selectTimes: selectTimes, jumpDistanceFactor: 25f);
            if (obj.HiddenBehindTerrainNow())
            {
                GUI.color = HiddenSelectionBracketColor;
            }
            else
            {
                GUI.color = Color.white;
            }
            int num = 90;

            for (int i = 0; i < 4; i++)
            {
                Widgets.DrawTextureRotated(bracketLocs[i], SelectionDrawerUtility.SelectedTexGUI, (float)num, 0.4f);
                num += 90;
            }
            GUI.color = Color.white;
        }
Example #9
0
        public static void DrawProgressBarOnGUIFor(WorldObject obj, float curProgress)
        {
            Vector2 vector      = obj.ScreenPos();
            Rect    rect        = new Rect(vector.x - 17.5f, vector.y - 17.5f, 35f, 35f);
            Vector2 textureSize = new Vector2((float)SelectionDrawerUtility.SelectedTexGUI.width * 0.4f, (float)SelectionDrawerUtility.SelectedTexGUI.height * 0.4f);

            SelectionDrawerUtility.CalculateSelectionBracketPositionsUI <WorldObject>(WorldProgressBarDrawer.bracketLocs, obj, rect, WorldProgressBarDrawer.selectTimes, textureSize, 25f);
            //if (obj.HiddenBehindTerrainNow())
            //{
            //    GUI.color = WorldProgressBarDrawer.HiddenSelectionBracketColor;
            //}
            //else
            //{
            //    GUI.color = Color.white;
            //}
            //int num = 90;
            //for (int i = 0; i < 4; i++)
            //{
            //if (i == 2)
            DrawScalingTextureRotated(WorldProgressBarDrawer.bracketLocs[2], LearningReadout.ProgressBarFillTex, 90f, curProgress, 0.4f);
            //num += 90;
            //}
            //GUI.color = Color.white;
        }
        private static void DrawSelectionBracketOnGUIFor(WorldObject obj)
        {
            Vector2 vector      = obj.ScreenPos();
            Rect    rect        = new Rect((float)(vector.x - 17.5), (float)(vector.y - 17.5), 35f, 35f);
            Vector2 textureSize = new Vector2((float)((float)SelectionDrawerUtility.SelectedTexGUI.width * 0.40000000596046448), (float)((float)SelectionDrawerUtility.SelectedTexGUI.height * 0.40000000596046448));

            SelectionDrawerUtility.CalculateSelectionBracketPositionsUI(WorldSelectionDrawer.bracketLocs, obj, rect, WorldSelectionDrawer.selectTimes, textureSize, 25f);
            if (obj.HiddenBehindTerrainNow())
            {
                GUI.color = WorldSelectionDrawer.HiddenSelectionBracketColor;
            }
            else
            {
                GUI.color = Color.white;
            }
            int num = 90;

            for (int i = 0; i < 4; i++)
            {
                Widgets.DrawTextureRotated(WorldSelectionDrawer.bracketLocs[i], SelectionDrawerUtility.SelectedTexGUI, (float)num, 0.4f);
                num += 90;
            }
            GUI.color = Color.white;
        }