Esempio n. 1
0
        //----------------------------------------------------------------------------private
        //正常刷新时间,加秒
        private void ReflashTime(object sender, EventArgs e)
        {                                              // gg yyyy/MM/dd hh:mm:ss dddd
            Worldtime.AddTime(new TimeSpan(0, 0, 15)); //1秒
            var    time  = Worldtime.GetTime();
            string state = Worldtime.GetState();

            TB_time.Text = time.ToString() + " " + state;
        }
Esempio n. 2
0
        //***********************************************************************************
        //控制台
        private void TB_input_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Up)
            {
                string str = (string)TB_input.Tag;
                TB_input.Text = str;
            }
            else if (e.KeyCode == Keys.Enter)
            {//char[] separator, int count, StringSplitOptions options
                char[]             separator = { ' ', '(', ')', ',', ';', '"', '(', ')', ';', '“', '”' };
                StringSplitOptions options   = StringSplitOptions.RemoveEmptyEntries;
                string[]           str       = TB_input.Text.Split(separator, options);
                if (str.Length <= 0)
                {
                    return;
                }

                if (str.Length > 1) //含有参数的
                {
                    if (str[0] == "c_give" || str[0] == "给我")
                    {
                        if (str[1] == "普通背包" || str[1] == "背包" || str[1] == "猪背包")
                        {
                            traveler.backpack.Resize(str[1] == "猪背包" ? 16 : 12);
                            bakcepackName.Text = str[1];
                        }

                        if (str.Length == 2)
                        {
                            traveler.backpack.AddObject(str[1], 1);
                        }
                        else
                        {
                            uint num;
                            if (uint.TryParse(str[2], out num))
                            {
                                traveler.backpack.AddObject(str[1], num);
                            }
                        }
                        ReflashBackpackList();
                    }
                    else if (str[0] == "printf" || str[0] == "print" || str[0] == "打印")
                    {
                        string output = "";
                        for (int i = 1; i < str.Length; ++i)
                        {
                            output += " " + str[i];
                        }
                        Print(output);
                    }
                    else if (str[0] == "WorldState" || str[0] == "时间")
                    {
                        timer_Time.Enabled = false;
                        Worldtime.SetState(str[1]);
                        timer_Time.Enabled = true;
                    }
                    else if (str[0] == "scane" || str[0] == "场景")
                    {
                        int enterorder;
                        if (str.Length > 2 && int.TryParse(str[2], out enterorder))
                        {
                            if (enterorder <= 0)
                            {
                                enterorder = 0;
                            }
                            else
                            {
                                enterorder = enterorder - 1;
                            }
                        }
                        else
                        {
                            enterorder = 0;
                        }
                        Address address = g_address.GetAddress(str[1]);
                        address.enterorder = enterorder;
                        this.AddAddress(address);
                        this.GotoNextScane();
                    }
                    else if (str[0] == "health" || str[0] == "健康")
                    {
                        int num;
                        if (Int32.TryParse(str[1], out num))
                        {
                            Form1.traveler.currenthealth = num;
                        }
                        ReflashBasedata();
                    }
                    else if (str[0] == "sanity" || str[0] == "精神")
                    {
                        int num;
                        if (Int32.TryParse(str[1], out num))
                        {
                            Form1.traveler.currentsanity = num;
                        }
                        ReflashBasedata();
                    }
                    else if (str[0] == "hunger" || str[0] == "饥饿")
                    {
                        int num;
                        if (Int32.TryParse(str[1], out num))
                        {
                            Form1.traveler.currenthunger = num;
                        }
                        ReflashBasedata();
                    }
                }
                else//不含参数的
                {
                    if (str[0] == "cls" || str[0] == "清屏")
                    {
                        TB_Dialogue.Text = "";
                    }
                    else if (str[0] == "NextWorldState" || str[0] == "下一段")
                    {
                        timer_Time.Enabled = false;
                        Worldtime.AddTime(Worldtime.GetTimeNowToNext());
                        timer_Time.Enabled = true;
                    }
                }

                TB_input.Tag  = TB_input.Text;
                TB_input.Text = "";
                TB_input.Focus();
            }
        }
Esempio n. 3
0
 public void Awake(TimeSpan passtime)
 {
     Worldtime.AddTime(passtime);
     timer_Time.Enabled = true;
 }