/// <summary>
        /// Fills the center region of the main screen with the content depending on the currentView.
        /// </summary>
        private void fillMainCenterContent(BrailleIOScreen screen)
        {
            if (screen != null)
            {
                BrailleIOViewRange center  = screen.GetViewRange(VR_CENTER_NAME);
                BrailleIOViewRange center2 = screen.GetViewRange(VR_CENTER_2_NAME);
                if (center != null)
                {
                    switch (currentView)
                    {
                    case LectorView.Drawing:
                        setCaptureArea();
                        if (center2 != null)
                        {
                            center2.SetVisibility(false);
                        }
                        break;

                    case LectorView.Braille:
                        String content = "Hallo Welt";     // TODO: set real content
                        setRegionContent(screen, VR_CENTER_2_NAME, content);
                        break;

                    default:
                        setCaptureArea();
                        break;
                    }
                }
            }
        }
        /// <summary>
        /// Changes the active center view to the given one (center or center_2).
        /// </summary>
        /// <param name="screen">The screen.</param>
        /// <param name="viewName">Name of the view. [VR_CENTER_NAME or VR_CENTER_2_NAME]</param>
        /// <returns></returns>
        BrailleIOViewRange changeActiveCenterView(BrailleIOScreen screen, String viewName)
        {
            //TODO: do this generic?!
            if (screen != null)
            {
                BrailleIOViewRange center  = screen.GetViewRange(VR_CENTER_NAME);
                BrailleIOViewRange center2 = screen.GetViewRange(VR_CENTER_2_NAME);

                if (viewName.Equals(VR_CENTER_2_NAME))
                {
                    if (center2 != null)
                    {
                        if (center != null)
                        {
                            center.SetVisibility(false);
                        }
                        center2.SetVisibility(true);
                        io.RefreshDisplay(true);
                        return(center2);
                    }
                }
                else
                {
                    if (center != null)
                    {
                        center.SetVisibility(true); io.RefreshDisplay(true);
                    }
                    if (center2 != null)
                    {
                        center2.SetVisibility(false); io.RefreshDisplay(true);
                    }
                    return(center);
                }
            }
            return(null);
        }
        /// <summary>
        /// Change visibility of the given view range. Center view range cannot be hidden.
        /// </summary>
        /// <param name="viewName">name of the screen</param>
        /// <param name="viewRangeName">name of the view range</param>
        /// <param name="visible">true if view range should become visible, false if view range should become invisible</param>
        /// <returns>true if successful, false if not successful</returns>
        private bool changeViewVisibility(string viewName, string viewRangeName, bool visible)
        {
            if (!viewRangeName.Equals(VR_CENTER_NAME))
            {
                BrailleIOScreen vs = io.GetView(viewName) as BrailleIOScreen;
                if (vs != null)
                {
                    BrailleIOViewRange vr     = vs.GetViewRange(viewRangeName);
                    BrailleIOViewRange center = vs.GetViewRange(VR_CENTER_NAME);
                    BrailleIOViewRange top    = vs.GetViewRange(VR_TOP_NAME);
                    BrailleIOViewRange bottom = vs.GetViewRange(VR_DETAIL_NAME);

                    if (vr != null && center != null && top != null && bottom != null)
                    {
                        vr.SetVisibility(visible);
                        // change margin of center region
                        if (visible)
                        {
                            if (viewRangeName.Equals(VR_TOP_NAME))
                            {
                                if (bottom.IsVisible())
                                {
                                    center.SetMargin(7, 0);
                                }
                                else
                                {
                                    center.SetMargin(7, 0, 0);
                                }
                            }
                            else if (viewRangeName.Equals(VR_DETAIL_NAME))
                            {
                                if (top.IsVisible())
                                {
                                    center.SetMargin(7, 0);
                                }
                                else
                                {
                                    center.SetMargin(0, 0, 7);
                                }
                            }
                        }
                        else
                        {
                            if (viewRangeName.Equals(VR_TOP_NAME))
                            {
                                if (bottom.IsVisible())
                                {
                                    center.SetMargin(0, 0, 7);
                                }
                                else
                                {
                                    center.SetMargin(0, 0);
                                }
                            }
                            else if (viewRangeName.Equals(VR_DETAIL_NAME))
                            {
                                if (top.IsVisible())
                                {
                                    center.SetMargin(7, 0, 0);
                                }
                                else
                                {
                                    center.SetMargin(0, 0);
                                }
                            }
                        }
                        return(true);
                    }
                }
            }
            audioRenderer.PlayWaveImmediately(StandardSounds.Error); // operation not possible
            return(false);
        }
Beispiel #4
0
        bool visible = true;  // flag to determine whether the current item blinking is showing on the display or not

        // on tick, reverse the visibility of the item blinking on the HyperBraille
        void selectionTimer_Elapsed(object sender, EventArgs e)
        {
            visible = !visible;
            viewRangeCurrentlySelected.SetVisibility(visible);
            Refresh();
        }
Beispiel #5
0
        /// <summary>
        /// Called every frame to drive the game logic
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Tick()
        {
            // Push the last update to the screen

            if (!buffers[0].Equals(buffers[1]) || textRegionDirty)
            {
                textRegionDirty = false;
                Render();
            }

            // Update the controllers
            characterController.Update();
            levelController.Update();
            dialogueController.Update();


            // Do the rendering/sound stuff. TODO: Clean this up with views
            buffers[bufferIndex].Clear();

            buffers[bufferIndex].X = (levelModel.Avatar.X + levelModel.Avatar.Width / 2) - buffers[bufferIndex].Width / 2;
            buffers[bufferIndex].Y = (levelModel.Avatar.Y + levelModel.Avatar.Height / 2) - buffers[bufferIndex].Height / 2;

            foreach (WorldObject obj in levelModel.level.Objects)
            {
                if (!obj.isHidden)
                {
                    buffers[bufferIndex].Draw(obj);
                }
            }

            buffers[bufferIndex].Draw(levelModel.Avatar);
            mainRegion.SetMatrix(buffers[bufferIndex].Data);

            bufferIndex = (bufferIndex + 1) % 2;

            if (gameState == GameState.Event && gameDialogue.HasAction())
            {
                if (detailRegion.GetText() != gameDialogue.GetCurrent())
                {
                    detailRegion.SetText(gameDialogue.GetCurrent());
                    textRegionDirty = true;
                    Audio.AbortCurrentSound();
                    Audio.PlaySound(gameDialogue.GetCurrent());
                }

                if (!detailRegion.IsVisible())
                {
                    detailRegion.SetVisibility(true);
                    textRegionDirty = true;
                }
            }
            else
            {
                Audio.AbortCurrentSound();
                detailRegion.SetText(string.Empty);

                if (detailRegion.IsVisible())
                {
                    textRegionDirty = true;
                    detailRegion.SetVisibility(false);
                }
            }
        }