コード例 #1
0
    // Start is called before the first frame update

    public void run(StateLevel sl)
    {
        switch (sl)
        {
        case StateLevel.Start:
            startState();
            break;

        case StateLevel.Ready:
            readyState();
            break;

        case StateLevel.Roll:
            Debug.Log("roll");
            rollState();
            break;

        case StateLevel.End:
            endState();
            break;

        default:
            Debug.Log("err");
            break;
        }
    }
コード例 #2
0
        //枚举类型作为参数传递
        /// <summary>
        ///
        /// </summary>
        /// <param name="Content"></param>
        /// <param name="StateLevel">枚举类型作为参数传递 StateLevel</param>
        /// <returns></returns>
        private Label CreateLabelText(string Content, StateLevel StateLevel)
        {
            Label Label = new Label();

            Label.Text     = Content;
            Label.Dock     = DockStyle.Fill;
            Label.AutoSize = true;

            Label.TextAlign = ContentAlignment.MiddleCenter;
            Label.Padding   = new Padding(10, 10, 10, 10);
            Color FontColor = Color.Green;

            switch (StateLevel)
            {
            case StateLevel.Warrning:
                FontColor = Color.OrangeRed;
                break;

            case StateLevel.Error:
                FontColor = Color.Red;
                break;

            case StateLevel.Normal:
                FontColor = Color.Green;
                break;

            default:
                FontColor = Color.Green;
                break;
            }
            Label.ForeColor = FontColor;
            return(Label);
        }
コード例 #3
0
 protected void nextState()
 {
     if (state == StateLevel.End)
     {
         state = 0;
         return;
     }
     state++;
 }
コード例 #4
0
ファイル: Game1.cs プロジェクト: GroupGame/Do_An_Cuoi_Ky
        protected override void Draw(GameTime gameTime)
        {
            //GraphicsDevice.Clear(Color.Black);
            GraphicsDevice.Clear(Color.CornflowerBlue);
            spriteBatch.Begin();

            switch (gameState)
            {
                case State.Menu:
                    sf.Draw(spriteBatch);
                    spriteBatch.Draw(menuImage, Vector2.Zero, Color.White);
                    //spriteBatch.Draw(singlePlayer, new Vector2(260, 200), Color.White);
                    //spriteBatch.Draw(multiPlayer, new Vector2(260, 280), Color.White);
                    //spriteBatch.Draw(Help, new Vector2(260, 360), Color.White);
                    //spriteBatch.Draw(About, new Vector2(260, 440), Color.White);
                    for (int i = 0; i < sprites.Count; i++)
                        sprites[i].Draw(gameTime, spriteBatch);
                    break;
                case State.Single:
                    sf.Draw(spriteBatch);
                    p.Draw(spriteBatch);

                    foreach (Explosion ex in explosionList)
                    {
                        ex.Draw(spriteBatch);
                    }

                    foreach (Asteroid a in asteroidList)
                    {
                        a.Draw(spriteBatch);
                    }
                    foreach (Emergency em in emergencyList)
                    {
                        em.Draw(spriteBatch);
                    }
                    foreach (Enemy e in enemyList)
                    {
                        e.Draw(spriteBatch);
                    }
                    if (p.score >= 400 && p.score <= 500 && enb.isVisible ==true)

                            enb.Draw(spriteBatch);

                    hud.Draw(spriteBatch);
                    break;
                case State.Multi:

                    sf.Draw(spriteBatch);
                    if (p.health > 0 && p.live > 0)
                    {
                        p.Draw(spriteBatch);
                    }
                    if (p2.health > 0 && p2.live > 0)
                    {
                        p2.Draw(spriteBatch);

                    }
                    foreach (Explosion ex in explosionList)
                    {
                        ex.Draw(spriteBatch);
                    }

                    foreach (Asteroid a in asteroidList)
                    {
                        a.Draw(spriteBatch);
                    }
                    foreach (Emergency em in emergencyList)
                    {
                        em.Draw(spriteBatch);
                    }
                    foreach (Enemy e in enemyList)
                    {
                        e.Draw(spriteBatch);
                    }

                    hud.Draw(spriteBatch);
                    hud2.Draw(spriteBatch);
                    break;
                case State.Option:
                    #region option
                    Vector2 r_sound = new Vector2();
                    Vector2 MousePosition = MouseEventHelper.GetInstance().GetMousePosition();
                    r_sound.X = 300;
                    r_sound.Y = 280;
                    spriteBatch.Draw(Option, Vector2.Zero, Color.White);
                    if (SoundManager.boolSound == true)
                    {
                        spriteBatch.Draw(On_Off_Sound[0], r_sound, Color.White);
                        if (IsSelected(MousePosition, r_sound, On_Off_Sound[0]) && MouseEventHelper.GetInstance().HasLeftButtonDownEvent())
                            SoundManager.boolSound = false;
                    }
                    else if (SoundManager.boolSound == false)
                    {
                        spriteBatch.Draw(On_Off_Sound[1], r_sound, Color.White);
                        if (IsSelected(MousePosition, r_sound, On_Off_Sound[1]) && MouseEventHelper.GetInstance().HasLeftButtonDownEvent())
                            SoundManager.boolSound = true;
                    }

                    Vector2 r_level = new Vector2();
                    r_level.X = 300;
                    r_level.Y = 330;
                    if (stateLevel == StateLevel.Easy)
                    {
                        spriteBatch.Draw(Level[0], r_level, Color.White);
                        if (IsSelected(MousePosition, r_level, Level[0]) && MouseEventHelper.GetInstance().HasLeftButtonDownEvent())
                            stateLevel = StateLevel.Normal;
                    }
                    else if (stateLevel == StateLevel.Normal)
                    {
                        spriteBatch.Draw(Level[1], r_level, Color.White);
                        if (IsSelected(MousePosition, r_level, Level[1]) && MouseEventHelper.GetInstance().HasLeftButtonDownEvent())
                            stateLevel = StateLevel.Hard;
                    }
                    else if (stateLevel == StateLevel.Hard)
                    {
                        spriteBatch.Draw(Level[2], r_level, Color.White);
                        if (IsSelected(MousePosition, r_level, Level[2]) && MouseEventHelper.GetInstance().HasLeftButtonDownEvent())
                            stateLevel = StateLevel.Easy;
                    }

                    for (int i = 0; i < btBack.Count; i++)
                        btBack[i].Draw(gameTime, spriteBatch);
                    #endregion
                    break;
                case State.Help:
                    spriteBatch.Draw(Help, Vector2.Zero, Color.White);
                    for (int i = 0; i < btBack.Count; i++)
                        btBack[i].Draw(gameTime, spriteBatch);
                    break;
                case State.About:
                    spriteBatch.Draw(AboutScreen, Vector2.Zero, Color.White);
                    for (int i = 0; i < btBack.Count; i++)
                        btBack[i].Draw(gameTime, spriteBatch);
                    break;
                case State.GameOver:
                    {
                        spriteBatch.Draw(gameOver, Vector2.Zero, Color.White);
                        spriteBatch.DrawString(hud.playerScoreFont, "Your final score was : " + hud.playerScore.ToString(), new Vector2(235, 100), Color.Red);
                        break;
                    }
            }

            spriteBatch.End();

            base.Draw(gameTime);
        }
コード例 #5
0
        public EstadoPasaporte Calculate(Dictionary <string, EstadoPasaporte> matrix)
        {
            // CASOS DE TRANSICION
            if (StateLevel == TypeState.Afectado)
            {
                return(NewState = matrix["Afectado"]);
            }

            if (StateLevel == TypeState.Recaido)
            {
                return(NewState = TestInmuneIgG.HasValue && TestInmuneIgG.Value ? matrix["Recaida1"] : matrix["Recaida2"]);
            }

            if (PCRReconvertido && !PCRUltimo && TestInmuneIgM == true)
            {
                return(NewState = TestInmuneIgG.HasValue && TestInmuneIgG.Value ? matrix["Recaida1"] : matrix["Recaida2"]);
            }

            // CASOS CALCULADOS
            List <EstadoPasaporte> partialMatriz = matrix.Values.Where(c => c.IdTipoEstadoNavigation.Nombre == StateLevel.ToString()).ToList();

            // Caso Azul
            if (!TestInmuneIgM.HasValue || !TestInmuneIgG.HasValue)
            {
                return(NewState = partialMatriz.FirstOrDefault(c => c.TestInmuneIgG == null && c.TestInmuneIgM == null && (!PCRReconvertido ? c.Pcrant == null : c.Pcrant == PCRReconvertido)));
            }

            if (TestInmuneIgM.HasValue && TestInmuneIgG.HasValue)
            {
                //Caso Verde
                if (PCRReconvertido)
                {
                    return(NewState = partialMatriz.FirstOrDefault(c => c.TestInmuneIgG == TestInmuneIgG.Value && c.TestInmuneIgM == TestInmuneIgM.Value && c.Pcrant == PCRReconvertido));
                }

                //Caso Naranja
                if (!PCRReconvertido)
                {
                    return(NewState = partialMatriz.FirstOrDefault(c => c.TestInmuneIgG == TestInmuneIgG.Value && c.TestInmuneIgM == TestInmuneIgM.Value && c.Pcrant == null));
                }
            }

            return(null);
        }