private void Finish() { using (var db = new MobileContext()) { var manager = new DataManager(db); var contextGuild = (Channel as IGuildChannel).Guild; var channel = db.Channels.FirstOrDefault(_ => _.Id == Result.Id); var guild = db.Guilds.FirstOrDefault(_ => _.Id == contextGuild.Id); Result.GuildId = contextGuild.Id; if (guild == null) { guild = new Guild() { Name = contextGuild.Name, Id = contextGuild.Id }; } if (channel == null) { channel = Result; } manager.Save(guild); manager.Save(channel); } OpenDialogs.Remove(this); }
void Bonus() { if (apples == maxApple) { apples += 30; AllappleText.text = "Apple Bonus +30"; } if (boxes == maxBox) { apples += 20; AllBoxText.text = "Box Bonus +20"; } if (times < best_Time) { best_Time = times; dataManager.stageInfoList [stageNo - 1].bestTime = best_Time; dataManager.Save(); } if (apples > highScore) { highScore = apples; dataManager.stageInfoList [stageNo - 1].highScore = highScore; dataManager.Save(); } }
public override void OnInspectorGUI() { DrawDefaultInspector(); var data = (DataManager)target; if (GUILayout.Button("Load")) { DataManager.Load(); } if (GUILayout.Button("Save")) { DataManager.Save(); } if (GUILayout.Button("Reset")) { DataManager.Reset(); } if (GUILayout.Button("RESET + UPDATE data to BUILD")) { if (data != null) { data.ResetAndUpdateData(); } } }
/// <summary> /// Update ToDo Note after each ToDo item update. /// </summary> void UpdateNote() { var item = NotesDataSource.GetItem(NoteUniqueId); TileManager.UpdateSecondaryTile(NoteUniqueId); DataManager.Save(item.NoteBook); }
public void SaveCurrentPlayerInfo() { PlayerController PC = GameObject.Find("MainPlayer/PlayerController").GetComponent <PlayerController>(); DataManager.SaveCharacter(PC.PlayerData); DataManager.Save(); }
/// <summary> /// 点击创建按钮 /// </summary> public void On_Create() { //如果玩家没有填写名字,可以提醒玩家 if (string.IsNullOrEmpty(inputField_name.text)) { Debug.Log("尚未填写名字"); return; } //创建角色 DataManager.CharData_Instance.created = true; //设置已创建标记 DataManager.CharData_Instance.name = inputField_name.text; //保存名字 //保存职业 if (toggle_warrior.isOn) { DataManager.CharData_Instance.occupation = 0; } else { DataManager.CharData_Instance.occupation = 1; } //保存数据 DataManager.Save(); //显示剧情页面 StartGame(); }
public JsonResult Edit(FormCollection form) { if (ModelState.IsValid) { //整体提交的数据 var data = Request.Form["data"]; List <AppFunction> funcList = JsonHelper.FromJson <List <AppFunction> >(data); List <AppFunction> oldFuncList = mFunctionMgr.GetAll().ToList(); //从Session取查询关键字 var queryKey = Session["FunctionQueryKey"] as string; if (!queryKey.IsEmpty()) { oldFuncList = SearchKey(oldFuncList, queryKey); } //清除 foreach (AppFunction func in oldFuncList) { mFunctionMgr.Remove(func); } //新增 foreach (AppFunction func in funcList) { mFunctionMgr.Add(func); } //保存 mFunctionMgr.Save(); return(JsonTips("success", JStr.SuccessSaved)); } return(JsonTips()); }
private void OnWindowClosing(object sender, CancelEventArgs args) { Prefs.Width = Width; Prefs.Height = Height; Prefs.WindowState = WindowState; PrefsManager.Save(Prefs, (ee) => MessageHelper.ThrowException(ee)); }
public void PowerupCooldownChange(float val, Text dispText) { val = Mathf.Round(val * 10f) / 10f; DataManager.PowerupCooldownTime = val; dispText.text = val + "s"; DataManager.Save(); }
public void SaveData() { var list = new List <LEDScreen>(); foreach (DataGridViewRow row in dataGridView1.Rows) { try { var model = new LEDScreen(); var id = 0; int.TryParse(row.Cells["ID"].Value.ToString(), out id); model.ID = id; var width = 0; int.TryParse(row.Cells["Width"].Value.ToString(), out width); model.Width = width; var height = 0; int.TryParse(row.Cells["Height"].Value.ToString(), out height); model.Height = height; list.Add(model); } catch { } } DataManager.Save(list); }
/* * METOD ADI : PrepareNextStage * AÇIKLAMA : Bir sonraki Stage'i oynamaya hazırlar. */ public void PrepareNextStage() { Painter.Instance.MissionStage = true; ParticleManager.Instance.StopFireworks(); ResetPositions(); currentStage.stage.SetActive(false); currentStage.ResetStage(); GameAnalytics.NewProgressionEvent(GAProgressionStatus.Start, Application.version, currentStageIndex.ToString("0000")); currentStageIndex++; dataManager.data.bestScore = dataManager.data.bestScore < ScoreManager.Instance.GetScore() ? ScoreManager.Instance.GetScore() : dataManager.data.bestScore; dataManager.data.level = currentStageIndex; dataManager.Save(); if (currentStageIndex >= stages.Count) { currentStageIndex = 0; ResetAllStages(); } PrepareCurrentStage(); uiManager.HideMissionState(); StartCoroutine(uiManager.UpdateProgressBar((float)currentStage.currentPartIndex / currentStage.cakeParts.Count, currentStageIndex + 1, currentStageIndex + 2)); }
void OnApplicationQuit() { if (DataManager.isLoaded) { DataManager.Save(); } }
protected async Task <ActionResult> Save <T>(object model) where T : class { try { if (ModelState.IsValid) { var dataManager = new DataManager <T>(); ((BaseModel)model).DateCreated = ((BaseModel)model).DateCreated ?? DateTime.Now; ((BaseModel)model).DateModified = DateTime.Now; var data = Mapper.Map <T>(model); var result = await dataManager.Save(data); return(RedirectToAction("Index")); } } catch (DataException /* dex */) { //Log the error (uncomment dex variable name and add a line here to write a log. ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator."); } return(Redirect(Request.UrlReferrer.ToString())); //View(viewName, model); }
public void SfxVolumeChange(float val) { val = DataManager.LinearToDecibel(val); mixer.SetFloat("sfxVol", val); DataManager.SfxVolume = val; DataManager.Save(); }
public void Post([FromBody] Cabin cabin) { cabin.ID = Guid.NewGuid(); var db = new DataManager(); db.Save(cabin); }
public void Createcategory() { var category = new Category(); var f = new CategoryEditForm(category) { Text = "Новый продукт" }; if (f.ShowDialog() == DialogResult.OK) { DataManager.CategoryRepository.Insert(category); DataManager.Save(); Categoris.Add(category); Categoris = Categoris.OrderBy(t => t.Name).ToList(); FillCategoris(); foreach (ListViewItem lv in ListCategoris.Items) { if (lv.Text == category.Name) { lv.Selected = true; lv.Focused = true; lv.EnsureVisible(); } else { lv.Selected = false; } } } }
private void ReturnMethod(object obj) { if (obj.ToString() == "All") { foreach (Desk d in DataManager.Desks) { d.State = false; d.UserID = ""; } foreach (User u in DataManager.Users) { u.isBooked = false; u.DeskNumber = 0; } } else { if (DataManager.Desks[DeskIdx].State == true) { DataManager.Desks[DeskIdx].State = false; string uid = DataManager.Desks[DeskIdx].UserID; DataManager.Desks[DeskIdx].UserID = ""; UserIdx = DataManager.Users.FindIndex(x => x.ID == uid); DataManager.Users[UserIdx].isBooked = false; DataManager.Users[UserIdx].DeskNumber = 0; } } DataManager.Save(); Desks = DataManager.Desks; Users = DataManager.Users; UserViewModel._userView.userViewModer.Desks = DataManager.Desks; UserViewModel._userView.BtnBinding(); }
public void SuggestionAds() { StagesAsset datas = DataManager.StagesAsset; //Suggestion unlock by Star nextButton.onClick.RemoveAllListeners(); var nextStage = datas.GetNext(UnlockType.Star, datas.Current.index, userData.totalStar); if (nextStage != null) { nextStage.isUnlocked = true; nextStage.unlockBy = UnlockType.Star; DataManager.Save(); nextButton.gameObject.SetActive(true); nextButton.onClick.AddListener(() => { DataManager.CurrentStage = nextStage; GameStateManager.Next(null); Hide(() => { }); }); } }
private void BookMethod(object obj) { if (int.Parse(obj.ToString()) > 0 && int.Parse(obj.ToString()) < DataManager.Desks.Count == false) { } else { DeskIdx = int.Parse(obj.ToString()) - 1; if (DataManager.Users[UserIdx].isBooked == true) { MessageBox.Show("퇴실 후 예약할 수 있습니다."); } else if (DataManager.Desks[DeskIdx].State == true) { MessageBox.Show("이미 예약한 사용자가 있습니다. 다른 좌석을 선택해 주세요."); } else if (DeskIdx > 0 && DeskIdx < DataManager.Desks.Count == false) { MessageBox.Show("다른 좌석을 선택해 주세요."); } else { DataManager.Desks[DeskIdx].State = true; DataManager.Desks[DeskIdx].UserID = DataManager.Users[UserIdx].ID; DataManager.Users[UserIdx].isBooked = true; DataManager.Users[UserIdx].DeskNumber = DeskIdx + 1; DataManager.Save(); Desks = DataManager.Desks; Users = DataManager.Users; UserViewModel._userView.userViewModer.Desks = DataManager.Desks; UserViewModel._userView.BtnBinding(); } } }
void ShowGameOverUI(BiteType biteType) { //endUIText.text = biteType == BiteType.Body ? bodyBite : bombBite; dataManager.Load(); if (score > dataManager.HighScore) { dataManager.HighScore = score; dataManager.Save(); highScoreUI.SetActive(true); } else { highScoreUI.SetActive(false); } if (biteType == BiteType.Body) { endUIText.text = bodyBite; } else { endUIText.text = bombBite; } endGameUI.SetActive(true); reloadButton.SetActive(false); scoreCounterUI.SetActive(true); scoreCounterUI.transform.GetChild(0).GetComponent <Text>().text = string.Format("Score = {0}", score); scorePanel.SetParent(bodyParent); scorePanel.localPosition = Vector3.zero; }
static void Main(string[] args) { DataManager dm = DataManager.New("c:\tmp\test"); DataManager.Save(dm); /* * VariableList vl = new VariableList(); * vl["a.t1"] = new Number(15, 0, 10); * vl["a.t2"] = new Number(16, 20, 30); * vl["a.t4"] = new Enumerator("option1", new List<string> { "option1", "option2", "option3" }); * vl["aa.t3"] = new Number(17, 0, 30); * vl["aa.t4"] = new Number(18); * vl["a.name"] = new Text("Paco"); * vl["a.text"] = new Text("Test {.name} {aa.t3}"); * vl["a.bool"] = new Bool(true); * * VariableList.CloneObject("a", "b"); * * PrintVariables(vl); * Console.WriteLine("..."); * PrintVariables(new VariableList("a")); * Console.WriteLine("..."); * PrintVariables(new VariableList("aa")); * Console.WriteLine("..."); * PrintVariables(new VariableList("b")); * Console.WriteLine("..."); */ Console.ReadKey(); }
public Task SaveSecretAsync(string alias, string apiKey) { return(Task.Run(() => { DataManager.Save(alias, Encoding.UTF8.GetBytes(apiKey), new Policy()); })); }
public void onExitClick() { source.Play(); DataManager.Save(); //Application.Quit(); SceneManager.LoadScene("Title"); }
/// <summary> /// callback handlers /// </summary> void RewardedVideoAdRewardedEvent(IronSourcePlacement ssp) { Debug.Log("unity-script: I got RewardedVideoAdRewardedEvent, amount = " + ssp.getRewardAmount() + " name = " + ssp.getRewardName());//Ödüllendirme. dataManager.Load(); dataManager.data.totalCoin += 100; dataManager.Save(); }
public void PartyDelayChange(float val, Text dispText) { val = Mathf.Round(val * 10f) / 10f; DataManager.PartyDelay = val; dispText.text = val + "s"; DataManager.Save(); }
static Task PlatformSetAsync(string key, string data) { try { try { // Remove the key in case it already exists, otherwise DataManager.Save will throw an exception. // There is no way to check if a key exists without throwing an exception, so there is // no point in checking whether the key exists prior to attempting to remove it. DataManager.RemoveAlias(key); } catch { // Not logging anything since this is an expected and normal situation (if the key did not exist). } DataManager.Save(key, Encoding.UTF8.GetBytes(data), new Policy()); return(Task.CompletedTask); } catch { Tizen.Log.Error(Platform.CurrentPackage.Label, "Failed to save data."); throw; } }
public void UnSet(int itemid) { FootItem Item = ItemManager.returnFootItem(itemid); Item.UnEquip(); DataManager.Save(); }
public void UnSet(int ItemID) { AccessoryItem Item = ItemManager.returnAccessoryItem(ItemID); Item.UnEquip(); DataManager.Save(); }
public void OnPlayerNameEndEdit() { if (_dataManager != null) { _dataManager.Save(); } }
// Update is called once per frame void Update() { if (shouldFloat) { transform.position += Vector3.down * speed * Time.deltaTime; float offset = 1f; if (!grabbableCtl.Grabbed) { offset = oscillateOffset + Mathf.Sin(Time.time * 2.5f) * oscillateRange; } transform.localScale = new Vector3(offset, offset, 1); if (myCollider.bounds.max.y < river.transform.GetComponent <RiverController>().endPos.y) { if (!saved) { StartCoroutine(HttpsInterface.PutAnInstance(itemCtl.data.name, () => { Destroy(gameObject); gameObject.SetActive(false); DataManager.Save(); })); saved = true; } } } else { transform.localScale = Vector3.one; } }
public virtual void SaveToDatabase(DataManager.UowSchuleDB UnitofWork) { string settings = GetSettingsAsString(); if (!String.IsNullOrEmpty(settings)) { UnitofWork.Settings["OutputTemplate.Settings." + GetType().FullName] = new Model.Setting("OutputTemplate.Settings." + GetType().FullName, settings); UnitofWork.Save(); } }
public void IncreasePopulation(Tile tile, Person[] newPeople) { var people = new List<Person> (tile.People); people.AddRange (newPeople); tile.People = people.ToArray (); var data = new DataManager (); for (int i = 0; i < newPeople.Length; i++) data.Save (newPeople [i]); }
public static void Main(string[] args) { var dataManager = new DataManager(); for (int i = 0; i < 500; i++) { var item = new ExampleInvoiceItem (); var invoice = new ExampleInvoice (); invoice.Items = new ExampleInvoiceItem[]{ item }; dataManager.Save (invoice); dataManager.SaveLinkedEntities (invoice); } }
// TODO: Remove or reimplement //[Test] public void Test_TwoWayReference_RemoveOnDelete() { Console.WriteLine (""); Console.WriteLine ("Preparing test..."); Console.WriteLine (""); var data = new DataManager(); data.Settings.IsVerbose = true; data.WriteSummary (); var invoiceItem = new ExampleInvoiceItem (); var invoice = new ExampleInvoice (invoiceItem); data.Save(invoice, true); data.WriteSummary (); Console.WriteLine (""); Console.WriteLine ("Executing test code..."); Console.WriteLine (""); data.Delete(invoice); data.WriteSummary (); var newInvoice = data.Get<ExampleInvoice> (invoice.Id); Assert.AreEqual(0, newInvoice.Items.Length, "Linker failed to remove the link."); }