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(); }
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(); }