IEnumerator WaitForRequest(Brain brain, bool pop) { WWW www = new WWW(pop ? brain.Population.Url.AbsoluteUri : brain.ChampionGene.Url.AbsoluteUri); print("Downloading"); yield return(www); print("Done downloading"); string folderPath = Application.persistentDataPath + string.Format("/{0}", ParseUser.CurrentUser.Username); DirectoryInfo dirInf = new DirectoryInfo(folderPath); if (!dirInf.Exists) { Debug.Log("Creating subdirectory"); dirInf.Create(); } string popFilePath = Application.persistentDataPath + string.Format("/{0}/{1}.pop.xml", ParseUser.CurrentUser.Username, brain.ObjectId); if (!pop) { popFilePath = Application.persistentDataPath + string.Format("/{0}/{1}.champ.xml", ParseUser.CurrentUser.Username, brain.ObjectId); } File.WriteAllText(popFilePath, www.text); TrainButton.Enable(); }
void slot1_DragDrop(dfControl control, dfDragEventArgs dragEvent) { dfPanel panel = control as dfPanel; BrainPanelState brainPanel = panel.GetComponent <BrainPanelState>(); if (draggedBrain != null) { if (draggedBrain.ChampionGene == null) { _dialog.ShowDialog("This brain has not been trained yet and cannot be used in battle mode."); brainPanel.Refresh(); return; } brainPanel.AddBrain(draggedBrain); BattleButton.Enable(); } }
// Update is called once per frame void Update() { cooldown += Time.deltaTime; if (cooldown >= Cooldown) { Button.Enable(); //CountdownLabel.Hide(); CountdownLabel.Text = "'R'"; } else { CountdownLabel.Text = string.Format("{0:0.00}", Cooldown - cooldown); } if (Input.GetKeyDown(KeyCode.R)) { Reset(); } }
public void ShowDialog(string text) { _label.Text = text; _panel.Show(); _button.Enable(); }