コード例 #1
0
        public override SpecialWeapon GetWeapon()
        {
            GhostCast ghost = new GhostCast();

            ghost.SetCard(FactionCard.GetFactionUnitCard("Vampire"));
            return(ghost);
        }
コード例 #2
0
        protected void Add(FactionCard card)
        {
            Cards.Add(card);

            if (card.GetType().IsSubclassOf(typeof(TurretCard)))
            {
                TurretCard c = (TurretCard)card;
                c.Reset();
            }
        }
コード例 #3
0
 public void SetValues(Texture2D MyTexture, SpriteFont Font, string Text, Color MyColor,
                       Vector2 Position, Vector2 Size, FactionCard MyCard)
 {
     ParentShip     = (PlayerShip)ParentFrame.Parent;
     this.MyColor   = MyColor;
     this.MyTexture = MyTexture;
     this.Font.set(Font);
     this.Text.set(Text);
     this.Size.set(Size);
     this.Position.set(Position);
     this.MyCard = (TurretCard)MyCard;
 }
コード例 #4
0
        private static void AddCards(LinkedList <string> SourcesFiles)
        {
            StringBuilder stringBuilder = new StringBuilder();
            ProcessStep   processStep   = ProcessStep.Level;
            WaveCard      newCard       = new WaveCard();
            string        UnitName      = "";
            int           UnitCount     = 0;
            float         UnitLevel     = 0;

            foreach (string SourceFile in SourcesFiles)
            {
                foreach (char c in SourceFile)
                {
                    if (c == ';' || c == ',' || c == '!')
                    {
                        switch (processStep)
                        {
                        case ProcessStep.Level:
                            string s = stringBuilder.ToString();
                            newCard.Level = int.Parse(s);
                            processStep   = ProcessStep.MinDiff;
                            break;

                        case ProcessStep.MinDiff:
                            newCard.MinDiff = int.Parse(stringBuilder.ToString());
                            processStep     = ProcessStep.MaxDiff;
                            break;

                        case ProcessStep.MaxDiff:
                            newCard.MaxDiff = int.Parse(stringBuilder.ToString());
                            processStep     = ProcessStep.EnergyCost;
                            break;

                        case ProcessStep.EnergyCost:
                            newCard.EnergyCost = int.Parse(stringBuilder.ToString());
                            processStep        = ProcessStep.Name;
                            break;

                        case ProcessStep.Name:
                            newCard.Name = stringBuilder.ToString();
                            processStep  = ProcessStep.Type;
                            break;

                        case ProcessStep.Type:
                            newCard.SetType(stringBuilder.ToString());
                            processStep = ProcessStep.Description;
                            break;

                        case ProcessStep.Description:
                            newCard.Description = stringBuilder.ToString();
                            processStep         = ProcessStep.Special;
                            break;

                        case ProcessStep.Special:
                            newCard.AddSpecial(stringBuilder.ToString());
                            processStep = c == ',' ? ProcessStep.Special : ProcessStep.PathName;
                            break;

                        case ProcessStep.PathName:
                            newCard.SetImagePath(stringBuilder.ToString());
                            processStep = ProcessStep.UName;
                            break;

                        case ProcessStep.UName:
                            UnitName    = stringBuilder.ToString();
                            processStep = ProcessStep.UCount;
                            break;

                        case ProcessStep.UCount:
                            UnitCount   = int.Parse(stringBuilder.ToString());
                            processStep = ProcessStep.ULevel;
                            break;

                        case ProcessStep.ULevel:
                            UnitLevel = int.Parse(stringBuilder.ToString());
                            newCard.AddUnit(new WaveUnit(FactionCard.GetFactionUnitCard(UnitName), UnitCount, UnitLevel));
                            if (c == ';')
                            {
                                processStep = ProcessStep.UName;
                            }
                            else
                            {
                                processStep = ProcessStep.Level;
                                if (!SortedCardLists.ContainsKey(newCard.Level - 1))
                                {
                                    SortedCardLists.Add(newCard.Level - 1, new List <WaveCard>());
                                }
                                SortedCardLists[newCard.Level - 1].Add(newCard);
                                newCard       = new WaveCard();
                                newCard.Super = FactionCard.SuperMode;
                            }
                            break;
                        }
                        stringBuilder = new StringBuilder();
                    }
                    else if (c != ' ' && c != '\n' && c != '\r')
                    {
                        stringBuilder.Append(c);
                    }
                }
            }
        }
コード例 #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);
            }
        }
コード例 #6
0
 public void SetCard(FactionCard c)
 {
     MyCard = (UnitCard)c;
 }