Beispiel #1
0
        public static void GUI(this ColorRGBAMsg message, bool withText = true)
        {
            Color oldBackgroundColor = UnityEngine.GUI.color;

            GUILayout.BeginHorizontal();
            UnityEngine.GUI.backgroundColor = message.ToUnityColor();
            GUILayout.Box("", s_ColorSwatchStyle);
            UnityEngine.GUI.backgroundColor = oldBackgroundColor;
            if (withText)
            {
                GUILayout.Label($"R{message.r} G{message.g} B{message.b} A{message.a}");
            }
            GUILayout.EndHorizontal();
        }
Beispiel #2
0
        // public static TimeMsg TimeMsg(this DateTime dateTime)
        // {
        //     return new TimeMsg { sec = Convert.ToUInt32(dateTime.Ticks), nanosec = Convert.ToUInt32(dateTime.Millisecond * 1E6) };
        // }

        public static Color ToUnityColor(this ColorRGBAMsg message)
        {
            return(new Color(message.r, message.g, message.b, message.a));
        }