public override void HandleLeftMouseDoubleClick() { // over the dice bag if (model.ThisPlayer.CursorLocation is IDiceBagCursorLocation) { IDiceBagCursorLocation location = (IDiceBagCursorLocation)model.ThisPlayer.CursorLocation; // over dice if (location.DiceCount > 0) { networkClient.Send(new DiceCastMessage(location.DiceHandIndex, location.DiceCount)); } } }
public override void UpdateCursor(System.Windows.Forms.Form mainForm, IView view) { ICursorLocation cursorLocation = model.ThisPlayer.CursorLocation; if (cursorLocation is IBoardCursorLocation) { IBoardCursorLocation location = (IBoardCursorLocation)cursorLocation; mainForm.Cursor = (location.Piece == null ? (model.CurrentSelection == null || model.CurrentSelection.Empty ? view.HandCursor : System.Windows.Forms.Cursors.Cross) : view.FingerCursor); /* * mainForm.Cursor = (location.Piece == null ? * (model.CurrentSelection == null || model.CurrentSelection.Empty ? * (model.CurrentGameBox.Reference == model.GameLibrary.DefaultGameBox ? System.Windows.Forms.Cursors.WaitCursor : view.HandCursor) : * System.Windows.Forms.Cursors.Cross) : * view.FingerCursor); */ } else if (cursorLocation is IStackInspectorCursorLocation) { IStackInspectorCursorLocation location = (IStackInspectorCursorLocation)cursorLocation; mainForm.Cursor = (location.Piece == null && location.Icon == StackInspectorIcon.None ? System.Windows.Forms.Cursors.Default : view.FingerCursor); } else if (cursorLocation is IDiceBagCursorLocation) { IDiceBagCursorLocation location = (IDiceBagCursorLocation)cursorLocation; mainForm.Cursor = (location.DiceCount == 0 ? System.Windows.Forms.Cursors.Default : view.FingerDoubleCursor); } else if (cursorLocation is ITabsCursorLocation) { ITabsCursorLocation location = (ITabsCursorLocation)cursorLocation; mainForm.Cursor = (location.Tab == null && location.Icon == TabsIcon.None ? System.Windows.Forms.Cursors.Default : view.FingerCursor); } else if (cursorLocation is IMenuCursorLocation) { IMenuCursorLocation location = (IMenuCursorLocation)cursorLocation; mainForm.Cursor = (location.Item == null ? System.Windows.Forms.Cursors.Default : view.FingerCursor); } else if (cursorLocation is IHandCursorLocation) { IHandCursorLocation location = (IHandCursorLocation)cursorLocation; mainForm.Cursor = (location.Piece == null && location.Icon == HandIcon.None ? System.Windows.Forms.Cursors.Default : (location.Icon == HandIcon.Resize ? System.Windows.Forms.Cursors.HSplit : view.FingerCursor)); } else { mainForm.Cursor = System.Windows.Forms.Cursors.Default; } }
/// <summary>Displays the next frame.</summary> public override void Render(IGraphics graphics, long currentTimeInMicroseconds) { if (model.CurrentGameBox.Reference == model.GameLibrary.DefaultGameBox) { // display "dice" logo IRotation rotation1 = model.ComputeRotationYawPitchRoll( 0.750000000f + 0.1f * (float)Math.Cos((float)Math.PI * 2.0f * (currentTimeInMicroseconds % (long)7000000) / 7000000.0f), 0.521750554f + 0.1f * (float)Math.Cos((float)Math.PI * 2.0f * (currentTimeInMicroseconds % (long)5000000) / 5000000.0f), 0.339836909f + 0.1f * (float)Math.Cos((float)Math.PI * 2.0f * (currentTimeInMicroseconds % (long)9000000) / 9000000.0f)); IRotation rotation2 = model.ComputeRotationYawPitchRoll( 0.750000000f + 0.1f * (float)Math.Cos((float)Math.PI * 2.0f * (currentTimeInMicroseconds % 9000000) / 9000000.0f), 2.356194490f + 0.1f * (float)Math.Cos((float)Math.PI * 2.0f * (currentTimeInMicroseconds % 7000000) / 7000000.0f), 3.141592654f + 0.1f * (float)Math.Cos((float)Math.PI * 2.0f * (currentTimeInMicroseconds % 5000000) / 5000000.0f)); Rectangle gameDisplayArea = view.GameDisplayAreaInPixels; logoMesh.Render( new PointF(gameDisplayArea.X + gameDisplayArea.Width * 0.43f, gameDisplayArea.Y + gameDisplayArea.Height * 0.35f), gameDisplayArea.Height * 0.1f, rotation1.ToRotationMatrix(), (uint)Color.LightGreen.ToArgb(), 0xff000000); logoMesh.Render( new PointF(gameDisplayArea.X + gameDisplayArea.Width * 0.57f, gameDisplayArea.Y + gameDisplayArea.Height * 0.45f), gameDisplayArea.Height * 0.1f, rotation2.ToRotationMatrix(), (uint)Color.Salmon.ToArgb(), 0xff000000); } else { DiceHand[] diceHands = model.CurrentGameBox.CurrentGame.DiceHands; if (diceHands.Length > 0) { // check for mouse roll over int rolledOverDiceHandIndex = 0; int rolledOverDiceCount = 0; if (model.ThisPlayer.CursorLocation is IDiceBagCursorLocation) { IDiceBagCursorLocation diceBagMouseLocation = (IDiceBagCursorLocation)model.ThisPlayer.CursorLocation; rolledOverDiceHandIndex = diceBagMouseLocation.DiceHandIndex; rolledOverDiceCount = diceBagMouseLocation.DiceCount; } // render background //IImage image = graphics.CreateMonochromaticImage(0xFFFFFFFF); float scale = view.GameDisplayAreaInPixels.Height / 1200.0f; //image.Render(new RectangleF(area.X + 7.0f * scale, area.Y + 6.0f * scale, area.Width - 14.0f * scale, area.Height - 12.0f * scale), 0xb0f0c67d); frameImageElements[0].Render(new RectangleF(area.X, area.Y, 11.0f * scale, 10.0f * scale)); frameImageElements[1].Render(new RectangleF(area.X + 11.0f * scale, area.Y, area.Width - 22.0f * scale, 10.0f * scale)); frameImageElements[2].Render(new RectangleF(area.Right - 11.0f * scale, area.Y, 11.0f * scale, 10.0f * scale)); frameImageElements[3].Render(new RectangleF(area.X, area.Y + 10.0f * scale, 11.0f * scale, area.Height - 20.0f * scale)); frameImageElements[4].Render(new RectangleF(area.X + 11.0f * scale, area.Y + 10.0f * scale, area.Width - 22.0f * scale, area.Height - 20.0f * scale)); frameImageElements[5].Render(new RectangleF(area.Right - 11.0f * scale, area.Y + 10.0f * scale, 11.0f * scale, area.Height - 20.0f * scale)); frameImageElements[6].Render(new RectangleF(area.X, area.Bottom - 10.0f * scale, 11.0f * scale, 10.0f * scale)); frameImageElements[7].Render(new RectangleF(area.X + 11.0f * scale, area.Bottom - 10.0f * scale, area.Width - 22.0f * scale, 10.0f * scale)); frameImageElements[8].Render(new RectangleF(area.Right - 11.0f * scale, area.Bottom - 10.0f * scale, 11.0f * scale, 10.0f * scale)); float singleLineHeight = area.Width * 0.2f; // idle dice for (int diceHandIndex = 0; diceHandIndex < diceHands.Length; ++diceHandIndex) { DiceHand diceHand = diceHands[diceHandIndex]; for (int dieIndex = 0; dieIndex < diceHand.Dice.Length; ++dieIndex) { if (!diceHand.BeingCast || dieIndex >= diceHand.DiceCountBeingCast) { Die die = diceHand.Dice[dieIndex]; IDieMesh dieMesh = die.DieMesh; float size = die.Size * (!diceHand.BeingCast && (model.ThisPlayer.PieceBeingDragged == null && model.ThisPlayer.StackBeingDragged == null) && (rolledOverDiceHandIndex == diceHandIndex && rolledOverDiceCount > dieIndex) ? 1.40f : 1.0f); dieMesh.Render( die.Position, size, die.Orientation.ToRotationMatrix(), die.Color, die.Pips); } } } // shadows of dice being cast for (int diceHandIndex = 0; diceHandIndex < diceHands.Length; ++diceHandIndex) { DiceHand diceHand = diceHands[diceHandIndex]; for (int dieIndex = 0; dieIndex < diceHand.Dice.Length; ++dieIndex) { if (diceHand.BeingCast && dieIndex < diceHand.DiceCountBeingCast) { Die die = diceHand.Dice[dieIndex]; IDieMesh dieMesh = die.DieMesh; float size = die.Size; dieMesh.RenderShadow( die.Position, size, die.Orientation.ToRotationMatrix(), 0x40000000); } } } // dice being cast for (int diceHandIndex = 0; diceHandIndex < diceHands.Length; ++diceHandIndex) { DiceHand diceHand = diceHands[diceHandIndex]; for (int dieIndex = 0; dieIndex < diceHand.Dice.Length; ++dieIndex) { if (diceHand.BeingCast && dieIndex < diceHand.DiceCountBeingCast) { Die die = diceHand.Dice[dieIndex]; IDieMesh dieMesh = die.DieMesh; float size = die.Size; dieMesh.Render( die.Position, size, die.Orientation.ToRotationMatrix(), die.Color, die.Pips); } } } } } }