示例#1
0
 private void Form1_KeyUp(object sender, KeyEventArgs e)
 {
     if (state == st.Sit)
     {
         state = st.None;
     }
 }
    private IEnumerator TransitionTo(string str)
    {
        if (str == "walking")
        {
            state = st.rising;
            an.SetBool("rising", true);
            an.SetBool("hidden", false);

            inTransition = true;

            yield return(new WaitForSeconds(2f));

            state = st.walking;
            an.SetBool("walking", true);
            an.SetBool("rising", false);

            inTransition = false;
        }
        else if (str == "hidden")
        {
            state = st.hiding;
            an.SetBool("hiding", true);
            an.SetBool("walking", false);

            inTransition = true;

            yield return(new WaitForSeconds(0.5f));

            state = st.hidden;
            an.SetBool("hiding", false);
            an.SetBool("hidden", true);

            inTransition = false;
        }
    }
    void Start()
    {
        currentStage = stage.none;
        state        = st.sleep;

        pupil = GameObject.Find("Pupil").GetComponent <FollowPlayerPupilScript>();
        pupil.followPlayer = false;
        pupil.GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 0);
    }
示例#4
0
 private void reset()
 {
     powerOn   = st.Yes;
     monitorOn = st.Yes;
     screenOff = st.Yes;
     blockOff  = st.Yes;
     end       = st.Unknown;
     work      = st.Unknown;
 }
    private IEnumerator Stun(float stunTime)
    {
        canMove = false;
        state   = st.hidden;
        transform.GetComponent <SpriteRenderer>().color = new Color(0.5f, 1, 1, 1);
        yield return(new WaitForSeconds(stunTime));

        canMove = true;
        transform.GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 1);
    }
        static void Main(string[] args)
        {
            //Program p = new Program();
            st s = new st(5);

            //s.A= 5;
            //Console.WriteLine(s.A);
            //s[0] = "pasta";
            //Console.WriteLine(s[0]);
            //Console.WriteLine(s.Length);
            s.AA();
        }
示例#7
0
 private void Form1_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Space)
     {
         //timer1.Start();
     }
     else if (e.KeyCode == Keys.Up)
     {
         state = st.JumpUp;
     }
     else if (e.KeyCode == Keys.Down)
     {
         state = st.Sit;
     }
 }
示例#8
0
        public Ist Create(
            ImmutableList <IstCrossJoinElement> value)
        {
            Ist crossJoin = null;

            try
            {
                crossJoin = new st(
                    value);
            }
            catch (Exception exception)
            {
                this.Log.Error("Exception message: " + exception.Message + " and stacktrace " + exception.StackTrace);
            }

            return(crossJoin);
        }
示例#9
0
        public void TestMethod17()
        {
            // ToString() test
            add a = new add(0, 1, 5);

            Assert.AreEqual("add r0 r1 r5", a.ToString());
            addi ai = new addi(0, 1, 5);

            Assert.AreEqual("addi r0 r1 5", ai.ToString());
            bz bz = new bz(1, 1);

            Assert.AreEqual("bz r1 1", bz.ToString());
            bge bge = new bge(1, 1);

            Assert.AreEqual("bge r1 1", bge.ToString());
            bnz bnz = new bnz(1, 1);

            Assert.AreEqual("bnz r1 1", bnz.ToString());
            ble ble = new ble(1, 1);

            Assert.AreEqual("ble r1 1", ble.ToString());
            finish f = new finish();

            Assert.AreEqual("finish", f.ToString());
            launch l = new launch(1);

            Assert.AreEqual("launch r1", l.ToString());
            ld ld = new ld(2, 1, 3);

            Assert.AreEqual("ld r2 r1 3", ld.ToString());
            mul m = new mul(1, 2, 3);

            Assert.AreEqual("mul r1 r2 r3", m.ToString());
            muli mi = new muli(1, 2, 3);

            Assert.AreEqual("muli r1 r2 3", mi.ToString());
            st s = new st(1, 2, 3);

            Assert.AreEqual("st r1 r2 3", s.ToString());
            sub sub = new sub(1, 2, 3);

            Assert.AreEqual("sub r1 r2 r3", sub.ToString());
            subi subi = new subi(1, 2, 3);

            Assert.AreEqual("subi r1 r2 3", subi.ToString());
        }
 private IEnumerator AwakeEye()
 {
     blockDoor.SetActive(true);
     while (pupil.GetComponent <SpriteRenderer>().color.a < 1)
     {
         pupil.GetComponent <SpriteRenderer>().color += new Color(0, 0, 0, 0.04f);
         yield return(new WaitForSeconds(0.1f));
     }
     flashScreen();
     GameObject.Find("GameManager").GetComponent <GameManagerScript>().DisplayMessage(true, false);
     GameObject.Find("GameManager").GetComponent <GameManagerScript>().messageDisplay.text = "Boss\n ♥ ♥ ♥";
     pupil.GetComponent <SpriteRenderer>().color = Color.white;
     state = st.idle;
     setupStage(stage.easy);
     pupil.followPlayer = true;
     GetComponent <AudioSource>().Play();
 }
示例#11
0
        public void TestMethod16()
        {
            // test st
            RegisterFile <int> iRF = new RegisterFile <int>(16);
            Memory             m   = new Memory(5000);

            addi a = new addi(0, 1, 1);
            addi b = new addi(1, 1, 1);
            st   s = new st(0, 1, 1);
            ld   l = new ld(0, 1, 1);

            a.Process(iRF, m);
            b.Process(iRF, m);
            s.Process(iRF, m);
            l.Process(iRF, m);

            Assert.AreEqual(1, iRF[0]);
        }
示例#12
0
        public Ist Create(
            ImmutableList <IstCrossJoinElement> value)
        {
            Ist crossJoin = null;

            try
            {
                crossJoin = new st(
                    value);
            }
            catch (Exception exception)
            {
                this.Log.Error(
                    exception.Message,
                    exception);
            }

            return(crossJoin);
        }
示例#13
0
        static void DeserializeObject(byte[] bytes)
        {
            // デシリアライズ
            st st = Deserialize <st>(bytes);

            JsonFormatter jsonFormatter = new JsonFormatter(JsonFormatter.Settings.Default);
            var           json          = jsonFormatter.Format(st);

            var setting = new JsonSerializerSettings {
                MissingMemberHandling = MissingMemberHandling.Ignore, NullValueHandling = NullValueHandling.Ignore, Formatting = Formatting.Indented, ContractResolver = new CamelCasePropertyNamesContractResolver()
            };
            var mySt = JsonConvert.DeserializeObject <MySt>(json, setting);

            Console.WriteLine("Read Success !!");
            Console.WriteLine($"A:{st.A}, B:{st.B}, C:{st.C}, D:{st.D}, Child.X:{st.Child.X}, Child.Y:{st.Child.Y}");
            foreach (var item in st.Dict)
            {
                Console.WriteLine($"key:{item.Key}, value:{item.Value}");
            }
        }
示例#14
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (state == st.JumpUp)
            {
                y -= 5;

                if (y >= h2)
                {
                    state = st.JumpDown;
                }
            }
            else if (state == st.JumpDown)
            {
                y += 5;
                if (y == (3 * pictureBox1.Height) / 4)
                {
                    state = st.None;
                }
            }
            pictureBox1.Refresh();
        }
示例#15
0
 private void EndButton_Click(object sender, EventArgs e)
 {
     OutputText.Text = "";
     if (PageTable[(int)EndID.Value, 0, 0] == -1)
     {
         MessageBox.Show("找不到该进程");
         return;
     }
     else
     {
         PageTable[(int)EndID.Value, 0, 0] = -1;
     }
     for (int i = 0; i < 1024; i++)
     {
         if (memory[i, 0] == (int)EndID.Value)
         {
             memory[i, 0] = -1;
         }
     }
     if (methodFlag == 0)
     {
         while (me.Count != 0)
         {
             st temp = (st)me.Pop();
             if (temp.id == (int)EndID.Value)
             {
                 temp.id = -1;
                 me.Push(temp);
                 break;
             }
             te1.Push(temp);
         }
         while (te1.Count != 0)
         {
             st temp = (st)te1.Pop();
             me.Push(temp);
         }
     }
     PrintList();
 }
示例#16
0
                public bool modify(TimeRecord rec)
                {
                    workOldState = work;

                    // Любая следующая команда, идущая за end является командой обнуления статуса, если это не команда start
                    // Это может быть только в том случае, если start пропущена или end вставлено из-за слишком большого промежутка (т.е. в любом случае, если есть ошибка)
                    if (end == st.Yes)
                    {
                        end = st.Unknown;
                        if (!rec.isOffAction && rec.type != started)
                        {
                            reset();
                        }
                    }


                    if (rec.type == MonOff)
                    {
                        monitorOn = toSt(false);
                    }
                    else
                    if (rec.type == MonOn)
                    {
                        monitorOn = toSt(true);
                        powerOn   = toSt(true);
                    }
                    else
                    if (rec.type == PowOff)
                    {
                        powerOn = toSt(false);
                    }
                    else
                    if (rec.type == PowOn)
                    {
                        powerOn = toSt(true);
                    }
                    else
                    if (rec.type == Screen)
                    {
                        screenOff = toSt(false);
                    }
                    else
                    if (rec.type == ScreenOff)
                    {
                        screenOff = toSt(true);
                    }
                    else
                    if (rec.type == bunlock)
                    {
                        blockOff = st.Yes;
                    }
                    else
                    if (rec.type == block)
                    {
                        blockOff = st.No;
                    }

                    if (rec.isOnAction)
                    {
                        work = toSt(true);
                    }
                    else
                    if (rec.isOffAction)
                    {
                        work = toSt(false);
                        if (rec.type == ended)
                        {
                            end = st.Yes;
                        }
                    }

                    if (rec.type == ended || rec.type == started)
                    {
                        blockOff = st.Yes;   // На случай, если есть проблемы (аварийное завершение)
                    }

                    if (powerOn == st.No || monitorOn == st.No || screenOff == st.No || blockOff == st.No)
                    {
                        work = toSt(false);
                    }

                    return(work != workOldState);
                }
示例#17
0
 public void DataRecived(st data)//on client
 {
     //if using hooks, must set var manually
     this.data = data;
 }
示例#18
0
        private void ConfirmButton_Click(object sender, EventArgs e)
        {
            time++;
            if (PageTable[(int)PID.Value, 0, 0] != -1)
            {
                MessageBox.Show("已经存在ID为" + (int)PID.Value + "的进程", "警告");
                return;
            }
            else
            {
                PageTable[(int)PID.Value, 0, 0] = 1;
                PageTable[(int)PID.Value, 0, 1] = (int)PReq.Value;
            }

            if (methodFlag == 0)
            {
                while (me.Count != 0)
                {
                    st temp = (st)me.Pop();
                    if (temp.id != -1)
                    {
                        te1.Push(temp);
                        continue;
                    }

                    int n = temp.max - temp.min + 1;
                    if (n < (int)PReq.Value)
                    {
                        te1.Push(temp);
                        continue;
                    }

                    else if (n / 2 < (int)PReq.Value)
                    {
                        temp.id = (int)PID.Value;
                        for (int j = temp.min; j <= temp.max; j++)
                        {
                            memory[j, 0] = (int)PID.Value;
                        }
                        break;
                    }
                    else
                    {
                        while (n / 2 >= (int)PReq.Value)
                        {
                            st temp1;
                            temp1.min = temp.max - n / 2 + 1;
                            temp1.max = temp.max;
                            temp1.id  = -1;
                            te2.Enqueue(temp1);
                            temp.max = temp1.min - 1;
                            n        = temp.max - temp.min + 1;
                        }

                        temp.id = (int)PID.Value;
                        for (int j = temp.min; j <= temp.max; j++)
                        {
                            memory[j, 0] = (int)PID.Value;
                        }
                    }
                    while (te2.Count != 0)
                    {
                        st temp2 = (st)te2.Dequeue();
                        me.Push(temp2);
                    }
                    me.Push(temp);
                    break;
                }

                while (te1.Count != 0)
                {
                    st temp = (st)te1.Pop();
                    me.Push(temp);
                }
            }
            if (methodFlag == 1)
            {
                int i = 0, count = 0;
                while (count < 16 && i < 1024 && count < (int)PReq.Value)
                {
                    if (memory[i, 0] == -1)
                    {
                        memory[i, 0] = (int)PID.Value;
                        memory[i, 1] = count;
                        memory[i, 2] = time;
                        PageTable[(int)PID.Value, count + 1, 0] = count;
                        PageTable[(int)PID.Value, count + 1, 1] = i;
                        count++;
                    }
                    else
                    {
                        i++;
                    }
                }
            }

            PrintList();
            if (methodFlag == 1)
            {
                PrintPageList((int)PID.Value);
            }
        }
示例#19
0
 ? CreateSequenceInitializer(st, token as JArray, indent)
示例#20
0
 RunClient(action, stream, shmid, ctl, st, Int32.Parse(pid), Boolean.Parse(initial));
示例#21
0
 public CItineraire(st route)
 {
     this._ID = route.ID;
     this._bka = route.bka;
     this._bkaside = route.bkaside;
     this._bkb = route.bkb;
     this._bkbside = route.bkbside;
     this._listeAiguillage = new List<CAiguillage>();
     for (int k = 0; k < route.swcmdlist.Count; k++)
         this._listeAiguillage.Add(new CAiguillage(route.swcmdlist.ElementAt(k)));
 }
示例#22
0
        static void Main(string[] args)
        {
            st st1 = new st(1, "oooo");

            Console.WriteLine("Вопрос номер " + st1.number);
            Console.WriteLine(st1.quest);
            mark A = mark.A;

            if ((int)A == 5)
            {
                Console.WriteLine("A = 5");
            }
            Session s1  = new Session();
            Exam    ex1 = new Exam();

            ex1.Subject = "Math";
            Question q1 = new Question();

            q1.Text = "Do you know Pifagor?";
            ex1.Questions.Add(q1);
            Test t1 = new Test();

            t1.Subject = "English";
            Question q2 = new Question();

            q2.Text = "How is your english?";
            t1.Questions.Add(q2);
            Question q3 = new Question();

            q3.Text = "Is it you?";
            t1.Questions.Add(q3);
            Exam ex2 = new Exam();

            ex2.Subject = "PE";
            Question q4 = new Question();

            q4.Text = "Do you like sport?";
            ex2.Questions.Add(q4);
            Question q5 = new Question();

            q5.Text = "Where were the last Olimpic Games?";
            ex2.Questions.Add(q5);

            s1.AddExam(ex1);
            s1.AddExam(ex2);
            s1.AddTest(t1);
            SessionController controller = new SessionController(s1);

            controller.GetChechoutCount();
            controller.GetExamsCountBySubject("Math");
            controller.GetTestCountByQuestionCount(2);

            FinalExam Fe = new FinalExam();

            //Fe.ToString();

            try
            {
                Question q6 = new Question();
                q6.Text = "";
                s1.AddExam(ex1);
                s1.AddExam(ex1);
                s1.AddExam(ex1);
                // s1.AddExam(ex1);

                Exam ex3 = new Exam();
                ex3.Subject = "OOP";
                // ex3.ToString();

                int i = 0;
                //Console.WriteLine(1/i);

                /*int[] k = { 5, 3, 2, 6 };
                 * while (k[i] != 0)
                 * {
                 *  Console.WriteLine(k[i]);
                 *  i++;
                 * }*/

                Question q = null;
                //q.Text = string.Empty;
            }

            catch (QuestionException e)
            {
                Console.WriteLine(e);
            }

            catch (SessionException e)
            {
                Console.WriteLine(e);
            }
            catch (ExamException e)
            {
                Console.WriteLine(e);
            }

            catch (DivideByZeroException)
            {
                Console.WriteLine("Деление на 0 !!!\n");
            }

            catch (IndexOutOfRangeException e)
            {
                Console.WriteLine(e);
            }

            catch (NullReferenceException e)
            {
                Console.WriteLine(e);
            }

            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            finally
            {
                Console.WriteLine("Блоки try-catch пройдены.");
            }

            /*Exam ex1 = new Exam();                        //5 lab
             * ex1.Take();
             * ((ITake)ex1).Take();
             *
             *
             * var finalExam = new FinalExam();
             *
             * if (finalExam is Checkout)
             * {
             *  Console.WriteLine("Exam is Checkout!");
             * }
             * else
             * {
             *  Console.WriteLine("Exam is not Checkout");
             * }
             *
             * finalExam.GetTypeName();
             *
             * var exam = finalExam as Exam;
             *
             * exam.GetTypeName();
             *
             *
             * Console.WriteLine("---------- 6 ----------");
             *
             * List<Checkout> list = new List<Checkout>();
             * var ex = new Exam();
             * var fex = new FinalExam();
             * var test = new Test();
             * list.Add(ex);
             * list.Add(fex);
             * list.Add(test);
             *
             * var printer = new Printer();
             *
             * foreach (var item in list)
             * {
             *  printer.IAmPrinting(item);
             * }
             */
            Console.ReadKey();
        }