Пример #1
0
        public override void Draw(ChartRenderer gfx)
        {
            if (gfx == null)
            {
                return;
            }

            /* Render the top icon without scaling. */
            ExtRect sourceRect      = ExtRect.CreateBounds(0, 0, Width, SCALE_Y1 + SHADOW_TOP);
            ExtRect destinationRect = ExtRect.CreateBounds(fDestRect.Left, fDestRect.Top,
                                                           Width, SCALE_Y1 + SHADOW_TOP);

            gfx.DrawImage(fControlsImage, destinationRect, sourceRect);
            /* Render the bottom icon without scaling. */
            sourceRect      = ExtRect.CreateBounds(0, SCALE_Y2, Width, Height - (SCALE_Y2 + SHADOW_BOTTOM));
            destinationRect = ExtRect.CreateBounds(fDestRect.Left,
                                                   fDestRect.Bottom - (Height - (SCALE_Y2 + SHADOW_BOTTOM)),
                                                   Width, Height - (SCALE_Y2 + SHADOW_BOTTOM));
            gfx.DrawImage(fControlsImage, destinationRect, sourceRect);

            /* Render the vertical bar with scaling of Y's (there's still no
             * scaling for X's). Image source must ignore some shadows at the
             * top and bottom. */
            sourceRect      = ExtRect.CreateBounds(0, SCALE_Y1 + SHADOW_TOP, Width, Height - (SCALE_Y2 + SHADOW_BOTTOM));
            destinationRect = ExtRect.CreateBounds(fDestRect.Left, fDestRect.Top + SCALE_Y1 + SHADOW_TOP, Width,
                                                   fDestRect.Bottom - (Height - (SCALE_Y2 + SHADOW_BOTTOM)) - (fDestRect.Top + SCALE_Y1 + SHADOW_TOP));
            gfx.DrawImage(fControlsImage, destinationRect, sourceRect);
            if (fDCount > 0)
            {
                gfx.DrawImage(fControlsImage, GetDRect(fThumbPos), THUMB_RECT);
            }
        }
        public KnowledgesWindow(BaseControl owner)
            : base(owner)
        {
            Font        = CtlCommon.SmFont;
            Width       = 600;
            Height      = 460;
            WindowStyle = new WindowStyles(WindowStyles.wsModal, WindowStyles.wsKeyPreview, WindowStyles.wsScreenCenter);
            Shifted     = true;
            BackDraw    = false;

            fReady = false;

            fList              = new ListBox(this);
            fList.Bounds       = ExtRect.Create(10, 10, 589, 199);
            fList.OnItemSelect = Knowledges_Select;
            fList.Columns      = 2;
            fList.Visible      = true;
            fList.Items.Sorted = true;

            fText             = new TextBox(this);
            fText.Bounds      = ExtRect.Create(10, 202, 589, 449);
            fText.Visible     = true;
            fText.Links       = true;
            fText.OnLinkClick = OnLinkClick;
            fText.TextColor   = Colors.Gold;
        }
Пример #3
0
        private void SetMultimediaLink(GEDCOMMultimediaLink value)
        {
            fMultimediaLink = value;
            if (fMultimediaLink == null || fMultimediaLink.Value == null)
            {
                return;
            }

            GEDCOMMultimediaRecord mmRec = (GEDCOMMultimediaRecord)fMultimediaLink.Value;

            IImage img = fBase.Context.LoadMediaImage(mmRec.FileReferences[0], false);

            if (img == null)
            {
                return;
            }

            imageView1.OpenImage(((ImageHandler)img).Handle);

            if (fMultimediaLink.IsPrimaryCutout)
            {
                ExtRect rt = fMultimediaLink.CutoutPosition.Value;
                imageView1.SelectionRegion = new RectangleF(rt.Left, rt.Top, rt.GetWidth(), rt.GetHeight());
            }
        }
Пример #4
0
        private void btnAccept_Click(object sender, EventArgs e)
        {
            try
            {
                RectangleF selectRegion = imageView1.SelectionRegion;

                if (!selectRegion.IsEmpty)
                {
                    fMultimediaLink.IsPrimaryCutout      = true;
                    fMultimediaLink.CutoutPosition.Value =
                        ExtRect.Create((int)selectRegion.Left, (int)selectRegion.Top, (int)selectRegion.Right, (int)selectRegion.Bottom);
                }
                else
                {
                    fMultimediaLink.IsPrimaryCutout      = false;
                    fMultimediaLink.CutoutPosition.Value = ExtRect.CreateEmpty();
                }

                PortraitsCache.Instance.RemoveObsolete(fMultimediaLink);

                DialogResult = DialogResult.Ok;
            }
            catch (Exception ex)
            {
                Logger.LogWrite("PortraitSelectDlg.btnAccept_Click(): " + ex.Message);
                DialogResult = DialogResult.None;
            }
        }
        protected override void DoMouseDownEvent(MouseEventArgs eventArgs)
        {
            base.DoMouseDownEvent(eventArgs);

            if (eventArgs.Button == MouseButton.mbLeft)
            {
                for (int i = 0; i <= 9; i++)
                {
                    ExtRect r = GetFileOpRect(i, MI_FILEDELETE);
                    if (r.Contains(eventArgs.X, eventArgs.Y) && fFiles[i].Exist)
                    {
                        GlobalVars.nwrGame.EraseGame(i);
                        fFiles[i].Exist = false;
                        UpdateList();
                        break;
                    }

                    r = GetFileOpRect(i, MI_FILENUM);
                    if (r.Contains(eventArgs.X, eventArgs.Y))
                    {
                        PrepareFile(i);
                        break;
                    }
                }
            }
        }
Пример #6
0
        private static void DrawButton(BaseScreen screen, ExtRect rect, string text, bool enabled, bool down, bool border)
        {
            if (border)
            {
                screen.DrawRectangle(rect, Colors.White, Colors.Black);

                /*int c = Colors.Gray;
                 * int c2 = Colors.Black;
                 * if (aDown) {
                 *  screen.drawLine(aRect.Left + 1, aRect.Top + 1, aRect.Left + 1, aRect.Bottom, c2);
                 *  screen.drawLine(aRect.Left + 1, aRect.Top + 1, aRect.Right, aRect.Top + 1, c2);
                 *  screen.drawLine(aRect.Right - 1, aRect.Top + 2, aRect.Right - 1, aRect.Bottom, c);
                 *  screen.drawLine(aRect.Left + 2, aRect.Bottom - 1, aRect.Right, aRect.Bottom - 1, c);
                 * } else {
                 *  screen.drawLine(aRect.Left + 1, aRect.Top + 1, aRect.Left + 1, aRect.Bottom - 1, c);
                 *  screen.drawLine(aRect.Left + 1, aRect.Top + 1, aRect.Right - 1, aRect.Top + 1, c);
                 *  screen.drawLine(aRect.Right - 1, aRect.Top + 1, aRect.Right - 1, aRect.Bottom - 1, c2);
                 *  screen.drawLine(aRect.Left + 1, aRect.Bottom - 1, aRect.Right, aRect.Bottom - 1, c2);
                 * }*/
            }

            int h = screen.GetTextHeight("A");
            int w = screen.GetTextWidth(text);
            int x = rect.Left + (rect.Width - w) / 2;
            int y = rect.Top + (rect.Height - h) / 2;

            screen.DrawText(x, y, text, 0);
        }
Пример #7
0
        private static SearchResult SearchMapLocation(int aX, int aY)
        {
            aX -= 8;
            aY -= 8;

            int num = GlobalVars.nwrGame.LayersCount;

            for (int idx = 0; idx < num; idx++)
            {
                NWLayer    layer      = GlobalVars.nwrGame.GetLayer(idx);
                LayerEntry layerEntry = layer.Entry;

                ExtRect rt = ExtRect.Create(layerEntry.MSX, layerEntry.MSY, layerEntry.MSX + (layerEntry.W << 5), layerEntry.MSY + layerEntry.H * 30);

                if (rt.Contains(aX, aY))
                {
                    int xx = (aX - layerEntry.MSX) / 32;
                    int yy = (aY - layerEntry.MSY) / 30;

                    NWField fld = layer.GetField(xx, yy);
                    if (fld != null)
                    {
                        SearchResult result = new SearchResult();
                        result.LID    = layerEntry.GUID;
                        result.FieldX = xx;
                        result.FieldY = yy;
                        return(result);
                    }
                }
            }

            return(null);
        }
Пример #8
0
        public static void DrawCtlBorder(BaseScreen screen, ExtRect rect, CtlBorders borders)
        {
            if (screen != null && CtlDecor != null)
            {
                int L = rect.Left;
                int T = rect.Top;
                int R = rect.Right;
                int B = rect.Bottom;

                if (borders.Contains(CtlBorders.cbTop))
                {
                    screen.DrawFilled(rect, BaseScreen.FILL_HORZ, 2, 0, 31, 2, L, T - 1, CtlDecor);
                }
                if (borders.Contains(CtlBorders.cbBottom))
                {
                    screen.DrawFilled(rect, BaseScreen.FILL_HORZ, 2, 0, 31, 2, L, B - 1, CtlDecor);
                }
                if (borders.Contains(CtlBorders.cbLeft))
                {
                    screen.DrawFilled(rect, BaseScreen.FILL_VERT, 0, 2, 2, 31, L - 1, T, CtlDecor);
                }
                if (borders.Contains(CtlBorders.cbRight))
                {
                    screen.DrawFilled(rect, BaseScreen.FILL_VERT, 0, 2, 2, 31, R - 1, T, CtlDecor);
                }
            }
        }
 public SysCreatureRec(SysCreature cid, int name, string sign, ExtRect scrRect)
 {
     Id      = cid;
     Name    = name;
     Sign    = sign;
     ScrRect = scrRect;
 }
Пример #10
0
        public static void DrawWalls(NWField field, ExtRect r)
        {
            for (int x = r.Left; x <= r.Right; x++)
            {
                for (int y = r.Top; y <= r.Bottom; y++)
                {
                    NWTile tile = (NWTile)field.GetTile(x, y);

                    ushort bpk = NWField.GetBuildPlaceKind(x, y, r, RuinsMode);

                    if (!RuinsMode)
                    {
                        tile.Background = PlaceID.pid_Floor;
                    }
                    else
                    {
                        if (bpk == PlaceID.pid_Undefined)
                        {
                            tile.Background = NWField.GetVarTile(PlaceID.pid_RnFloor);
                        }
                    }

                    tile.Foreground = bpk;
                }
            }
        }
Пример #11
0
        private void BuildDoors(byte maxDoors, ExtRect br)
        {
            try {
                int dCnt;
                if (maxDoors == 1)
                {
                    dCnt = 1;
                }
                else
                {
                    dCnt = RandomHelper.GetBoundedRnd((int)maxDoors - 1, (int)((int)maxDoors + 1));
                }

                int dx = 0;
                int dy = 0;

                for (int i = 1; i <= dCnt; i++)
                {
                    int tries = TryCount;
                    do
                    {
                        int side = (RandomHelper.GetBoundedRnd(Directions.DtFirst, Directions.DtLast));

                        switch (side)
                        {
                        case Directions.DtNorth:
                            dx = RandomHelper.GetBoundedRnd(br.Left + 2, br.Right - 2);
                            dy = br.Top;
                            break;

                        case Directions.DtSouth:
                            dx = RandomHelper.GetBoundedRnd(br.Left + 2, br.Right - 2);
                            dy = br.Bottom;
                            break;

                        case Directions.DtWest:
                            dx = br.Left;
                            dy = RandomHelper.GetBoundedRnd(br.Top + 2, br.Bottom - 2);
                            break;

                        case Directions.DtEast:
                            dx = br.Right;
                            dy = RandomHelper.GetBoundedRnd(br.Top + 2, br.Bottom - 2);
                            break;
                        }

                        if (!IsExistDoor(dx, dy))
                        {
                            AddDoor(dx, dy, side, DoorState.Opened);
                            IsPassableDoor(dx, dy);
                            break;
                        }

                        tries--;
                    } while (tries > 0);
                }
            } catch (Exception ex) {
                Logger.Write("Building.buildDoors(): " + ex.Message);
            }
        }
Пример #12
0
        private void InternalDraw(ChartDrawMode drawMode, BackgroundMode background)
        {
            // drawing relative offset of tree on graphics
            int spx = 0;
            int spy = 0;

            Size     clientSize = ClientSize;
            ExtPoint scrollPos  = new ExtPoint(Math.Abs(AutoScrollPosition.X), Math.Abs(AutoScrollPosition.Y));

            if (drawMode == ChartDrawMode.dmInteractive)
            {
                spx += -scrollPos.X;
                spy += -scrollPos.Y;

                Rectangle viewPort = GetImageViewPort();
                fModel.VisibleArea = ExtRect.CreateBounds(scrollPos.X, scrollPos.Y, viewPort.Width, viewPort.Height);
            }
            else
            {
                fModel.VisibleArea = ExtRect.CreateBounds(0, 0, fModel.ImageWidth, fModel.ImageHeight);
            }

            if (drawMode == ChartDrawMode.dmInteractive || drawMode == ChartDrawMode.dmStaticCentered)
            {
                if (fModel.ImageWidth < clientSize.Width)
                {
                    spx += (clientSize.Width - fModel.ImageWidth) / 2;
                }

                if (fModel.ImageHeight < clientSize.Height)
                {
                    spy += (clientSize.Height - fModel.ImageHeight) / 2;
                }
            }

            fModel.SetOffsets(spx, spy);

            DrawBackground(background);

            #if DEBUG_IMAGE
            using (Pen pen = new Pen(Color.Red)) {
                fRenderer.DrawRectangle(pen, Color.Transparent, fSPX, fSPY, fImageWidth, fImageHeight);
            }
            #endif

            bool hasDeep = (fSelected != null && fSelected != fModel.Root && fSelected.Rec != null);

            if (hasDeep && fOptions.DeepMode == DeepMode.Background)
            {
                DrawDeep(fOptions.DeepMode, spx, spy);
            }

            fRenderer.SetTranslucent(0.0f);
            fModel.Draw(drawMode);

            if (hasDeep && fOptions.DeepMode == DeepMode.Foreground)
            {
                DrawDeep(fOptions.DeepMode, spx, spy);
            }
        }
Пример #13
0
        protected override void DoPaintEvent(BaseScreen screen)
        {
            if (CtlCommon.WinBack != null && CtlCommon.WinDecor != null)
            {
                ExtRect crt = ClientRect;
                int     L   = crt.Left;
                int     T   = crt.Top;
                int     R   = crt.Right;
                int     B   = crt.Bottom;

                if (BackDraw)
                {
                    screen.DrawFilled(crt, BaseScreen.FILL_TILE, 0, 0, (int)CtlCommon.WinBack.Width, (int)CtlCommon.WinBack.Height, 0, 0, CtlCommon.WinBack);
                }
                else
                {
                    screen.FillRect(crt, Colors.Black);
                }

                screen.DrawFilled(crt, BaseScreen.FILL_HORZ, 16, 0, 61, 8, L, T, CtlCommon.WinDecor);
                screen.DrawFilled(crt, BaseScreen.FILL_HORZ, 16, 0, 61, 8, L, B - 7, CtlCommon.WinDecor);
                screen.DrawFilled(crt, BaseScreen.FILL_VERT, 0, 16, 8, 61, L, T, CtlCommon.WinDecor);
                screen.DrawFilled(crt, BaseScreen.FILL_VERT, 0, 16, 8, 61, R - 7, T, CtlCommon.WinDecor);

                screen.DrawImage(L, T, 0, 0, 8, 8, CtlCommon.WinDecor, 255);
                screen.DrawImage(L, B - 7, 0, 0, 8, 8, CtlCommon.WinDecor, 255);
                screen.DrawImage(R - 7, T, 0, 0, 8, 8, CtlCommon.WinDecor, 255);
                screen.DrawImage(R - 7, B - 7, 0, 0, 8, 8, CtlCommon.WinDecor, 255);
                screen.DrawImage(L + 8, T + 8, 8, 8, 13, 10, CtlCommon.WinDecor, 255);
                screen.DrawImage(L + 8, B - 7 - 10, 8, 75, 13, 10, CtlCommon.WinDecor, 255);
                screen.DrawImage(R - 7 - 13, T + 8, 72, 8, 13, 10, CtlCommon.WinDecor, 255);
                screen.DrawImage(R - 7 - 13, B - 7 - 10, 72, 75, 13, 10, CtlCommon.WinDecor, 255);
            }
        }
Пример #14
0
        private ExtRect GetDRect(int stepIndex)
        {
            int step     = fDestRect.Height / D_COUNT;
            int thumbTop = fDestRect.Top + stepIndex * step;

            return(ExtRect.CreateBounds(fDestRect.Left, thumbTop, fDestRect.Width, step));
        }
Пример #15
0
        protected override void DoMouseDownEvent(MouseEventArgs eventArgs)
        {
            base.DoMouseDownEvent(eventArgs);

            ExtRect r  = base.IntRect;
            int     eX = eventArgs.X - r.Left;
            int     eY = eventArgs.Y - r.Top;

            int row = fTopIndex + eY / fLineHeight;

            if (row >= 0 && row < fLines.Count)
            {
                int num = fLinksList.Count;
                for (int i = 0; i < num; i++)
                {
                    HyperLink link = fLinksList[i];

                    if (link.Row == row && (eX > link.X1 && eX < link.X2))
                    {
                        DoLinkClickEvent(link, i);
                        return;
                    }
                }
            }
        }
Пример #16
0
        protected override void DoPaintEvent(BaseScreen screen)
        {
            base.DoPaintEvent(screen);

            string s = BaseLocale.GetStr(RS.rs_AdventurerName);

            screen.SetTextColor(Colors.Gold, true);
            screen.DrawText((Width - CtlCommon.SmFont.GetTextWidth(s)) / 2, fEditBox.Top - CtlCommon.SmFont.Height, s, 0);
            s           = BaseLocale.GetStr(RS.rs_Apprenticeship);
            screen.Font = CtlCommon.BgFont;
            screen.SetTextColor(Colors.Gold, true);
            screen.DrawText((Width - CtlCommon.BgFont.GetTextWidth(s)) / 2, 60, s, 0);
            screen.Font = CtlCommon.SmFont;

            for (var pa = SysCreature.sc_First; pa <= SysCreature.sc_Last; pa++)
            {
                SysCreatureRec sc = StaticData.dbSysCreatures[(int)pa];

                s = BaseLocale.GetStr(sc.Name);
                ExtRect   r   = sc.ScrRect;
                BaseImage img = fImages[(int)pa];
                screen.DrawImage(r.Left, r.Top, 0, 0, (int)img.Width, (int)img.Height, img, 255);
                screen.DrawText(r.Left + (r.Width - CtlCommon.SmFont.GetTextWidth(s)) / 2, r.Top - CtlCommon.SmFont.Height, s, 0);
            }
        }
Пример #17
0
        public static ExtRect NormalizeFormRect(ExtRect winRect)
        {
            // Travis CI does not have access to UI and tests aren't performed.
            #if !CI_MODE
            //------------------------------------------------------------------
            // 2016-09-30 Ruslan Garipov <*****@*****.**>
            // Restrict position and size of the main window.
            // FIXME: DPI-aware code still required here.
            //------------------------------------------------------------------

            Screen screen = Screen.FromRectangle(Rt2Rt(winRect));
            if (screen != null)
            {
                Rectangle workArea = screen.WorkingArea;

                int width  = winRect.GetWidth();
                int height = winRect.GetHeight();

                // Besides disallowing to the main window to have its right
                // and bottom borders overhanged entire virtual workspace,
                // combined from all available monitors, this code also
                // does not allow to have this window "between" two
                // monitors. This may be UNWANTED BEHAVIOR.
                winRect.Left   = Math.Max(workArea.Left, Math.Min(workArea.Right - width, winRect.Left));
                winRect.Top    = Math.Max(workArea.Top, Math.Min(workArea.Bottom - height, winRect.Top));
                winRect.Right  = winRect.Left + width - 1;
                winRect.Bottom = winRect.Top + height - 1;
            }
            #endif

            return(winRect);
        }
Пример #18
0
        public static ExtRect GetFormRect(Form form)
        {
            if (form == null)
            {
                return(ExtRect.CreateEmpty());
            }

            // You must not expect user has a top window located on the primary
            // monitor. If a top window ain't on the primary monitor,
            // `x` and `y` may be negative numbers.

            // 2016-09-30 Ruslan Garipov <*****@*****.**>
            // GK doesn't check size and position of the `form` here anymore.
            // `GetFormRect` is called **before** closing the application, but
            // there's no guarantees that user won't change a monitor settings
            // after that. GK should restrict position of a top window on the
            // application startup. And I'm still not sured GK should constrain
            // a window size (either top one or child).
            // FIXME: If `Control::Left`, `Control::Top`, `Control::Width` and
            // `Control::Height` return physical values (device depended), code
            // here or code that uses the result of `GetFormRect` must convert
            // them to logical values (device independed) before storing it as
            // the application settings. Had GK been a native Windows
            // application, it had to do that. But since it's a .NET application
            // I don't know is it a true.
            return(ExtRect.Create(form.Left, form.Top, form.Right, form.Bottom));
        }
Пример #19
0
        public SelfWindow(BaseControl owner)
            : base(owner)
        {
            Font        = CtlCommon.SmFont;
            Width       = 640;
            Height      = 480;
            WindowStyle = new WindowStyles(WindowStyles.wsScreenCenter, WindowStyles.wsModal, WindowStyles.wsKeyPreview);
            //super.Shifted = true;

            fDiagnosisCtl         = new ListBox(this);
            fDiagnosisCtl.Bounds  = ExtRect.Create(10, 130 + StaticData.RsFontHeight, 212, 469); // 3
            fDiagnosisCtl.Visible = true;

            fSkillsCtl         = new ListBox(this);
            fSkillsCtl.Bounds  = ExtRect.Create(218, 130 + StaticData.RsFontHeight, 421, 469); // 4
            fSkillsCtl.Visible = true;

            fAbilitiesCtl         = new ListBox(this);
            fAbilitiesCtl.Bounds  = ExtRect.Create(427, 130 + StaticData.RsFontHeight, 629, 469); // 5
            fAbilitiesCtl.Visible = true;

            fDiagnosisCtl.ControlStyle.Exclude(ControlStyles.сsOpaque);
            fSkillsCtl.ControlStyle.Exclude(ControlStyles.сsOpaque);
            fAbilitiesCtl.ControlStyle.Exclude(ControlStyles.сsOpaque);
        }
Пример #20
0
        public override void Draw(BaseScreen screen)
        {
            if (InvItem == null)
            {
                return;
            }

            string iName = InvItem.Name;
            int    c;

            if (Accepted)
            {
                c = Colors.Green;
            }
            else
            {
                c = Colors.Red;
            }
            int     h = CtlCommon.SmFont.Height + 10;
            int     w = CtlCommon.SmFont.GetTextWidth(iName) + 10;
            ExtRect r = ExtRect.Create(DragPos.X, DragPos.Y, DragPos.X + w, DragPos.Y + h);

            screen.DrawRectangle(r, c, Colors.Yellow);
            CtlCommon.SmFont.Color = BaseScreen.RGB(1, 1, 1);
            screen.DrawText(DragPos.X + 5, DragPos.Y + 5, iName, 0);
        }
Пример #21
0
        public override bool Accept()
        {
            try {
                ExtRect selectRegion = fView.ImageCtl.SelectionRegion;

                if (!selectRegion.IsEmpty())
                {
                    fMultimediaLink.IsPrimaryCutout      = true;
                    fMultimediaLink.CutoutPosition.Value = selectRegion;
                }
                else
                {
                    fMultimediaLink.IsPrimaryCutout      = false;
                    fMultimediaLink.CutoutPosition.Value = ExtRect.CreateEmpty();
                }

                var uid = fMultimediaLink.GetUID(fBase.Context.Tree);
                PortraitsCache.Instance.RemoveObsolete(uid);

                return(true);
            } catch (Exception ex) {
                Logger.WriteError("PortraitSelectDlgController.Accept()", ex);
                return(false);
            }
        }
Пример #22
0
        protected override void DoPaintEvent(BaseScreen screen)
        {
            base.DoPaintEvent(screen);

            string nm_self = GlobalVars.nwrGame.Player.Name;
            string nm_col  = fCollocutor.Name;

            screen.SetTextColor(Colors.Gold, true);

            ExtRect pakRt = fPackList.Bounds; // 2
            ExtRect colRt = fColList.Bounds;  // 0

            int lcx = pakRt.Left + (pakRt.Width - CtlCommon.SmFont.GetTextWidth(nm_self)) / 2;
            int rcx = colRt.Left + (colRt.Width - CtlCommon.SmFont.GetTextWidth(nm_col)) / 2;

            int lcy = pakRt.Top - CtlCommon.SmFont.Height;
            int rcy = colRt.Top - CtlCommon.SmFont.Height;

            screen.DrawText(lcx, lcy, nm_self, 0);
            screen.DrawText(rcx, rcy, nm_col, 0);

            screen.DrawText(pakRt.Left, pakRt.Bottom + 3, BaseLocale.GetStr(RS.rs_Weight) + ": " + string.Format("{0:F2} / {1:F2}", new object[] {
                GlobalVars.nwrGame.Player.TotalWeight,
                GlobalVars.nwrGame.Player.MaxItemsWeight
            }), 0);
            screen.DrawText(colRt.Left, colRt.Bottom + 3, BaseLocale.GetStr(RS.rs_Weight) + ": " + string.Format("{0:F2} / {1:F2}", new object[] {
                fCollocutor.TotalWeight,
                fCollocutor.MaxItemsWeight
            }), 0);
        }
Пример #23
0
        public ExchangeWindow(BaseControl owner)
            : base(owner)
        {
            fPackList             = new ListBox(this);
            fPackList.Bounds      = ExtRect.Create(309, 28, 589, 398);
            fPackList.Visible     = true;
            fPackList.OnDragDrop  = OnPackDragDrop;
            fPackList.OnDragOver  = OnPackDragOver;
            fPackList.OnDragStart = OnPackDragStart;
            fPackList.OnMouseDown = OnListMouseDown;
            fPackList.OnMouseMove = OnListMouseMove;
            fPackList.OnKeyDown   = null;
            fPackList.ShowHints   = true;
            fPackList.Options.Include(LBOptions.lboIcons);

            fColList             = new ListBox(this);
            fColList.Bounds      = ExtRect.Create(10, 28, 290, 398);
            fColList.Visible     = true;
            fColList.OnDragDrop  = OnColDragDrop;
            fColList.OnDragOver  = OnColDragOver;
            fColList.OnDragStart = OnColDragStart;
            fColList.OnMouseDown = OnListMouseDown;
            fColList.OnMouseMove = OnListMouseMove;
            fColList.OnKeyDown   = null;
            fColList.ShowHints   = true;
            fColList.Options.Include(LBOptions.lboIcons);
        }
Пример #24
0
        public string GetUID()
        {
            string result = null;

            try {
                if (Value != null)
                {
                    ExtRect cutoutArea;
                    if (IsPrimaryCutout)
                    {
                        cutoutArea = CutoutPosition.Value;
                    }
                    else
                    {
                        cutoutArea = ExtRect.CreateEmpty();
                    }

                    GDMMultimediaRecord mmRec = (GDMMultimediaRecord)Value;
                    result = mmRec.UID + "-" + GKUtils.GetRectUID(cutoutArea.Left, cutoutArea.Top, cutoutArea.Right, cutoutArea.Bottom);
                }
            } catch (Exception ex) {
                Logger.WriteError("GDMMultimediaLink.GetUID()", ex);
                result = null;
            }
            return(result);
        }
Пример #25
0
        public bool Build(byte maxDoors, byte minSize, byte maxSize, ExtRect area)
        {
            try {
                int hr = RandomHelper.GetBoundedRnd(minSize, maxSize);
                int wr = RandomHelper.GetBoundedRnd(minSize, maxSize);
                int tH = area.Height - hr;
                int tW = area.Width - wr;

                int tries = TryCount;
                while (tries > 0)
                {
                    int     x  = area.Left + RandomHelper.GetBoundedRnd(0, tW);
                    int     y  = area.Top + RandomHelper.GetBoundedRnd(0, tH);
                    ExtRect br = ExtRect.CreateBounds(x, y, wr, hr);

                    if (CanBuild(br, area))
                    {
                        Area = br;
                        if (maxDoors > 0)
                        {
                            BuildDoors(maxDoors, br);
                        }
                        Flush();

                        return(true);
                    }
                    tries--;
                }
            } catch (Exception ex) {
                Logger.Write("Building.build(): " + ex.Message);
            }

            return(false);
        }
Пример #26
0
        public AlchemyWindow(BaseControl owner)
            : base(owner)
        {
            Font        = CtlCommon.SmFont;
            Width       = 600;
            Height      = 460;
            WindowStyle = new WindowStyles(WindowStyles.wsScreenCenter, WindowStyles.wsModal, WindowStyles.wsKeyPreview);
            Shifted     = true;

            fPackList              = new ListBox(this);
            fPackList.Bounds       = ExtRect.Create(309, 28, 589, 398);
            fPackList.OnItemSelect = null;
            fPackList.Visible      = true;
            fPackList.OnDragDrop   = OnPackDragDrop;
            fPackList.OnDragOver   = OnPackDragOver;
            fPackList.OnDragStart  = OnPackDragStart;
            fPackList.OnMouseDown  = OnListMouseDown;
            fPackList.ShowHints    = true;
            fPackList.OnMouseMove  = OnListMouseMove;

            fIngredientsList              = new ListBox(this);
            fIngredientsList.Bounds       = ExtRect.Create(10, 28, 290, 207);
            fIngredientsList.OnItemSelect = null;
            fIngredientsList.Visible      = true;
            fIngredientsList.OnDragDrop   = OnIngrDragDrop;
            fIngredientsList.OnDragOver   = OnIngrDragOver;
            fIngredientsList.OnDragStart  = OnIngrDragStart;
            fIngredientsList.OnMouseDown  = OnListMouseDown;
            fIngredientsList.ShowHints    = true;
            fIngredientsList.OnMouseMove  = OnListMouseMove;

            fResList             = new ListBox(this);
            fResList.Bounds      = ExtRect.Create(10, 225, 290, 398); // 7
            fResList.Visible     = true;
            fResList.ShowHints   = true;
            fResList.OnMouseMove = OnListMouseMove;

            NWButton btnAlchemy = new NWButton(this);

            btnAlchemy.Width        = 90;
            btnAlchemy.Height       = 30;
            btnAlchemy.Left         = fPackList.Left + 20;
            btnAlchemy.Top          = Height - 30 - 20;
            btnAlchemy.OnClick      = OnBtnAlchemy;
            btnAlchemy.OnLangChange = GlobalVars.nwrWin.LangChange;
            btnAlchemy.LangResID    = 131;
            btnAlchemy.ImageFile    = "itf/DlgBtn.tga";

            NWButton btnClose = new NWButton(this);

            btnClose.Width        = 90;
            btnClose.Height       = 30;
            btnClose.Left         = Width - 90 - 20;
            btnClose.Top          = Height - 30 - 20;
            btnClose.OnClick      = OnBtnClose;
            btnClose.OnLangChange = GlobalVars.nwrWin.LangChange;
            btnClose.LangResID    = 8;
            btnClose.ImageFile    = "itf/DlgBtn.tga";
        }
Пример #27
0
        public void Generate(NWField field, int pX, int pY)
        {
            ExtRect area = ExtRect.Create(pX - 7, pY - 7, pX + 7, pY + 7);

            field.Gen_RarefySpace(area, ChangeFCTile, 8, 50);

            field.NormalizeFog();
        }
 public MainControlRec(int nameRes, string imageFile, EventID _event, ExtRect rt)
 {
     NameRes   = nameRes;
     ImageFile = imageFile;
     Event     = _event;
     R         = rt;
     Button    = null;
 }
Пример #29
0
        protected override void DoPaintEvent(BaseScreen screen)
        {
            ExtRect crt = ClientRect;

            CtlCommon.DrawCtlBorder(screen, crt);
            crt.Inflate(-1, -1);
            DrawGauge(screen, crt, Pos, Max, Colors.Black, Colors.Gray, Colors.Gold);
        }
Пример #30
0
        private void InternalDraw(ChartDrawMode drawMode, BackgroundMode background)
        {
            // drawing relative offset of tree on graphics
            int spx = 0;
            int spy = 0;

            if (drawMode == ChartDrawMode.dmInteractive)
            {
                var imageViewport = base.ImageViewport;
                spx = imageViewport.Left;
                spy = imageViewport.Top;
                fModel.VisibleArea = UIHelper.Rt2Rt(base.Viewport);
            }
            else
            {
                if (drawMode == ChartDrawMode.dmStaticCentered)
                {
                    Size clientSize = CanvasRectangle.Size;

                    if (fModel.ImageWidth < clientSize.Width)
                    {
                        spx += (clientSize.Width - fModel.ImageWidth) / 2;
                    }

                    if (fModel.ImageHeight < clientSize.Height)
                    {
                        spy += (clientSize.Height - fModel.ImageHeight) / 2;
                    }
                }

                fModel.VisibleArea = ExtRect.CreateBounds(0, 0, fModel.ImageWidth, fModel.ImageHeight);
            }

            fModel.SetOffsets(spx, spy);

            DrawBackground(background);

#if DEBUG_IMAGE
            using (Pen pen = new Pen(Color.Red)) {
                fRenderer.DrawRectangle(pen, Color.Transparent, fSPX, fSPY, fImageWidth, fImageHeight);
            }
#endif

            bool hasDeep = (fSelected != null && fSelected != fModel.Root && fSelected.Rec != null);

            if (hasDeep && fOptions.DeepMode == DeepMode.Background)
            {
                DrawDeep(fOptions.DeepMode, spx, spy);
            }

            fRenderer.SetTranslucent(0.0f);
            fModel.Draw(drawMode);

            if (hasDeep && fOptions.DeepMode == DeepMode.Foreground)
            {
                DrawDeep(fOptions.DeepMode, spx, spy);
            }
        }