Exemple #1
0
 public Button(string name, ElFN fn, int usetime = 1, bool CanLostInDark = true, bool CanLostCook = true, string prefabname = null, bool GotoNextState = false, double rate = 0.5)
 {
     this.name       = name;
     this.maxusetime = this.usetime = usetime;
     this.prefabname = prefabname;
     this.fn         = (object sender, EventArgs e) => {
         if (CanLostInDark && Worldtime.GetState() == "晚上" && !Form1.traveler.HasTag("light"))
         {
             g_baseresult.LostInDark();
         }
         else
         {
             if (this.usetime > 0) //注意不能直接用 usetime--  !!!,因为它是指传入的参数
             {
                 --this.usetime;
                 if (fn != null)
                 {
                     fn(this.scane);
                 }
                 if (this.usetime <= 0)
                 {
                     if (linkbutton != null)
                     {
                         linkbutton.Enabled = false;
                     }
                 }
             }
             if (CanLostCook)
             {
                 MainForm.DeCookMenu();
             }
         }
         if (GotoNextState)
         {
             Worldtime.GotoNextState(rate);
         }
     };
 }
Exemple #2
0
 public void SetLeavefn(ElFN fn)
 {
     this.leavefn = fn;
 }
Exemple #3
0
        public void AddButton(string name, ElFN fn, int usetime = 1, bool CanLostInDark = true, bool CanLostCook = true, string prefabname = null, bool GotoNextState = false)
        {
            Button button = new Button(name, fn, usetime, CanLostInDark, CanLostCook, prefabname, GotoNextState);

            AddButton(button);
        }
Exemple #4
0
 public void SetEnterfn(ElFN fn)
 {
     this.enterfn = fn;
 }