Inheritance: Knot3.Framework.Core.DrawableScreenComponent
Exemplo n.º 1
0
 public Border(IScreen screen, DisplayLayer drawOrder, Bounds bounds,
                int lineWidth, int padding, Color lineColor, Color outlineColor)
     : base(screen, drawOrder)
 {
     LineWidth = lineWidth;
     Padding = padding;
     lines = new Lines (screen, drawOrder, lineWidth, lineColor, outlineColor);
     Bounds = bounds;
 }
Exemplo n.º 2
0
        public MenuScreen(GameCore game)
            : base(game)
        {
            // die Linien
            lines = new Lines (screen: this, drawOrder: DisplayLayer.Dialog, lineWidth: 6);

            // der Mauszeiger
            pointer = new MousePointer (this);

            // häufig verwendete Positionen und Größen
            ScreenContentBounds = new Bounds (screen: this, relX: 0.075f, relY: 0.180f, relWidth: 0.850f, relHeight: 0.650f);
            ScreenTitleBounds = new Bounds (this, 0.075f, 0.075f, 0.900f, 0.050f);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Erzeugt eine neue Instanz eines ChallengeModeScreen-Objekts und initialisiert diese mit einem Knot3Game-Objekt, einem Spielerknoten playerKnot und dem Knoten challengeKnot, den der Spieler nachbauen soll.
        /// </summary>
        public ChallengeModeScreen(GameCore game, Challenge challenge)
            : base(game)
        {
            // world
            PlayerWorld = new World (screen: this, drawOrder: DisplayLayer.GameWorld, bounds: Bounds.FromRight (percent: 0.5f));
            ChallengeWorld = new World (screen: this, drawOrder: DisplayLayer.GameWorld, bounds: Bounds.FromLeft (percent: 0.5f));
            ChallengeWorld.Camera = PlayerWorld.Camera;
            PlayerWorld.OnRedraw += () => ChallengeWorld.Redraw = true;
            ChallengeWorld.OnRedraw += () => PlayerWorld.Redraw = true;
            // input
            playerKnotInput = new KnotInputHandler (screen: this, world: PlayerWorld);
            challengeKnotInput = new KnotInputHandler (screen: this, world: ChallengeWorld);
            // overlay
            overlay = new Overlay (screen: this, world: PlayerWorld);
            // pointer
            pointer = new MousePointer (screen: this);
            // model mouse handler
            playerModelMouseHandler = new ModelMouseHandler (screen: this, world: PlayerWorld);
            challengeModelMouseHandler = new ModelMouseHandler (screen: this, world: ChallengeWorld);

            // knot renderer
            PlayerKnotRenderer = new KnotRenderer (screen: this, position: Vector3.Zero);
            PlayerWorld.Add (PlayerKnotRenderer);
            ChallengeKnotRenderer = new KnotRenderer (screen: this, position: Vector3.Zero);
            ChallengeWorld.Add (ChallengeKnotRenderer);

            // debug displays
            debugBoundings = new DebugBoundings (screen: this, position: Vector3.Zero);

            // edge movements
            PlayerEdgeMovement = new EdgeMovement (screen: this, world: PlayerWorld, knotRenderer: PlayerKnotRenderer, position: Vector3.Zero);
            PlayerEdgeMovement.KnotMoved = OnKnotMoved;

            // assign the specified challenge
            Challenge = challenge;
            // assign the specified player knot
            PlayerKnot = challenge.Start.Clone () as Knot;
            // assign the specified target knot
            ChallengeKnotRenderer.RenderKnot (challenge.Target);
            // assign the specified start knot
            PlayerKnotRenderer.RenderKnot (PlayerKnot);

            SkyCube playerSkyCube = new SkyCube (screen: this, position: Vector3.Zero, distance: 10000);
            PlayerWorld.Add (playerSkyCube);
            SkyCube challengeSkyCube = new SkyCube (screen: this, position: Vector3.Zero, distance: 10000);
            ChallengeWorld.Add (challengeSkyCube);

            // Die Spielzeit-Anzeige
            playTimeDisplay = new TextItem (screen: this, drawOrder: DisplayLayer.ScreenUI + DisplayLayer.MenuItem, text: String.Empty);
            playTimeDisplay.Bounds.Position = new ScreenPoint (this, 0.800f, 0.01f);
            playTimeDisplay.Bounds.Size = new ScreenPoint (this, 0.15f, 0.04f);
            playTimeDisplay.BackgroundColorFunc = (s) => Design.WidgetBackground;
            playTimeDisplay.ForegroundColorFunc = (s) => Design.WidgetForeground;
            playTimeDisplay.AlignX = HorizontalAlignment.Center;
            playTimeBorder = new Border (screen: this, drawOrder: DisplayLayer.ScreenUI + DisplayLayer.MenuItem,
                                         widget: playTimeDisplay, lineWidth: 2, padding: 0);
            //Undo-Button
            undoButton = new Button (screen: this,
                                     drawOrder: DisplayLayer.ScreenUI + DisplayLayer.MenuItem,
                                     name: "Undo",
                                     onClick: (time) => OnUndo ());
            undoButton.SetCoordinates (left: 0.55f, top: 0.900f, right: 0.65f, bottom: 0.95f);

            undoButtonBorder = new Border (screen: this, drawOrder: DisplayLayer.ScreenUI + DisplayLayer.MenuItem,
                                           widget: undoButton, lineWidth: 2, padding: 0);
            undoButton.AlignX = HorizontalAlignment.Center;
            undoButton.IsVisible = false;

            // Redo-Button
            redoButton = new Button (
                screen: this,
                drawOrder: DisplayLayer.ScreenUI + DisplayLayer.MenuItem,
                name: "Redo",
                onClick: (time) => OnRedo ()
            );
            redoButton.SetCoordinates (left: 0.70f, top: 0.900f, right: 0.80f, bottom: 0.95f);

            redoButtonBorder = new Border (screen: this, drawOrder: DisplayLayer.ScreenUI + DisplayLayer.MenuItem,
                                           widget: redoButton, lineWidth: 2, padding: 0);
            redoButton.AlignX = HorizontalAlignment.Center;
            redoButton.IsVisible = false;

            // die Linien
            lines = new Lines (screen: this, drawOrder: DisplayLayer.Dialog, lineWidth: 2);
            lines.AddPoints (0.500f, 0.000f, 0.500f, 1.000f);

            // Status
            state = ChallengeModeState.Start;
        }