Пример #1
0
        protected override void OnInitialized()
        {
            pieChartComponent  = new PieChartComponent();
            lineChartComponent = new LineChartComponent();

            LastTsStatistics = DateTime.Now.ToString("dddd, dd MMMM yyyy - HH:mm:ss");
            LastTsAlerts     = DateTime.Now.ToString("dddd, dd MMMM yyyy - HH:mm:ss");

            _pieconfig  = pieChartComponent.config;
            _lineConfig = lineChartComponent.config;
            Twin        = new TwinEntity();
            Twin.Init();
            Alerts = AlertService.GetAlertsAsync();
        }
    public override void CreateObjects()
    {
        AnswerPieChartInstance               = Instantiate(AnswerPieChartPrefab, transform).GetComponent <PieChartComponent>();
        ConfirmationObjectInstance           = AnswerPieChartInstance.gameObject;
        OriginalConfirmationInstancePosition = AnswerPieChartInstance.transform.GetChild(0).position;
        var usedLightGray = false;

        foreach (var answer in AnswerTimes)
        {
            if (!usedLightGray)
            {
                usedLightGray = true;
                AnswerPieChartInstance.SetValue(answer.Key, answer.Value.Count, AnswerCorrectIncorrect[answer.Key] ? PieChartComponent.PieChartColor.Red : PieChartComponent.PieChartColor.LightGray);
            }
            else
            {
                AnswerPieChartInstance.SetValue(answer.Key, answer.Value.Count, AnswerCorrectIncorrect[answer.Key] ? PieChartComponent.PieChartColor.Red : PieChartComponent.PieChartColor.Grey);
            }
        }
        AnswerPieChartInstance.transform.GetChild(0).position  += new Vector3(0, -100, 0);
        AnswerPieChartInstance.transform.GetChild(0).localScale = new Vector3(2, 2, 2);
        AnswerPieChartInstance.gameObject.SetActive(false);
    }