Exemple #1
0
 void Start()
 {
     cig      = Tobacco.s_inst;
     ui       = AccessUI.s_inst;
     ind_xpos = 8.2f * CameraController.aspect_multiplier;
     ui.rainDistanceIndicator.position = new Vector3(Camera.main.transform.position.x - ind_xpos, ui.rainDistanceIndicator.position.y, ui.rainDistanceIndicator.position.z);
     rb = GetComponent <Rigidbody2D>();
     Move(true);
 }
Exemple #2
0
 void Awake()
 {
     if (s_inst == null)
     {
         s_inst = this;
     }
     else
     {
         Destroy(this);
         s_inst = this;
     }
 }
 void wc_NoMoreData()
 {
     try {
         if (InvokeRequired)
         {
             AccessUI del = delegate { wc_NoMoreData(); };
             Invoke(del);
             return;
         }
         MessageBox.Show("Done!");
         button1_Click(null, null);
     } catch { }
 }
Exemple #4
0
 void Start()
 {
     controllType = GameControllerV2.s_inst.LiveDataStorage.controllType;
     ui           = AccessUI.s_inst;
     if (shrinkable)
     {
         e0 = embers.transform.localScale.y;
     }
     pocPos = transform.position;
     pocRot = transform.rotation;
     if (shrinkable)
     {
         yStartScale = transform.localScale.y;
     }
     rb = GetComponentInParent <Rigidbody2D>();
     ui.healthSlider.maxValue = Health;
     launchSlider.maxValue    = launchTime;
     cigDecrement             = 1 / (burnTime * 60 / tickEvery);
     pocetnaPozicijaX         = embers.transform.position.x;
     cntBackAfter             = 10f * CameraController.aspect_multiplier;
     cantGoBackX = transform.position.x - cntBackAfter;
     nextTick    = Time.time + tickEvery;
 }
        void wc_DataCollected(DataCollectedEventArgs e)
        {
            try {
                if (InvokeRequired)
                {
                    AccessUI del = delegate { wc_DataCollected(e); };
                    Invoke(del);
                    return;
                }
                if (!chkSilent.Checked)
                {
                    //aici restul de cod
                    TreeNode root = this.treeResults.Nodes[0];
                    //verificam daca avem nod adaugat. Daca nu cream unul nou pentru pozitia curenta
                    TreeNode tn;
                    if (root.Nodes.Count <= e.CrawlerID)
                    {
                        //generam unul nou
                        tn = new TreeNode();
                        root.Nodes.Add(tn);
                        tn.ImageIndex         = 1;
                        tn.SelectedImageIndex = 1;
                        tn.StateImageIndex    = 1;
                        tn.Text = e.URL;
                        tn.Tag  = "Crawler ID = " + e.CrawlerID;
                    }
                    else
                    {
                        tn = root.Nodes[e.CrawlerID];
                    }



                    //avem nodul pe care trebuie sa punem datele
                    TreeNode newChild = new TreeNode();
                    tn.Nodes.Add(newChild);
                    newChild.Text               = "[" + e.Language.ToString() + "] " + e.URL;
                    newChild.ImageIndex         = 2;
                    newChild.SelectedImageIndex = 2;
                    newChild.StateImageIndex    = 2;
                    newChild.Tag = e.Text;
                }
                //} else {
                //    if (chkWordCounter.Checked) {
                //        //TextWriter tw = new StreamWriter(this.edtPath.Text + e.CrawlerID + "_" + e.Language.ToString() + ".txt", false, Encoding.UTF8);
                //        //tw.Write(e.Text);
                //        //tw.Flush();
                //        //tw.Close();
                //        //tw.Dispose();
                //        int word_count = e.Text.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Length;
                //        if (e.Language == LanguageType.RO) {
                //            ro_en += word_count;
                //            ro_de += word_count;
                //        }
                //        if (e.Language == LanguageType.EN) {
                //            ro_en += word_count;
                //        }
                //        if (e.Language == LanguageType.DE) {
                //            ro_de += word_count;
                //        }
                //        this.lblResults.Text = "Results: " + ro_en + "/" + ro_de;
                //        //TextWriter twDesc = new StreamWriter(this.edtPath.Text + "descriptor.txt", true);
                //        //twDesc.WriteLine(this.edtPath.Text + e.CrawlerID + "_" + e.Language.ToString() + ".txt " + word_count.ToString() + " " + e.URL);
                //        //twDesc.Flush();
                //        //twDesc.Close();
                //        //twDesc.Dispose();
                //        if ((ro_en > this.edtPagesNeeded.Value) && (ro_de > this.edtPagesNeeded.Value)) {
                //            this.button1_Click(null, new EventArgs());
                //        }
                //    }

                //}
                this.progressBar1.Value = e.CrawlerID + 1;
                this.lblResults.Text    = "Results: " + this.progressBar1.Value + "/" + this.edtPagesNeeded.Value;
                int    wcount = e.Text.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Length;
                string d      = "";
                if (this.edtPath.Text[this.edtPath.Text.Length - 1] != '\\')
                {
                    d = "\\";
                }
                TextWriter tw = new StreamWriter(this.edtPath.Text + d + e.CrawlerID + "_" + e.Language.ToString() + ".txt", false, Encoding.UTF8);
                tw.Write(e.Text);
                tw.Flush();
                tw.Close();
                tw.Dispose();
                TextWriter twDesc = new StreamWriter(this.edtPath.Text + d + "descriptor.txt", true);
                twDesc.WriteLine(this.edtPath.Text + d + e.CrawlerID + "_" + e.Language.ToString() + ".txt " + wcount.ToString() + " " + e.URL);
                twDesc.Flush();
                twDesc.Close();
                twDesc.Dispose();
            } catch (Exception ex) { MessageBox.Show("There was an exception inside the WIKICRAWLER plugin. Please report the following :" + ex.ToString()); this.button1_Click(null, EventArgs.Empty); }
        }