예제 #1
0
        protected override void FillTab()
        {
            var rect = new Rect(0f, 0f, 300f, 400f).ContractedBy(20f);

            if (SelThing.GetUniqueLoadID() != selThingId)
            {
                scrollbarPosition = Vector2.zero;
                selThingId        = SelThing.GetUniqueLoadID();
            }
            Widgets.TextAreaScrollable(rect, SelThing.TryGetComp <CompLua>().Stdout, ref scrollbarPosition, true);
        }
예제 #2
0
        protected override void FillTab()
        {
            if (SelThing.GetUniqueLoadID() != selThingReference)
            {
                RefreshTextInTerminal();
                selThingReference = SelThing.GetUniqueLoadID();
            }
            var inRect      = new Rect(0f, 0f, WinSize.x, WinSize.y).ContractedBy(20f);//inner rectangle
            var contentRect = new Rect(inRect);

            contentRect.yMax -= 20f;
            var style = new GUIStyle(Text.CurTextFieldStyle) //Construct our GUIStyle
            {
                wordWrap = true
            };

            if (Resources.CourierNew != null) //Implicit conversion to bool
            {
                style.font = Resources.CourierNew;
            }
            textInTerminal = GUI.TextArea(contentRect, textInTerminal, style);
            var buttonsRect = inRect.BottomPartPixels(18f);
            var margin      = 5f;
            var width       = (inRect.width - margin) / 2f;
            var leftRect    = buttonsRect.LeftPartPixels(width);
            var rightRect   = buttonsRect.RightPartPixels(width);
            var save        = Widgets.ButtonText(leftRect, "LuaSave".Translate());
            var help        = Widgets.ButtonText(rightRect, "LuaHelp".Translate());//TODO: Implement help

            if (save)
            {
                Save();
            }
            if (help)
            {
                Find.WindowStack.Add(new Dialog_LuaHelp());
            }
        }