Exemplo n.º 1
0
        private static void DoExpansionInfo(int index, float yOffset)
        {
            ExpansionDef expansionDef = ModLister.AllExpansions[index];
            float        num          = 500f;
            float        num2         = 16f;

            Text.Font = GameFont.Medium;
            float num3 = Text.CalcHeight(expansionDef.label, num - num2 * 2f);

            Text.Font = GameFont.Small;
            string text = "ClickForMoreInfo".Translate();
            float  num4 = Text.CalcHeight(text, num - num2 * 2f);
            float  num5 = Text.CalcHeight(expansionDef.description, num - num2 * 2f);
            float  num6 = num3 + num4 + num2 + num5 + num2 * 2f;
            Rect   rect = new Rect(8f, yOffset - num6, num, num6);

            Widgets.DrawWindowBackground(rect);
            Rect position = rect.ContractedBy(num2);

            GUI.BeginGroup(position);
            float num7 = 0f;

            Text.Font   = GameFont.Medium;
            Text.Anchor = TextAnchor.UpperCenter;
            Widgets.Label(new Rect(0f, num7, position.width, num3), new GUIContent(" " + expansionDef.label, expansionDef.Icon));
            Text.Font = GameFont.Small;
            num7     += num3;
            GUI.color = Color.grey;
            Widgets.Label(new Rect(0f, num7, position.width, num4), text);
            GUI.color   = Color.white;
            Text.Anchor = TextAnchor.UpperLeft;
            num7       += num4 + num2;
            Widgets.Label(new Rect(0f, num7, position.width, position.height - num7), expansionDef.description);
            GUI.EndGroup();
        }
Exemplo n.º 2
0
        private static void DoExpansionInfo(int index, float yOffset)
        {
            ExpansionDef     expansionDef  = ModLister.AllExpansions[index];
            List <Texture2D> previewImages = expansionDef.PreviewImages;
            float            num           = 350f;
            float            num2          = 16f;
            float            num3          = 200f;
            float            num4          = num3 * 2f + num2 * 2f;
            float            b             = (previewImages.NullOrEmpty() ? 0f : (num3 * 3f + num2 * 2.5f));

            Text.Font = GameFont.Medium;
            float num5 = Text.CalcHeight(expansionDef.label, num - num2 * 2f);

            Text.Font = GameFont.Small;
            string text = "ClickForMoreInfo".Translate();
            float  num6 = Text.CalcHeight(expansionDef.description, num - num2 * 2f);
            float  num7 = Text.CalcHeight(text, num - num2 * 2f);

            b = Mathf.Max(num5 + num7 + num2 + num6 + num2 * 2f, b);
            Rect rect = new Rect(8f, yOffset - b, num, b);

            Widgets.DrawWindowBackground(new Rect(rect.x, rect.y, previewImages.NullOrEmpty() ? rect.width : (rect.width + num4), rect.height));
            Rect position = rect.ContractedBy(num2);

            GUI.BeginGroup(position);
            float num8 = 0f;

            Text.Font   = GameFont.Medium;
            Text.Anchor = TextAnchor.UpperCenter;
            Widgets.Label(new Rect(0f, num8, position.width, num5), new GUIContent(" " + expansionDef.label, expansionDef.Icon));
            Text.Font = GameFont.Small;
            num8     += num5;
            GUI.color = Color.grey;
            Widgets.Label(new Rect(0f, num8, position.width, num7), text);
            GUI.color   = Color.white;
            Text.Anchor = TextAnchor.UpperLeft;
            num8       += num7 + num2;
            Widgets.Label(new Rect(0f, num8, position.width, position.height - num8), expansionDef.description);
            GUI.EndGroup();
            if (previewImages.NullOrEmpty())
            {
                return;
            }
            Rect position2 = new Rect(rect.x + rect.width, rect.y, num4, rect.height).ContractedBy(num2);

            GUI.BeginGroup(position2);
            float num9  = 0f;
            float num10 = 0f;

            for (int i = 0; i < previewImages.Count; i++)
            {
                float num11 = num3 - num2 / 2f;
                GUI.DrawTexture(new Rect(num9, num10, num11, num11), previewImages[i]);
                num9 += num3 + num2 / 2f;
                if (num9 >= position2.width)
                {
                    num9   = 0f;
                    num10 += num3 + num2 / 2f;
                }
            }
            GUI.EndGroup();
        }