private void AddGroup(TechTreeGroup group)
        {
            group.SetNode(Groups.AddLast(group), this);

            if (CurrentGroup == null)
            {
                CurrentGroup = group;
            }
        }
        public void SetForGameSelection()
        {
            Groups.Clear();
            TechTreeGroup group = new TechTreeGroup(FactionManager.GetFaction(ParentShip.FactionNumber).Cards);

            group.SetNode(Groups.AddLast(group), this);
            CurrentGroup    = group;
            CardPickingMode = false;
        }
Example #3
0
        public void DrawAll()
        {
            TechTreeGroup PreviousGroup = MyNode.Previous != null ? MyNode.Previous.Value : MyNode.List.Last.Value;
            TechTreeGroup NextGroup     = MyNode.Next != null ? MyNode.Next.Value : MyNode.List.First.Value;

            if (ParentMenu.MyFaction.PickingCards)
            {
                PreviousGroup.Draw(Position - new Vector2(0, PreviousGroup.Size.Y));
            }

            Draw(Position);

            if (ParentMenu.MyFaction.PickingCards)
            {
                NextGroup.Draw(Position + new Vector2(0, Size.Y));
            }
        }
 public void SetGroup(TechTreeGroup CurrentGroup)
 {
     this.CurrentGroup = CurrentGroup;
 }
Example #5
0
        public void Update(GameTime gameTime, BasicController MyController, bool Highlighted)
        {
            if (Highlighted && !ParentMenu.Closing)
            {
                TargetPosition = ParentMenu.Position - TechTreeMenu.NegativeOffset - new Vector2(0, Size.Y / 2);
                Position      += (TargetPosition - Position) * gameTime.ElapsedGameTime.Milliseconds * PlayerMenu.CloseOpenSpeed * 2;
                Alpha          = Math.Min(1, Alpha + gameTime.ElapsedGameTime.Milliseconds * PlayerMenu.CloseOpenSpeed * 2);
                if (Alpha > 0.5f)
                {
                    Vector2 CursorPrevious = Cursor;
                    bool    ExtraSticks    = FactionManager.GetFaction(ParentMenu.ParentShip.FactionNumber).PickingCards;
                    Cursor += MyController.MenuStick(ExtraSticks, ExtraSticks, true, false, false);

                    if (ExtraSticks)
                    {
                        Vector2 BumperCursorPrevious = BumperCursor;
                        BumperCursor = MyController.MenuStick(false, false, false, true, true);
                        if (Math.Abs(BumperCursor.X) > 0.1f && Math.Abs(BumperCursor.X) < 0.1f)
                        {
                            Faction f = FactionManager.GetFaction(ParentMenu.ParentShip.FactionNumber);
                            if (BumperCursor.X > 0)
                            {
                                f.CardPickPosition++;
                                if (f.CardPickPosition == f.Cards.Count)
                                {
                                    ParentMenu.ParentShip.ReadyMenu();
                                }
                            }
                            else
                            {
                                f.CardPickPosition = Math.Max(0, f.CardPickPosition - 1);
                            }
                        }
                    }

                    if (Cursor.Y != 0 && ParentMenu.MyFaction.PickingCards)
                    {
                        if (Cursor.Y < 0)
                        {
                            TechTreeGroup PreviousGroup = MyNode.Previous != null ? MyNode.Previous.Value : MyNode.List.Last.Value;
                            if (PreviousGroup.Cards != null && PreviousGroup.Cards.Count > 0)
                            {
                                PreviousGroup.Cursor.X = Cursor.X;
                                PreviousGroup.Position = Position - new Vector2(0, PreviousGroup.Size.Y);
                                ParentMenu.SetGroup(PreviousGroup);
                                PreviousGroup.SwitchTo();
                            }
                        }
                        else if (Cursor.Y > 0)
                        {
                            TechTreeGroup NextGroup = MyNode.Next != null ? MyNode.Next.Value : MyNode.List.First.Value;
                            if (NextGroup.Cards != null && NextGroup.Cards.Count > 0)
                            {
                                NextGroup.Cursor.X = Cursor.X;
                                NextGroup.Position = Position + new Vector2(0, Size.Y);
                                ParentMenu.SetGroup(NextGroup);
                                NextGroup.SwitchTo();
                            }
                        }
                        Cursor.Y = 0;
                    }
                    Cursor.X = MathHelper.Clamp(Cursor.X, 0, Cards.Count - 1);

                    int i = 0;
                    foreach (FactionCard c in Cards)
                    {
                        c.MenuUpdate(gameTime, (int)Cursor.X == i, 1 - Math.Abs(Cursor.X - i++) / 2.25f);
                    }

                    Vector2 TargetOffset = -new Vector2((Cursor.X - 2) * CellBorders.X, -CellBorders.Y / 2f);
                    DrawOffset += (TargetOffset - DrawOffset) * OffsetSpeed;

                    HighlightedCard = Cards[(int)Cursor.X];
                    if (MyController.AButton() && !MyController.AButtonPrevious())
                    {
                    }
                    HighlightedCard.Update3D(ParentMenu.ParentShip);
                }
            }
            else
            {
                Alpha = Math.Max(0, Alpha - gameTime.ElapsedGameTime.Milliseconds * PlayerMenu.CloseOpenSpeed);
            }
        }