Exemplo n.º 1
0
 public override void Load()
 {
     GameOverAnimation            = new SimpleAnimation();
     GameOverAnimation.IsAnimated = true;
     GameOverAnimation.Path       = "Game Over";
     GameOverAnimation.Load(Content, string.Empty);
 }
Exemplo n.º 2
0
 public override void Load()
 {
     VictoryAnimation            = new SimpleAnimation();
     VictoryAnimation.IsAnimated = true;
     VictoryAnimation.Path       = "Game End";
     VictoryAnimation.Load(Content, string.Empty);
 }
Exemplo n.º 3
0
 public void Load(ContentManager Content)
 {
     if (ProjectileAnimation != null && ProjectileAnimation.Path != string.Empty)
     {
         ProjectileAnimation.Load(Content, "Animations/Sprites/");
     }
     if (TrailAnimation != null && TrailAnimation.Path != string.Empty)
     {
         TrailAnimation.Load(Content, "Animations/Sprites/");
     }
 }
Exemplo n.º 4
0
        public void Load(ContentManager Content)
        {
            if (Content == null)
            {
                return;
            }

            if (ActiveProjectileInfo != null)
            {
                ActiveProjectileInfo.Load(Content);
            }

            if (NozzleFlashAnimation != null && NozzleFlashAnimation.Path != string.Empty)
            {
                NozzleFlashAnimation.Load(Content, "Animations/Sprites/");
            }
            if (ExplosionAttributes.ExplosionAnimation.Path != string.Empty)
            {
                ExplosionAttributes.ExplosionAnimation.Load(Content, "Animations/Sprites/");
            }
        }
        public PERAttackAttributes(BinaryReader BR, ContentManager Content)
        {
            ProjectileSpeed   = BR.ReadSingle();
            AffectedByGravity = BR.ReadBoolean();
            CanBeShotDown     = BR.ReadBoolean();
            MaxLifetime       = BR.ReadByte();

            ProjectileAnimation = new SimpleAnimation(BR, false);
            if (Content != null)
            {
                ProjectileAnimation.Load(Content, "Animations/Sprites/");
            }

            NumberOfProjectiles = BR.ReadByte();
            MaxLateralSpread    = BR.ReadSingle();
            MaxForwardSpread    = BR.ReadSingle();
            MaxUpwardSpread     = BR.ReadSingle();

            GroundCollision = (GroundCollisions)BR.ReadByte();
            BounceLimit     = BR.ReadByte();
        }
Exemplo n.º 6
0
        public override void Load()
        {
            fntFinlanderFont   = Content.Load <SpriteFont>("Fonts/Finlander Font");
            fntMultiDialogFont = Content.Load <SpriteFont>("Fonts/VisualNovelMultiDialogFont");

            LeftPosition  = new Vector2(0, Constants.Height - VNBoxHeight);
            RightPosition = new Vector2(Constants.Width, Constants.Height - VNBoxHeight);

            if (VisualNovelPath != null)
            {
                FileStream   FS = new FileStream("Content/Visual Novels/" + VisualNovelPath + ".pevn", FileMode.Open, FileAccess.Read);
                BinaryReader BR = new BinaryReader(FS, Encoding.UTF8);
                BR.BaseStream.Seek(0, SeekOrigin.Begin);

                #region Assets

                int CharacterCount = BR.ReadInt32();
                for (int C = 0; C < CharacterCount; C++)
                {
                    ListCharacter.Add(new VisualNovelCharacter(BR));
                }

                int BustCharacterCount = BR.ReadInt32();
                for (int i = 0; i < BustCharacterCount; i++)
                {
                    ListBustPortrait.Add(new SimpleAnimation(BR, Content, "Visual Novels/Bust Portraits/"));
                }

                int PortraitCharacterCount = BR.ReadInt32();
                for (int i = 0; i < PortraitCharacterCount; i++)
                {
                    ListPortrait.Add(new SimpleAnimation(BR, Content, "Visual Novels/Portraits/"));
                }

                int BackgroundCount = BR.ReadInt32();//Number of backgrounds.
                for (int i = 0; i < BackgroundCount; i++)
                {
                    string Name = BR.ReadString();
                    string Path = BR.ReadString();
                    ListBackground.Add(new VisualNovelBackground(Name, Path, Content.Load <Texture2D>("Visual Novels/Backgrounds/" + Path)));
                }

                #endregion

                #region Dialog

                int ListDialogCount = BR.ReadInt32();//Number of script.
                for (int D = 0; D < ListDialogCount; D++)
                {
                    //Base info.
                    int PositionX = BR.ReadInt32();
                    int PositionY = BR.ReadInt32();

                    //Get the index of the assets used.
                    int LeftCharacterIndex           = BR.ReadInt32();
                    int LeftCharacterPortraitIndex   = BR.ReadInt32();
                    int RightCharacterIndex          = BR.ReadInt32();
                    int RightCharacterPortraitIndex  = BR.ReadInt32();
                    int TopCharacterIndex            = BR.ReadInt32();
                    int TopCharacterPortraitIndex    = BR.ReadInt32();
                    int BottomCharacterIndex         = BR.ReadInt32();
                    int BottomCharacterPortraitIndex = BR.ReadInt32();
                    int BackgroundIndex = BR.ReadInt32();

                    //Init the assets.

                    #region Left Character

                    SimpleAnimation LeftCharacter;
                    if (LeftCharacterIndex > 0)
                    {
                        if (LeftCharacterPortraitIndex <= ListCharacter[LeftCharacterIndex - 1].LoadedCharacter.ArrayPortraitBustPath.Length)
                        {
                            string ActivePortraitName = ListCharacter[LeftCharacterIndex - 1].LoadedCharacter.ArrayPortraitBustPath[LeftCharacterPortraitIndex - 1];
                            string PortraitType       = "Bust Portraits";
                            string FullName           = PortraitType + "/" + ActivePortraitName;

                            LeftCharacter = new SimpleAnimation(ActivePortraitName, ActivePortraitName, Content.Load <Texture2D>("Visual Novels/" + FullName));
                        }
                        else
                        {
                            LeftCharacter = new SimpleAnimation(ListBustPortrait[LeftCharacterPortraitIndex - ListCharacter[LeftCharacterIndex - 1].LoadedCharacter.ArrayPortraitBustPath.Length - 1]);
                        }
                    }
                    else if (LeftCharacterIndex == 0 && LeftCharacterPortraitIndex > 0)
                    {
                        LeftCharacter = new SimpleAnimation(ListBustPortrait[LeftCharacterPortraitIndex - 1]);
                    }
                    else
                    {
                        LeftCharacter = null;
                    }

                    if (LeftCharacter != null)
                    {
                        if (LeftCharacter.IsAnimated)
                        {
                            LeftCharacter = new SimpleAnimation(LeftCharacter.Name, LeftCharacter.Path, new AnimationLooped(LeftCharacter.Path));
                            LeftCharacter.Load(Content, "");
                        }

                        if (LeftCharacterIndex > 0)
                        {
                            LeftCharacter.Path = ListCharacter[LeftCharacterIndex - 1].LoadedCharacter.FullName;
                        }
                    }

                    #endregion

                    #region Right Character

                    SimpleAnimation RightCharacter;
                    if (RightCharacterIndex > 0)
                    {
                        if (RightCharacterPortraitIndex <= ListCharacter[RightCharacterIndex - 1].LoadedCharacter.ArrayPortraitBustPath.Length)
                        {
                            string ActivePortraitName = ListCharacter[RightCharacterIndex - 1].LoadedCharacter.ArrayPortraitBustPath[RightCharacterPortraitIndex - 1];
                            string PortraitType       = "Bust Portraits";
                            string FullName           = PortraitType + "/" + ActivePortraitName;

                            RightCharacter = new SimpleAnimation(ActivePortraitName, ActivePortraitName, Content.Load <Texture2D>("Visual Novels/" + FullName));
                        }
                        else
                        {
                            RightCharacter = new SimpleAnimation(ListBustPortrait[RightCharacterPortraitIndex - ListCharacter[RightCharacterIndex - 1].LoadedCharacter.ArrayPortraitBustPath.Length - 1]);
                        }
                    }
                    else if (RightCharacterIndex == 0 && RightCharacterPortraitIndex > 0)
                    {
                        RightCharacter = new SimpleAnimation(ListBustPortrait[RightCharacterPortraitIndex - 1]);
                    }
                    else
                    {
                        RightCharacter = null;
                    }

                    if (RightCharacter != null)
                    {
                        if (RightCharacter.IsAnimated)
                        {
                            RightCharacter = new SimpleAnimation(RightCharacter.Name, RightCharacter.Path, new AnimationLooped(RightCharacter.Path));
                            RightCharacter.Load(Content, "");
                        }

                        if (RightCharacterIndex > 0)
                        {
                            RightCharacter.Path = ListCharacter[RightCharacterIndex - 1].LoadedCharacter.FullName;
                        }
                    }

                    #endregion

                    #region Top Character

                    SimpleAnimation TopCharacter;

                    if (TopCharacterIndex > 0)
                    {
                        if (TopCharacterPortraitIndex <= ListCharacter[TopCharacterIndex - 1].LoadedCharacter.ArrayPortraitBoxPath.Length)
                        {
                            string ActivePortraitName = ListCharacter[TopCharacterIndex - 1].LoadedCharacter.ArrayPortraitBoxPath[TopCharacterPortraitIndex - 1];
                            string PortraitType       = "Portraits";
                            string FullName           = PortraitType + "/" + ActivePortraitName;

                            TopCharacter = new SimpleAnimation(ActivePortraitName, ActivePortraitName, Content.Load <Texture2D>("Visual Novels/" + FullName));
                        }
                        else
                        {
                            TopCharacter = new SimpleAnimation(ListPortrait[TopCharacterPortraitIndex - ListCharacter[TopCharacterIndex - 1].LoadedCharacter.ArrayPortraitBoxPath.Length - 1]);
                        }
                    }
                    else if (TopCharacterIndex == 0 && TopCharacterPortraitIndex > 0)
                    {
                        TopCharacter = new SimpleAnimation(ListPortrait[TopCharacterPortraitIndex - 1]);
                    }
                    else
                    {
                        TopCharacter = null;
                    }

                    if (TopCharacter != null)
                    {
                        if (TopCharacter.IsAnimated)
                        {
                            TopCharacter = new SimpleAnimation(TopCharacter.Name, TopCharacter.Path, new AnimationLooped(TopCharacter.Path));
                            TopCharacter.Load(Content, "");
                        }

                        if (TopCharacterIndex > 0)
                        {
                            TopCharacter.Path = ListCharacter[TopCharacterIndex - 1].LoadedCharacter.FullName;
                        }
                    }

                    #endregion

                    #region Bottom Character

                    SimpleAnimation BottomCharacter;

                    if (BottomCharacterIndex > 0)
                    {
                        if (BottomCharacterPortraitIndex <= ListCharacter[BottomCharacterIndex - 1].LoadedCharacter.ArrayPortraitBoxPath.Length)
                        {
                            string ActivePortraitName = ListCharacter[BottomCharacterIndex - 1].LoadedCharacter.ArrayPortraitBoxPath[BottomCharacterPortraitIndex - 1];
                            string PortraitType       = "Portraits";
                            string FullName           = PortraitType + "/" + ActivePortraitName;

                            BottomCharacter = new SimpleAnimation(ActivePortraitName, ActivePortraitName, Content.Load <Texture2D>("Visual Novels/" + FullName));
                        }
                        else
                        {
                            BottomCharacter = new SimpleAnimation(ListPortrait[BottomCharacterPortraitIndex - ListCharacter[BottomCharacterIndex - 1].LoadedCharacter.ArrayPortraitBoxPath.Length - 1]);
                        }
                    }
                    else if (BottomCharacterIndex == 0 && BottomCharacterPortraitIndex > 0)
                    {
                        BottomCharacter = new SimpleAnimation(ListPortrait[BottomCharacterPortraitIndex - 1]);
                    }
                    else
                    {
                        BottomCharacter = null;
                    }

                    if (BottomCharacter != null)
                    {
                        if (BottomCharacter.IsAnimated)
                        {
                            BottomCharacter = new SimpleAnimation(BottomCharacter.Name, BottomCharacter.Path, new AnimationLooped(BottomCharacter.Path));
                            BottomCharacter.Load(Content, "");
                        }

                        if (BottomCharacterIndex > 0)
                        {
                            BottomCharacter.Path = ListCharacter[BottomCharacterIndex - 1].LoadedCharacter.FullName;
                        }
                    }

                    #endregion

                    VisualNovelBackground Back;
                    if (BackgroundIndex > 0)
                    {
                        Back = ListBackground[BackgroundIndex - 1];
                    }
                    else
                    {
                        Back = null;
                    }

                    int ActiveChar       = BR.ReadByte();
                    int ActiveTopChar    = BR.ReadByte();
                    int ActiveBottomChar = BR.ReadByte();

                    //Load the texts.
                    string Text        = BR.ReadString();
                    string TextPreview = BR.ReadString();
                    string TextTop     = BR.ReadString();
                    bool   OverrideCharacterPriority = BR.ReadBoolean();

                    //Init the Dialog.
                    Dialog NewDialog = new Dialog(LeftCharacter, RightCharacter, TopCharacter, BottomCharacter, Back, (Dialog.ActiveBustCharacterStates)ActiveChar, Text, TextPreview);
                    NewDialog.TopPortaitVisibleState    = (Dialog.PortaitVisibleStates)ActiveTopChar;
                    NewDialog.BottomPortaitVisibleState = (Dialog.PortaitVisibleStates)ActiveBottomChar;
                    NewDialog.TextTop  = TextTop;
                    NewDialog.Position = new Point(PositionX, PositionY);

                    NewDialog.OverrideCharacterPriority = OverrideCharacterPriority;
                    if (OverrideCharacterPriority)
                    {
                        int ListSpeakerPriorityCount = BR.ReadInt32();
                        for (int S = 0; S < ListSpeakerPriorityCount; ++S)
                        {
                            NewDialog.ListSpeakerPriority.Add(new SpeakerPriority((SpeakerPriority.PriorityTypes)BR.ReadByte(), BR.ReadString()));
                        }
                    }

                    //Add its linked dialogs.
                    int LinkedDialogsSize = BR.ReadInt32();
                    for (int L = 0; L < LinkedDialogsSize; L++)
                    {
                        NewDialog.ListNextDialog.Add(BR.ReadInt32());
                    }
                    ListDialog.Add(NewDialog);

                    //Check if it's a Timeline Dialog.
                    if (PositionX == 0)
                    {
                        Timeline.Add(NewDialog);
                    }

                    Dictionary <string, CutsceneScript> Scripts = CutsceneScriptHolder.LoadAllScripts();

                    NewDialog.CutsceneBefore = new Cutscene(null, BR, Scripts);
                    NewDialog.CutsceneAfter  = new Cutscene(null, BR, Scripts);
                }

                #endregion

                BR.Close();
                FS.Close();
            }
            if (Timeline.Count > 0)
            {
                Timeline.Sort(delegate(Dialog d1, Dialog d2) { return(d1.Position.Y.CompareTo(d2.Position.Y)); });
                CurrentDialog = Timeline[0];
                UpdateTextChoices();

                if (CurrentDialog.CutsceneBefore != null)
                {
                    PushScreen(CurrentDialog.CutsceneBefore);
                }
            }

            if (UseLocalization)
            {
                ReadLocalizationFile();
            }
        }
Exemplo n.º 7
0
        public Layer(FightingZone Owner, BinaryReader BR)
            : this(Owner)
        {
            Dictionary <string, Prop> DicPropsByName = Prop.GetAllPropsByName();

            int ListPolygonCount = BR.ReadInt32();
            ListWorldCollisionPolygon = new List <WorldPolygon>(ListPolygonCount);
            for (int P = 0; P < ListPolygonCount; P++)
            {
                int ArrayVertexCount = BR.ReadInt32();

                Vector2[] ArrayVertex = new Vector2[ArrayVertexCount];
                for (int V = 0; V < ArrayVertexCount; V++)
                {
                    ArrayVertex[V] = new Vector2(BR.ReadSingle(), BR.ReadSingle());
                }

                bool BlockBullets = BR.ReadBoolean();
                bool IsPlatform   = BR.ReadBoolean();

                WorldPolygon NewPolygon;
                if (GameScreen.GraphicsDevice != null)
                {
                    NewPolygon = new WorldPolygon(ArrayVertex, GameScreen.GraphicsDevice.PresentationParameters.BackBufferWidth, GameScreen.GraphicsDevice.PresentationParameters.BackBufferHeight);
                }
                else
                {
                    NewPolygon = new WorldPolygon(ArrayVertex, 1, 1);
                }

                NewPolygon.BlockBullets = BlockBullets;
                NewPolygon.IsPlatform   = IsPlatform;

                NewPolygon.ComputerCenter();
                ListWorldCollisionPolygon.Add(NewPolygon);
            }

            int       ArrayGroundLevelCollisionCount = BR.ReadInt32();
            Vector2[] ArrayGroundLevelCollision      = new Vector2[ArrayGroundLevelCollisionCount];
            for (int V = 0; V < ArrayGroundLevelCollisionCount; V++)
            {
                ArrayGroundLevelCollision[V] = new Vector2(BR.ReadSingle(), BR.ReadSingle());
            }
            short[] ArrayGroundLevelCollisionIndex = new short[2];
            ArrayGroundLevelCollisionIndex[0] = 0;
            ArrayGroundLevelCollisionIndex[1] = 1;

            if (GameScreen.GraphicsDevice != null)
            {
                GroundLevelCollision = new Polygon(ArrayGroundLevelCollision, ArrayGroundLevelCollisionIndex, GameScreen.GraphicsDevice.PresentationParameters.BackBufferWidth, GameScreen.GraphicsDevice.PresentationParameters.BackBufferHeight);
            }
            else
            {
                GroundLevelCollision = new Polygon(ArrayGroundLevelCollision, ArrayGroundLevelCollisionIndex, 1, 1);
            }

            int ListImagesCount = BR.ReadInt32();
            ListImages = new List <SimpleAnimation>(ListImagesCount);
            for (int P = 0; P < ListImagesCount; P++)
            {
                SimpleAnimation NewBackground = new SimpleAnimation(BR, true);
                NewBackground.Position = new Vector2(BR.ReadSingle(), BR.ReadSingle());
                NewBackground.Depth    = BR.ReadSingle();

                if (!Owner.IsServer)
                {
                    NewBackground.Load(Owner.Content, "");
                    ListImages.Add(NewBackground);
                }
            }

            int ListPropCount = BR.ReadInt32();
            for (int P = 0; P < ListPropCount; ++P)
            {
                string PropName = BR.ReadString();
                Prop   NewProp  = DicPropsByName[PropName].Copy();
                NewProp.Load(BR, Owner.Content, this, Owner);

                //Props are Client side only.
                if (NewProp.CanRunOnServer || !Owner.IsServer)
                {
                    ListProp.Add(NewProp);
                }
            }

            int ListSpawnPointSPCount = BR.ReadInt32();
            for (int S = 0; S < ListSpawnPointSPCount; ++S)
            {
                ListSpawnPointTeam.Add(SpawnPoint.Load(BR));
            }

            int ListSpawnPointMPCount = BR.ReadInt32();
            for (int S = 0; S < ListSpawnPointMPCount; ++S)
            {
                ListSpawnPointTeam.Add(SpawnPoint.Load(BR));
            }
        }