private void Start1(object argument) { #region Set your CancelButton, ProgressBar, and StatusLabel here... Form activeForm = this.parentControl; // set myForm=this; ToolStripSplitButton cancelButton = this.cancelButton; ToolStripProgressBar progressBar = this.progressBar; ToolStripStatusLabel statusLabel = this.progressLabel; // disable these controls when running... Control[] userControls = lockControls; #endregion bool isRunning = false; EventHandler cancel = null; FormClosingEventHandler formClosing = null; BackgroundTask.Start( argument, delegate(object sender, DoWorkEventArgs e) //(object sender, DoWorkEventArgs e) => { #region DoWorkEventHandler - main code goes here... // IMPORTANT: Do not access any GUI controls here. (This code is running in the background thread!) var w = (BackgroundWorker)sender; Thread.CurrentThread.Priority = ThreadPriority.BelowNormal; string tablename = e.Argument.ToString(); var dt = ds.Tables[tablename]; var df = new DataFactory(Provider, ConnectionString); df.TestConnection(); int maxRows = (int)df.ExecuteScalar("select count(*) from " + tablename); int nr = 0; var sr = new StatusReport(); sr.SetBackgroundWorker(w, e, 1); sr.ReportProgress("Loading", 0, maxRows, 0); string query = "select * from " + tablename + " (nolock)"; foreach (var item in df.ExecuteReader(query)) { nr++; if (sr.CanReportProgress()) { sr.Value = nr; sr.ReportProgress(); } var dr = dt.NewRow(); DataUtil.CopyRow(item, dr); dt.Rows.Add(dr); } sr.ReportProgress("Complete", 0, maxRows, maxRows); #endregion }, delegate(object sender, EventArgs e) //(object sender, DoWorkEventArgs e) => { #region EventHandler - initialize code goes here... // It is safe to access the GUI controls here... progressBar.Visible = true; progressBar.Minimum = progressBar.Maximum = progressBar.Value = 0; isRunning = true; #region Hookup event handlers for Button.Canceland Form.FormClosing var w = sender as BackgroundWorker; if (w != null && w.WorkerSupportsCancellation) { if (cancelButton != null) { cancel = (object sender2, EventArgs e2) => { //var w = sender2 as BackgroundWorker; string msg = "The application is still busy processing. Do you want to stop it now?"; if (MessageBox.Show(msg, "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { w.CancelAsync(); } }; cancelButton.Click += cancel; cancelButton.Enabled = true; cancelButton.Visible = true; } } // also, confirm the user if the user clicks the close button. if (activeForm != null) { formClosing = (object sender2, FormClosingEventArgs e2) => { if (!isRunning) { return; } string msg = "The application is still busy processing. Do you want to close the application anyway?"; e2.Cancel = MessageBox.Show(msg, "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) != DialogResult.Yes; }; activeForm.FormClosing += formClosing; } #endregion FormUtil.Busy(activeForm, userControls, true); #endregion }, delegate(object sender, ProgressChangedEventArgs e) //(object sender, ProgressChangedEventArgs e) => { #region ProgressChangedEventHandler - update progress code goes here... // It is safe to access the GUI controls here... var sr = e.UserState as StatusReport; if (sr == null) { return; } StatusReport.UpdateStatusReport(progressBar, sr); statusLabel.Text = sr.ToString(); activeForm.Refresh(); #endregion }, delegate(object sender, RunWorkerCompletedEventArgs e) //(object sender, RunWorkerCompletedEventArgs e) => { #region RunWorkerCompletedEventHandler - cleanup code goes here... // It is safe to access the GUI controls here... try { if (e.Error != null) { throw e.Error; } } catch (Exception ex) { MessageBox.Show(ex.ToString(), ex.Message); } finally { FormUtil.Busy(activeForm, userControls, false); progressBar.Visible = false; if (cancel != null) { cancelButton.Click -= cancel; cancelButton.Enabled = false; cancelButton.Visible = false; } if (formClosing != null) { activeForm.FormClosing -= formClosing; } isRunning = false; statusLabel.Text = "Ready"; } #endregion }); }
public async Task Update(ISqlTransactionHandler transactionHandler, ClientData clientData) { if (clientData.Manager.GetState(clientData) == DataState.Updated) { await _providerFactory.EstablishTransaction(transactionHandler, clientData); using (DbCommand command = transactionHandler.Connection.CreateCommand()) { command.CommandText = "[bla].[UpdateClient]"; command.CommandType = CommandType.StoredProcedure; command.Transaction = transactionHandler.Transaction.InnerTransaction; IDataParameter timestamp = DataUtil.CreateParameter(_providerFactory, "timestamp", DbType.DateTime2); timestamp.Direction = ParameterDirection.Output; command.Parameters.Add(timestamp); DataUtil.AddParameter(_providerFactory, command.Parameters, "id", DbType.Guid, DataUtil.GetParameterValue(clientData.ClientId)); DataUtil.AddParameter(_providerFactory, command.Parameters, "name", DbType.String, DataUtil.GetParameterValue(clientData.Name)); await command.ExecuteNonQueryAsync(); clientData.UpdateTimestamp = (DateTime)timestamp.Value; } } }
public async Task Get_One_By_Name_For_Render_Mongo_Test() { if (!_context.AllowMongoDB) { Assert.True(true); return; } // Arrange #pragma warning disable CA2000 // Dispose objects before losing scope PageMongoRepository pageRepository = new PageMongoRepository(_context.GetMongoConnection()); #pragma warning restore CA2000 // Dispose objects before losing scope // Act Page pageBuilderTest = new Page { Id = DataUtil.GenerateUniqueId(), Name = "page-builder-3", DisplayName = "Page Builder", UrlPath = "portal/page/builder", ShellOptions = new List <ShellOption>(), Claims = new List <PortalClaim> { PortalClaimStandards.AllowAccess }, PageDatasources = new List <PageDatasource> { new PageDatasource { Id = "asd", IsActive = true, Name = "data", Options = new LetPortal.Portal.Entities.Shared.DatasourceOptions { Type = LetPortal.Portal.Entities.Shared.DatasourceControlType.Database, DatabaseOptions = new LetPortal.Portal.Entities.Shared.SharedDatabaseOptions { DatabaseConnectionId = "sfasfasf", Query = "{\"$query\":{\"databases\":[{\"$match\":{\"_id\":\"ObjectId('{{queryparams.id}}')\"}}]}}" } } } }, Commands = new List <PageButton> { new PageButton { Id = "180b55dd-e31f-387f-0844-7a9c74f88941", Name = "Save", Icon = "save", Color = "primary", AllowHidden = "!!queryparams.id", IsRequiredValidation = true, ButtonOptions = new ButtonOptions { ActionCommandOptions = new ActionCommandOptions { ActionType = ActionType.ExecuteDatabase, DbExecutionChains = new DatabaseExecutionChains { Steps = new List <DatabaseExecutionStep> { new DatabaseExecutionStep { DatabaseConnectionId = "fasdfas", ExecuteCommand = "{\"$insert\":{\"{{options.entityname}}\":{ \"$data\": \"{{data}}\"}}}" } } }, NotificationOptions = new NotificationOptions { CompleteMessage = "Insert new database successfully!", FailedMessage = "Oops! Something went wrong, please try again!" }, ConfirmationOptions = new ConfirmationOptions { IsEnable = true, ConfirmationText = "Are you sure to create a database?" } }, RouteOptions = new RouteOptions { IsEnable = false } } } } }; await pageRepository.AddAsync(pageBuilderTest); Page page = await pageRepository.GetOneByNameForRenderAsync("page-builder-3"); pageRepository.Dispose(); // Assert Assert.NotNull(page); }
public T GetValue <T>(string findExp) { return(DataUtil.ToValue <T>(GetValue(findExp))); }
public T GetValue <T>() { return(DataUtil.ToValue <T>(GetValue())); }
/// <inheritdoc/> public async override Task <object> ReadAsync(DataManagerRequest dm, string key = null) { DataListObject list = DataManager?.List; if (list == null) { return dm.RequiresCounts ? new DataResult() { Result = null, Count = 0 } } : null; IEnumerable <DataRow> data = list.GetData(); if (dm.Where != null && dm.Where.Count > 0) { data = data.Where(r => Matches(r, "and", dm.Where)); } if (dm.Search != null && dm.Search.Count > 0) { data = data.Where(r => Matches(r, "and", SearchToWhere(dm.Search))); } data = data.ToList(); // run the search before sorting and counting if (dm.Sorted != null && dm.Sorted.Count > 0) { var sortCrit = ToSortCriteria(dm.Sorted.Reverse <Sort>()); // multi-column sort comes in reverse order ((List <DataRow>)data).Sort(sortCrit); } int count = data.Count(); if (dm.Skip != 0) { data = data.Skip(dm.Skip); } if (dm.Take != 0) { data = data.Take(dm.Take); } if (dm.Group != null) { IEnumerable groupedData = data; foreach (var group in dm.Group) { groupedData = DataUtil.Group <DataRow>(groupedData, group, dm.Aggregates, 0, dm.GroupByFormatter); } return(dm.RequiresCounts ? new DataResult() { Result = groupedData, Count = count } : (object)data); } var res = dm.RequiresCounts ? new DataResult() { Result = data, Count = count } : (object)data; return(await Task.FromResult(res)); }
/// <summary> /// 觸發條件為外在因素者 /// <param name="data">技能資料</param> /// <param name="allDamage">傷害資料</param> private void OnSkillExternalRule(SkillLargeData data, List <DamageData> allDamage = null) { bool[] meets = new bool[data.ruleData.Count]; int parameter = 0; foreach (DamageData damageData in allDamage) { if (damageData.hpRatio <= 0) { for (int i = 0; i < data.ruleData.Count; i++) { if (data.ruleData [i].rule [0] == (int)Rule.Death) { meets [i] = true; if (data.isOr) { OnEffectTarget(data.ruleData [i]); return; } } } } } for (int i = 0; i < data.ruleData.Count; i++) { switch (data.ruleData[i].rule [0]) { case (int)Rule.None: meets [i] = true; break; case (int)Rule.norDmg: meets [i] = allDamage.Count > 0; parameter = GetDamage(allDamage); break; case (int)Rule.norDmgP: if (allDamage.Count > 0 && allDamage [0].damageType == DamageType.Physical) { meets [i] = true; parameter = allDamage [0].damage; } else { meets[i] = false; } break; case (int)Rule.norDmgM: //兩種傷害時,傷害一 物理:傷害二 魔法 if (allDamage.Count == 2) { meets [i] = true; parameter = allDamage [1].damage; } //但種傷害時,因傷害一可能為物理傷害,所以必須檢查 else if (allDamage.Count == 1) { if (allDamage [0].damageType == DamageType.Magic) { meets [i] = true; parameter = allDamage [0].damage; } else { meets [i] = false; } } else { meets [i] = false; } break; } } if (data.isOr) { for (int i = 0; i < data.ruleData.Count; i++) { if (meets [i] == true) { if (mainTarget [1] == "E" || (mainTarget [1] == "P" && fightUIController.GetEnerge(data.ruleData [i].energe))) { Debug.Log("Launch Success"); OnEffectTarget(AddParameter(true, data.ruleData [i], parameter), false); } else { if (fightUIController.GetEnerge(data.ruleData [i].energe) == false) { Debug.Log("Energe Not Worth"); } } } } } else { if (!DataUtil.CheckArray <bool> (meets, false)) { OnMultiEffectTarget(data.ruleData, parameter, false); } } }
private string GetScopeSql() { return(String.Format("WHERE {0} = @0", DataUtil.GetColumnName(typeof(T), Scope))); }
public override IEnumerable <T> Find(string sqlCondition, params object[] args) { return(_database.Fetch <T>(DataUtil.ReplaceTokens(sqlCondition), args)); }
public ushort[] GetAllSlices() { ushort[] result = DataUtil.GetValues(gelSlices); return(ArrayUtil.UniqueValues(result)); }
/* * 保存数据 */ private void Submit_Button_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrWhiteSpace(backgroundMusicButtonLeft.Text)) { MessageBox.Show("请填写按钮左边距;"); return; } else if (!DataUtil.isInt(backgroundMusicButtonLeft.Text.ToString())) { MessageBox.Show("按钮左边距必须是整数;"); return; } if (string.IsNullOrWhiteSpace(backgroundMusicButtonTop.Text.ToString())) { MessageBox.Show("请填写按钮上边距;"); return; } else if (!DataUtil.isInt(backgroundMusicButtonTop.Text.ToString())) { MessageBox.Show("按钮上边距必须是整数;"); return; } if (string.IsNullOrWhiteSpace(backgroundMusicButtonWidth.Text)) { MessageBox.Show("请填写按钮宽度;"); return; } else if (!DataUtil.isInt(backgroundMusicButtonLeft.Text.ToString())) { MessageBox.Show("按钮宽度必须是整数;"); return; } if (string.IsNullOrWhiteSpace(backgroundMusicButtonHeight.Text.ToString())) { MessageBox.Show("请填写按钮高度;"); return; } else if (!DataUtil.isInt(backgroundMusicButtonTop.Text.ToString())) { MessageBox.Show("按钮高度必须是整数;"); return; } //1.更新到数据库 Cfg cfg = cfgBll.get(1); cfg.backgroundMusicShow = (bool)backgroundMusicShow.IsChecked; cfg.backgroundMusicAutoplay = (bool)backgroundMusicAutoplay.IsChecked; cfg.backgroundMusicLoop = (bool)backgroundMusicLoop.IsChecked; cfg.backgroundMusicButtonWidth = int.Parse(backgroundMusicButtonWidth.Text); cfg.backgroundMusicButtonHeight = int.Parse(backgroundMusicButtonHeight.Text); cfg.backgroundMusicButtonLeft = int.Parse(backgroundMusicButtonLeft.Text); cfg.backgroundMusicButtonTop = int.Parse(backgroundMusicButtonTop.Text); StorageFile storageFile = (StorageFile)backgroundMusicUrl.Tag; if (storageFile != null && !string.IsNullOrWhiteSpace(backgroundMusicUrl.Text)) { cfg.backgroundMusicId = storageFile.id; } else { cfg.backgroundMusicId = 0; } Canvas buttonImageCanvas = FrameworkElementUtil.GetChildObject <Canvas>(BackgroundMusicButtonImageWrapPanel, "buttonImageCanvas"); StorageImage storageImage = (StorageImage)buttonImageCanvas.Tag; if (storageImage != null) { cfg.backgroundMusicButtonImageId = storageImage.id; } else { cfg.backgroundMusicButtonImageId = 0; } cfgBll.update(cfg); //2.更新全局配置 App.localStorage.cfg = cfg; //3.重新加载页面 mainWindow.reloadWindow(); Close(); }
public bool IsPageModel() { if (PageModel == null) return false; return !DataUtil.IsNullOrEmptyOrWhiteSpace(PageModel.PageUrl) && PageModel.AddToCartClickElement != null && PageModel.SizeSetElement != null; }
private void btnRedo_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (dtREDOGIAPHONG.Rows.Count - 1 >= 0) { DataRow dr = dtREDOGIAPHONG.Rows[dtREDOGIAPHONG.Rows.Count - 1]; String temp = dr[3].ToString(); if (temp.Equals("DELETE")) { try { string sql = "DELETE FROM GIAPHONG WHERE MAHangPhong ='" + dr[0].ToString() + "'and NgayApDung='" + dr[1].ToString() + "'"; if (DataUtil.ExecQueryString(sql)) { kHACHSANDataSet.GIAPHONG.RejectChanges(); object[] findTheseVals = new object[2]; findTheseVals[0] = dr[0].ToString(); findTheseVals[1] = dr[1].ToString(); DataRow dt = kHACHSANDataSet.GIAPHONG.Rows.Find(findTheseVals); kHACHSANDataSet.GIAPHONG.Rows.Remove(dt); kHACHSANDataSet.GIAPHONG.AcceptChanges(); dtUNDOGIAPHONG.RejectChanges(); dtUNDOGIAPHONG.NewRow(); dtUNDOGIAPHONG.Rows.Add(dr[0].ToString(), dr[1].ToString(), Convert.ToDouble(dr[2]), "INSERT"); dtUNDOGIAPHONG.AcceptChanges(); dtREDOGIAPHONG.RejectChanges(); dtREDOGIAPHONG.Rows.RemoveAt(dtREDOGIAPHONG.Rows.Count - 1); dtREDOGIAPHONG.AcceptChanges(); gIAPHONGBindingSource.EndEdit(); updatetable(); } } catch (Exception e1) { MessageBox.Show("WHAT's Error: " + e1.Message, "", MessageBoxButtons.OK); } } else if (temp.Equals("UPDATE")) { try { string sql = "UPDATE GIAPHONG SET GIAHANGPHONG = " + dr[2].ToString() + "WHERE MAHangPhong ='" + dr[0].ToString() + "'and NgayApDung='" + dr[1].ToString() + "'"; if (DataUtil.ExecQueryString(sql)) { kHACHSANDataSet.GIAPHONG.RejectChanges(); object[] findTheseVals = new object[2]; findTheseVals[0] = dr[0].ToString(); findTheseVals[1] = dr[1].ToString(); DataRow dt = kHACHSANDataSet.GIAPHONG.Rows.Find(findTheseVals); dtUNDOGIAPHONG.RejectChanges(); dtUNDOGIAPHONG.NewRow(); dtUNDOGIAPHONG.Rows.Add(dr[0].ToString(), dr[1].ToString(), Convert.ToDouble(dt[2]), "UPDATE"); dtUNDOGIAPHONG.AcceptChanges(); dt[2] = dr[2]; kHACHSANDataSet.GIAPHONG.AcceptChanges(); dtREDOGIAPHONG.RejectChanges(); dtREDOGIAPHONG.Rows.RemoveAt(dtREDOGIAPHONG.Rows.Count - 1); dtREDOGIAPHONG.AcceptChanges(); updatetable(); } } catch (Exception e1) { MessageBox.Show("WHAT's Error: " + e1.Message, "", MessageBoxButtons.OK); } } else if (temp.Equals("INSERT")) { try { string sql = "Insert into GIAPHONG ([MAHANGPHONG],[NgayAPdung],[GIAHANGPHONG])VALUES ('" + dr[0].ToString() + "','" + dr[1].ToString() + "'," + dr[2].ToString() + ")"; if (DataUtil.ExecQueryString(sql)) { kHACHSANDataSet.GIAPHONG.RejectChanges(); kHACHSANDataSet.GIAPHONG.Rows.Add(dr[0].ToString(), dr[1].ToString(), Convert.ToDouble(dr[2])); kHACHSANDataSet.GIAPHONG.AcceptChanges(); dtUNDOGIAPHONG.RejectChanges(); dtUNDOGIAPHONG.NewRow(); dtUNDOGIAPHONG.Rows.Add(dr[0].ToString(), dr[1].ToString(), Convert.ToDouble(dr[2]), "DELETE"); dtUNDOGIAPHONG.AcceptChanges(); dtREDOGIAPHONG.RejectChanges(); dtREDOGIAPHONG.Rows.RemoveAt(dtREDOGIAPHONG.Rows.Count - 1); dtREDOGIAPHONG.AcceptChanges(); gIAPHONGBindingSource.EndEdit(); gIAPHONGBindingSource.ResetCurrentItem(); updatetable(); } } catch (Exception e1) { MessageBox.Show("WHAT's Error: " + e1.Message, "", MessageBoxButtons.OK); } } if (btnThem.Enabled == false) { gIAPHONGBindingSource.Position = vitri; } btnUndo.Enabled = true; if (dtREDOGIAPHONG.Rows.Count - 1 < 0) { btnRedo.Enabled = false; } } gIAPHONGGridControl.Enabled = true; groupBox1.Enabled = false; btnThem.Enabled = btnHieuChinh.Enabled = btnXoa.Enabled = btnReload.Enabled = true; btnGhi.Enabled = btnHuy.Enabled = false; }
internal List <Cancha> ListaCanchasxSearch(Cancha objCancha) { List <Cancha> listaCanchas = new List <Cancha>(); Cancha cancha; iniciarConexion(); string procedimiento = ""; command = new SqlCommand(); command.Connection = getCon(); command.CommandType = CommandType.StoredProcedure; if (objCancha.cancha_distrito_id == 0) { if (objCancha.cancha_distrito.Equals("")) { procedimiento = Constante.USP_SEL_LISTACANCHA; } else { procedimiento = Constante.USP_SEL_ALLCANCHAxCANCHA_DISTRITO; command.Parameters.Add("@cancha_distrito", SqlDbType.Int).Value = objCancha.cancha_distrito; } } else { command.Parameters.Add("@cancha_distrito_id", SqlDbType.Int).Value = objCancha.cancha_distrito_id; if (objCancha.cancha_distrito.Equals("")) { procedimiento = Constante.USP_SEL_ALLCANCHAxCANCHA_DISTRITO_ID; } else { procedimiento = Constante.USP_SEL_ALLCANCHAxCANCHA_DISTRITO_ID_DISTRITO_NAME; command.Parameters.Add("@cancha_distrito", SqlDbType.Int).Value = objCancha.cancha_distrito; } } command.CommandText = procedimiento; using (IDataReader iDataReader = command.ExecuteReader()) { int iCancha_id = iDataReader.GetOrdinal("cancha_id"); int iCancha_usuario_id = iDataReader.GetOrdinal("cancha_usuario_id"); int iCancha_nombre = iDataReader.GetOrdinal("cancha_nombre"); int iCancha_descripcion = iDataReader.GetOrdinal("cancha_descripcion"); int iCancha_distrito = iDataReader.GetOrdinal("cancha_distrito"); int iCancha_tipo = iDataReader.GetOrdinal("cancha_tipo"); while (iDataReader.Read()) { cancha = new Cancha(); cancha.cancha_id = DataUtil.ValueOfDataBase <Int32>(iDataReader[iCancha_id]); cancha.cancha_usuario_id = DataUtil.ValueOfDataBase <Int32>(iDataReader[iCancha_usuario_id]); cancha.cancha_nombre = DataUtil.ValueOfDataBase <string>(iDataReader[iCancha_nombre]); cancha.cancha_descripcion = DataUtil.ValueOfDataBase <string>(iDataReader[iCancha_descripcion]); cancha.cancha_tipo = DataUtil.ValueOfDataBase <string>(iDataReader[iCancha_tipo]); cancha.cancha_distrito = DataUtil.ValueOfDataBase <string>(iDataReader[iCancha_distrito]); listaCanchas.Add(cancha); } } cerrarConexion(); return(listaCanchas); }
/// <summary> /// The main program entry point. /// </summary> /// <param name="args">The command line parameters.</param> static void Main(string[] args) { // check the compute device Console.WriteLine("Checking compute device..."); Console.WriteLine($" Using: {NetUtil.CurrentDevice.AsString()}"); // unpack archive Console.WriteLine("Unpacking archive..."); if (!File.Exists("x_train_imdb.bin")) { ZipFile.ExtractToDirectory("imdb_data.zip", "."); } // load training and test data Console.WriteLine("Loading data files..."); var sequenceLength = 500; var training_data = DataUtil.LoadBinary <float>("x_train_imdb.bin", 25000, sequenceLength); var training_labels = DataUtil.LoadBinary <float>("y_train_imdb.bin", 25000); var testing_data = DataUtil.LoadBinary <float>("x_test_imdb.bin", 25000, sequenceLength); var testing_labels = DataUtil.LoadBinary <float>("y_test_imdb.bin", 25000); Console.WriteLine($" Records for training: {training_data.Length}"); Console.WriteLine($" Records for testing: {testing_data.Length}"); // build features and labels var features = NetUtil.Var(new int[] { 1 }, CNTK.DataType.Float); var labels = NetUtil.Var(new int[] { 1 }, CNTK.DataType.Float, dynamicAxes: new List <CNTK.Axis>() { CNTK.Axis.DefaultBatchAxis() }); // build the network var lstmUnits = 32; var network = features .OneHotOp(10000, true) .Embedding(32) .LSTM(lstmUnits, lstmUnits) .Dense(1, CNTKLib.Sigmoid) .ToNetwork(); Console.WriteLine("Model architecture:"); Console.WriteLine(network.ToSummary()); // set up the loss function and the classification error function var lossFunc = CNTKLib.BinaryCrossEntropy(network.Output, labels); var errorFunc = NetUtil.BinaryClassificationError(network.Output, labels); // use the Adam learning algorithm var learner = network.GetAdamLearner( learningRateSchedule: (0.001, 1), momentumSchedule: (0.9, 1), unitGain: true); // set up a trainer and an evaluator var trainer = network.GetTrainer(learner, lossFunc, errorFunc); var evaluator = network.GetEvaluator(errorFunc); // train the model Console.WriteLine("Epoch\tTrain\tTrain\tTest"); Console.WriteLine("\tLoss\tError\tError"); Console.WriteLine("-----------------------------"); var maxEpochs = 10; var batchSize = 128; var loss = new double[maxEpochs]; var trainingError = new double[maxEpochs]; var testingError = new double[maxEpochs]; var batchCount = 0; for (int epoch = 0; epoch < maxEpochs; epoch++) { // train one epoch on batches loss[epoch] = 0.0; trainingError[epoch] = 0.0; batchCount = 0; training_data.Batch(batchSize, (data, begin, end) => { // get the current batch var featureBatch = features.GetSequenceBatch(sequenceLength, training_data, begin, end); var labelBatch = labels.GetBatch(training_labels, begin, end); // train the network on the batch var result = trainer.TrainBatch( new[] { (features, featureBatch), (labels, labelBatch) },
public override void Update(string sqlCondition, params object[] args) { _database.Update <T>(DataUtil.ReplaceTokens(sqlCondition), args); }
private void LoadCategoryParent() { try { var CatList = ( from t2 in DB.ESHOP_CATEGORies where t2.CAT_RANK > 0 && (_type == 0 ? (t2.CAT_TYPE != 1) : t2.CAT_TYPE == 1) //&& (_gtype != 1 ? (getCatid().Contains(t2.CAT_ID.ToString()) || getCatid().Contains(t2.CAT_PARENT_ID.ToString())) : true) select new { CAT_ID = t2.CAT_NAME == "------- Root -------" ? 0 : t2.CAT_ID, CAT_NAME = (string.IsNullOrEmpty(t2.CAT_CODE) ? t2.CAT_NAME : t2.CAT_NAME + "(" + t2.CAT_CODE + ")"), CAT_NAME_EN = (string.IsNullOrEmpty(t2.CAT_CODE_EN) ? t2.CAT_NAME_EN : t2.CAT_NAME_EN + "(" + t2.CAT_CODE_EN + ")"), CAT_PARENT_ID = t2.CAT_PARENT_ID, CAT_RANK = t2.CAT_RANK } ); if (CatList.ToList().Count > 0) { DataRelation relCat; DataTable tbl = DataUtil.LINQToDataTable(CatList); DataSet ds = new DataSet(); ds.Tables.Add(tbl); tbl.PrimaryKey = new DataColumn[] { tbl.Columns["CAT_ID"] }; relCat = new DataRelation("Category_parent", ds.Tables[0].Columns["CAT_ID"], ds.Tables[0].Columns["CAT_PARENT_ID"], false); ds.Relations.Add(relCat); DataSet dsCat = ds.Clone(); DataTable CatTable = ds.Tables[0]; DataUtil.TransformTableWithSpace(ref CatTable, dsCat.Tables[0], relCat, null); if (CatList.ToList()[0].CAT_RANK > 1) { ddlCategory.DataSource = CatList; } else { ddlCategory.DataSource = dsCat.Tables[0]; } ddlCategory.DataTextField = "CAT_NAME"; ddlCategory.DataValueField = "CAT_ID"; ddlCategory.DataBind(); } else { DataTable dt = new DataTable("Newtable"); dt.Columns.Add(new DataColumn("CAT_ID")); dt.Columns.Add(new DataColumn("CAT_NAME")); dt.Columns.Add(new DataColumn("CAT_NAME_EN")); DataRow row = dt.NewRow(); row["CAT_ID"] = 0; row["CAT_NAME"] = "--------Root--------"; row["CAT_NAME_EN"] = "--------Root--------"; dt.Rows.Add(row); ddlCategory.DataTextField = "CAT_NAME"; ddlCategory.DataValueField = "CAT_ID"; ddlCategory.DataSource = dt; ddlCategory.DataBind(); } } catch (Exception ex) { clsVproErrorHandler.HandlerError(ex); } }
public bool CreateLancamentos() { var x = gridView1.RowCount; var ctx = new BalcaoContext(); var dao = ctx.LancamentoFinanceiroDao; for (int i = 0; i < gridView1.DataRowCount; i++) { DataRow row = gridView1.GetDataRow(i); //data lançamento e pagamento var data = row[ModelControlLancamento.DATA].ToString(); //nome do cliente var nomeCliente = row[ModelControlLancamento.HISTORICO].ToString().Trim(); //observação - filtra pelo sql para obter algumas data var obs = row[ModelControlLancamento.OBSERVACAO].ToString(); //valor do lancamento var credito = row[ModelControlLancamento.CREDITO].ToString(); //valor do lancamento var debito = row[ModelControlLancamento.DEBITO].ToString(); //var saldo = row[ModelLancamento.SALDO]; LancamentoFinanceiro l = new LancamentoFinanceiro(); l.RecCreatedBy = 2; //Filial l.IdFilial = 1; //Centro de custo mapear manualmente apos a inserção infelizmente l.IdCentroCusto = 1; l.StatusLancamento = TypeStatusLancamentoFinanceiro.Aberto; if (!string.IsNullOrEmpty(obs)) { l.Observacao = obs; } Console.WriteLine(nomeCliente); if (!string.IsNullOrEmpty(nomeCliente)) { try { string str = nomeCliente; var split = nomeCliente.Split(' '); if (split.Length > 1) { if (split.Length >= 2) { str = split[0] + " " + split[1]; } else { str = split[0]; } } //acha o cliente usando LIKE var cliFor = ctx.CliForDao .Where(c => c.RazaoSocial.Contains(str)).First(); //pass o cliente pro lancamento l.IdCliFor = cliFor.IdCliFor; if (cliFor.RazaoSocial.Contains("BC STONES") || cliFor.RazaoSocial.Contains("BARCAMP") || cliFor.RazaoSocial.Contains("LIBERIO") || cliFor.RazaoSocial.Contains("FABRICIO") || cliFor.RazaoSocial.Contains("ALYSSON") || cliFor.RazaoSocial.Contains("SERGIO") || cliFor.RazaoSocial.Contains("INDUSTRIA") || cliFor.RazaoSocial.Contains("RICARDO")) { l.IdCentroCusto = 1; } else if (cliFor.RazaoSocial.Contains("MINERACAO ALTO DAS PERDIZES LTDA - ME")) { l.IdCentroCusto = 2; } else if (cliFor.RazaoSocial.Contains("POSTO")) { l.IdCentroCusto = 4; } else if (cliFor.RazaoSocial.Contains("SUPER")) { l.IdCentroCusto = 5; } else if (obs.Contains("PAGAMENTO FUNCIONARIOS")) { l.IdCentroCusto = 6; } else if (cliFor.RazaoSocial.Contains("VIVO") || cliFor.RazaoSocial.Contains("CTBC") || cliFor.RazaoSocial.Contains("ALGAR") || cliFor.RazaoSocial.Contains("TERRA") || cliFor.RazaoSocial.Contains("TELEFONE") || cliFor.RazaoSocial.Contains("TELEFONICA") || cliFor.RazaoSocial.Contains("TELEFONIA")) { l.IdCentroCusto = 5; } else if (cliFor.RazaoSocial.Contains("CARINHA TRANSPORTES")) { l.IdCentroCusto = 9; } else { l.IdCentroCusto = 3; } } catch { var cliFor = new CliFor(); cliFor.CpfCnpj = "00000000000000"; cliFor.Classificacao = TypeClassificaoCliente.Fornecedor; cliFor.RazaoSocial = nomeCliente; ctx.CliForDao.Save(cliFor); l.IdCliFor = cliFor.IdCliFor; } } if (!string.IsNullOrWhiteSpace(data)) { l.DataLancamento = DataUtil.ToDate(data.ToString()); l.DataVencimento = DataUtil.ToDate(data.ToString()); } //observação nao ta vazio e nao tem texto nao tem texto if (!string.IsNullOrEmpty(obs) && !obs.IsContainsLetters()) { //o texto da observação as vezes eh a data de pagamento l.DataPagamento = DataUtil.ToDate(obs); } //se o credito eh vazio entao eh debito if (string.IsNullOrWhiteSpace(credito) || credito == "0") { l.ValorLancamento = ParseUtil.ToDecimal(debito); l.TipoLancamento = TypeLancamentoFinanceiro.Pagar; } //se nao eh credito else { l.ValorLancamento = ParseUtil.ToDecimal(credito); l.TipoLancamento = TypeLancamentoFinanceiro.Receber; } try { //l.IdCentroCusto = ctx.CentroCustoDao.First().IdCentroCusto; //efetiva o lancamento no banco dao.Save(l); this.Result.Add(l); } catch (Exception ex) { this.Errors.Add(l); LoggerUtilIts.ShowExceptionLogs(ex); } } return(true); }
/// <summary> /// 觸發條件為自身因素者 /// <param name="orgData">攻擊者資料</param> /// <param name="targetData">被攻擊者資料</param> /// <param name="data">技能資料</param> /// <param name="allDamage">傷害資料</param> private void OnSkillSelfRule(SkillLargeData data, List <DamageData> allDamage = null) { mainSkillId = data.id; int parameter = 0; bool[] meets = new bool[data.ruleData.Count]; for (int i = 0; i < data.ruleData.Count; i++) { switch (data.ruleData [i].rule [0]) { case (int)Rule.None: meets [i] = true; break; case (int)Rule.HpLess: case (int)Rule.HpBest: meets [i] = fightController.OnRuleMeets(mainOrgIdx, data.ruleData [i].rule, mainTarget[0]); break; case (int)Rule.OnDmg: meets [i] = allDamage != null && allDamage.Count > 0; parameter = GetDamage(allDamage); break; case (int)Rule.JobCntUp: meets [i] = fightUIController.GetJobGround(data.ruleData [i].rule [1]) >= data.ruleData [i].rule [2]; parameter = fightUIController.GetJobGround(data.ruleData [i].rule [1]); break; case (int)Rule.LayerCntUp: meets [i] = fightUIController.GetLayerGround(data.ruleData [i].rule [1]) >= data.ruleData [i].rule [2]; parameter = fightUIController.GetLayerGround(data.ruleData [i].rule [1]); break; case (int)Rule.JobCntDown: meets [i] = fightUIController.GetJobGround(data.ruleData [i].rule [1]) < data.ruleData [i].rule [2]; parameter = fightUIController.GetJobGround(data.ruleData [i].rule [1]); break; case (int)Rule.LayerCntDown: meets [i] = fightUIController.GetLayerGround(data.ruleData [i].rule [1]) < data.ruleData [i].rule [2]; parameter = fightUIController.GetLayerGround(data.ruleData [i].rule [1]); break; } } if (data.isOr) { for (int i = 0; i < data.ruleData.Count; i++) { if (meets [i] == true) { if (mainTarget [0] == "E" || (mainTarget [0] == "P" && fightUIController.GetEnerge(data.ruleData [i].energe) == true)) { Debug.Log("Launch Success"); OnEffectTarget(AddParameter(false, data.ruleData [i], parameter)); } else { if (fightUIController.GetEnerge(data.ruleData [i].energe) == false) { Debug.Log("Energe Not Worth"); } } } } } else { if (!DataUtil.CheckArray <bool> (meets, false)) { OnMultiEffectTarget(data.ruleData, parameter, true); } } }
private void btn_mp3_xbox_Click(object sender, EventArgs e) { DataUtil.setKey(keyHolder.mp3Key_xbox); loadMainForm("mp3Xbox"); }
static void Main(string[] args) { Console.WriteLine("Loading data...."); // unzip archive if (!System.IO.File.Exists("train_images.bin")) { DataUtil.Unzip(@"mnist_data.zip", "."); } // load training and test data var training_data = DataUtil.LoadBinary <float>("train_images.bin", 60000, 28 * 28); var test_data = DataUtil.LoadBinary <float>("test_images.bin", 10000, 28 * 28); var training_labels = DataUtil.LoadBinary <float>("train_labels.bin", 60000, 10); var test_labels = DataUtil.LoadBinary <float>("test_labels.bin", 10000, 10); // report results Console.WriteLine($"{training_data.GetLength(0)} training digits loaded"); Console.WriteLine($"{test_data.GetLength(0)} test digits loaded"); // build features and labels var features = NetUtil.Var(new int[] { 28, 28 }, DataType.Float); var labels = NetUtil.Var(new int[] { 10 }, DataType.Float); // build the network var network = features .Dense(512, CNTKLib.ReLU) .Dense(10) .ToNetwork(); // set up the loss function and the classification error function var lossFunc = CNTKLib.CrossEntropyWithSoftmax(network.Output, labels); var errorFunc = CNTKLib.ClassificationError(network.Output, labels); // set up a trainer that uses the RMSProp algorithm var learner = network.GetRMSPropLearner( learningRateSchedule: 0.99, gamma: 0.95, inc: 2.0, dec: 0.5, max: 2.0, min: 0.5 ); // set up a trainer and an evaluator var trainer = network.GetTrainer(learner, lossFunc, errorFunc); var evaluator = network.GetEvaluator(errorFunc); // declare some variables var maxEpochs = 20; var batchSize = 128; var loss = 0.0; var error = 0.0; var batchCount = 0; // train the network during several epochs Console.WriteLine("Training the neural network...."); for (int epoch = 0; epoch < maxEpochs; epoch++) { Console.Write($"Training epoch {epoch + 1}/{maxEpochs}... "); // train the network using random batches loss = 0.0; error = 0.0; batchCount = 0; training_data.Index().Shuffle().Batch(batchSize, (indices, begin, end) => { // get the current batch var featureBatch = features.GetBatch(training_data, indices, begin, end); var labelBatch = labels.GetBatch(training_labels, indices, begin, end); // train the network on the batch var result = trainer.TrainBatch( new[] { (features, featureBatch), (labels, labelBatch) },
private void btn_rdr_xbox_Click(object sender, EventArgs e) { DataUtil.setKey(keyHolder.rdrKey); loadMainForm("rdrXbox"); }
public T GetValue <T>(string findExp, bool throwError) { return(DataUtil.ToValue <T>(GetValue(findExp, throwError))); }
private void btn_mc_xbox_Click(object sender, EventArgs e) { DataUtil.setKey(keyHolder.mcKey); loadMainForm("mcXbox"); }
public T GetValue <T>(bool throwError) { return(DataUtil.ToValue <T>(GetValue(throwError))); }
private void btn_gtaV_Click(object sender, EventArgs e) { DataUtil.setKey(keyHolder.gtaVKey); loadMainForm("gtaVXbox"); }
private void btnUpload_Click(object sender, EventArgs e) { DataUtil.UpdateData(); }
public static DataTable Parsing(DataSet _ds, LinkedList _llstWhere, bool bDataParsing, bool bMoCVD, bool includingToggleData) { ParseBLOB parseBlob = null; ParseCLOB parseClob = null; DataSet _dsSelect = null; DataTable dtResult = new DataTable(); bool bResultTable = false; try { parseBlob = new ParseBLOB(); parseClob = new ParseCLOB(); _dsSelect = new DataSet(); eSPCWebService.eSPCWebService _wsSPC = new WebServiceController <eSPCWebService.eSPCWebService>().Create(); LinkedList _llstData = new LinkedList(); DataSet dsContextType = _wsSPC.GetContextType(_llstData.GetSerialData()); LinkedList mllstContextType = SetContextType(dsContextType); for (int i = 0; i < _ds.Tables.Count; i++) { string sTableName = _ds.Tables[i].TableName.ToString(); if (sTableName == Definition.TableName.USERNAME_DATA) { bResultTable = true; _dsSelect = parseBlob.DecompressDATA_TRX_DATA(_ds.Tables[i], _llstWhere, mllstContextType, bDataParsing, includingToggleData); if (_dsSelect.Tables.Count > 0) { dtResult = _dsSelect.Tables[0].Copy(); } _dsSelect.Dispose(); if (dtResult.Columns.Contains(BISTel.eSPC.Common.COLUMN.FILE_DATA)) { dtResult.Columns.Remove(BISTel.eSPC.Common.COLUMN.FILE_DATA); } } else if (sTableName == Definition.TableName.USERNAME_TEMPDATA) { _dsSelect = parseClob.DecompressData(_ds.Tables[i], _llstWhere, mllstContextType, bDataParsing, includingToggleData); if (!DataUtil.IsNullOrEmptyDataSet(_dsSelect)) { DataTable dt = _dsSelect.Tables[0]; if (bResultTable) { foreach (DataColumn dc in dt.Columns) { if (dc.ColumnName.Contains(BISTel.eSPC.Common.COLUMN.DATA_LIST) || dc.ColumnName.Contains(BISTel.eSPC.Common.COLUMN.CONTEXT_LIST) || dc.ColumnName.Contains("NORMAL") || dc.ColumnName.Contains("ORIGINAL_PARAM")) { continue; } if (!dtResult.Columns.Contains(dc.ColumnName.ToString())) { dtResult.Columns.Add(dc.ColumnName.ToString(), dc.DataType); } } foreach (DataRow dr in dt.Rows) { dtResult.ImportRow(dr); } } else { dtResult.Merge(dt); if (dtResult.Columns.Contains(BISTel.eSPC.Common.COLUMN.DATA_LIST)) { dtResult.Columns.Remove(BISTel.eSPC.Common.COLUMN.DATA_LIST); } if (dtResult.Columns.Contains(BISTel.eSPC.Common.COLUMN.CONTEXT_LIST)) { dtResult.Columns.Remove(BISTel.eSPC.Common.COLUMN.CONTEXT_LIST); } } } } } dtResult.Columns.Add(Definition.CHART_COLUMN.DTSOURCEID); for (int i = 0; i < dtResult.Rows.Count; i++) { dtResult.Rows[i][Definition.CHART_COLUMN.DTSOURCEID] = i; } } catch (Exception ex) { } finally { if (_ds != null) { _ds.Dispose(); } if (parseBlob != null) { parseBlob = null; } if (parseClob != null) { parseClob = null; } if (_dsSelect != null) { _dsSelect.Dispose(); } } return(dtResult); }
/// <inheritdoc/> public IList <Person> Query(PersonQueryDto dto) { var sqlWhere = new StringBuilder(); if (!string.IsNullOrEmpty(dto.Query)) { sqlWhere.AppendLine(" AND ( "); sqlWhere.AppendLine(" PersonCode LIKE @Query OR "); sqlWhere.AppendLine(" LoginId LIKE @Query OR "); sqlWhere.AppendLine(" Name LIKE @Query OR "); sqlWhere.AppendLine(" Title LIKE @Query OR "); sqlWhere.AppendLine(" PersonId IN ( "); sqlWhere.AppendLine(" SELECT TargetId "); sqlWhere.AppendLine(" FROM Tag AS TG1 WITH (NOLOCK) "); sqlWhere.AppendLine(" WHERE TG1.TargetTable = 'Person' "); sqlWhere.AppendLine(" AND TG1.Value = @TagQuery "); sqlWhere.AppendLine(" ) "); sqlWhere.AppendLine(" ) "); } if (!string.IsNullOrEmpty(dto.Status)) { sqlWhere.AppendLine(" AND Status = @Status "); } if (!string.IsNullOrEmpty(dto.GroupCode)) { sqlWhere.AppendLine(" AND EXISTS ("); sqlWhere.AppendLine(" SELECT PersonId "); sqlWhere.AppendLine(" FROM [Group] AS GR1 WITH (NOLOCK) INNER JOIN "); sqlWhere.AppendLine(" GroupPerson AS GP1 WITH (NOLOCK) ON GR1.GroupId = GP1.GroupID "); sqlWhere.AppendLine(" WHERE GR1.GroupCode = @GroupCode "); sqlWhere.AppendLine(" ) "); } if (!string.IsNullOrEmpty(dto.ProjectCode)) { sqlWhere.AppendLine(" AND EXISTS ("); sqlWhere.AppendLine(" SELECT PersonId "); sqlWhere.AppendLine(" FROM Project AS PR1 WITH (NOLOCK) INNER JOIN "); sqlWhere.AppendLine(" ProjectPerson AS PP1 WITH (NOLOCK) ON PR1.ProjectId = PP1.ProjectID "); sqlWhere.AppendLine(" WHERE PR1.ProjectCode = @ProjectCode "); sqlWhere.AppendLine(" ) "); } var sqlSort = new StringBuilder(); if (dto.Sort.Count == 0) { sqlSort.AppendLine(" ORDER BY {0}.SortNo ASC, {0}.PersonCode ASC "); } else { sqlSort.AppendLine(" ORDER BY "); foreach (var item in dto.Sort) { if (item.Field.Equals("PersonCode", StringComparison.OrdinalIgnoreCase)) { sqlSort.Append(" {0}.PersonCode " + item.SortType.ToString() + ","); } else if (item.Field.Equals("SortNo", StringComparison.OrdinalIgnoreCase)) { sqlSort.Append(" {0}.SortNo " + item.SortType.ToString() + ","); } else if (item.Field.Equals("Name", StringComparison.OrdinalIgnoreCase)) { sqlSort.Append(" {0}.Name " + item.SortType.ToString() + ","); } else if (item.Field.Equals("CreateTime", StringComparison.OrdinalIgnoreCase)) { sqlSort.Append(" {0}.CreateTime " + item.SortType.ToString() + ","); } } sqlSort.Length -= 1; sqlSort.AppendLine(); } var param = new { Status = dto.Status, GroupCode = dto.GroupCode, ProjectCode = dto.ProjectCode, Query = DataUtil.EscapeLike(dto.Query, LikeMatchType.PrefixSearch), TagQuery = dto.Query, Page = dto.Page, PageSize = dto.PageSize, }; var sqlCount = new StringBuilder(); sqlCount.AppendLine(" SELECT COUNT(*) FROM Person WHERE 1 = 1 "); sqlCount.AppendLine(sqlWhere.ToString()); dto.TotalCount = (int)Connection.ExecuteScalar( sqlCount.ToString(), param, commandTimeout: DBSettings.CommandTimeout); var sql = new StringBuilder(); sql.AppendLine(" SELECT PS1.* "); sql.AppendLine(" , (SELECT TG1.Value "); sql.AppendLine(" FROM Tag AS TG1 WITH (NOLOCK) "); sql.AppendLine(" WHERE TG1.TargetId = PS1.PersonId "); sql.AppendLine(" ORDER BY TG1.Value "); sql.AppendLine(" FOR JSON PATH "); sql.AppendLine(" ) AS PersonTags "); sql.AppendLine(" FROM Person AS PS1 "); sql.AppendLine(" WHERE 1 = 1 "); sql.AppendLine(sqlWhere.ToString()); sql.AppendLine(string.Format(sqlSort.ToString(), "PS1")); sql.AppendLine(" OFFSET (@Page - 1) * @PageSize ROWS "); sql.AppendLine(" FETCH FIRST @PageSize ROWS ONLY "); return(Connection.Query <Person, string, Person>( sql.ToString(), (person, personTags) => { person.Tags = JsonUtil.Deserialize <List <string> >(JsonUtil.ToRawJsonArray(personTags, "Value")); return person; }, param, splitOn: "PersonTags", commandTimeout: DBSettings.CommandTimeout).ToList()); }
public bool NextRound() { List <GroundController> nextRoundGcs = new List <GroundController> (); List <GroundController> layerList = new List <GroundController> (); List <GroundController> hasLayerGcs = new List <GroundController> (); List <GroundController> layerGcs = new List <GroundController> (); GroundController maxGc = null; int focusCount = 1; foreach (GroundController gc in allGcs) { if (gc._layer != 0 && (int)gc._groundType != 99) { hasLayerGcs.Add(gc); } } if (hasLayerGcs.Count == 0) { return(false); } else if (hasLayerGcs.Count <= CreateGround) { nextRoundGcs = hasLayerGcs; } else { while (nextRoundGcs.Count < CreateGround - 1) { if (maxGc == null) { for (int i = 7; i > 0; i--) { foreach (GroundController gc in hasLayerGcs) { if (gc._layer == i) { layerList.Add(gc); } } if (layerList.Count > 0) { maxGc = DataUtil.RandomList(focusCount, layerList.ToArray()) [0]; break; } } } else { for (int i = 1; i <= 7; i++) { layerList = new List <GroundController> (); foreach (GroundController gc in hasLayerGcs) { if (gc._layer == i) { if (gc != maxGc && !nextRoundGcs.Contains(gc)) { layerList.Add(gc); } } } if (layerList.Count > 0) { layerGcs.Add(DataUtil.RandomList(1, layerList.ToArray()) [0]); } } List <GroundController> gcs = new List <GroundController> (); for (int i = 0; i < layerGcs.Count; i++) { for (int j = 0; j < Mathf.FloorToInt(i / 2) + 1; j++) { gcs.Add(layerGcs [i]); } } //避免因數量不足進入無窮迴圈 if (nextRoundGcs.Count == 0) { nextRoundGcs = DataUtil.RandomList(CreateGround - 1 - nextRoundGcs.Count, gcs.ToArray(), layerGcs.Count); } else { List <GroundController> randomGcs = DataUtil.RandomList(CreateGround - 1 - nextRoundGcs.Count, gcs.ToArray(), layerGcs.Count); if (randomGcs.Count > 0) { Debug.LogWarning(randomGcs.Count); foreach (GroundController gc in randomGcs) { nextRoundGcs.Add(gc); } } } } } nextRoundGcs.Add(maxGc); } foreach (GroundController gc in nextRoundGcs) { gc.ChangeType(false, true); } return(true); }