Exemple #1
0
    void Start()
    {
        GameObject gameControllerObject = GameObject.FindWithTag("GameController");

        gameController = gameControllerObject.GetComponent <NextNum> ();
    }
Exemple #2
0
 /// <summary>
 /// Функция выдачи номера запроса
 /// </summary>
 /// <returns>номер запроса</returns>
 static public int GenQueryNum()
 {
     return(NextNum.Gen(13));
 }
Exemple #3
0
 /// <summary>
 /// Запуск симуляции по кнопке
 /// </summary>
 private void StartSimButton_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < StatusWindows.Count; i++)
     {
         ((StatusWindow)StatusWindows[i]).Dispose();
     }
     StatusWindows.Clear();
     if (OutputHandler.Init(FilePathTextBox.Text))
     {
         t = new Thread(new ThreadStart(MainThread));
         int BalanceType = 0;
         if (NoBalanceRadioButton.Checked)
         {
             BalanceType = 0;
         }
         if (DeCentralizedBalanceRadioButton.Checked)
         {
             BalanceType = 1;
         }
         if (CenralizedBalanceRadioButton.Checked)
         {
             BalanceType = 2;
         }
         if (DeCentralizedT2RadioButton.Checked)
         {
             BalanceType = 3;
         }
         if (CentralizedType2RadioButton.Checked)
         {
             BalanceType = 4;
         }
         ModelDays = (int)ModelDaysNumericUpDown.Value;
         DaysProgressBar.Maximum = ModelDays;
         DaysProgressBar.Value   = 0;
         TimeProgressBar.Maximum = 1440;
         ModelDaysLabel.Text     = "0";
         StopSimButton.Enabled   = true;
         StartSimButton.Enabled  = false;
         rh = new RegionsHandler((int)RegionsUpDown5.Value,
                                 (int)ClientsNumericUpDown.Value, (int)ServersUpDown.Value,
                                 (int)DBcapNumericUpDown.Value, BalanceType);
         rh.SetThrottle(RefreshSpeedTrackBar.Value);
         if (ZeroTimeСheckBox.Checked)
         {
             rh.SetTimeToZero();
         }
         rh.TS     += new TimeStatus(TimeStatusHandler);
         rh.DaysTS += new TimeStatus(ModelDaysStatusHandler);
         NextNum.Mode(RandomQueryCheckBox.Checked);
         if (StatusWindowsCheckBox.Checked)
         {
             int col = 0;
             int row = 0;
             for (int i = 0; i < rh.Regions.Count; i++)
             {
                 RBN          rbn = (RBN)rh.Regions[i];
                 StatusWindow sw  = new StatusWindow(rbn.Region_num,
                                                     rbn.Region_num * (int)ServersUpDown.Value,
                                                     rbn.Region_num * (int)ClientsNumericUpDown.Value,
                                                     rbn.Region_num * (int)ClientsNumericUpDown.Value,
                                                     rbn.Region_num * (int)DBcapNumericUpDown.Value);
                 StatusWindows.Add(sw);
                 rh.RIA += new RegionIsActive(sw.RegionStatusHandler);
                 rh.QS  += new QueueStatus(sw.QueueStatusHandler);
                 rh.QCS += new QueryCountStatus(sw.QueryCountStatusHandler);
                 rh.QWS += new QueueWeightStatus(sw.QueueWeightStatusHandler);
                 rh.GR  += new GeneralRegionStatus(sw.GeneralRegionStatusHandler);
                 if ((col + 1) * sw.Width + sw.Width >
                     Screen.PrimaryScreen.WorkingArea.Width)
                 {
                     col = 0;
                     row++;
                 }
                 sw.SetLocation((++col) * sw.Width, row * sw.Height);
             }
         }
         thread_life = true;
         t.Start();
     }
 }