Exemplo n.º 1
0
        /// <summary>
        /// Updates this node based on the value of "selected".
        /// </summary>
        private void ChangeGraph()
        {
            if (selected < 0)
            {
                GraphGUID        = null;
                Inputs           = new List <NodeInput>();
                InputNames       = new List <string>();
                InputDefaultVals = new List <float>();
            }
            else
            {
                GraphGUID = guids[selected];

                Graph g = TryLoadGraph();
                if (g != null)
                {
                    if (convertParamsToInputs)
                    {
                        SetInputsFrom(new GraphParamCollection(g).FloatParams);
                    }
                    else
                    {
                        Inputs.Clear();
                        InputNames.Clear();
                        InputDefaultVals.Clear();
                    }
                }

                UpdateGraphPaths();
                selected = guids.IndexOf(GraphGUID);
            }
        }
Exemplo n.º 2
0
        protected override bool CustomGUI()
        {
            bool changed = false;

            {
                bool oldConverted = convertParamsToInputs;
                convertParamsToInputs = GUILayout.Toggle(convertParamsToInputs, "Convert params to inputs");
                if (oldConverted && !convertParamsToInputs)
                {
                    changed = true;
                    Inputs.Clear();
                    InputNames.Clear();
                    InputDefaultVals.Clear();
                }
                else if (!oldConverted && convertParamsToInputs)
                {
                    changed = true;
                    Graph g = TryLoadGraph();
                    if (g == null)
                    {
                        convertParamsToInputs = false;
                    }
                    else
                    {
                        SetInputsFrom(new GraphParamCollection(g).FloatParams);
                    }
                }
            }

            Vector2 textDims = GUI.skin.label.CalcSize(new GUIContent("Graph:"));

            EditorGUIUtility.labelWidth = textDims.x;
            int newIndex = EditorGUILayout.Popup("Graph:", selected, names, GUILayout.MinWidth(100.0f));

            if (selected != newIndex)
            {
                selected = newIndex;
                ChangeGraph();
                changed = true;
            }

            if (GUILayout.Button("Refresh graphs"))
            {
                changed = CheckOutGraphs(true) || changed;
            }

            return(changed);
        }
Exemplo n.º 3
0
        public void UpDateSignals(Parameters parameters)
        {
            InputNames.Clear();
            InputMeanings.Clear();
            OutputNames.Clear();
            OutputMeanings.Clear();
            foreach (string addSignal in _mineConfig.AuziDSignalsConfig.AddedSignals)
            {
                int index;
                if (Int32.TryParse(addSignal, out index))
                {
                    if (index < 72)
                    {
                        InputNames.Add(codes[index] + " " + _mineConfig.AuziDSignalsConfig.SignalsNames[index]);
                        if (parameters.AuziDIOSignalsState[index] == AuziDState.On)
                        {
                            InputMeanings.Add(Color.Green);
                        }
                        else if (parameters.AuziDIOSignalsState[index] == AuziDState.Off)
                        {
                            InputMeanings.Add(Color.Silver);
                        }
                        else if (parameters.AuziDIOSignalsState[index] == AuziDState.Undefind)
                        {
                            InputMeanings.Add(Color.White);
                        }
                    }
                    else
                    {
                        OutputNames.Add(codes[index] + " " + _mineConfig.AuziDSignalsConfig.SignalsNames[index]);
                        if (parameters.AuziDIOSignalsState[index] == AuziDState.On)
                        {
                            OutputMeanings.Add(Color.Green);
                        }
                        else if (parameters.AuziDIOSignalsState[index] == AuziDState.Off)
                        {
                            OutputMeanings.Add(Color.Silver);
                        }
                        else if (parameters.AuziDIOSignalsState[index] == AuziDState.Undefind)
                        {
                            OutputMeanings.Add(Color.White);
                        }
                    }
                }
                if (parameters.AuziDIOSignalsState[73] == AuziDState.Off)
                {
                    if (_leftPerepodiom == 0)
                    {
                        var dataBaseService = new DataBaseService();
                        dataBaseService.FillGeneralLog("Левый переподъём ФПК", "Левый переподъём ФПК", GeneralLogEventType.Demage);
                    }
                    _leftPerepodiom = 1;
                }
                else
                {
                    _leftPerepodiom = 0;
                }
                if (parameters.AuziDIOSignalsState[72] == AuziDState.Off)
                {
                    if (_rightPerepodiom == 0)
                    {
                        var dataBaseService = new DataBaseService();
                        dataBaseService.FillGeneralLog("Правый переподъём ФПК", "Правый переподъём ФПК", GeneralLogEventType.Demage);
                    }
                    _rightPerepodiom = 1;
                }
                else
                {
                    _rightPerepodiom = 0;
                }
                if (parameters.AuziDIOSignalsState[78] == AuziDState.Off)
                {
                    if (_prevSpeed == 0)
                    {
                        var dataBaseService = new DataBaseService();
                        dataBaseService.FillGeneralLog("Превышение скорости", "Превышение скорости", GeneralLogEventType.Demage);
                    }
                    _prevSpeed = 1;
                }
                else
                {
                    _prevSpeed = 0;
                }
            }

            /* int numEdded = InputNames.Count;
             * for (int i = numEdded; i < 32; i++)
             * {
             *   InputNames.Add("");
             *   InputMeanings.Add(Color.Gray);
             * }
             * numEdded = OutputNames.Count;
             * for (int i = numEdded; i < 16; i++)
             * {
             *   OutputNames.Add("");
             *   OutputMeanings.Add(Color.Gray);
             * } */
        }