示例#1
0
        /// <summary>
        /// Загрузка всех каналов из базы данных
        /// </summary>
        /// <param name="m_connConfigDB">Ссылка на объект с установленным соединением с БД</param>
        /// <param name="m_listTEC">Список объектов, содержащий перечень каналов каждой ТЭЦ</param>
        public void InitChannels(DbConnection m_connConfigDB, List <TEC_LOCAL> m_listTEC)
        {
            int err = -1;

            List <SIGNAL> listRes = new List <SIGNAL>();
            SIGNAL        signal;

            DataTable list_channels = null;

            //Получить список каналов, используя статическую функцию
            list_channels = getListChannels(ref m_connConfigDB,out err);

            for (int i = 0; i < list_channels.Rows.Count; i++)
            {
                try
                {
                    signal = new SIGNAL(Convert.ToString(list_channels.Rows[i].ItemArray[Convert.ToInt32(PanelCommonAux.DB_TABLE_DATA.DESCRIPTION)]),
                                        Convert.ToInt32(list_channels.Rows[i].ItemArray[Convert.ToInt32(PanelCommonAux.DB_TABLE_DATA.USPD)]),
                                        Convert.ToInt32(list_channels.Rows[i].ItemArray[Convert.ToInt32(PanelCommonAux.DB_TABLE_DATA.CHANNEL)]),
                                        Convert.ToBoolean(list_channels.Rows[i].ItemArray[Convert.ToInt32(PanelCommonAux.DB_TABLE_DATA.USE)])
                                        );
                    m_listTEC[Convert.ToInt32(list_channels.Rows[i].ItemArray[Convert.ToInt32(PanelCommonAux.DB_TABLE_DATA.ID_TEC)]) - 1].m_arListSgnls[Convert.ToInt32(Enum.Parse(typeof(TEC_LOCAL.INDEX_DATA),Convert.ToString(list_channels.Rows[i].ItemArray[Convert.ToInt32(PanelCommonAux.DB_TABLE_DATA.GROUP)])))].Add(signal);
                }
                catch (Exception e)
                {
                    Logging.Logg().Exception(e,string.Format(@"Ошибка получения списка каналов"),Logging.INDEX_MESSAGE.NOT_SET);
                }
            }
        }
    void UpdateDigitalDisplay(bool bShow,SIGNAL s)
    {
        CarBillBoard_Label.color = Color.black;

        m_nSignalCurrent = s;

        if (s == SIGNAL.Circle)
        {
            CarBillBoard_Label.text = "O";
        }
        else if (s == SIGNAL.Cross)
        {
            CarBillBoard_Label.text = "X";
        }
        else if (s == SIGNAL.Triangle)
        {
            CarBillBoard_Label.text = "△";
        }
        else
        {
            CarBillBoard_Label.text = " ";
        }

        CarBillBoard_Label.enabled = bShow;
    }
示例#3
0
                private bool getListSignalResponse(DataTable tableListSignals)
                {
                    bool bRes = true;

                    SIGNAL sgnl;
                    string[] description;
                    string name_main = string.Empty
                        , name_detail = string.Empty;

                    foreach (DataRow r in tableListSignals.Rows) {
                        try {
                            switch (_key._current_type) {
                                case CONN_SETT_TYPE.DATA_AISKUE:
                                    sgnl = new SIGNAL() {
                                        id = (int)r[@"ID"]
                                        , kks_code = AIISKUE_KKSCODE.ToKKSCode((int)r[@"USPD_CODE"], (int)r[@"CODE"])
                                        , name_shr = string.Format(@"{0}", (string)r[@"NAME"])
                                        , name = string.Format(@"{0}", (string)r[@"NAME"])
                                    };
                                    break;
                                case CONN_SETT_TYPE.DATA_SOTIASSO:
                                    description = ((string)r[@"description"]).Split(new char[] { '.' });

                                    name_main = description[1].Split(' ')[1];
                                    name_detail = description[1].Split(' ')[description[1].Split(' ').Length - 1];

                                    sgnl = new SIGNAL() {
                                        id = (int)(decimal)r[@"id"]
                                        , kks_code = string.Format(@"{0}", (string)r[@"name"])
                                        , name_shr = string.Format(@"{0} {1}", name_main, name_detail.Equals(name_main) == false ? name_detail : string.Empty)
                                        , name = string.Format(@"{0}", (string)r[@"description"])
                                    };
                                    break;
                                default:
                                    sgnl = new SIGNAL();
                                    break;
                            }
                        } catch (Exception e) {
                            bRes = false;
                            sgnl = new SIGNAL();

                            Logging.Logg().Exception(e, string.Format(@"::getListSignalResponse () - ..."), Logging.INDEX_MESSAGE.NOT_SET);
                        }

                        if (sgnl.id > 0)
                            _signals.Add(sgnl);
                        else
                            ; // Logging.Logg().Error(string.Format(@""), Logging.INDEX_MESSAGE.NOT_SET)
                    }

                    return bRes;
                }
    void Behavior_Num_Start()
    {
        if (elapseTime_num == 0)
        {
            //m_nDigitalCurrent = Random.Range(1,10); // 1~9
            //m_nDigitalCurrent = GetRandomDigitExcept5(); // 1~9

            m_nSignalCurrent = GetRandomSignal();             // get signal
            UpdateDigitalDisplay(true,m_nSignalCurrent);
            // log the signal shown
            xMain.Instance.WriteLogIntoFile("Showing Signal:" + m_nSignalCurrent,true);

            // log the number shown
            //xMain.Instance.WriteLogIntoFile( "Showing Num:"+m_nDigitalCurrent +",Mode:" + m_Type_Current   , true );

            m_bAnswerPress = false;
        }

        if (m_bTimePauseByGameTime == false)        // v0.9
        {
            elapseTime_num += Time.deltaTime;
        }

        if (m_bAnswerPress == true)        // if press , don't display
        {
            UpdateDigitalDisplay(false,m_nSignalCurrent);
        }

        if (elapseTime_num > crossDelayTime)
        {
            if (!cross_random)
            {
                float probability = Random.value;
                if (probability < 0.75)
                {
                    //m_nSignalCurrent = SIGNAL.Cross;
                    UpdateDigitalDisplay(true,SIGNAL.Cross);
                    cross_show = true;
                    xMain.Instance.WriteLogIntoFile("Showing Signal:" + m_nSignalCurrent,true);
                    xMain.Instance.WriteLogIntoFile("Cross Show Up Time:" + crossDelayTime,true);
                }
                Debug.Log(probability);
                cross_random = true;
            }
        }

        if (elapseTime_num > 1)
        {
            elapseTime_num = 0;
            // you didn't answer , minus score
            if (m_bAnswerPress == false && cross_show == false)
            {
                xMain.Instance.GetGameCore().BloodDamageUpdate(0.1f,"NoPress");
                xMain.Instance.WriteLogIntoFile("BtnPress:" + "No," + "Signal:" + m_nSignalCurrent,true);
                //xMain.Instance.WriteLogIntoFile( "BtnPress:"+"X,"+"Num:"+m_nDigitalCurrent +",Mode:" + m_Type_Current   , true );
            }

            // you didn't answer and cross showed up, plus crossDelayTime
            if (m_bAnswerPress == false && cross_show == true)
            {
                crossDelayTime += deltaDelay;
            }

            // set cross signal can show
            cross_random = false;
            // hide cross
            cross_show = false;

            //UpdateDigitalDisplay( false , -1);
            UpdateDigitalDisplay(false,SIGNAL.Blank);
            m_bAnswerPress = true;

            updateDelegate_num = Behavior_Num_Finish;
        }
    }
示例#5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MSignal"/> class.
 /// </summary>
 /// <param name="Sender">The Sender.</param>
 /// <param name="Signal">The signal.</param>
 public MSignal(Object sender,SIGNAL signal)
 {
     this.Sender = sender;
     this.Signal = signal;
 }