Пример #1
0
 public void Draw(SpriteBatch spritebatch)
 {
     if (Textured == true)
     {
         if (Selected)
         {
             spritebatch.Draw(SelectedTexture, position, null, Color.White, 0f, new Vector2(mainTexture.Width / 2, mainTexture.Height / 2), 1.0f, SpriteEffects.None, 0);
         }
         else
         {
             spritebatch.Draw(CurrentTexture, position, null, Color.White, 0f, new Vector2(mainTexture.Width / 2, mainTexture.Height / 2), 1.0f, SpriteEffects.None, 0);
         }
         spritebatch.DrawString(Font, Text, textPosition, FontColor, 0f, new Vector2(mainTexture.Width / 2, mainTexture.Height / 2), 1.0f, SpriteEffects.None, 0);
     }
     else
     {
         if (Selected == true)
         {
             SelectedBox.Draw(spritebatch);
         }
         else
         {
             DefaultBox.Draw(spritebatch);
         }
         spritebatch.DrawString(Font, Text, textPosition, FontColor);
     }
 }
Пример #2
0
        /// <summary>
        /// Find the box that fits in maximumBox and if possible is closest to an idealBox
        /// </summary>
        /// <param name="notPackedBoxes">All available boxes</param>
        /// <param name="idealBox">The ideal box we are looking for</param>
        /// <param name="maximumBox">The absolute max dimensions that could be packed</param>
        /// <returns>The box that could be packed</returns>
        SelectedBox FindBox(List <Box> notPackedBoxes, Point3D idealBox, Point3D maximumBox)
        {
            SelectedBox foundBox = null;

            // Go through all boxes
            foreach (var box in notPackedBoxes)
            {
                // Check all orientations of the box that fit in maximum space
                foreach (var boxDimensions in
                         box.Dimensions.AllRotations.Where(maximumBox.ContainsDimension)) // Order different from original. was XZY, YXZ, YZX, ZXY, ZYX
                {
                    var fitsInLayer = boxDimensions.Y <= idealBox.Y;
                    var delta       = idealBox.AbsoluteDiff(boxDimensions); // Calculate absolute coordinate differences
                    // If this box is a better fit then remember it
                    if (foundBox == null ||
                        foundBox.IsBetterFit(fitsInLayer, delta))
                    {
                        foundBox = new SelectedBox()
                        {
                            Box = box, PackedDimensions = boxDimensions, DeltaFromIdeal = delta, FitsInLayer = fitsInLayer
                        };
                    }
                    // If box is cube then checking one box orientation is enough
                    if (box.Dimensions.IsCube)
                    {
                        break;
                    }
                }
            }
            return(foundBox);
        }
Пример #3
0
 public void UnloadContent()
 {
     if (TextureMainPath == null)
     {
         DefaultBox.UnloadContent();
         SelectedBox.UnloadContent();
     }
 }
Пример #4
0
 private void listBoxUsedPlatforms_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listBoxUsedPlatforms.SelectedIndex != -1)
     {
         _selectedListBox = SelectedBox.Used;
         listBoxAvailablePlatforms.SelectedIndex = -1;
         SelectPlatform((AppleTargetPlatform)listBoxUsedPlatforms.SelectedItem);
     }
 }
Пример #5
0
 /// <summary>
 /// Установить игрока на позицию
 /// </summary>
 /// <param name="player"></param>
 public void SetPLayer(PlayerViewModel player)
 {
     if (SelectedBox != null)
     {
         SelectedBox.SetPlayer(player);
         MovementInField = false;
         SelectedBox     = null;
         ResetHighlight();
     }
 }
Пример #6
0
/*	[MenuItem ("Dialogue/Tests/Conversation/Fix One Way Links", false, 23)]
 *      static public void FixOneWayLinks()
 *      {
 *              RunTest(EditorTypeUtils.EntityTestType.FixOneWayLinks);
 *      }*/

        public virtual MonsterTestBase GetCurrentlySelected()
        {
            object SelectedInst = SelectedBox.GetInspectorInstance();

            if (SelectedInst != null)
            {
                if (typeof(MonsterTestBase).IsAssignableFrom(SelectedInst.GetType()))
                {
                    return((MonsterTestBase)SelectedInst);
                }
            }

            return(null);
        }
Пример #7
0
        /// <summary>
        /// Действия при выборе игрового бокса
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PlBoxVM_BoxSelected(object sender, EventArgs e)
        {
            PlayBoxViewModel newSelectedBox = sender as PlayBoxViewModel;

            MovementInField = true;

            if (SelectedBox == null)
            {
                SelectedBox = newSelectedBox;
                OnBoxSelected();

                if (MovementInField)
                {
                    if (newSelectedBox.IsPlayerPresent)
                    {
                        LocalHighlightPositions();
                    }
                    else
                    {
                        SelectedBox = null;
                    }
                }
            }
            else
            {
                if (newSelectedBox.IsPlayerPresent)
                {
                    if (newSelectedBox != SelectedBox)
                    {
                        PlayerViewModel plNSB = newSelectedBox.WithdrawPlayer();
                        PlayerViewModel plSB  = SelectedBox.WithdrawPlayer();
                        newSelectedBox.SetPlayer(plSB);
                        SelectedBox.SetPlayer(plNSB);
                        ResetHighlight();
                        SelectedBox = null;
                    }
                }
                else
                {
                    PlayerViewModel plSB = SelectedBox.WithdrawPlayer();
                    newSelectedBox.SetPlayer(plSB);
                    ResetHighlight();
                    SelectedBox = null;
                }
            }
        }
Пример #8
0
        private void UpdateButtonOkStatus()
        {
            string message = string.Empty;

            // name
            if (string.IsNullOrEmpty(tbName.Text))
            {
                message = Resources.ID_FIELDNAMEEMPTY;
            }
            // name validity
            else if (!_document.IsValidNewAnalysisName(tbName.Text, _analysis))
            {
                message = string.Format(Resources.ID_INVALIDNAME, tbName.Text);
            }
            // description
            else if (string.IsNullOrEmpty(tbDescription.Text))
            {
                message = Resources.ID_FIELDDESCRIPTIONEMPTY;
            }
            // orientation
            else if (!AllowVerticalX && !AllowVerticalY && !AllowVerticalZ)
            {
                message = Resources.ID_DEFINEATLEASTONEVERTICALAXIS;
            }
            // maximum weight reached with only one box ?
            else if (UseMaximumCaseWeight && (MaximumCaseWeight < SelectedCase.Weight + SelectedBox.Weight))
            {
                message = string.Format(Resources.ID_MAXIMUMCASEWEIGHTSHOULDEXCEED, SelectedCase.Weight + SelectedBox.Weight);
            }
            // does box fits in case ?
            else if (!SelectedBox.FitsIn(SelectedCase, AllowVerticalX, AllowVerticalY, AllowVerticalZ))
            {
                message = string.Format(Resources.ID_BOXDOESNOTFITINCASE, SelectedBox.Name, SelectedCase.Name);
            }
            // update nud boxes according to checkbox
            nudMaximumCaseWeight.Enabled    = checkBoxMaximumCaseWeight.Checked;
            nudMaximumNumberOfBoxes.Enabled = checkBoxMaximumNumberOfBoxes.Checked;
            //---
            // button OK
            bnOk.Enabled = string.IsNullOrEmpty(message);
            // status bar
            toolStripStatusLabelDef.ForeColor = string.IsNullOrEmpty(message) ? Color.Black : Color.Red;
            toolStripStatusLabelDef.Text      = string.IsNullOrEmpty(message) ? Resources.ID_READY : message;
        }
Пример #9
0
 public void Draw(SpriteBatch spritebatch)
 {
     if (Textured == true)
     {
         spritebatch.Draw(CurrentTexture, Position, Color.White);
         spritebatch.DrawString(Font, Text, TextPosition, FontColor);
     }
     else
     {
         if (Selected == true)
         {
             SelectedBox.Draw(spritebatch);
         }
         else
         {
             DefaultBox.Draw(spritebatch);
         }
         spritebatch.DrawString(Font, Text, TextPosition, FontColor);
     }
 }
Пример #10
0
        protected void LoadList()
        {
            if (hasChosen == false)
            {
                SelectedBox.Visible = false;
                ListName.Text       = "Please Choose An Option to View";
            }
            else
            {
                SelectedBox.Visible = true;
                if (choiceType.Equals("SoldProducts"))
                {
                    products = data.readAccountProduct(user);

                    foreach (Product p in products)
                    {
                        productnames.Add(p.ProductName);
                    }
                    SelectedBox.DataSource = productnames;
                    SelectedBox.DataBind();
                    ListName.Text = user.UName + "'s Sold Products";
                }
                if (choiceType.Equals("Tags"))
                {
                    userTags = data.readTags();
                    userTags = userTags.Where(o => o.UserID.Contains(user.Id)).ToList();
                    foreach (Tag t in userTags)
                    {
                        tagnames.Add(t.TagName);
                    }
                    SelectedBox.DataSource = tagnames;
                    SelectedBox.DataBind();
                    ListName.Text = user.UName + "'s Created Tags";
                }
            }
        }
Пример #11
0
 /// <summary>
 /// Updates list boxes GUI based on internal state
 /// </summary>
 private void UpdateListBoxes()
 {
     listBoxAvailablePlatforms.Items.Clear();
     listBoxUsedPlatforms.Items.Clear();
     foreach (var platform in _available)
     {
         listBoxAvailablePlatforms.Items.Add(platform.Key);
     }
     foreach (var platform in _used)
     {
         listBoxUsedPlatforms.Items.Add(platform.Key);
     }
     if (_available.Count > 0)
     {
         listBoxAvailablePlatforms.Focus();
         listBoxAvailablePlatforms.Select();
         listBoxAvailablePlatforms.SelectedIndex = 0;
         listBoxUsedPlatforms.SelectedIndex      = -1;
         _selectedListBox = SelectedBox.Available;
     }
     else if (_used.Count > 0)
     {
         listBoxUsedPlatforms.Focus();
         listBoxUsedPlatforms.Select();
         listBoxUsedPlatforms.SelectedIndex      = 0;
         listBoxAvailablePlatforms.SelectedIndex = -1;
         _selectedListBox = SelectedBox.Used;
     }
     else
     {
         listBoxUsedPlatforms.SelectedIndex      = -1;
         listBoxAvailablePlatforms.SelectedIndex = -1;
         _selectedListBox = SelectedBox.Undefined;
     }
     UpdateSelectedPlatformValues();
 }
Пример #12
0
 /// <summary>
 /// Updates list boxes GUI based on internal state
 /// </summary>
 private void UpdateListBoxes()
 {
     listBoxAvailablePlatforms.Items.Clear();
     listBoxUsedPlatforms.Items.Clear();
     foreach (var platform in _available)
     {
         listBoxAvailablePlatforms.Items.Add(platform.Key);
     }
     foreach (var platform in _used)
     {
         listBoxUsedPlatforms.Items.Add(platform.Key);
     }
     if (_available.Count > 0)
     {
         listBoxAvailablePlatforms.Focus();
         listBoxAvailablePlatforms.Select();
         listBoxAvailablePlatforms.SelectedIndex = 0;
         listBoxUsedPlatforms.SelectedIndex = -1;
         _selectedListBox = SelectedBox.Available;
     }
     else if (_used.Count > 0)
     {
         listBoxUsedPlatforms.Focus();
         listBoxUsedPlatforms.Select();
         listBoxUsedPlatforms.SelectedIndex = 0;
         listBoxAvailablePlatforms.SelectedIndex = -1;
         _selectedListBox = SelectedBox.Used;
     }
     else
     {
         listBoxUsedPlatforms.SelectedIndex = -1;
         listBoxAvailablePlatforms.SelectedIndex = -1;
         _selectedListBox = SelectedBox.Undefined;
     }
     UpdateSelectedPlatformValues();
 }
Пример #13
0
 private void listBoxUsedPlatforms_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listBoxUsedPlatforms.SelectedIndex != -1)
     {
         _selectedListBox = SelectedBox.Used;
         listBoxAvailablePlatforms.SelectedIndex = -1;
         SelectPlatform((AppleTargetPlatform)listBoxUsedPlatforms.SelectedItem);
     }
 }