示例#1
0
        public KeywordView(BohemianArtifact bbshelf, Vector3 position, Vector3 size)
        {
            bookshelf = bbshelf;
            bookshelf.Library.SelectedArtifactChanged += new ArtifactLibrary.SelectedArtifactHandler(library_SelectedArtifactChanged);
            bookshelf.Library.LanguageChanged += new ArtifactLibrary.ChangeLanguageHandler(Library_LanguageChanged);
            this.position = position;
            this.size = size;
            draggedText = null;

            titleText = new SelectableText(XNA.Font, "Keywords", new Vector3(0.4f, 0, 0), bookshelf.GlobalTextColor, Color.White);
            titleText.InverseScale(0.8f, size.X, size.Y);

            WavyText.createAllLetters(bbshelf.Library.Artifacts);

            centerCircleRadius = 0.1f;
            relatedCircleRadius = centerCircleRadius * 0.5f;

            artifactCircles = new List<KeywordContainer>();
            for (int i = 0; i < MAX_CIRCLES; i++)
            {
                KeywordContainer newContainer = new KeywordContainer();
                newContainer.Circle = new SelectableEllipse(new Vector2(center.X, center.Y), relatedCircleRadius, centerCircleRadius * 0.05f, Color.White, new Color(1, 1, 1, 0), Color.Black, null);
                newContainer.Circle.TouchActivated += new TouchActivatedEventHandler(Circle_TouchActivated);
                newContainer.Circle.TouchReleased += new TouchReleaseEventHandler(Circle_TouchReleased);
                bookshelf.SelectableObjects.AddObject(newContainer.Circle);
                artifactCircles.Add(newContainer);
            }
            artifactCircles[CENTER_CIRCLE_ID].Circle.Radius = centerCircleRadius;
            PositionRelatedCircles();
        }
示例#2
0
        public LanguageView(BohemianArtifact bbshelf, Vector3 position, Vector3 size)
        {
            bookshelf = bbshelf;
            this.position = position;
            this.size = size;

            Texture2D englishTexture = XNA.LoadTexture(BohemianArtifact.TexturePath + "en_flag.jpg");
            englishCircle = new SelectableEllipse(new Vector2(0.25f, 0.25f), 0.225f, 0.01f, Color.White, Color.Gray, englishTexture);
            englishCircle.Alpha = unselectedAlpha;
            englishCircle.TouchActivated += new TouchActivatedEventHandler(Circle_TouchActivated);
            englishCircle.TouchReleased += new TouchReleaseEventHandler(Circle_TouchReleased);
            bookshelf.SelectableObjects.AddObject(englishCircle);

            Texture2D frenchTexture = XNA.LoadTexture(BohemianArtifact.TexturePath + "fr_flag.jpg");
            frenchCircle = new SelectableEllipse(new Vector2(0.75f, 0.25f), 0.225f, 0.01f, Color.White, Color.Gray, frenchTexture);
            frenchCircle.Alpha = unselectedAlpha;
            frenchCircle.TouchActivated += new TouchActivatedEventHandler(Circle_TouchActivated);
            frenchCircle.TouchReleased += new TouchReleaseEventHandler(Circle_TouchReleased);
            bookshelf.SelectableObjects.AddObject(frenchCircle);

            if (Artifact.CurrentLanguage == Artifact.LANGUAGE_ENGLISH)
                englishCircle.Alpha = selectedAlpha;
            else
                frenchCircle.Alpha = selectedAlpha;
        }
示例#3
0
        public DetailsView(BohemianArtifact bbshelf, Vector3 position, Vector3 size)
        {
            bookshelf = bbshelf;
            bookshelf.Library.SelectedArtifactChanged += new ArtifactLibrary.SelectedArtifactHandler(library_SelectedArtifactChanged);
            bookshelf.Library.LanguageChanged += new ArtifactLibrary.ChangeLanguageHandler(Library_LanguageChanged);
            this.position = position;
            this.size = size;
            font = bookshelf.Content.Load<SpriteFont>("Arial");

            titleText = new SelectableText(font, "Details", new Vector3(0.4f, 0, 0), bookshelf.GlobalTextColor, Color.White);
            titleText.InverseScale(0.8f, size.X, size.Y);

            boundingBox = new BoundingBox(new Vector3(0, 0, 0), new Vector3(1, 1, 0), Color.Black, 0.005f);
            roundedBox = new RoundedBoundingBox(new Vector3(0, 0, 0), new Vector3(1, 1, 0), new Color(200, 200, 200), 0.008f, this);
            float maxWidth = 0.5f; // as a percentage of the width of the details box

            maxImageBox = new SelectableQuad(new Vector2(0, 0), new Vector2(maxWidth, maxWidth * size.X / size.Y), Color.White);
            rotationRange = new FloatRange(0, 10, 1, (float)(-Math.PI / 24), (float)(Math.PI / 24));

            batch = new SpriteBatch(XNA.GraphicsDevice);
            headerScale = 0.9f;
            subheaderScale = 0.7f;
            bodyScale = 0.55f;

            heightOfBodyLine = font.MeasureString("Eg").Y * bodyScale; // Eg = a high capital letter + low-hanging lowercase to fill the space
            heightofSpaceBetweenLines = font.MeasureString("Eg\nEg").Y * bodyScale - 2 * heightOfBodyLine;

            //setLengths(bbshelf.Library.Artifacts); // for debugging

            maxImageBox.TouchReleased += new TouchReleaseEventHandler(maxImageBox_TouchReleased);
            //bbshelf.SelectableObjects.AddObject(maxImageBox); // for debugging
        }
        public TimelineView(BohemianArtifact bbshelf, Vector3 p, Vector3 s)
        {
            bookshelf = bbshelf;
            bookshelf.Library.SelectedArtifactChanged += new ArtifactLibrary.SelectedArtifactHandler(library_SelectedArtifactChanged);
            position = p;
            size = s;
            font = bookshelf.Content.Load<SpriteFont>("Kootenay");
            lineBookTable = new Hashtable();

            CreateLinesFromBooks();

            cross1 = new SelectableLine(new Vector3(0, 0.2f, 0), new Vector3(0, 0.9f, 0), Color.Blue, 10);
            cross2 = new SelectableLine(new Vector3(1, 0.2f, 0), new Vector3(1, 0.9f, 0), Color.Red, 10);

            titleText = new SelectableText(font, "Timeline View", new Vector3(0.4f, 0, 0), bookshelf.GlobalTextColor, Color.White);
            titleText.InverseScale(0.5f, size.X, size.Y);

            topBar = new SelectableQuad(new Vector2(0, 0.1f), new Vector2(1, 0.1f), Color.LightGray);
            bookshelf.SelectableObjects.AddObject(topBar);
            bottomBar = new SelectableQuad(new Vector2(0, 0.9f), new Vector2(1, 0.1f), Color.LightGray);
            bookshelf.SelectableObjects.AddObject(bottomBar);

            topOffset = 0;
            bottomOffset = 1;
        }
        public MaterialsView(BohemianArtifact bbshelf, Vector3 position, Vector3 size)
        {
            bookshelf = bbshelf;
            bookshelf.Library.SelectedArtifactChanged += new ArtifactLibrary.SelectedArtifactHandler(library_SelectedArtifactChanged);
            this.position = position;
            this.size = size;

            titleText = new SelectableText(XNA.Font, "Materials", new Vector3(0.4f, 0, 0), bookshelf.GlobalTextColor, Color.White);
            titleText.InverseScale(0.8f, size.X, size.Y);

            // the border circle that encases the centre and separates the tiers
            borderCircle = new SelectableBlob(circleCenter, (float)Math.PI, BORDER_RADIUS * 0.01f, BORDER_RADIUS, 0, Color.Black, Color.Black, Color.Black, null);

            // create the steam paths
            steamPaths = new SteamPath[numSteam];
            steamSpeed = 5;
            Color steamColor = new Color(0.95f, 0.95f, 0.95f);
            float steamWidth = 0.03f;
            float steamFade = 0.025f;
            // start from the center and work outwards
            steamPaths[0] = new SteamPath(new Vector2(0.5f, circleCenter.Y), new Vector2(0.58f, 0.0f), -0.015f, steamWidth, steamFade, steamColor, steamColor, Color.White);
            steamPaths[1] = new SteamPath(new Vector2(0.6f, circleCenter.Y), new Vector2(0.75f, 0.025f), -0.03f, steamWidth, steamFade, steamColor, steamColor, Color.White);
            steamPaths[2] = new SteamPath(new Vector2(0.4f, circleCenter.Y), new Vector2(0.3f, 0.025f), 0.04f, steamWidth, steamFade, steamColor, steamColor, Color.White);
            steamPaths[3] = new SteamPath(new Vector2(0.3f, circleCenter.Y), new Vector2(0.1f, 0.1f), 0.07f, steamWidth, steamFade, steamColor, steamColor, Color.White);
            steamPaths[4] = new SteamPath(new Vector2(0.7f, circleCenter.Y), new Vector2(0.95f, 0.1f), -0.06f, steamWidth, steamFade, steamColor, steamColor, Color.White);
            steamPaths[5] = new SteamPath(new Vector2(0.8f, circleCenter.Y), new Vector2(1.0f, 0.35f), -0.05f, steamWidth, steamFade, steamColor, steamColor, Color.White);
            steamPaths[6] = new SteamPath(new Vector2(0.2f, circleCenter.Y), new Vector2(0.0f, 0.3f), 0.05f, steamWidth, steamFade, steamColor, steamColor, Color.White);

            animationTimer = new Timer(0.4f);
            animationTimer.FinishEvent += new TimerFinished(AnimationTimerFinished);

            //materialTexts = new Dictionary<string, SelectableText>();
            //LoadMaterialTexts();
            //materialTextures = new Dictionary<string, Texture2D>();
            //LoadMaterialTextures();
            materialColors = new Dictionary<Material, Color>();
            LoadMaterialColors();

            // a list of materials that are selected
            materialConstraints = new List<Material>();

            artifactList = new List<ArtifactContainer>();
            CreateArtifactList();
            UpdateArtifactsFromConstraints();

            RepositionArtifacts();

            // create the list of materials
            materialList = new List<MaterialContainer>();
            CreateMaterialBlobs();
            RepositionBlobs();

            animationTimer.Start();
        }
示例#6
0
        static void Main()
        {
            // Disable the WinForms unhandled exception dialog.
            // SurfaceShell will notify the user.
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.ThrowException);

            using (BohemianArtifact app = new BohemianArtifact())
            {
                app.Run();
            }
        }
        public MaterialsView(BohemianArtifact bbshelf, Vector3 position, Vector3 size)
        {
            bookshelf = bbshelf;
            bookshelf.Library.SelectedArtifactChanged += new ArtifactLibrary.SelectedArtifactHandler(library_SelectedArtifactChanged);
            this.position = position;
            this.size = size;

            titleText = new SelectableText(XNA.Font, "Materials", new Vector3(0.4f, 0, 0), bookshelf.GlobalTextColor, Color.White);
            titleText.InverseScale(0.8f, size.X, size.Y);

            // create a list of tier boundaries
            tierBoundaries = new Tier[MAX_TIERS];
            tierBoundaries[0] = new Tier(0, 0.25f);
            tierBoundaries[1] = new Tier(0.275f, 0.02f);
            tierBoundaries[2] = new Tier(0.325f, 0.020f);
            tierBoundaries[3] = new Tier(0.375f, 0.020f);
            tierBoundaries[4] = new Tier(0.425f, 0.020f);
            // and a list of materials that were previously selected
            materialConstraints = new List<string>();
            // and the list of tiers, including the center
            materialTiers = new List<ArrayList>();

            // the border circle that encases the centre and separates the tiers
            borderCircle = new SelectableEllipse(new Vector2(center.X, center.Y), tierBoundaries[0].CircleRadius, 0.01f, Color.White, Color.Gray, null);

            animationTimer = new Timer(0.5f);
            animationTimer.FinishEvent += new TimerFinished(AnimationTimerFinished);

            materialColors = new Dictionary<string, Color>();
            materialTextures = new Dictionary<string, Texture2D>();
            LoadMaterialTextures();
            materialTexts = new Dictionary<string, SelectableText>();
            LoadMaterialTexts();

            CreateMaterialBlobs();
            PackAllTiers();
            animationTimer.Start();
        }
示例#8
0
        public TimelineView(BohemianArtifact bbshelf, Vector3 position, Vector3 size)
        {
            bookshelf = bbshelf;
            bookshelf.Library.SelectedArtifactChanged += new ArtifactLibrary.SelectedArtifactHandler(library_SelectedArtifactChanged);
            this.position = position;
            this.size = size;

            // create left and right white fadeouts
            leftWhiteVertices = new VertexPositionColor[6];
            leftWhiteVertices[0] = new VertexPositionColor(new Vector3(-2, 0, 0), Color.White);
            leftWhiteVertices[1] = new VertexPositionColor(new Vector3(0, 0, 0), Color.White);
            leftWhiteVertices[2] = new VertexPositionColor(new Vector3(0.005f, 0, 0), Color.Transparent);
            leftWhiteVertices[3] = new VertexPositionColor(new Vector3(0.005f, 1, 0), Color.Transparent);
            leftWhiteVertices[4] = new VertexPositionColor(new Vector3(0, 1, 0), Color.White);
            leftWhiteVertices[5] = new VertexPositionColor(new Vector3(-2, 1, 0), Color.White);
            rightWhiteVertices = new VertexPositionColor[6];
            rightWhiteVertices[0] = new VertexPositionColor(new Vector3(1 - 0.005f, 0, 0), Color.Transparent);
            rightWhiteVertices[1] = new VertexPositionColor(new Vector3(1, 0, 0), Color.White);
            rightWhiteVertices[2] = new VertexPositionColor(new Vector3(3, 0, 0), Color.White);
            rightWhiteVertices[3] = new VertexPositionColor(new Vector3(3, 1, 0), Color.White);
            rightWhiteVertices[4] = new VertexPositionColor(new Vector3(1, 1, 0), Color.White);
            rightWhiteVertices[5] = new VertexPositionColor(new Vector3(1 - 0.005f, 1, 0), Color.Transparent);
            hexWhiteIndices = new int[12];
            hexWhiteIndices[0] = 0;
            hexWhiteIndices[1] = 1;
            hexWhiteIndices[2] = 4;
            hexWhiteIndices[3] = 4;
            hexWhiteIndices[4] = 5;
            hexWhiteIndices[5] = 0;
            hexWhiteIndices[6] = 1;
            hexWhiteIndices[7] = 2;
            hexWhiteIndices[8] = 3;
            hexWhiteIndices[9] = 3;
            hexWhiteIndices[10] = 4;
            hexWhiteIndices[11] = 1;
            // create left and right black quads
            leftBlackVertices = new VertexPositionColor[4];
            leftBlackVertices[0] = new VertexPositionColor(new Vector3(-2, 0, 0), Color.Black);
            leftBlackVertices[1] = new VertexPositionColor(new Vector3(0, 0, 0), Color.Black);
            leftBlackVertices[2] = new VertexPositionColor(new Vector3(0, 1, 0), Color.Black);
            leftBlackVertices[3] = new VertexPositionColor(new Vector3(-2, 1, 0), Color.Black);
            rightBlackVertices = new VertexPositionColor[4];
            rightBlackVertices[0] = new VertexPositionColor(new Vector3(1, 0, 0), Color.Black);
            rightBlackVertices[1] = new VertexPositionColor(new Vector3(3, 0, 0), Color.Black);
            rightBlackVertices[2] = new VertexPositionColor(new Vector3(3, 1, 0), Color.Black);
            rightBlackVertices[3] = new VertexPositionColor(new Vector3(1, 1, 0), Color.Black);
            quadBlackIndices = new int[6];
            quadBlackIndices[0] = 0;
            quadBlackIndices[1] = 1;
            quadBlackIndices[2] = 2;
            quadBlackIndices[3] = 2;
            quadBlackIndices[4] = 3;
            quadBlackIndices[5] = 0;

            titleText = new SelectableText(XNA.Font, "Timeline", new Vector3(0.4f, 0, 0), bookshelf.GlobalTextColor, Color.White);
            titleText.InverseScale(0.8f, size.X, size.Y);

            // arrays to hold tick marks for each timeline
            catalogTicks = new List<TimelineYearTick>();
            useTicks = new List<TimelineYearTick>();
            manufactureTicks = new List<TimelineYearTick>();

            // create a line for each timeline, these will not be interactive elements
            catalogLine = new SelectableLine(new Vector3(0, catalogLineHeight, 0), new Vector3(1, catalogLineHeight, 0), Color.LightGray, lineThickness);
            useLine = new SelectableLine(new Vector3(0, useLineHeight, 0), new Vector3(1, useLineHeight, 0), Color.LightGray, lineThickness);
            manufactureLine = new SelectableLine(new Vector3(0, manufactureLineHeight, 0), new Vector3(1, manufactureLineHeight, 0), Color.LightGray, lineThickness);

            // underneath each timeline, there are three widgets to control zooming and traversing
            catalogWidgets = new SelectableLine[3];
            useWidgets = new SelectableLine[3];
            manufactureWidgets = new SelectableLine[3];
            for (int i = 0; i < 3; i++)
            {
                // create interactive elements and add them to the object manager
                catalogWidgets[i] = new SelectableLine(new Vector3((float)i / 3, catalogLineHeight, 0), new Vector3((float)(i + 1) / 3, catalogLineHeight, 0), new Color(i * 255 / 2, 0, 0), lineThickness * 2);
                useWidgets[i] = new SelectableLine(new Vector3((float)i / 3, useLineHeight, 0), new Vector3((float)(i + 1) / 3, useLineHeight, 0), new Color(0, i * 255 / 2, 0), lineThickness * 2);
                manufactureWidgets[i] = new SelectableLine(new Vector3((float)i / 3, manufactureLineHeight, 0), new Vector3((float)(i + 1) / 3, manufactureLineHeight, 0), new Color(0, 0, i * 255 / 2), lineThickness * 2);
                catalogWidgets[i].TouchActivated += new TouchActivatedEventHandler(TimelineView_TouchActivated);
                useWidgets[i].TouchActivated += new TouchActivatedEventHandler(TimelineView_TouchActivated);
                manufactureWidgets[i].TouchActivated += new TouchActivatedEventHandler(TimelineView_TouchActivated);
                bookshelf.SelectableObjects.AddObject(catalogWidgets[i]);
                bookshelf.SelectableObjects.AddObject(useWidgets[i]);
                bookshelf.SelectableObjects.AddObject(manufactureWidgets[i]);
            }

            // the circles are test objects to show how the timeline range is being manipulated
            catalogCircles = new SelectableEllipse[2];
            useCircles = new SelectableEllipse[2];
            manufactureCircles = new SelectableEllipse[2];
            // these arrays store the left/right for each timeline, along with a left/right offset that is used as a temp variable
            // the order is: L_RANGE, L_OFFSET, R_RANGE, R_OFFSET
            catalogTimelineRange = new float[4] { 0, 0, 1, 1 };
            useTimelineRange = new float[4] { 0, 0, 1, 1 };
            manufactureTimelineRange = new float[4] { 0, 0, 1, 1 };
            catalogCircles[0] = new SelectableEllipse(Vector2.Zero, 0.01f, 0.001f, Color.Orange, Color.Black, null);
            catalogCircles[1] = new SelectableEllipse(Vector2.Zero, 0.01f, 0.001f, Color.Pink, Color.Black, null);
            useCircles[0] = new SelectableEllipse(Vector2.Zero, 0.01f, 0.001f, Color.Orange, Color.Black, null);
            useCircles[1] = new SelectableEllipse(Vector2.Zero, 0.01f, 0.001f, Color.Pink, Color.Black, null);
            manufactureCircles[0] = new SelectableEllipse(Vector2.Zero, 0.01f, 0.001f, Color.Orange, Color.Black, null);
            manufactureCircles[1] = new SelectableEllipse(Vector2.Zero, 0.01f, 0.001f, Color.Pink, Color.Black, null);

            topSorted = new List<KeyValuePair<TimelineContainer, float>>();
            bottomSorted = new List<KeyValuePair<TimelineContainer, float>>();

            timelineArtifactList = new List<TimelineContainer>();
            lineArtifactDictionary = new Dictionary<SelectableLine, TimelineContainer>();
            selectedContainer = null;
            highlightedContainer = null;
            relatedContainers = new List<TimelineContainer>();
            InitializeTimelineList();

            animationTimer = new Timer(0.5f);
            animationTimer.FinishEvent += new TimerFinished(AnimationTimerFinished);
        }