示例#1
0
        public SessionLocation(string filePath, DynamicContentManager Content)
        {
            SessionLocationBuilder builder = SessionLocationBuilder.BuilderRead(filePath);

            plane              = new TexturedPlane(builder.Image);
            plane.billboard    = true;
            isVisible          = builder.IsVisible;
            PrimaryColor       = new Color((byte)builder.PrimaryColor.X, (byte)builder.PrimaryColor.Y, (byte)builder.PrimaryColor.Z, (byte)builder.PrimaryColor.W);
            Name               = builder.Name;
            Description        = builder.Description;
            CursorDetectRadius = builder.CursorDetectRadius;
            if (builder.InitialAngle != 0 || builder.OrbitalSpeed != 0 || builder.OrbitHeight != 0 || builder.DistFromCenter != 0)
            {
                UserPlaced            = true;
                initialDistFromCenter = builder.DistFromCenter;
                initialAngle          = builder.InitialAngle;
                initialOrbitalSpeed   = builder.OrbitalSpeed;
                initialOrbitHeight    = builder.OrbitHeight;
                plane.AddModifier(new OrbitModifier3D(new Vector3(0, builder.OrbitHeight, 0), Vector3.Up, builder.DistFromCenter, builder.InitialAngle, builder.OrbitalSpeed, plane, false, -1));
            }
            else
            {
                UserPlaced = false;
            }
        }
示例#2
0
        public GenericMeteor(string filePath, DynamicContentManager Content)
        {
            GenericMeteorBuilder meteorData = GenericMeteorBuilder.BuilderRead(filePath);

            plane           = new TexturedPlane(meteorData.Image);
            plane.billboard = true;
            name            = meteorData.Name;
        }
示例#3
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            base.Initialize();
            GameSettings.Initialize(Path.Combine(Content.RootDirectory, "settings.txt"));

            Window.Title              = "Session Viewer";
            Window.AllowUserResizing  = false;
            IsMouseVisible            = true;
            Window.ClientSizeChanged += OnClientSizeChanged;
            ScreenManager.AddScreen(new MainMenuScreen());
            DynamicContentManager.RegisterCustomLoader(typeof(SessionManager), SessionManager.BuildSession);
            DynamicContentManager.RegisterCustomLoader(typeof(Skaia), Skaia.BuildSkaia);
            DynamicContentManager.RegisterCustomLoader(typeof(GenericMeteor), GenericMeteor.BuildGenericMeteor);
            DynamicContentManager.RegisterCustomLoader(typeof(PlayerWorld), PlayerWorld.BuildPlayerWorld);
            DynamicContentManager.RegisterCustomLoader(typeof(SessionLocation), SessionLocation.BuildSessionLocation);
        }
示例#4
0
        public static TileData[] LoadBuildingData(string path, DynamicContentManager content)
        {
            BuildingDataLoader[] unprocessedTileData;
            XmlSerializer        xmlSerializer = new XmlSerializer(typeof(BuildingDataCont));
            StreamReader         streamReader  = new StreamReader(path);

            unprocessedTileData = ((BuildingDataCont)xmlSerializer.Deserialize(streamReader)).TileDefinitions;
            streamReader.Close();

            BuildingData[] result = new BuildingData[unprocessedTileData.Length];
            for (int i = 0; i < result.Length; i++)
            {
                Texture2D tileTexture = content.Load <Texture2D>(unprocessedTileData[i].Spritesheet);
                result[i] = new BuildingData {
                    ID = unprocessedTileData[i].ID, Name = unprocessedTileData[i].Name, Spritesheet = tileTexture, SampleArea = unprocessedTileData[i].SampleArea
                };
            }
            return(result);
        }
示例#5
0
        public TexturedPlane(string filePath, DynamicContentManager Content)
        {
            TexturedPlaneBuilder builder = TexturedPlaneBuilder.BuilderRead(filePath);

            position = builder.Position;
            if (builder.Rotation != new Quaternion(0, 0, 0, 0))
            {
                rotation = builder.Rotation;
            }
            scale   = builder.Scale;
            texture = ScreenManager.Content.Load <Texture2D>(builder.ImagePath);
            color   = new Color(builder.Color);

            vertexArray    = new VertexPositionColorTexture[4];
            vertexArray[0] = new VertexPositionColorTexture(new Vector3(scale.X, 0, scale.Y), color, new Vector2(1, 0));
            vertexArray[1] = new VertexPositionColorTexture(new Vector3(-scale.X, 0, scale.Y), color, new Vector2(1, 1));
            vertexArray[2] = new VertexPositionColorTexture(new Vector3(scale.X, 0, -scale.Y), color, new Vector2(0, 0));
            vertexArray[3] = new VertexPositionColorTexture(new Vector3(-scale.X, 0, -scale.Y), color, new Vector2(0, 1));
        }
示例#6
0
        public Skaia(string filePath, DynamicContentManager Content)
        {
            SkaiaBuilder builder = SkaiaBuilder.BuilderRead(filePath);

            plane                 = new TexturedPlane(builder.Image);
            Battlefield           = new TexturedPlane(builder.Battlefield);
            Battlefield.DepthBias = -0.01f;
            plane.billboard       = true;
            Battlefield.billboard = true;
            CursorDetectRadius    = builder.CursorDetectRadius;
            PrimaryColor          = new Color((byte)builder.PrimaryColor.X, (byte)builder.PrimaryColor.Y, (byte)builder.PrimaryColor.Z, (byte)builder.PrimaryColor.W);
            Name        = builder.Name;
            Description = builder.Description;
            isVisible   = builder.IsVisible;

            constructSkaia();
            //for (int i = 0; i < 50; i++)
            //{
            //    reckoningGates[i] = new
            //}
        }
示例#7
0
        public Window(WindowManager manager, DynamicContentManager content, Rectangle dimensions, Color[] borderColors, IContainer layout, string title = "Window", bool closable = true, bool growForPadding = false)
        {
            //Reserve space for title bar (? x 17) + edges (4 x 2)
            this.manager = manager;
            if (!(layout is Element))
            {
                throw new ArgumentException();
            }
            mainContainer     = (Element)layout;
            this.borderColors = borderColors;
            if (uiComponents == null)
            {
                uiComponents = content.Load <Texture2D>(".//UI//UI Elements.png");
            }
            Title           = title;
            TopPad          = 2;
            BotPad          = 2;
            TitlePad        = 15;
            LeftPad         = 2;
            RightPad        = 2;
            this.dimensions = dimensions;
            if (growForPadding)
            {
                dimensions.Width  += LeftPad + RightPad;
                dimensions.Height += TitlePad + TopPad + BotPad;
            }
            if (closable)
            {
                closeButton = new Button(new AABox(new Rectangle(0, 0, 13, 13)), uiComponents,
                                         new Rectangle[] { new Rectangle(13, 0, 13, 13), new Rectangle(13, 0, 13, 13), new Rectangle(13, 0, 13, 13), new Rectangle(13, 0, 13, 13) },
                                         new Coordinate(0, 0));
                closeButton.Released += CloseWindow;
            }

            layout.BuildNames();
            buildBindables();
            Resize(new Coordinate(dimensions.Width, dimensions.Height));
        }
示例#8
0
        private void reload(string filePath, DynamicContentManager Content)
        {
            SessionLocation newState = Content.Load <SessionLocation>(filePath);

            newState.plane.ClearModifiers();
            TexturedPlane oldPlane = plane;

            plane               = newState.plane;
            plane.Color         = oldPlane.Color;
            plane.WorldPosition = oldPlane.WorldPosition;
            IsVisible           = newState.isVisible;
            PrimaryColor        = newState.PrimaryColor;
            Name               = newState.Name;
            Description        = newState.Description;
            CursorDetectRadius = newState.CursorDetectRadius;
            for (int i = 0; i < oldPlane.Modifiers.Length; i++)
            {
                if (oldPlane.Modifiers[i] != null)
                {
                    plane.AddModifier(oldPlane.Modifiers[i].DeepCopy(plane));
                }
            }
        }
示例#9
0
 public static PlayerWorld BuildPlayerWorld(string path, DynamicContentManager content)
 {
     return(new PlayerWorld(path, content));
 }
示例#10
0
 public static GenericMeteor BuildGenericMeteor(string path, DynamicContentManager content)
 {
     return(new GenericMeteor(path, content));
 }
示例#11
0
 public static SessionLocation BuildSessionLocation(string path, DynamicContentManager content)
 {
     return(new SessionLocation(path, content));
 }
示例#12
0
 public static Skaia BuildSkaia(string path, DynamicContentManager content)
 {
     return(new Skaia(path, content));
 }
示例#13
0
        public SessionManager(string filePath, DynamicContentManager Content)
        {
            SessionBuilder builder = SessionBuilder.BuilderRead(filePath);

            if (builder.OtherLocations == null)
            {
                builder.OtherLocations = new string[0];
            }
            Worlds           = new Dictionary <string, Location>(3 + builder.Lands.Length + builder.OtherLocations.Length);
            GenericMeteors   = new GenericMeteor[builder.GenericMeteors.Length];
            Description      = builder.Description;
            PlayerWorldCount = builder.Lands.Length;

            if (builder.Scratched)
            {
                Timeline = new TimelineEvent[builder.Timeline.Length + PlayerWorldCount + builder.OtherLocations.Length + 4];
            }
            else
            {
                Timeline = new TimelineEvent[builder.Timeline.Length + PlayerWorldCount + builder.OtherLocations.Length + 3];
            }

            Skaia tempSkaia = Content.Load <Skaia>(builder.Skaia);

            Worlds.Add("Skaia", tempSkaia);
            SessionLocation tempProspit = Content.Load <SessionLocation>(builder.Prospit);

            Worlds.Add("Prospit", tempProspit);
            SessionLocation tempDerse = Content.Load <SessionLocation>(builder.Derse);

            Worlds.Add("Derse", tempDerse);
            PlayerWorld[] tempLands = new PlayerWorld[PlayerWorldCount];
            for (int i = 0; i < builder.Lands.Length; i++)
            {
                tempLands[i]    = Content.Load <PlayerWorld>(builder.Lands[i]);
                Timeline[i + 2] = new TimelineEvent(tempLands[i].Name, EventTypes.Reload, "None", builder.Lands[i]);
                Worlds.Add(tempLands[i].Name, tempLands[i]);
            }
            SessionLocation[] tempMeteors = new SessionLocation[builder.OtherLocations.Length];
            for (int i = 0; i < tempMeteors.Length; i++)
            {
                tempMeteors[i] = Content.Load <SessionLocation>(builder.OtherLocations[i]);
                Timeline[i + 2 + tempLands.Length] = new TimelineEvent(tempMeteors[i].Name, EventTypes.Reload, "None", builder.OtherLocations[i]);
                Worlds.Add(tempMeteors[i].Name, tempMeteors[i]);
            }
            for (int i = 0; i < GenericMeteors.Length; i++)
            {
                GenericMeteors[i] = new GenericMeteor(Path.Combine(Content.BaseDirectory, builder.GenericMeteors[i]), Content);
            }

            Timeline[0] = new TimelineEvent("Prospit", EventTypes.Reload, "None", builder.Prospit);
            Timeline[1] = new TimelineEvent("Derse", EventTypes.Reload, "None", builder.Derse);

            Timeline[tempLands.Length + tempMeteors.Length + 2] = new TimelineEvent("Skaia", EventTypes.Reload, true, "None", builder.Skaia);
            if (builder.Scratched)
            {
                for (int i = tempLands.Length + tempMeteors.Length + 3; i < Timeline.Length - 1; i++)
                {
                    Timeline[i] = builder.Timeline[i - (tempLands.Length + tempMeteors.Length + 3)];
                }
                Timeline[Timeline.Length - 1] = new TimelineEvent("Session", EventTypes.ScratchComplete, true, "", "");
            }
            else
            {
                for (int i = tempLands.Length + tempMeteors.Length + 3; i < Timeline.Length; i++)
                {
                    Timeline[i] = builder.Timeline[i - (tempLands.Length + tempMeteors.Length + 3)];
                }
            }

            List <int> visibleEvents = new List <int>();

            for (int i = 0; i < Timeline.Length; i++)
            {
                if (Timeline[i].IsVisible)
                {
                    visibleEvents.Add(i);
                }
            }
            VisibleEvents   = visibleEvents.ToArray();
            Scratched       = builder.Scratched;
            VoidSession     = builder.VoidSession;
            NullSession     = builder.NullSession;
            ReckoningActive = false;
        }
示例#14
0
 public void init(DynamicContentManager content)
 {
     //content.Load<Texture2D>(".//")
 }
示例#15
0
        private void reload(string filePath, DynamicContentManager Content)
        {
            PlayerWorld   newState = Content.Load <PlayerWorld>(filePath);
            TexturedPlane oldPlane = plane;

            plane               = newState.plane;
            plane.Color         = oldPlane.Color;
            plane.WorldPosition = oldPlane.WorldPosition;
            //planeOrbit = (OrbitModifier3D)planeOrbit.DeepCopy(plane);
            //plane.AddModifier(planeOrbit);
            IsVisible      = newState.isVisible;
            PrimaryColor   = newState.PrimaryColor;
            SecondaryColor = newState.SecondaryColor;
            Name           = newState.Name;
            Description    = newState.Description;
            PlayerName     = newState.PlayerName;
            if (newState.CursorDetectRadius > 0)
            {
                CursorDetectRadius = newState.CursorDetectRadius;
            }

            if (gateLevel != newState.gateLevel && PlayerEntered)
            {
                setGates(gateLevel);
            }
            gateLevel = newState.gateLevel;

            for (int i = 0; i < oldPlane.Modifiers.Length; i++)
            {
                if (oldPlane.Modifiers[i] != null)
                {
                    IModifier3D newMod = oldPlane.Modifiers[i].DeepCopy(plane);
                    if (oldPlane.Modifiers[i] == planeOrbit)
                    {
                        planeOrbit = (OrbitModifier3D)newMod;
                    }
                    plane.AddModifier(newMod);
                }
            }

            if (PlayerEntered != newState.PlayerEntered)
            {
                PlayerEntered = newState.PlayerEntered;
                for (int i = 0; i < lowerSpirograph.Modifiers.Length; i++)
                {
                    if (lowerSpirograph.Modifiers[i] != null && lowerSpirograph.Modifiers[i] is ColorModifier3D)
                    {
                        lowerSpirograph.Modifiers[i].Remove();
                        i--;
                    }
                }
                for (int i = 0; i < plane.Modifiers.Length; i++)
                {
                    if (plane.Modifiers[i] != null && plane.Modifiers[i] is ColorModifier3D)
                    {
                        plane.Modifiers[i].Remove();
                        i--;
                    }
                }
                if (PlayerEntered)
                {
                    lowerSpirograph.AddModifier(new ColorModifier3D(PrimaryColor, true, lowerSpirograph, 90));
                    plane.AddModifier(new ColorModifier3D(Color.White, true, plane, 90));
                    setGates(gateLevel);
                }
                else
                {
                    lowerSpirograph.AddModifier(new ColorModifier3D(Color.Lerp(PrimaryColor, Color.Black, 0.8f), true, lowerSpirograph, 90));
                    plane.AddModifier(new ColorModifier3D(new Color(50, 50, 50), true, plane, 90));
                    setGates(0);
                }
            }
            //else if (!PlayerEntered)
            //    setGates(0);
        }
示例#16
0
        public static Tile[, ,] LoadTileMap(string path, MapToTileData conversions, int levels, DynamicContentManager content)
        {
            if (levels < 1)
            {
                throw new ArgumentException("The map must have at least one level.");
            }
            Texture2D mapImage = content.Load <Texture2D>(path);

            Color[] mapData = new Color[mapImage.Width * mapImage.Height];
            mapImage.GetData <Color>(mapData);
            Tile[,,] map = new Tile[mapImage.Width, mapImage.Height, levels];
            for (int z = 0; z < levels; z++)
            {
                for (int y = 0; y < mapImage.Height; y++)
                {
                    for (int x = 0; x < mapImage.Width; x++)
                    {
                        if (z == 0)
                        {
                            if (mapData[y * mapImage.Width + x] == new Color(128, 128, 128))
                            {
                                map[x, y, z] = new Tile(conversions.ADozed, true);
                            }
                            else if (mapData[y * mapImage.Width + x] == new Color(128, 128, 0))
                            {
                                map[x, y, z] = new Tile(conversions.ASmooth, true);
                            }
                            else if (mapData[y * mapImage.Width + x] == new Color(0, 128, 0))
                            {
                                map[x, y, z] = new Tile(conversions.ARough, true);
                            }
                            else if (mapData[y * mapImage.Width + x] == new Color(128, 0, 0))
                            {
                                map[x, y, z] = new Tile(conversions.AHostile, true);
                            }
                            else if (mapData[y * mapImage.Width + x] == new Color(0, 0, 0))
                            {
                                map[x, y, z] = new Tile(conversions.AImpassible, true);
                            }
                        }
                        else
                        {
                            if (mapData[y * mapImage.Width + x] == new Color(128, 128, 128))
                            {
                                map[x, y, z] = new Tile(conversions.UDozed, true);
                            }
                            else if (mapData[y * mapImage.Width + x] == new Color(128, 128, 0))
                            {
                                map[x, y, z] = new Tile(conversions.USmooth, false);
                            }
                            else if (mapData[y * mapImage.Width + x] == new Color(0, 128, 0))
                            {
                                map[x, y, z] = new Tile(conversions.URough, false);
                            }
                            else if (mapData[y * mapImage.Width + x] == new Color(128, 0, 0))
                            {
                                map[x, y, z] = new Tile(conversions.UHostile, false);
                            }
                            else if (mapData[y * mapImage.Width + x] == new Color(0, 0, 0))
                            {
                                map[x, y, z] = new Tile(conversions.UImpassible, false);
                            }
                        }
                    }
                }
            }
            return(map);
        }
示例#17
0
        public override void LoadContent()
        {
            Content = new DynamicContentManager(ScreenManager.StaticGame, ScreenManager.StaticGame.Content, ScreenManager.StaticGame.Content.RootDirectory);
            //Content.LogFailures = true;

            copyrightText = new StringPositionColor("Homestuck © Andrew Hussie", new Vector2(0, 575), Color.White);
            ScreenManager.Globals.Fonts.AddFont("Consolas", ".//Fonts//Consolas.spritefont");
            ScreenManager.Globals.Fonts.AddFont("Carima", ".//Fonts//Carima.spritefont");
            Texture2D sessionTexture = Content.Load <Texture2D>(".//UI//Session.png");

            titleText = new Sprite(new Vector2(393, 111), Vector2.One, 0, Color.White, Content.Load <Texture2D>(".//UI//Title Text.png"));
            Button enterButton = new Button(null, Content.Load <Texture2D>(".//UI//Enter Button.png"), null, new Coordinate(526, 299));
            Button guideButton = new Button(null, Content.Load <Texture2D>(".//UI//Guide Button.png"), null, new Coordinate(526, 365));
            Button exitButton  = new Button(null, Content.Load <Texture2D>(".//UI//Exit Button.png"), null, new Coordinate(526, 431));

            Content.Load <Texture2D>(".//UI//Blank Button.png");

            fileToStart  = new Button(null, Content.Load <Texture2D>(".//UI//Up Button.png"), null, new Coordinate(650, 1160));
            prevFilePage = new Button(null, Content.Load <Texture2D>(".//UI//Left Button.png"), null, new Coordinate(580, 1160));
            nextFilePage = new Button(null, Content.Load <Texture2D>(".//UI//Right Button.png"), null, new Coordinate(720, 1160));

            guideToStart  = new Button(null, Content.Load <Texture2D>(".//UI//Down Button.png"), null, new Coordinate(650, -40));
            prevGuidePage = new Button(null, Content.Load <Texture2D>(".//UI//Left Button.png"), null, new Coordinate(580, -40));
            nextGuidePage = new Button(null, Content.Load <Texture2D>(".//UI//Right Button.png"), null, new Coordinate(720, -40));

            enterButton.Clicked += OnEnter;
            mainButtonList.Add(enterButton);
            guideButton.Clicked += OnGuide;
            mainButtonList.Add(guideButton);
            exitButton.Clicked += OnExit;
            mainButtonList.Add(exitButton);

            backgroundSession = new Sprite(new Vector2(227 - sessionTexture.Width / 2, 300 - sessionTexture.Height / 2),
                                           Vector2.One, 0, Color.White, sessionTexture);

            backgroundSession.AddModifier(new RotateModifier2D(0.006f, false, -1));

            guideScreen    = new Page[1];
            guideScreen[0] = new Page(new Vector2(0, -600),
                                      new StringPositionColor[] {
                new StringPositionColor("LMB", new Vector2(10, 0), Color.White), new StringPositionColor("-Select World", new Vector2(70, 0), Color.White),
                new StringPositionColor("RMB", new Vector2(10, 20), Color.White), new StringPositionColor("-Deselect World", new Vector2(70, 20), Color.White),
                new StringPositionColor("MMB", new Vector2(10, 40), Color.White), new StringPositionColor("-Rotate Camera", new Vector2(70, 40), Color.White),
                new StringPositionColor("F", new Vector2(10, 60), Color.White), new StringPositionColor("-Skip forward on timeline", new Vector2(70, 60), Color.White),
                new StringPositionColor("B", new Vector2(10, 80), Color.White), new StringPositionColor("-Skip backward on timeline", new Vector2(70, 80), Color.White),
                new StringPositionColor("Esc", new Vector2(10, 100), Color.White), new StringPositionColor("-Quit to main menu", new Vector2(70, 100), Color.White),
                new StringPositionColor("Up", new Vector2(10, 120), Color.White), new StringPositionColor("-Move forward", new Vector2(70, 120), Color.White),
                new StringPositionColor("Down", new Vector2(10, 140), Color.White), new StringPositionColor("-Move backward", new Vector2(70, 140), Color.White),
                new StringPositionColor("Left", new Vector2(10, 160), Color.White), new StringPositionColor("-Move left", new Vector2(70, 160), Color.White),
                new StringPositionColor("Right", new Vector2(10, 180), Color.White), new StringPositionColor("-Move right", new Vector2(70, 180), Color.White)
            },
                                      new Sprite[] { new Sprite(Vector2.Zero, Vector2.One, 0, Color.White, Content.Load <Texture2D>(".//UI//Guide Screen.png")) }
                                      );

            ScreenManager.StaticGame.Window.Title = "Session Viewer";

            fileToStart.Clicked  += OnLeaveEnter;
            prevFilePage.Clicked += OnPrevFile;
            nextFilePage.Clicked += OnNextFile;

            guideToStart.Clicked  += OnLeaveGuide;
            prevGuidePage.Clicked += OnPrevGuide;
            nextGuidePage.Clicked += OnNextGuide;

            base.LoadContent();
        }