private void MainRender() { cursor = arrow; if (crafted != null) { var item = Items.Crafter.Crafteables.Find(elem => elem == crafted); ShaderRepository.ShipAmbientShader.SetValue("lightPosition", new float[4] { 655, 1220, 504, 1 }); ShaderRepository.ShipAmbientShader.SetValue("perlinNoise", perlinNoise); ShaderRepository.ShipAmbientShader.SetValue("time", time); foreach (var mesh in crafted3DModel) { mesh.Effect = ShaderRepository.ShipAmbientShader; ShaderRepository.ShipAmbientShader.SetValue("rotation", Matrix.RotationX(mesh.Rotation.X) * Matrix.RotationY(mesh.Rotation.Y)); mesh.Technique = "CraftedItems"; mesh.RotateY(0.025f); D3DDevice.Instance.Device.RenderState.AlphaBlendEnable = true; mesh.Render(); } //laser1.Render(); //laser2.Render(); item.Icon.Scaling = item.DefaultScale * 4; item.Icon.Position = new TGCVector2( Screen.Width / 2 - item.Icon.Bitmap.Width * item.Icon.Scaling.X / 2, Screen.Height / 2 ); var cursorPos = System.Windows.Forms.Cursor.Position; if ( cursorPos.X > Screen.Width * 0.4f && cursorPos.X < Screen.Width * 0.6f && cursorPos.Y > Screen.Height * 0.3f && cursorPos.Y < Screen.Height * 0.8f ) { cursor = hand; aboutToTake = true; } else { aboutToTake = false; } drawer.BeginDrawSprite(); //drawer.DrawSprite(item.Icon); drawer.DrawSprite(cursor); drawer.EndDrawSprite(); return; } bool hovering = false; int i = 0; dialogBox.Clear(); foreach (var item in Items.Crafter.Crafteables) { item.Icon.Scaling = item.DefaultScale + this.GetScaleForSpriteByPixels(item.Icon, 10, 10); bubble.Position = new TGCVector2(bubbleInitialPos.X, bubbleInitialPos.Y + i++ *bubble.Bitmap.Height * bubble.Scaling.Y); CenterIconToCurrentBubble(item.Icon); if (cursorOverBubble()) { //bubble.Color = Color.Red; ItemHighlighted = item; hoveredItems[Items.Crafter.Crafteables.IndexOf(item)] = true; hovering = true; dialogBox.AddLineBig(item.Name + " ", this.Character.CanCraft(item) ? Color.FromArgb(255, 0, 255, 0) : Color.Red); dialogBox.AddLineSmall("(" + item.type.ToString() + ")", Color.Gray); dialogBox.AddLineSmall("____________________"); dialogBox.AddLineSmall(item.Description); dialogBox.AddLineSmall("____________________"); dialogBox.AddLineSmall("Recipe:"); foreach (var ingredient in item.Recipe.Ingredients) { bool fulfills = this.Character.Inventory.Items.Where(it => it.Name.Equals(ingredient.Item.Name)).Count() >= ingredient.Quantity; dialogBox.AddLineSmall(ingredient.Item.Name + ": " + ingredient.Quantity, fulfills ? Color.FromArgb(255, 0, 255, 0) : Color.Red); } } else { hoveredItems[Items.Crafter.Crafteables.IndexOf(item)] = false; } this.bubble.Color = this.Character.CanCraft(item) ? Color.White : Color.Black; drawer.BeginDrawSprite(); drawer.DrawSprite(bubble); drawer.DrawSprite(item.Icon); drawer.EndDrawSprite(); } if (hovering) { dialogBox.Render(); } this.cursor.Color = hovering ? Color.FromArgb(255, 0, 255, 0) : this.cursorDefaultColor; drawer.BeginDrawSprite(); drawer.DrawSprite(cursor); drawer.EndDrawSprite(); }