// Start is called before the first frame update
        void Start()
        {
            // Welcome Message, showing that the communication between C++ dll and Unity was established correctly.
            Debug.Log("Connection between C++ Interface and Unity established with success !\n");
            PluxDevManager = new PluxDeviceManager(ScanResults, ConnectionDone);
            int welcomeNumber = PluxDevManager.WelcomeFunctionUnity();

            Debug.Log("Welcome Number: " + welcomeNumber);

            // Initialization of Variables.
            MultiThreadList = new List <List <int> >();
            ActiveChannels  = new List <int>();

            // Initialization of graphical zone.
            WindowGraph.IGraphVisual graphVisual = new WindowGraph.LineGraphVisual(GraphContainer, DotSprite, new Color(0, 158, 227, 0), new Color(0, 158, 227));
            GraphContainer = graphVisual.GetGraphContainer();
            GraphZone      = new WindowGraph(GraphContainer, graphVisual);
            GraphZone.ShowGraph(new List <int>()
            {
                0
            }, graphVisual, -1, (int _i) => "" + (_i), (float _f) => Mathf.RoundToInt(_f) + "k");

            // Create a timer that controls the update of real-time plot.
            System.Timers.Timer waitForPlotTimer = new System.Timers.Timer();
            waitForPlotTimer.Elapsed  += new ElapsedEventHandler(OnWaitingTimeEnds);
            waitForPlotTimer.Interval  = 1000; // 1 second.
            waitForPlotTimer.Enabled   = true;
            waitForPlotTimer.AutoReset = true;
        }
 private void Awake()
 {
     instance        = this;
     graphVisuals[0] = new LineGraphVisual(graphContainer, dotSprite, Color.blue, Color.gray);
     graphVisuals[1] = new BarGraphVisual(graphContainer, Color.blue, 0.7f);
     toolTipTxt      = toolTip.GetComponentInChildren <Text>();
     toolTipRect     = toolTip.GetComponent <RectTransform>();
 }
        public void SetGraphVisualObjectInfo(Vector2 graphPos, float graphPosWidth, string toolTipTxt,
                                             bool isEnd = false)
        {
            GetGraphPos();
            UpdateDotConnection();

            Button_UI dotButton = dotGameObject.GetComponent <Button_UI>();

            dotButton.MouseOverOnceFunc = () => { WindowGraph.ShowToolTipStatic(toolTipTxt, graphPos); };
            dotButton.MouseOutOnceFunc  = () => { WindowGraph.HideToolTipStatic(); };
            OnChangedGraphVisualObject?.Invoke(this, EventArgs.Empty);
        }
Esempio n. 4
0
        // Start is called before the first frame update
        private void Awake()
        {
            InterfaceObject  = GameObject.Find("UI");
            Engine           = GetComponent <EngineModel>();
            VehicleRigidBody = GetComponent <Rigidbody>();
            Speedometer      = InterfaceObject.GetComponent <SpeedometerScript>();
            GraphObject      = InterfaceObject.transform.Find("Canvas").gameObject.transform.Find("WindowGraph").GetComponent <WindowGraph>();
            graph            = InterfaceObject.GetComponent <Graph>();
            GearField        = InterfaceObject.transform.Find("Canvas").gameObject.transform.Find("Gear").GetComponent <Text>();

            (s_SpeedType, m_SpeedCoefficient) = GenericFunctions.SpeedTypeConverter(m_SpeedType);
        }
Esempio n. 5
0
        public void SetGraphVisualObjectInfo(Vector2 graphPos, float graphPosWidth, string toolTipTxt,
                                             bool isEnd = false)
        {
            RectTransform rectTransform = barObject.GetComponent <RectTransform>();

            rectTransform.anchoredPosition = new Vector2(graphPos.x, 0f);
            rectTransform.sizeDelta        = new Vector2(graphPosWidth * barWidthMultiplier, graphPos.y);

            Button_UI buttonUi = barObject.GetComponent <Button_UI>();

            buttonUi.MouseOverOnceFunc = () => { WindowGraph.ShowToolTipStatic(toolTipTxt, graphPos); };
            buttonUi.MouseOutOnceFunc  = WindowGraph.HideToolTipStatic;
        }
Esempio n. 6
0
 private void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         _instance = this;
     }
     loginScreen.SetActive(true);
     gameObject.transform.parent.parent.gameObject.SetActive(false);
     gameObject.transform.parent.parent.gameObject.GetComponent <LunchDataScreen>().enabled = true;
 }
        // Start is called before the first frame update
        void Start()
        {
            // Welcome Message, showing that the communication between C++ dll and Unity was established correctly.
            Debug.Log("Connection between C++ Interface and Unity established with success !\n");
            PluxDevManager = new PluxDeviceManager();
            int welcomeNumber = PluxDevManager.WelcomeFunctionUnity();

            Debug.Log("Welcome Number: " + welcomeNumber);

            // Initialization of Variables.
            MultiThreadList = new List <List <int> >();
            ActiveChannels  = new List <int>();

            // Initialization of graphical zone.
            WindowGraph.IGraphVisual graphVisual = new WindowGraph.LineGraphVisual(GraphContainer, DotSprite, new Color(0, 158, 227, 0), new Color(0, 158, 227));
            GraphContainer = graphVisual.GetGraphContainer();
            GraphZone      = new WindowGraph(GraphContainer, graphVisual);
            GraphZone.ShowGraph(new List <int>()
            {
                0
            }, graphVisual, -1, (int _i) => "" + (_i), (float _f) => Mathf.RoundToInt(_f) + "k");
        }
 void Start()
 {
     GraphWindow = GraphCanvas.GetComponentInChildren <WindowGraph>();
     GraphCanvas.transform.position = GraphCanvas.transform.position + new Vector3(0, -110, 0);
 }
        public void Initialize()
        {
            var is360Level = _beatmapData.spawnRotationEventsCount > 0;
            var pos        = is360Level ? _config.Chart360LevelPosition : _config.ChartStandardLevelPosition;
            var rot        = is360Level
                                ? Quaternion.Euler(_config.Chart360LevelRotation)
                                : Quaternion.Euler(_config.ChartStandardLevelRotation);

            _floatingScreen = FloatingScreen.CreateFloatingScreen(_config.ChartSize, false, pos, rot, curvatureRadius: 0f, hasBackground: _config.HasBackground);
            _floatingScreen.SetRootViewController(this, AnimationType.None);
            _floatingScreen.name = nameof(SongChartVisualizer);

            if (_config.HasBackground)
            {
                var imageView = _floatingScreen.GetComponentInChildren <ImageView>();
                imageView.material = _assetLoader.UINoGlowMaterial;
                imageView.color    = _config.CombinedBackgroundColor;

                transform.SetParent(imageView.transform);
            }

            if (_audioTimeSyncController.songLength < 0)
            {
                _shouldNotRunTick = true;
                return;
            }

            // _siraLog.Debug($"There are {_beatmapData.beatmapObjectsData.Count(x => x.beatmapObjectType == BeatmapObjectType.Note)} notes");
            // _siraLog.Debug($"There are {_beatmapData.beatmapLinesData.Count} lines");

            _npsSections = GetNpsSections(_beatmapData);
#if DEBUG
            for (var i = 0; i < _npsSections.Count; i++)
            {
                var npsInfos = _npsSections[i];
                _siraLog.Debug($"Nps at section {i + 1}: {npsInfos.Nps} (from [{npsInfos.FromTime}] to [{npsInfos.ToTime}])");
            }
#endif

            _siraLog.Debug("Loading assetbundle..");
            var assembly = Assembly.GetExecutingAssembly();
            using (var stream = assembly.GetManifestResourceStream("SongChartVisualizer.UI.linegraph"))
            {
                _assetBundle = AssetBundle.LoadFromStream(stream);
            }

            if (!_assetBundle)
            {
                _siraLog.Warn("Failed to load AssetBundle! The chart will not work properly..");
            }
            else
            {
                var prefab = _assetBundle.LoadAsset <GameObject>("LineGraph");
                var sprite = _assetBundle.LoadAsset <Sprite>("Circle");
                var go     = Instantiate(prefab, transform);

                go.transform.Translate(0.04f, 0, 0);
                _windowGraph = go.AddComponent <WindowGraph>();
                _windowGraph.circleSprite          = sprite;
                _windowGraph.transform.localScale /= 10;
                var npsValues = _npsSections.Select(info => info.Nps).ToList();
                _windowGraph.ShowGraph(npsValues, false, linkColor: _config.LineColor);

                _currentSectionIdx = 0;
                _currentSection    = _npsSections[_currentSectionIdx];

                CreateSelfCursor(_config.PointerColor);

                if (_config.PeakWarning)
                {
                    var highestValue = _npsSections.Max(info => info.Nps);
                    _hardestSectionIdx = _npsSections.FindIndex(info => Math.Abs(info.Nps - highestValue) < 0.001f);
                    PrepareWarningText();

                    FadeInTextIfNeeded();
                }
            }
        }
Esempio n. 10
0
 private void Awake()
 {
     dbHandler = GameObject.Find("DatabaseHandler").GetComponent <DatabaseHandler>();
     graph     = GameObject.Find("Window_Graph").GetComponent <WindowGraph>();
 }