Exemple #1
0
    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();
    }
Exemple #2
0
    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();
        }
    }
Exemple #3
0
    // 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();
        }
    }
Exemple #4
0
 public void ShowDialog(string text)
 {
     _label.Text = text;
     _panel.Show();
     _button.Enable();
 }