コード例 #1
0
        /// <summary>
        /// Initializes toastr widget subclass with default values from widget template.
        /// </summary>
        /// <param name="context">Widget context</param>
        /// <param name="viewDesignPrefab">Prefab for toastr views</param>
        public new void Init(RosJsonMessage context, GameObject viewDesignPrefab)
        {
            duration = context.toastrDuration;
            color    = WidgetUtility.BytesToColor(context.toastrColor);
            fontSize = context.toastrFontSize;

            base.Init(context, viewDesignPrefab);
        }
コード例 #2
0
        /// <summary>
        /// Stores the initial data.
        /// </summary>
        /// <param name="context">the message which contains the initial data</param>
        /// <param name="viewDesignPrefab">the prefab that should be instantiated to show the widget</param>
        public new void Init(RosJsonMessage context, GameObject viewDesignPrefab)
        {
            color               = WidgetUtility.BytesToColor(context.graphColor);
            numXLabels          = context.xDivisionUnits;
            numYLabels          = context.yDivisionUnits;
            showCompleteHistory = context.showCompleteHistory;

            base.Init(context, viewDesignPrefab);
        }
コード例 #3
0
        /// <summary>
        /// Initialization of widget.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="viewDesignPrefab"></param>
        public void Init(RosJsonMessage context, GameObject viewDesignPrefab)
        {
            this.context          = context;
            id                    = context.id;
            childWidgetId         = context.childWidgetId;
            position              = WidgetUtility.StringToWidgetPosition(context.widgetPosition);
            relativeChildPosition = WidgetUtility.StringToRelativeChildPosition(context.relativeChildPosition);
            trainingInfo          = context.trainingInfo;

            this.viewDesignPrefab = viewDesignPrefab;
        }
コード例 #4
0
ファイル: TextWidget.cs プロジェクト: Roboy/TeleportVR
        /// <summary>
        /// Initializes text widget subclass with default values from widget template.
        /// </summary>
        /// <param name="context">Widget context</param>
        /// <param name="viewDesignPrefab">Prefab for icon views</param>
        public new void Init(RosJsonMessage context, GameObject viewDesignPrefab)
        {
            color    = WidgetUtility.BytesToColor(context.textColor);
            fontSize = context.textFontSize;

            TextWidgetTemplate incomingMessageTemplate = new TextWidgetTemplate(context.textMessage, WidgetUtility.BytesToColor(context.textColor), context.textFontSize);

            currentlyDisplayedMessage = incomingMessageTemplate;

            base.Init(context, viewDesignPrefab);
        }
コード例 #5
0
        /// <summary>
        /// Gets called when a new RosMessage arrives for the widget. Adds a new datapoint and/or updates
        /// the widget properties
        /// </summary>
        /// <param name="rosMessage">the message which contains the live data point</param>
        public override void ProcessRosMessage(RosJsonMessage rosMessage)
        {
            if (rosMessage.graphColor != null && rosMessage.graphColor.Length == 4)
            {
                color = WidgetUtility.BytesToColor(rosMessage.graphColor);
            }
            DateTime dt = DateTime.Now;

            if (rosMessage.graphTimestamp != 0)
            {
                DateTime epochStart = new DateTime(1970, 1, 1, 0, 0, 0, System.DateTimeKind.Utc);
                dt = epochStart.AddSeconds(rosMessage.graphTimestamp);
            }
            if (rosMessage.graphValue != 0)
            {
                AddDatapoint(new Datapoint(dt, rosMessage.graphValue));
            }

            showCompleteHistory = rosMessage.showCompleteHistory;
        }
コード例 #6
0
 /// <summary>
 /// Process incoming new ros message.
 /// </summary>
 /// <param name="rosMessage"></param>
 public override void ProcessRosMessage(RosJsonMessage rosMessage)
 {
     EnqueueNewMessage(rosMessage.toastrMessage, rosMessage.toastrDuration, WidgetUtility.BytesToColor(rosMessage.toastrColor), rosMessage.toastrFontSize);
 }
コード例 #7
0
ファイル: TextWidget.cs プロジェクト: Roboy/TeleportVR
        /// <summary>
        /// Process new incoming ros message.
        /// </summary>
        /// <param name="rosMessage"></param>
        public override void ProcessRosMessage(RosJsonMessage rosMessage)
        {
            TextWidgetTemplate incomingMessageTemplate = new TextWidgetTemplate(rosMessage.textMessage, WidgetUtility.BytesToColor(rosMessage.textColor), rosMessage.textFontSize);

            changeDisplayedMessage(incomingMessageTemplate);
        }