Example #1
0
    public void Add(OperateStep onestep)
    {
        if (stepmap.ContainsKey(onestep))
        {
            if (string.IsNullOrEmpty(formula))
            {
                formula += stepmap [onestep];
            }
            else
            {
                char[]   charSeparator = new char[] { ',' };
                string[] l             = formula.Split(charSeparator, System.StringSplitOptions.RemoveEmptyEntries);

                // 获得上一步存储的步骤序号
                int ps = (int)GetString2Step(l [l.Length - 1]);
                int cs = (int)onestep;

                // TODO: 检查新步骤是否与上一步骤有冲突,进行公式合并。
                if ((cs / 3) == (ps / 3))
                {
                    Delete();
                    if ((cs % 3) == (ps % 3))
                    {
                        if (cs % 3 == 0)                           // 相加等于2
                        {
                            Add((OperateStep)(cs + 1));
                        }
                        else if (cs % 3 == 2)
                        {
                            Add((OperateStep)(cs - 1));
                        }
                    }
                    else
                    {
                        if (cs % 3 == 1)
                        {
                            Add((OperateStep)(cs * 2 - ps));
                        }
                        else if (ps % 3 == 1)
                        {
                            Add((OperateStep)(ps * 2 - cs));
                        }
                    }
                }
                else
                {
                    formula += "," + stepmap [onestep];
                }
            }
        }
        formulatext.text = formula;
    }
Example #2
0
    OperateStep GetString2Step(string val)
    {
        OperateStep step = OperateStep.B;

        foreach (OperateStep s in stepmap.Keys)
        {
            if (stepmap [s].Equals(val))
            {
                step = s;
                break;
            }
        }
        return(step);
    }
Example #3
0
    IEnumerator DoFormula()
    {
        mysteps.Clear();
        string context = formula;

//		context = context.Replace ("\n", "");
//		context = context.Replace ("\r", "");
//		context = context.Replace ("\t", "");
//		context = context.Replace (" ", "");
        char[]   charSeparator = new char[] { ',' };
        string[] l             = null;
        l = context.Split(charSeparator, System.StringSplitOptions.RemoveEmptyEntries);
        for (int i = 0; i < l.Length; i++)
        {
            mysteps.Add(l [i]);
        }
        while (!string.IsNullOrEmpty(formula) && mysteps.Count > 0)
        {
            if (operater.Stop)
            {
                // 等待1秒,如果是新手,应该多加等待
                yield return(new WaitForSeconds(spacetime));

                // 找到map的第一个公式
                OperateStep curstep = GetString2Step(mysteps [0]);                 // OperateStep.U;
//				foreach (OperateStep step in stepmap.Keys) {
//					if (stepmap [step] == mysteps [0]) {
//						curstep = step;
//						break;
//					}
//				}

                operater.DoSingleStep(curstep);
                // 去掉公式的第一个操作字符串,生成剩下的公式字符串(适用于用户自己编写的公式)(盲拧)
                if (mysteps.Count > 1)
                {
                    formula = formula.Remove(0, mysteps [0].Length + 1);
                }
                else
                {
                    formula = formula.Remove(0, mysteps [0].Length);
                }
                mysteps.Remove(mysteps [0]);
            }
            formulatext.text = formula;
            yield return(null);
        }
    }
Example #4
0
    public void CreatBrokeFormula()
    {
        int    lf = Random.Range(1, 21); // length of formula
        int    si = -1;                  // 记录当前公式的序号
        string fb = "";                  // 生成的打乱公式
        string fr = "";                  // 生成的还原公式

        for (int i = 0; i < lf;)
        {
            int cs = Random.Range(0, 18);
            if ((int)(cs / 3) != (int)(si / 3))
            {
                si = cs;

                OperateStep onestep = (OperateStep)cs;
                if (string.IsNullOrEmpty(fb))
                {
                    fb += stepmap [onestep];
                }
                else
                {
                    fb += "," + stepmap [onestep];
                }

                int         rs     = (int)(cs / 3) * 3 + (2 - cs % 3);
                OperateStep restep = (OperateStep)rs;

                if (string.IsNullOrEmpty(fr))
                {
                    fr = stepmap [restep];
                }
                else
                {
                    fr = stepmap [restep] + "," + fr;
                }

                i++;
            }
        }
        astr = fb;
        bstr = fr;
        print(fb);
        print(fr);
    }
Example #5
0
    public void Add(OperateStep onestep)
    {
        if (stepmap.ContainsKey (onestep)) {
            if (string.IsNullOrEmpty (formula)) {
                formula += stepmap [onestep];
            } else {

                char[] charSeparator = new char[] { ',' };
                string[] l = formula.Split (charSeparator, System.StringSplitOptions.RemoveEmptyEntries);

                // 获得上一步存储的步骤序号
                int ps = (int)GetString2Step (l [l.Length - 1]);
                int cs = (int)onestep;

                // TODO: 检查新步骤是否与上一步骤有冲突,进行公式合并。
                if ((cs / 3) == (ps / 3)) {
                    Delete ();
                    if ((cs % 3) == (ps % 3)) {
                        if (cs % 3 == 0) { // 相加等于2
                            Add ((OperateStep)(cs + 1));
                        } else if (cs % 3 == 2) {
                            Add ((OperateStep)(cs - 1));
                        }
                    } else {
                        if (cs % 3 == 1) {
                            Add ((OperateStep)(cs * 2 - ps));
                        } else if (ps % 3 == 1) {
                            Add ((OperateStep)(ps * 2 - cs));
                        }
                    }
                } else {
                    formula += "," + stepmap [onestep];
                }
            }
        }
        formulatext.text = formula;
    }
        /// <summary>
        /// ��ʾ��������ݹ���ؼ�  --- ��������List<ILEDDisplayInfo>�仯ΪDictionary<string, List<ILEDDisplayInfo>>��
        ///                             keyֵΪ�������ƣ����Ҹ�������Ϣʵ��Ϊ��Ҫ��ص�������Ϣ
        /// </summary>
        public MarsScreenMonitorDataViewer()
        {
            InitializeComponent();
            CurrentFont = this.Font;
            _customToolTipFont = this.Font;
            _complexScreenFont = this.Font;
            _simpleOrStandardScreenFont = this.Font;
            _needUpdateFont = this.Font;

            _updateMonitorDataForNotUpdateDic = new Dictionary<string, Dictionary<string, ScannerMonitorData>>();
            CompeleteConfigScanBoardDisplayEvent += new EventHandler(MarsScreenMonitorDataViewer_CompeleteConfigScanBoardDisplayEvent);

            _curMonitorConfigInfo = new MonitorConfigData();
            _curAllLedScreenRectDic = new Dictionary<string, List<ScreenGridBindObj>>();
            //_physicalScreenInfo = new PhysicalDisplayInfo();
            _curTempMaxMinKeyInfo = new TempAndHumiInfo();
            _curHumiMaxMinKeyInfo = new TempAndHumiInfo();
            _tempStatisInfo = new TempAndHumiStatisticsInfo();
            _humiStatisInfo = new TempAndHumiStatisticsInfo();
            _curOperateStep = OperateStep.None;

            _indicator.BackColor = Color.White;
            _indicator.CircleColor = Color.Blue;
            _indicator.AnimationSpeed = 50;

            #region ��ʼ������ؼ�
            _complexScreenLayout = new UC_ComplexScreenLayout();
            _complexScreenLayout.Parent = panel_Display;
            _complexScreenLayout.Dock = DockStyle.Fill;
            _complexScreenLayout.ClearAllMonitorInfo();
            _complexScreenLayout.CurType = _curType;

            _statusRectangleLayout = new UC_StatusRectangleLayout();
            _statusRectangleLayout.DefaultFocusStyle.BackColor = Color.White;
            _statusRectangleLayout.DefaultFocusStyle.BoardColor = Color.Yellow;
            _statusRectangleLayout.IsCanSelect = false;
            _statusRectangleLayout.Parent = panel_Display;
            _statusRectangleLayout.Dock = DockStyle.Fill;
            //_statusRectangleLayout.BorderStyle = BorderStyle.FixedSingle;
            _statusRectangleLayout.BackColor = Color.Transparent;
            _statusRectangleLayout.ClearAllRectangularGrid();
            _statusRectangleLayout.CurType = _curType;

            _sbStatusInfoUC = new UC_StatusInfo(CommonStaticValue.SBStatusDisplayStr[0],
                                                CommonStaticValue.SBStatusDisplayStr[1],
                                                CommonStaticValue.SBStatusDisplayStr[2]);
            _sbStatusInfoUC.Parent = panel_Info;
            _sbStatusInfoUC.Dock = DockStyle.Fill;

            _fanInfoUC = new UC_SmokeFanPowerInfo(CommonStaticValue.FanDisplayStr[0], CommonStaticValue.FanDisplayStr[1]);
            _fanInfoUC.Parent = panel_Info;
            _fanInfoUC.Dock = DockStyle.Fill;

            _powerInfoUC = new UC_SmokeFanPowerInfo(CommonStaticValue.PowerDisplayStr[0], CommonStaticValue.PowerDisplayStr[1]);
            _powerInfoUC.Parent = panel_Info;
            _powerInfoUC.Dock = DockStyle.Fill;

            _smokeInfo = new UC_SmokeFanPowerInfo(CommonStaticValue.SmokeDisplayStr[0], CommonStaticValue.SmokeDisplayStr[1]);
            _smokeInfo.Parent = panel_Info;
            _smokeInfo.Dock = DockStyle.Fill;

            _tempInfoUC = new UC_TempAndHumiInfo(CommonStaticValue.TemperatureDisplayStr[0], CommonStaticValue.TemperatureDisplayStr[1],
                                                 CommonStaticValue.TemperatureDisplayStr[2], CommonStaticValue.TemperatureDisplayStr[3],
                                                 CommonStaticValue.TemperatureDisplayStr[4], CommonStaticValue.CelsiusUnit,
                                                 new ClickMaxMinValueEventHandler(ClickTempMaxMinValue));
            _tempInfoUC.Parent = panel_Info;
            _tempInfoUC.Dock = DockStyle.Fill;

            _humidityInfoUC = new UC_TempAndHumiInfo(CommonStaticValue.HumidityDisplayStr[0], CommonStaticValue.HumidityDisplayStr[1],
                                                     CommonStaticValue.HumidityDisplayStr[2], CommonStaticValue.HumidityDisplayStr[3],
                                                     CommonStaticValue.HumidityDisplayStr[4], CommonStaticValue.HUMIDITY_UNIT,
                                                     new ClickMaxMinValueEventHandler(ClickHumiMaxMinValue));
            _humidityInfoUC.Parent = panel_Info;
            _humidityInfoUC.Dock = DockStyle.Fill;

            _rowLineInfoUC = new UC_RowLineCabinetDoorInfo(CommonStaticValue.RowLineStr[0], CommonStaticValue.RowLineStr[1]);
            _rowLineInfoUC.Parent = panel_Info;
            _rowLineInfoUC.Dock = DockStyle.Fill;

            _mcStatusInfoUC = new UC_StatusInfo(CommonStaticValue.MCStatusDisplayStr[0],
                                                CommonStaticValue.MCStatusDisplayStr[1],
                                                CommonStaticValue.MCStatusDisplayStr[2]);
            _mcStatusInfoUC.Parent = panel_Info;
            _mcStatusInfoUC.Dock = DockStyle.Fill;

            _generalStatuInfoUC = new UC_RowLineCabinetDoorInfo(CommonStaticValue.GeneralStatusStr[0], CommonStaticValue.GeneralStatusStr[1]);
            _generalStatuInfoUC.Parent = panel_Info;
            _generalStatuInfoUC.Dock = DockStyle.Fill;

            _tempCorNoticeUC = new UC_TempAndHumidityCorNotice(MinTempValue, _curMonitorConfigInfo.TempAlarmThreshold,
                                                               MaxTempValue, CommonStaticValue.CelsiusUnit);
            _tempCorNoticeUC.Parent = panel_ColorMotice;
            _tempCorNoticeUC.Dock = DockStyle.Fill;

            _humidityCorNoticeUC = new UC_TempAndHumidityCorNotice(MinHumidityValue, _curMonitorConfigInfo.HumiAlarmThreshold,
                                                                   MaxHumidityValue, CommonStaticValue.HUMIDITY_UNIT);
            _humidityCorNoticeUC.Parent = panel_ColorMotice;
            _humidityCorNoticeUC.Dock = DockStyle.Fill;

            _sbStatusCorNotice = new UC_StatusCorNotice();
            _sbStatusCorNotice.Parent = panel_ColorMotice;
            _sbStatusCorNotice.Dock = DockStyle.Fill;

            _mcStatusCorNotice = new UC_StatusCorNotice();
            _mcStatusCorNotice.Parent = panel_ColorMotice;
            _mcStatusCorNotice.Dock = DockStyle.Fill;

            _smokeOrPowerCorNotice = new UC_SmokeFanPowerCorNotice(MonitorDisplayType.Smoke);
            _smokeOrPowerCorNotice.Parent = panel_ColorMotice;
            _smokeOrPowerCorNotice.Dock = DockStyle.Fill;

            _fanCorNotice = new UC_SmokeFanPowerCorNotice(MonitorDisplayType.Fan);
            _fanCorNotice.Parent = panel_ColorMotice;
            _fanCorNotice.Dock = DockStyle.Fill;

            _rowLineCorNotice = new UC_RowLineCorNotice();
            _rowLineCorNotice.Parent = panel_ColorMotice;
            _rowLineCorNotice.Dock = DockStyle.Fill;

            _generalStatusCorNotice = new UC_SmokeFanPowerCorNotice(MonitorDisplayType.GeneralSwitch);
            _generalStatusCorNotice.Parent = panel_ColorMotice;
            _generalStatusCorNotice.Dock = DockStyle.Fill;

            _statusRectangleLayout.GridMouseDoubleClick += new RectangularGridMouseEventHandler(StatusRectangleLayout_GridMouseDoubleClick);
            _statusRectangleLayout.GridMouseMove += new RectangularGridMouseEventHandler(StatusRectangleLayout_GridMouseMove);
            #endregion

            this.Disposed += new EventHandler(MarsScreenMonitorDataViewer_Disposed);
            vScrollBar_PixelLength.Value = (int)(DefaultLengthOnePixel * 100);
            vScrollBar_PixelLength_Scroll(null, null);

            _isNeedSetScaleRatio = false;
            _isHasValidMonitorInfo = false;
            //���ý����ϲ�ͬ��ʾ���Ϳؼ�������
            SetDisplayTypeControl();
            this.CurCtrlSystemMode = _curCtrlSystemMode;
        }
Example #7
0
 public void DoSingleStep(OperateStep step)
 {
     if (rotating) {
         return;
     }
     switch (step) {
     case OperateStep.L:
         DoLP ();
         break;
     case OperateStep.L0:
         DoLN ();
         break;
     case OperateStep.L2:
         DoLP2 ();
         break;
     case OperateStep.R:
         DoRP ();
         break;
     case OperateStep.R0:
         DoRN ();
         break;
     case OperateStep.R2:
         DoRP2 ();
         break;
     case OperateStep.U:
         DoUP ();
         break;
     case OperateStep.U0:
         DoUN ();
         break;
     case OperateStep.U2:
         DoUP2 ();
         break;
     case OperateStep.D:
         DoDP ();
         break;
     case OperateStep.D0:
         DoDN ();
         break;
     case OperateStep.D2:
         DoDP2 ();
         break;
     case OperateStep.F:
         DoFP ();
         break;
     case OperateStep.F0:
         DoFN ();
         break;
     case OperateStep.F2:
         DoFP2 ();
         break;
     case OperateStep.B:
         DoBP ();
         break;
     case OperateStep.B0:
         DoBN ();
         break;
     case OperateStep.B2:
         DoBP2 ();
         break;
     case OperateStep.X:
         DoXP ();
         break;
     case OperateStep.X0:
         DoXN ();
         break;
     case OperateStep.X2:
         DoXP2 ();
         break;
     case OperateStep.Y:
         DoYP ();
         break;
     case OperateStep.Y0:
         DoYN ();
         break;
     case OperateStep.Y2:
         DoYP2 ();
         break;
     case OperateStep.Z:
         DoZP ();
         break;
     case OperateStep.Z0:
         DoZN ();
         break;
     case OperateStep.Z2:
         DoZP2 ();
         break;
     }
     //		print ("~~~~~~~~" + step);
     // 每走一步进行一次判断。
     CheckAcomplished ();
 }
Example #8
0
    public void DoSingleStep(OperateStep step)
    {
        if (rotating)
        {
            return;
        }
        switch (step)
        {
        case OperateStep.L:
            DoLP();
            break;

        case OperateStep.L0:
            DoLN();
            break;

        case OperateStep.L2:
            DoLP2();
            break;

        case OperateStep.R:
            DoRP();
            break;

        case OperateStep.R0:
            DoRN();
            break;

        case OperateStep.R2:
            DoRP2();
            break;

        case OperateStep.U:
            DoUP();
            break;

        case OperateStep.U0:
            DoUN();
            break;

        case OperateStep.U2:
            DoUP2();
            break;

        case OperateStep.D:
            DoDP();
            break;

        case OperateStep.D0:
            DoDN();
            break;

        case OperateStep.D2:
            DoDP2();
            break;

        case OperateStep.F:
            DoFP();
            break;

        case OperateStep.F0:
            DoFN();
            break;

        case OperateStep.F2:
            DoFP2();
            break;

        case OperateStep.B:
            DoBP();
            break;

        case OperateStep.B0:
            DoBN();
            break;

        case OperateStep.B2:
            DoBP2();
            break;

        case OperateStep.X:
            DoXP();
            break;

        case OperateStep.X0:
            DoXN();
            break;

        case OperateStep.X2:
            DoXP2();
            break;

        case OperateStep.Y:
            DoYP();
            break;

        case OperateStep.Y0:
            DoYN();
            break;

        case OperateStep.Y2:
            DoYP2();
            break;

        case OperateStep.Z:
            DoZP();
            break;

        case OperateStep.Z0:
            DoZN();
            break;

        case OperateStep.Z2:
            DoZP2();
            break;
        }
    }