Example #1
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Example #2
0
        /// <summary>
        /// É responsável pelo carregamento do conteúdo do jogo, chamada apenas uma vez.
        /// </summary>
        protected override void LoadContent()
        {
            // Create o SpriteBatch para desenhar as texturas
            spriteBatch = new SpriteBatch(GraphicsDevice);

            //carregando os sons
            Sons.LoadContent(Content);

            //Definindo as fontes
            Fontes.Menu            = Content.Load <SpriteFont>("Fonts\\bitstreamMenu");
            Fontes.MenuSelecionado = Fontes.Menu;
            Fontes.Score           = Content.Load <SpriteFont>("Fonts\\Score_Miramonte");
            Fontes.Creditos        = Content.Load <SpriteFont>("Fonts\\bitstreamCreditos");
            Fontes.TituloCreditos  = Fontes.Score;

            //Tela do logo
            telaLogo = new TelaLogo(this);
            telaLogo.Initialize();
            Components.Add(telaLogo);

            //Tela Inicial
            fundoInicial = Content.Load <Texture2D>("Telas\\tela_inicio");
            telaInicial  = new TelaInicio(this, fundoInicial);
            telaInicial.Initialize();
            Components.Add(telaInicial);


            //Tela Controles
            fundoControles = Content.Load <Texture2D>("Telas\\tela_inicio");
            controles      = Content.Load <Texture2D>("Telas\\telas_controles");
            telaControles  = new TelaControles(this, fundoControles, controles);
            telaControles.Initialize();
            Components.Add(telaControles);

            //Tela Jogo
            telaJogo = new TelaJogo(this);
            telaJogo.Initialize();
            Components.Add(telaJogo);

            //Tela Abertura
            telaAbertura = new TelaAbertura(this);
            telaAbertura.Initialize();
            Components.Add(telaAbertura);

            //Tela Creditos
            telaCreditos = new TelaCreditos(this);
            telaCreditos.Initialize();
            Components.Add(telaCreditos);

            ((TelaInicio)telaInicial).CriarMenu();

            //Iniciar a primeira tela
            telaLogo.Mostrar();
            telaAtual = telaLogo;

            base.LoadContent();
        }
 public void Play(Sons s)
 {
     try
     {
         _sons[s].Play();
     }
     catch (Exception e)
     {
         EugLib.FileStream.toStdOut(e.ToString());
     }
 }
        public MainPage()
        {
            InitializeComponent();

            var assembly = typeof(MainPage).GetTypeInfo().Assembly;

            imgLogo.Source = ImageSource.FromResource($"{assembly.GetName().Name}.Model.Imagens.logo.png");

            Sons.carregarSons();
            Sons.intro.Play();
            lstPergunta = new Repositorio().LerJson();
        }
Example #5
0
        public static void Reproduzir(Sons Índice, bool Laço = false)
        {
            // Somente se necessário
            if (Editor_Mapas.Objetos.Visible && !Editor_Mapas.Objetos.butÁudio.Checked)
            {
                return;
            }

            // Reproduz o áudio
            Lista[(byte)Índice].Volume = 20;
            Lista[(byte)Índice].Loop   = Laço;
            Lista[(byte)Índice].Play();
        }
Example #6
0
 void Awake()
 {
     if (!sons)
     {
         sons = this;
         DontDestroyOnLoad(gameObject);
         audioSource = GetComponent <AudioSource>();
     }
     else
     {
         Destroy(gameObject);
     }
 }
Example #7
0
        public static void Reproduce(Sons Index, bool Laço = false)
        {
            // Apenas se necessário
            if (!Lists.Options.Sons)
            {
                return;
            }

            // Reproduz o Sound
            List[(byte)Index].Volume = 20;
            List[(byte)Index].Loop   = Laço;
            List[(byte)Index].Play();
        }
Example #8
0
    public void Tocar(string name)
    // função que faz qualquer audio dentro do jogo ser tocado
    {
        //procura um item dentro do array que tenha o nome que foi digitado
        Sons s = System.Array.Find(trilha, sound => sound.nome == name);

        //se nao encontrar um item no array retorna
        if (s == null)
        {
            return;
        }
        // se encontrar toca
        s.fonte.Play();
    }
Example #9
0
        protected override Property ReadSonClass(Property prop)
        {
            switch (prop.Value)
            {
            case "CLASS":
                CLASS entity = new CLASS(DXFData, prop);
                Sons.Add(entity);
                var lastProp = entity.ReadProperties();
                return(lastProp);

            default:
                return(base.ReadSonClass(prop));
            }
        }
Example #10
0
    public void jouerSon(Sons sonAJouer, bool isLooping)
    {
        source.loop = isLooping;

        //Debug.Log("jouerSon");

        switch (sonAJouer)
        {
        case Sons.music:
            source.clip = music;
            source.Play();
            break;

        case Sons.frappeTable:
            source.clip = frappeTable;
            source.Play();
            break;

        case Sons.remplirChope:
            source.clip = remplirChope;
            source.Play();
            break;

        case Sons.chuteChope:
            source.clip = renverserChope;
            source.Play();
            break;

        case Sons.renverserLegerement:
            Debug.Log("renverserLegerement");
            source.clip = renverserLegerement;
            source.Play();
            break;

        case Sons.boireChope:
            source.clip = boireChope;
            source.Play();
            break;

        case Sons.glisserChope:
            source.clip = glisserChope;
            source.Play();
            break;
        }
    }
Example #11
0
 protected override Property ReadSonClass(Property prop)
 {
     //是属性,那么特别待遇了
     if (prop.Value.Length > 0 && prop.Value[0] == '{')
     {
         ACAD_XDICTIONARY hv = new ACAD_XDICTIONARY(DXFData, prop);
         Sons.Add(hv);
         var lastProp = hv.ReadProperties();
         return(lastProp);
     }
     else if (prop.Code == 102 && prop.Value == "}")
     {
         return(DXFData.Next());
     }
     else
     {
         return(base.ReadSonClass(prop));
     }
 }
Example #12
0
        public Bohr GetAutomoveWithChar(char character)
        {
            Bohr next = NextStateByChar.GetValueOrDefault(character);

            if (next != null)
            {
                return(next);
            }

            Bohr forward = Sons.GetValueOrDefault(character);

            if (forward == null)
            {
                forward = Parent == null ? this : GetSuffLink().GetAutomoveWithChar(character);
            }

            NextStateByChar[character] = forward;
            return(forward);
        }
Example #13
0
        public void Abrir(Sons sons)
        {
            if (sons == Sons.Sirene) //
            {
                Sirene.PlayLooping();
            }
            else if (sons == Sons.SuperPilula) //
            {
                SuperPilula.Play();
            }
            else //
            {
                WinApi.MciSendString("close myaudio", "", 0, IntPtr.Zero);
                WinApi.MciSendString(string.Concat("open ", Caminho.Audios, sons, ".wav", " alias myaudio"), "", 0, IntPtr.Zero);
                WinApi.MciSendString("set myaudio time format ms", "", 0, IntPtr.Zero);
                WinApi.MciSendString("status myaudio length", new string(Convert.ToChar(" "), 128), 128, IntPtr.Zero);

                Reproduzir();
            }
        }
Example #14
0
 public void LoadContent(ContentManager content, Sons s, string assetName)
 {
     _sons.Add(s, content.Load<SoundEffect>(assetName).CreateInstance());
 }
Example #15
0
 /// <summary>
 /// 创建子类并进行属性读取
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 protected Property CreateSonClass(Entity entity)
 {
     Sons.Add(entity);
     return(entity.ReadProperties());
 }
Example #16
0
 public Entity Append(Entity entity)
 {
     Sons.Add(entity);
     return(entity);
 }
    public void SoundEffect(string name)
    {
        GameObject Ignore = new GameObject(name);

        Ignore.AddComponent <AudioSource> ();

        AudioSource Sons;

        Sons = GameObject.Find(name).GetComponent <AudioSource> ();

        defVolume = Sons.volume;
        defPitch  = Sons.pitch;


        if (name != "null")
        {
            foreach (AudioEvent a in audioClips)             //procura o AudioEvent especificado por name

            {
                if (a.audioEventName == name)
                {
                    isPresent = true;

                    Sons.volume   = a.volume;                 //assimila o volume do AudioEvent
                    Sons.pitch    = a.pitch;                  //assimila o pitch do AudioEvent
                    Sons.priority = a.priority;

                    if (a.Loop)
                    {
                        Sons.loop = true;
                    }

                    if (a.audioClip != null)
                    {
                        Sons.clip = a.audioClip;
                        Sons.Play();
                    }
                    else
                    {
                        Debug.LogError("AudioEvent " + a.audioEventName + " has no AudioClip!");
                        break;
                    }

                    if (!a.Loop)
                    {
                        Destroy(Ignore, Sons.clip.length);
                    }
                }
            }

            Sons.volume = defVolume;
            Sons.pitch  = defPitch;



            //source.volume = defVolume;
            //source.pitch = defPitch;
            if (!isPresent)
            {
                Debug.LogError("AudioEvent " + name + " wasn't found! Are you sure you typed it right?");
            }
        }
        else
        {
            Debug.LogError("AudioEvent " + name + " is using the default name of 'null'. Rename it and try again.");
        }
        isPresent = false;
    }
Example #18
0
 public void AddSon(ZMI son) => Sons.Add(son);
Example #19
0
 public void RemoveSon(ZMI son) => Sons.Remove(son);