예제 #1
0
            public virtual void ReadChildData(BinaryReader reader)
            {
                int x = 0;

                _singlePlayerFont.ReadString(reader);
                _multiPlayerFont.ReadString(reader);
                _itemMessageText.ReadString(reader);
                _iconBitmap.ReadString(reader);
                _alternateIconText.ReadString(reader);
                for (x = 0; (x < _buttonIcons.Count); x = (x + 1))
                {
                    ButtonIcons.Add(new HudButtonIconBlock());
                    ButtonIcons[x].Read(reader);
                }
                for (x = 0; (x < _buttonIcons.Count); x = (x + 1))
                {
                    ButtonIcons[x].ReadChildData(reader);
                }
                _hudMessages.ReadString(reader);
                _arrowBitmap.ReadString(reader);
                for (x = 0; (x < _waypointArrows.Count); x = (x + 1))
                {
                    WaypointArrows.Add(new HudWaypointArrowBlock());
                    WaypointArrows[x].Read(reader);
                }
                for (x = 0; (x < _waypointArrows.Count); x = (x + 1))
                {
                    WaypointArrows[x].ReadChildData(reader);
                }
                _defaultWeaponHud.ReadString(reader);
                _indicatorBitmap.ReadString(reader);
                _carnageReportBitmap.ReadString(reader);
                _checkpointSound.ReadString(reader);
            }
예제 #2
0
 public void ReadChildData(BinaryReader reader)
 {
     _singlePlayerFont.ReadString(reader);
     _multiPlayerFont.ReadString(reader);
     _itemMessageText.ReadString(reader);
     _iconBitmap.ReadString(reader);
     _alternateIconText.ReadString(reader);
     for (int x = 0; x < _buttonIcons.Count; x++)
     {
         ButtonIcons.AddNew();
         ButtonIcons[x].Read(reader);
     }
     for (int x = 0; x < _buttonIcons.Count; x++)
     {
         ButtonIcons[x].ReadChildData(reader);
     }
     _hudMessages.ReadString(reader);
     _arrowBitmap.ReadString(reader);
     for (int x = 0; x < _waypointArrows.Count; x++)
     {
         WaypointArrows.AddNew();
         WaypointArrows[x].Read(reader);
     }
     for (int x = 0; x < _waypointArrows.Count; x++)
     {
         WaypointArrows[x].ReadChildData(reader);
     }
     _defaultWeaponHud.ReadString(reader);
     _indicatorBitmap.ReadString(reader);
     _carnageReportBitmap.ReadString(reader);
     _checkpointSound.ReadString(reader);
 }
예제 #3
0
    private void Awake()
    {
        Points.Setup();

        buttonIcons = GetComponent <ButtonIcons>();

        arrowManager = GetComponent <DirectionArrows>();

        TryAddDictionaryValues();
    }
예제 #4
0
        private void DrawTitleBar(Graphics g)
        {
            g.FillRectangle(_brTitlebar, _rcTitleBar);

            StringFormat sf = new StringFormat();

            sf.Alignment     = StringAlignment.Near;
            sf.LineAlignment = StringAlignment.Center;
            sf.Trimming      = StringTrimming.EllipsisCharacter;
            sf.FormatFlags   = StringFormatFlags.NoWrap;

            if (_rcIcon.Width > 0)
            {
                g.DrawImage(this.Icon.ToBitmap(), _rcIcon);
            }

            using (Brush b = new SolidBrush(ThemeManager.ForeColor))
            {
                if (_rcTitle.Width > 0)
                {
                    g.DrawString(_text, _titleBarFont, b, _rcTitle, sf);
                }

                if (_rcMinimize.Width > 0)
                {
                    bool        hovered = (_hoveredButtons & FormButtons.Minimize) == FormButtons.Minimize;
                    ButtonIcons index   = hovered ? ButtonIcons.MinimizeHovered : ButtonIcons.Minimize;
                    DrawButton(g, index, _rcMinimize);
                }

                if (_rcMaximize.Width > 0)
                {
                    bool        hovered = (_hoveredButtons & FormButtons.Maximize) == FormButtons.Maximize;
                    ButtonIcons index   = ButtonIcons.Minimize;

                    if (WindowState == FormWindowState.Normal)
                    {
                        index = hovered ? ButtonIcons.MaximizeHovered : ButtonIcons.Maximize;
                    }
                    else
                    {
                        index = hovered ? ButtonIcons.RestoreHovered : ButtonIcons.Restore;
                    }

                    DrawButton(g, index, _rcMaximize);
                }

                if (_rcClose.Width > 0)
                {
                    bool        hovered = (_hoveredButtons & FormButtons.Close) == FormButtons.Close;
                    ButtonIcons index   = hovered ? ButtonIcons.CloseHovered : ButtonIcons.Close;
                    DrawButton(g, index, _rcClose);
                }
            }
        }
        public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)
        {
            AddInGlobal.InventorApp = addInSiteObject.Application;
            AddInGlobal.GetAddinClassId(GetType());

            IButton button = new Button();
            var     action = new ButtonActions.ButtonActions();

            addIcon                        = new ButtonIcons(Resources.add_16x16, Resources.add_32x32);
            addButtonDefinition            = button.CreateButton("Add", "Add", addIcon);
            addButtonDefinition.OnExecute += action.AddButtonDefinitionOnExecute;

            addFromFolderIcon                        = new ButtonIcons(Resources.folder_add_16x16, Resources.folder_add_32x32);
            addFromFolderButtonDefinition            = button.CreateButton("Add Folder", "Add Folder", addFromFolderIcon);
            addFromFolderButtonDefinition.OnExecute += action.AddFromFolderButtonDefinitionOnExecute;

            searchIcon                        = new ButtonIcons(Resources.icon_search_16x16, Resources.icon_search_32x32);
            searchButtonDefinition            = button.CreateButton("Search", "Search", searchIcon);
            searchButtonDefinition.OnExecute += action.SearchButtonDefinitionOnExecute;

            settingsIcon                        = new ButtonIcons(Resources.setting_16x16, Resources.setting_32x32);
            settingsButtonDefinition            = button.CreateButton("Settings", "Settings", settingsIcon);
            settingsButtonDefinition.OnExecute += action.SettingsButtonDefinitionOnExecute;
        }
예제 #6
0
        public ButtonDefinition CreateButton(string displayName, string internalName, ButtonIcons buttonIcons)
        {
            ButtonDefinition buttonDefinition = AddInGlobal.InventorApp.CommandManager.ControlDefinitions.AddButtonDefinition(
                displayName, internalName, CommandTypesEnum.kEditMaskCmdType, "{" + AddInGlobal.ClassId + "}",
                null, null, buttonIcons.iconStandard, buttonIcons.iconLarge);

            buttonDefinition.AutoAddToGUI();
            AddInGlobal.panel         = RibbonContainer.CreateRibbonPanel("ZeroDoc", "id_TabTools", "Search 3D Models", displayName, buttonDefinition);
            AddInGlobal.panel.Visible = true;
            buttonDefinition.Enabled  = true;
            return(buttonDefinition);
        }
예제 #7
0
        private void DrawButton(Graphics g, ButtonIcons index, Rectangle rc)
        {
            Color cl1 = ThemeManager.CaptionButtonColor1;
            Color cl2 = ThemeManager.CaptionButtonColor2;
            Color clPen = ThemeManager.BorderColor;
            Color clText = ThemeManager.ForeColor;

            float percLight = 0.4f;
            string letter = "";

            int i = (int)index;
            switch (index)
            {
                case ButtonIcons.Minimize:
                    letter = "0";
                    break;
                
                case ButtonIcons.MinimizeHovered:
                    letter = "0";
                    cl1 = ControlPaint.Light(cl1, percLight);
                    cl2 = ControlPaint.Light(cl2, percLight);
                    clText = ThemeManager.WndTextColor;
                    break;

                case ButtonIcons.Maximize:
                    letter = "1";
                    break;
                
                case ButtonIcons.MaximizeHovered:
                    letter = "1";
                    cl1 = ControlPaint.Light(cl1, percLight);
                    cl2 = ControlPaint.Light(cl2, percLight);
                    clText = ThemeManager.WndTextColor;
                    break;
                
                case ButtonIcons.Restore:
                    letter = "2";
                    break;
                
                case ButtonIcons.RestoreHovered:
                    letter = "2";
                    cl1 = ControlPaint.Light(cl1, percLight);
                    cl2 = ControlPaint.Light(cl2, percLight);
                    clText = ThemeManager.WndTextColor;
                    break;

                case ButtonIcons.Close:
                    letter = "r";
                    cl1 = ThemeManager.CaptionButtonRedColor1;
                    cl2 = ThemeManager.CaptionButtonRedColor2;
                    break;
                
                case ButtonIcons.CloseHovered:
                    letter = "r";
                    cl1 = ControlPaint.Light(ThemeManager.CaptionButtonRedColor1, percLight);
                    cl2 = ControlPaint.Light(ThemeManager.CaptionButtonRedColor2, percLight);
                    clText = ThemeManager.WndTextColor;
                    break;
            }

            Rectangle rcBorder = new Rectangle(rc.Location, rc.Size);
            rcBorder.Inflate(1, 0);

            Size szText = g.MeasureString(letter, CaptionButtonFont).ToSize();

            Rectangle rcText = new Rectangle(
                rcBorder.Left + (rcBorder.Width - szText.Width) / 2 + 1,
                rcBorder.Top + (rcBorder.Height - szText.Height) / 2 - 2,
                szText.Width, szText.Height);

            using (Pen p = new Pen(ThemeManager.BorderColor, 1))
            using (Brush bt = new SolidBrush(clText))
            using (Brush br = new LinearGradientBrush(rc, cl1, cl2, 90f))
            {
                g.FillRectangle(br, rcBorder);
                g.DrawString(letter, CaptionButtonFont, bt, rcText);
                g.DrawRectangle(p, rcBorder);
            }



            //g.DrawImageUnscaled(_btnImgList.Images[(int)index], rc);
        }
예제 #8
0
        private void DrawButton(Graphics g, ButtonIcons index, Rectangle rc)
        {
            Color cl1    = ThemeManager.CaptionButtonColor1;
            Color cl2    = ThemeManager.CaptionButtonColor2;
            Color clPen  = ThemeManager.BorderColor;
            Color clText = ThemeManager.CaptionButtonForeColor;

            float  percLight = 0.4f;
            string letter    = "";

            int i = (int)index;

            switch (index)
            {
            case ButtonIcons.Minimize:
                letter = "0";
                break;

            case ButtonIcons.MinimizeHovered:
                letter = "0";
                cl1    = ControlPaint.Light(cl1, percLight);
                cl2    = ControlPaint.Light(cl2, percLight);
                break;

            case ButtonIcons.Maximize:
                letter = "1";
                break;

            case ButtonIcons.MaximizeHovered:
                letter = "1";
                cl1    = ControlPaint.Light(cl1, percLight);
                cl2    = ControlPaint.Light(cl2, percLight);
                break;

            case ButtonIcons.Restore:
                letter = "2";
                break;

            case ButtonIcons.RestoreHovered:
                letter = "2";
                cl1    = ControlPaint.Light(cl1, percLight);
                cl2    = ControlPaint.Light(cl2, percLight);
                break;

            case ButtonIcons.Close:
                letter = "r";
                cl1    = ThemeManager.CaptionCloseButtonColor1;
                cl2    = ThemeManager.CaptionCloseButtonColor2;
                clText = ThemeManager.CaptionCloseButtonForeColor;
                break;

            case ButtonIcons.CloseHovered:
                letter = "r";
                cl1    = ControlPaint.Light(ThemeManager.CaptionCloseButtonColor1, percLight);
                cl2    = ControlPaint.Light(ThemeManager.CaptionCloseButtonColor2, percLight);
                clText = ThemeManager.CaptionCloseButtonForeColor;
                break;
            }

            Rectangle rcBorder = new Rectangle(rc.Location, rc.Size);

            rcBorder.Inflate(1, 0);

            Size szText = g.MeasureString(letter, CaptionButtonFont).ToSize();

            Rectangle rcText = new Rectangle(
                rcBorder.Left + (rcBorder.Width - szText.Width) / 2 + 1,
                rcBorder.Top + (rcBorder.Height - szText.Height) / 2 - 2,
                szText.Width, szText.Height);

            using (Pen p = new Pen(ThemeManager.BorderColor, 1))
                using (Brush bt = new SolidBrush(clText))
                    using (Brush br = new LinearGradientBrush(rc, cl1, cl2, 90f))
                    {
                        g.FillRectangle(br, rcBorder);
                        g.DrawString(letter, CaptionButtonFont, bt, rcText);
                        g.DrawRectangle(p, rcBorder);
                    }



            //g.DrawImageUnscaled(_btnImgList.Images[(int)index], rc);
        }