Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        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();
        }
Exemplo n.º 3
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);
        }