Пример #1
0
 static public int Play(IntPtr l)
 {
     try {
         UIPlaySound self = (UIPlaySound)checkSelf(l);
         self.Play();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Пример #2
0
 private void CheckKeys()
 {
     //if they hit escape load the previous scene
     if (Input.GetKeyDown("escape"))
     {
         slideSound.Play();
         while (slideSound.IsInvoking())
         {
             //do nothing
         }
         MissionSelect();
     }
 }
Пример #3
0
 private void CheckKeys()
 {
     //if they hit escape load the previous scene
     if (Input.GetKeyDown("escape"))
     {
         slideSound.Play();
         while (slideSound.IsInvoking())
         {
             //do nothing
         }
         MainMenuSelect();
     }
     if (Input.GetKeyDown("a"))
     {
         ShowAesopMissionText();
         ShowFourcroyMissionText();
         ShowHerronsMissionText();
         ShowSantaroMissionText();
     }
     if (Input.GetKeyUp("a"))
     {
         HideAesopMissionText();
         HideFourcroyMissionText();
         HideHerronsMissionText();
         HideSantaroMissionText();
     }
     if (Input.GetKeyDown("return") && highlightedMission != null)
     {
         slideSound.Play();
         while (slideSound.IsInvoking())
         {
             //do nothing
         }
         LobbySelect();
     }
 }
Пример #4
0
 private void CheckKeys()
 {
     //if they hit escape load the previous scene
     if (Input.GetKeyDown("escape"))
     {
         slideSound.Play();
         while (slideSound.IsInvoking())
         {
             //do nothing
         }
         MainMenuSelect();
     }
     //if they hit enter pretend to save changes and load previous scene
     if (Input.GetKeyDown("return"))
     {
         //This is where the settings would be saved.
         slideSound.Play();
         while (slideSound.IsInvoking())
         {
             //do nothing
         }
         MainMenuSelect();
     }
 }
Пример #5
0
    private void scan()
    {
        Result result = reader.Decode(temps, cameraTexture.height, cameraTexture.width);

        if (result != null)
        {
            DialogUtil.tip(result.Text);
            UIPlaySound sound = gameObject.GetComponent <UIPlaySound>();
            sound.Play();
            cameraTexture.Stop();
            if (callBack != null)
            {
                callBack.Execute();
            }
        }
    }
Пример #6
0
    public static int Play(IntPtr l)
    {
        int result;

        try
        {
            UIPlaySound uIPlaySound = (UIPlaySound)LuaObject.checkSelf(l);
            uIPlaySound.Play();
            LuaObject.pushValue(l, true);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
        public void OnSourceCreated(Source source)
        {
            if (_CurrentTelegram != null && !_CurrentTelegram.GetComponent <TelegramController>().IsDragging)
            {
                _CurrentTelegram.GetComponent <TelegramController>().DestroyTelegram();
            }
            GameObject telegramGO = GameObject.Instantiate(_TelegramPrefab) as GameObject;

            _CurrentTelegram = telegramGO;
            TelegramController telegram = telegramGO.GetComponent <TelegramController>();

            telegram.Source                  = source;
            telegram.transform.parent        = transform;
            telegram.transform.localPosition = Vector2.zero;
            telegram.transform.localScale    = Vector2.one;

            TickerSound.Play();
        }
Пример #8
0
    IEnumerator DestroyGameObject()
    {
        yield return(new WaitForSeconds(DestroyTime));

        if (destroyAudio != null)
        {
            UIPlaySound us = gameObject.AddComponent <UIPlaySound>();
            us.audioClip = destroyAudio;
            us.Play();
        }
        if (isSetHide)
        {
            gameObject.SetActive(false);
        }
        else
        {
            Destroy(gameObject);
        }
    }
Пример #9
0
 public void OnMoneyChanged(int money)
 {
     CashSound.Play();
     MoneyLabel.text = string.Format("{0}", money);
 }
Пример #10
0
    void Update()
    {
        switch (gameState)
        {
        case GameState.Starting:          //ok
            if (countDownTimeLeft <= 0)
            {
                CountDownSound.audioClip = CountDownSource;
                CountDownSound.Play();
                gameState = GameState.Playing;
                playState = PlayState.NewRandom;
            }
            else if (Mathf.FloorToInt(countDownTimeLeft) < countDownTimeLeftTmp)
            {
                CountDownLabelPlayTween.resetOnPlay = true;
                if (countDownTimeLeftTmp < 3)
                {
                    CountDownSound.Play();
                }
                CountDownLabel.text = countDownTimeLeftTmp.ToString();
                CountDownLabelPlayTween.Play(true);
                countDownTimeLeftTmp--;
            }
            countDownTimeLeft -= Time.deltaTime;
            break;

        case GameState.Playing:          //ok

            PlayComboCountLabel.text = combo.ToString();

            switch (playState)
            {
            case PlayState.NewRandom:              //ok

                randomQuestion = Random.Range(0, dataCount);
                computerPlay   = NewComputerPlay(randomQuestion);
                playerPlay     = -1;

                QuestionLabel.key = data[randomQuestion][0];
                timeLeft          = SetTimeLeft(combo);

                PlayUI.SetActive(true);
                playState = PlayState.Going;
                break;

            case PlayState.Going:              //ok

                TimeLeftCountDownLabel.text = timeLeft.ToString("0.0");
                timeLeft -= Time.deltaTime;


                if (playerPlay != -1)
                {
                    isPlayed = true;
                    PlayUI.SetActive(false);
                    playState      = PlayState.PlayingAnimation;
                    animationState = AnimationState.MoveForward;
                }
                if (timeLeft <= 0.0f)
                {
                    PlayUI.SetActive(false);
                    TimeLeftCountDownLabel.text = "0.0";
                    DefeatSprite.spriteName     = "TimesUp";
                    gameState = GameState.EndAnimation;
                }
                break;

            case PlayState.PlayingAnimation:
                switch (animationState)
                {
                case AnimationState.MoveForward:
                    if (isPlayed)
                    {
                        isPlayed = false;
                        if (AwinB(playerPlay, computerPlay))
                        {
                            ResultLocalize.key = "Win";
                        }
                        else if (AwinB(computerPlay, playerPlay))
                        {
                            ResultLocalize.key = "Lose";
                        }
                        else
                        {
                            ResultLocalize.key = "Draw";
                        }
                        ResultLabel.gameObject.SetActive(true);
                        player[playerPlay].Play(true);
                        computer[computerPlay].Play(true);
                    }
                    if (!player[playerPlay].GetComponent <TweenPosition>().enabled)
                    {
                        stopTime       = 1.0f;
                        animationState = AnimationState.Stop;
                    }
                    break;

                case AnimationState.Stop:
                    stopTime -= Time.deltaTime;
                    if (stopTime <= 0.0f)
                    {
                        isPlayed       = true;
                        animationState = AnimationState.MoveBack;
                    }
                    break;

                case AnimationState.MoveBack:
                    if (isPlayed)
                    {
                        isPlayed = false;
                        player[playerPlay].Play(false);
                        computer[computerPlay].Play(false);
                    }
                    if (!player[playerPlay].GetComponent <TweenPosition>().enabled)
                    {
                        ResultLabel.gameObject.SetActive(false);
                        playState = PlayState.Judgment;
                    }
                    break;
                }
                break;

            case PlayState.Judgment:                 //ok
                if (AwinB(playerPlay, computerPlay)) //player win
                {
                    combo++;
                    playState = PlayState.NewRandom;
                }
                else if (AwinB(computerPlay, playerPlay))                      //computer win
                {
                    DefeatSprite.spriteName = "Defeat";
                    gameState = GameState.EndAnimation;
                }
                else
                {
                    playState = PlayState.NewRandom;
                }
                break;
            }


            break;

        case GameState.EndAnimation:


            switch (endAnimationState)
            {
            case EndAnimationState.MoveDown:
                DefeatSpriteTweenPosition.from = new Vector3(0, 511, 0);
                DefeatSpriteTweenPosition.to   = new Vector3(0, 0, 0);
                DefeatSpritePlayTween.Play(true);
                if (!DefeatSpriteTweenPosition.enabled)
                {
                    stopTime          = 1.0f;
                    endAnimationState = EndAnimationState.Stop;
                }
                break;

            case EndAnimationState.Stop:
                if (stopTime > 0)
                {
                    stopTime -= Time.deltaTime;
                }
                else
                {
                    DefeatSpriteTweenPosition.gameObject.SetActive(false);
                    testNetwork.ReTestConnection();
                    gameState = GameState.Ending;
                }
                break;
            }


            break;

        case GameState.Ending:
            PlayUI.SetActive(false);
            EndUI.SetActive(true);
            EndComboCountLabel.text = combo.ToString();
            if (testNetwork.isConnect)
            {
                if (!testNetwork.isReConnect)
                {
                    Warning.SetActive(false);
                }
            }
            else
            {
                Warning.SetActive(true);
                testNetwork.ReTestConnection();
            }
            break;
        }
    }
Пример #11
0
    private void CheckKeys()
    {
        //just quit when escape is hit.
        if (Input.GetKeyDown("escape"))
        {
            Application.Quit();
        }

        //move the slider up one element
        if (Input.GetKeyDown("up") || Input.GetKeyDown("w"))
        {
            slideSound.Play();
            verticalScrollBar.value = verticalScrollBar.value - 0.5f;
        }

        //move the slider down one element
        if (Input.GetKeyDown("down") || Input.GetKeyDown("s"))
        {
            //If the next one down is quit play the slide onto quit sound
            if (verticalScrollBar.value == 0.5f)
            {
                quitSlideSound.Play();
            }
            else
            {
                slideSound.Play();
            }
            verticalScrollBar.value = verticalScrollBar.value + 0.5f;
        }

        //they hit enter while START was selected, begin mission select
        if (Input.GetKeyDown("return") && verticalScrollBar.value == 0.0f)
        {
            selectSound.Play();
            while (selectSound.IsInvoking())
            {
                //do nothing
            }
            //then load level
            MissionSelect();
        }

        //they  hit enter while FACTION was selected, begin race/faction select
        if (Input.GetKeyDown("return") && verticalScrollBar.value == 0.5f)
        {
            selectSound.Play();
            while (selectSound.IsInvoking())
            {
                //do nothing
            }
            //then load level
            RaceFactionSelect();
        }
        //they hit enter while QUIT was selected, quit the application
        if (Input.GetKeyDown("return") && verticalScrollBar.value == 1.0f)
        {
            selectSound.Play();
            while (selectSound.IsInvoking())
            {
                //do nothing
            }
            Application.Quit();
        }
    }