Exemple #1
0
        public void EnqueueMessage(string message)
        {
            bool alreadyInDesignMode = OdysseyUI.CurrentHud.DesignMode;
            if (!alreadyInDesignMode)
                OdysseyUI.CurrentHud.BeginDesign();

            Label newLabel = new Label
                {
                    Id = string.Format("{0}_{1}{2}", ControlTag, TextLiteral.ControlTag, ++labelCount),
                    //Position = new SlimDX.Vector2(Description.Padding.Left, Description.Padding.Top + (labels.Count * rowHeight)),
                    TextDescriptionClass = TextDescriptionClass,
                    //DesignMode = DesignMode,
                    //IsVisible = true,
                    Wrapping = true,
                    Size = new Size(ContentAreaSize.Width, 0),
                    Content = message
                };

            labels.Add(newLabel);
            Add(newLabel);
            CheckOverflow();
            CheckPositions();

            if (!alreadyInDesignMode)
                OdysseyUI.CurrentHud.EndDesign();
        }
Exemple #2
0
 public Button()
     : base(ControlTag + (++count), ControlTag)
 {
     IsFocusable = false;
     label = new Label()
     {
         Id = ControlTag + TextLiteral.ControlTag,
         Content = Id,
         IsSubComponent = true,
         Parent = this,
         TextDescriptionClass = TextDescriptionClass,
     };
 }
Exemple #3
0
        static Label[] BuildLabels(int lines, Thickness padding, int margin, int rowHeight, string tClass, bool designMode, Size size)
        {
            Label[] labels = new Label[lines] ;

            for (int i = 0; i < lines; i++)
                labels[i] = new Label
                {
                    Id = string.Format("{0}_{1}{2}", ControlTag, TextLiteral.ControlTag, i),
                    Position = new SlimDX.Vector2(padding.Left, padding.Top + (i * rowHeight)),
                    TextDescriptionClass = tClass,
                    DesignMode = designMode,
                    IsVisible = false,
                    Wrapping = true,
                    Size = size
                };

            return labels;
        }
Exemple #4
0
        protected void OnCompleted(object sender, BoxEventArgs e)
        {
            DateTime end = DateTime.Now;
            Label label = new Label
            {
                Position = new Vector2(400, 300),
                TextDescriptionClass = "Large",
                Content = "Session complete\nTrial " + (Test.Count+1)
            };

            Test.Count++;

            if (Test.Count > 0 && Test.Count % 8 == 0)
                label.Content += "\nPlease have a break.";

            if (Test.Count == BoxRenderer.ConditionsCount)
                label.Content = "Thanks, this task is now complete";

            completed = true;

            OdysseyUI.CurrentHud.BeginDesign();
            OdysseyUI.CurrentHud.Controls.Add(label);
            OdysseyUI.CurrentHud.EndDesign();

            BoxPerformance bp = new BoxPerformance();
            bp.SetData(BoxRenderer.startTime, end, events);

            bp.ShowDialog();

            if (Completed != null)
                Completed(sender, e);
        }
Exemple #5
0
        public override void Init()
        {
            clock = new Timer() { Interval = 1000 };
            stopwatch = new Stopwatch();
            clock.Elapsed += delegate
                             {

                                 lCountDown.Content = (--countdown).ToString();
                                 if (countdown == 0)
                                 {
                                     BoxRenderer boxR = new BoxRenderer(Game.Context);
                                     Global.Window.Dispatcher.BeginInvoke(new Action(delegate { Game.ChangeRenderer(boxR);boxR.StartNew(); }));

                                     clock.Stop();
                                 }
                             };
            //Camera.LookAt(new Vector3(3,0f, 3), new Vector3(-6.5f, 5.55f, -6.5f));
            int[] condition = conditions[Test.BoxIndex % conditions.Count];
            bool[] arrowCondition = arrowConditions[condition[1]];
            boxSize = new float[]
            {
                arrowCondition[0] ? 1.5f : 4.5f,
                arrowCondition[1] ? 1.5f : 4.5f,
                arrowCondition[2] ? 1.5f : 4.5f
            };
            box = new Box(1, 1, 1);
            box.ScalingValues = new Vector3(boxSize[0], boxSize[1], boxSize[2]);
            sWidget = new ScalingWidget(box);

            RenderableNode rNodeBox = new RenderableNode(box) { Label = "RBox" };
            float[] axis = axes[condition[2]];

            FixedNode fNodeFrame = new FixedNode {
                Label = "fGrid",
                Position = Vector3.Zero,
                Rotation = Quaternion.RotationYawPitchRoll(MathHelper.DegreesToRadians(axis[0]),
                MathHelper.DegreesToRadians(axis[1]),
                MathHelper.DegreesToRadians(axis[2]))
            };

            fNodeBox = new FixedNode
            {
                Label = "fBox",
            };

            NewSession();

            CameraAnchorNode coNode = new CameraAnchorNode();
            Scene.Tree.RootNode.AppendChild(fNodeFrame);
            Scene.Tree.RootNode.AppendChild(coNode);
            fNodeBox.AppendChild(rNodeBox);
            fNodeFrame.AppendChild(bbox.ToBranch());
            fNodeFrame.AppendChild(fNodeBox);

            FixedNode nWidget = sWidget.ToBranch();
            fNodeBox.AppendChild(nWidget);

            DeviceContext.Immediate.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList;

            Hud = Hud.FromDescription(Game.Context.Device,
                new HudDescription(
                    width: Game.Context.Settings.ScreenWidth,
                    height: Game.Context.Settings.ScreenHeight,
                    zNear: Game.CurrentRenderer.Camera.NearClip,
                    zFar: Game.CurrentRenderer.Camera.FarClip,
                    cameraEnabled: true,
                    multithreaded: true
                    ));
            OdysseyUI.CurrentHud = Hud;

            Hud.BeginDesign();

            bNew = new Button()
            {
                Size = new System.Drawing.Size(120, 60),
                Content = "New Session",
                Position = new Vector2(1760, 0)
            };

            Button bSession = new Button()
            {
                Size = new System.Drawing.Size(120, 30),
                Content = "Next",
                Position = new Vector2(1760, 40)
            };
            bSession.MouseClick += (sender, e) =>
            {
                //Test.BoxIndex++;
                Test.Count= (Test.Count + 1) % conditions.Count;
                BoxRenderer boxR = new BoxRenderer(Game.Context);
                Global.Window.Dispatcher.BeginInvoke(new Action(delegate { Game.ChangeRenderer(boxR); boxR.StartNew(); }));
            };

            Button bStop = new Button
            {
                Size = new System.Drawing.Size(120, 60),
                Content = "Stop",
                Position = new Vector2(0, 1020)
            };
            bStop.TouchUp += (sender, e) =>
                {
                    stopwatch.Stop();
                    Stop(new BoxEventArgs(startTime,DateTime.Now, true));
                };

            lCountDown = new Label()
                         {
                             Content = "3",
                             Position = new Vector2(800, 300),
                             IsVisible = false,
                             TextDescriptionClass = "Huge"
                         };

            rp = new TouchRayPanel { Size = Hud.Size, };//Camera = this.Camera };
            rp.SetScalingWidget(sWidget);
            rp.SetBox(box);
            rp.SetFrame((IBox)bbox);
            rp.SetArrowConditions(arrowCondition);
            rp.SetAxis(axis);
            Hud.Add(rp);
            //rp.Add(bSession);
            //rp.Add(bConnect);
            //rp.Add(bTracking);
            //
            rp.Add(bStop);
            rp.Add(bNew);
            rp.Completed += (sender, e) => ((BoxRenderer)Game.CurrentRenderer).Stop(e);

            bNew.MouseUp += delegate
                               {
                                   if (startingNewSession)
                                       return;
                                   startingNewSession = true;
                                   Hud.BeginDesign();
                                   lCountDown.IsVisible = true;
                                   Hud.Controls.Add(lCountDown);
                                   Hud.EndDesign();
                                   clock.Start();
                               };

            Hud.Init();
            Hud.EndDesign();

            Scene.BuildRenderScene();
            Hud.AddToScene(this, Scene);
            IsInited = true;
        }