protected override void OnBtnClick(GameObject go)
        {
            EazySoundManager.PlayUISound(Global.Instance.BtnClip);
            switch (go.name)
            {
            case "btnStartGame":
                UIDispatcher.Instance.Dispatc(ConstDefine.InitScene_StartGame, null);
                break;

            case "btnShop":
                UIDispatcher.Instance.Dispatc(ConstDefine.InitScene_Shop, null);
                break;

            case "btnHelp":
                UIDispatcher.Instance.Dispatc(ConstDefine.InitScene_Help, null);
                break;

            case "btnMusic":
                m_IsPlaySound = !m_IsPlaySound;
                object[] obj = new object[1];
                obj[0] = m_IsPlaySound;
                UIDispatcher.Instance.Dispatc(ConstDefine.InitScene_Music, obj);
                break;
            }
        }
Exemplo n.º 2
0
 protected virtual void OnCollision(GameObject collision)
 {
     if (m_NextStatus != Status.None)
     {
         return;
     }
     if (m_Status == Status.Shoot)
     {
         Rigidbody2D rigi = collision.gameObject.GetComponent <Rigidbody2D>();
         if (rigi != null)
         {
             Vector2 f = m_Rigi.mass * m_CurSpeed / Time.deltaTime;
             rigi.AddForce(f);
         }
         IHealth health = collision.gameObject.GetComponent <IHealth>();
         if (health != null)
         {
             health.OnHit(this.gameObject);
         }
         IWeak   weak = collision.gameObject.GetComponent <IWeak>();
         Missile m    = collision.gameObject.GetComponent <Missile>();
         if (weak == null && m == null)
         {
             m_NextStatus = Status.Over;
             GameObject go = ResourcesMrg.Instance.Load(ResourcesMrg.ResourceType.Effect, "Explode", isCache: true);
             go.transform.position = transform.position;
             EazySoundManager.PlayUISound(m_OverClip);
         }
     }
 }
Exemplo n.º 3
0
    // Start is called before the first frame update
    void Start()
    {
        card = GetComponent <Card>();
        var cardData = card.cardData;
        var trigger  = GetComponent <ObservableEventTrigger>();

        float offset = transform.localPosition.y;

        trigger
        .OnPointerEnterAsObservable()
        .Subscribe(_ => {
            transform.DOLocalMoveY(delta + offset, 0.1f);
            EazySoundManager.PlayUISound(sfx_hover);
        })
        .AddTo(this);

        trigger
        .OnPointerExitAsObservable()
        .Subscribe(_ => {
            transform.DOLocalMoveY(offset, 0.1f);
        })
        .AddTo(this);

        trigger
        .OnPointerClickAsObservable()
        .Subscribe(_ => {
            card.selected = !card.selected;
            cover.SetActive(card.selected);
            if (card.selected)
            {
                EazySoundManager.PlayUISound(sfx_click);
            }
        })
        .AddTo(this);
    }
Exemplo n.º 4
0
    public void ApplyPresent()
    {
        EazySoundManager.PlayUISound(sfx_click2);

        var player  = FindObjectOfType <Player>();
        var statics = player.GetComponent <CardStatistic>();

        player.money -= statics.SumPrice();
        player.love  += statics.SumLove();
        player.day++;
        player.message     = "ありがとう!";
        player.IsNotWorked = true;

        //reset
        foreach (Transform child in cardCase.transform)
        {
            Destroy(child.gameObject);
        }

        Observable
        .Interval(TimeSpan.FromMilliseconds(250))
        .Take(6)
        .Subscribe(l =>
        {
            //Debug.Log($"ok {l}");
            var deck   = FindObjectOfType <Deck>();
            var holder = deck.DrawCard();
            holder.transform.SetParent(cardCase.transform, false);
        }).AddTo(this);

        present.gameObject.SetActive(false);
    }
 protected override void OnBtnClick(GameObject go)
 {
     if (go.name.EndsWith("btnClose", StringComparison.CurrentCultureIgnoreCase))
     {
         Close();
     }
     EazySoundManager.PlayUISound(Global.Instance.UISound);
 }
Exemplo n.º 6
0
    public void AwakeWorkWindow()
    {
        EazySoundManager.PlayUISound(sfx_click);

        var player = FindObjectOfType <Player>();

        work.gameObject.SetActive(true);
    }
Exemplo n.º 7
0
 public void BlinkNotEnoughMana(Skill skill)
 {
     missingManaBar.fillAmount = (float)skill.skillCost / targetEntity.totalMana.Value;
     missingManaBlink.BeginBlinking();
     if (missingManaSound)
     {
         EazySoundManager.PlayUISound(missingManaSound, 0.2f);
     }
 }
 protected override void OnBtnClick(GameObject go)
 {
     base.OnBtnClick(go);
     if (go.name == "btnPause")
     {
         UIDispatcher.Instance.Dispatc(ConstDefine.SceneGameLevelViewClickPauseBtn, null);
     }
     EazySoundManager.PlayUISound(Global.Instance.UISound);
 }
 private void OnClickOKButton(GameObject go)
 {
     if (ClickOkAction != null)
     {
         ClickOkAction();
     }
     Cloese();
     EazySoundManager.PlayUISound(Global.Instance.BtnClip);
 }
Exemplo n.º 10
0
 public void PlayThisSound()
 {
     if (isUI)
     {
         EazySoundManager.PlayUISound(targetAudio, baseVolume);
     }
     else
     {
         EazySoundManager.PlaySound(targetAudio, baseVolume);
     }
 }
Exemplo n.º 11
0
 private void ClikBtn()
 {
     if (m_IsLock)
     {
         return;
     }
     if (OnClickBtn != null)
     {
         OnClickBtn(m_GameLevel);
     }
     EazySoundManager.PlayUISound(Global.Instance.UISound);
 }
Exemplo n.º 12
0
    public void ApplyWork()
    {
        EazySoundManager.PlayUISound(sfx_click2);

        var player = FindObjectOfType <Player>();

        player.money += player.salary;
        player.day++;
        player.message     = "お疲れ様です";
        player.IsNotWorked = false;

        work.gameObject.SetActive(false);
    }
Exemplo n.º 13
0
        protected override void OnBtnClick(GameObject go)
        {
            if (go.name == "btnClose")
            {
                UIDispatcher.Instance.Dispatc(ConstDefine.GameLevelSelectClickReturnBtn, null);
            }
            else if (go.name == "btnClear")
            {
                UIDispatcher.Instance.Dispatc(ConstDefine.GameLevelSelectClickClearBtn, null);
            }

            EazySoundManager.PlayUISound(Global.Instance.UISound);
        }
Exemplo n.º 14
0
    public void AwakePresentWindow()
    {
        EazySoundManager.PlayUISound(sfx_click);

        var player = FindObjectOfType <Player>();

        //show result
        var selectedCards = cardCase.GetComponentsInChildren <CardHolder>()
                            .Where(holder => holder.GetComponentInChildren <Card>().selected);

        if (selectedCards.Count() <= 0)
        {
            IsClicked = true;

            Observable
            .Timer(TimeSpan.FromSeconds(3))
            .Subscribe(_ => {
                IsClicked = false;
            })
            .AddTo(this);

            return;
        }

        if (player.GetComponent <CardStatistic>().SumPrice() > player.money)
        {
            return;
        }

        present.gameObject.SetActive(true);


        //reset
        foreach (Transform child in resultCardCase.transform)
        {
            Destroy(child.gameObject);
        }

        //clone
        foreach (var holder in selectedCards)
        {
            var clone = Instantiate(holder);
            var func  = clone.GetComponentInChildren <CardBehaviour>();
            Destroy(func.cover);
            Destroy(func);
            Destroy(clone.GetComponentInChildren <Card>());
            Destroy(clone.GetComponentInChildren <CardUI>());
            clone.transform.SetParent(resultCardCase.transform, false);
        }
    }
Exemplo n.º 15
0
    public int PlayUISound(AudioClip clip, float volume, float pitch = 1)
    {
        if (!Application.isPlaying)
        {
            return(-1);
        }

        var id        = EazySoundManager.PlayUISound(clip, volume);
        var eazyAudio = EazySoundManager.GetUISoundAudio(id);

        eazyAudio.Pitch = pitch;

        return(id);
    }
Exemplo n.º 16
0
    // Start is called before the first frame update
    void Start()
    {
        var player = GetComponent <Player>();

        player
        .ObserveEveryValueChanged(p => p.level)
        .Where(level => level > 1)
        .Subscribe(level =>
        {
            particle.Play();
            EazySoundManager.PlayUISound(sfx);
        })
        .AddTo(this);
    }
        protected override void OnBtnClick(GameObject go)
        {
            base.OnBtnClick(go);
            switch (go.name)
            {
            case "btnStartGame":
                UIDispatcher.Instance.Dispatc(ConstDefine.InitSceneViewClickStartGameBtn, null);
                break;

            case "btnHelp":
                UIDispatcher.Instance.Dispatc(ConstDefine.InitSceneViewClickHelpBtn, null);
                break;
            }
            EazySoundManager.PlayUISound(Global.Instance.UISound);
        }
Exemplo n.º 18
0
    public AudioClip playSFX(SFXEnum sfx)
    {
        AudioClip sfxToPlay = getSFX(sfx);

        EazySoundManager.PlayUISound(sfxToPlay);

        if (sfx == SFXEnum.pass)
        {
            EazySoundManager.PlayUISound(gainSfx);
        }



        return(sfxToPlay);
    }
Exemplo n.º 19
0
        protected override void OnBtnClick(GameObject go)
        {
            base.OnBtnClick(go);
            switch (go.name)
            {
            case "btnReturn":
                UIDispatcher.Instance.Dispatc(ConstDefine.GameLevelScene_FailWindow_Return, null);
                break;

            case "btnContinue":
                UIDispatcher.Instance.Dispatc(ConstDefine.GameLevelScene_FailWindow_Continue, null);
                break;
            }
            EazySoundManager.PlayUISound(Global.Instance.BtnClip);
        }
Exemplo n.º 20
0
 protected override void OnBtnClick(GameObject go)
 {
     base.OnBtnClick(go);
     if (go.name == "btnLeft")
     {
         Refresh(true);
         m_BtnLeft.transform.DoScale(Vector3.one * 1.1f, 0.1f).SetAnimatorCurve(m_BtnCurve).SetLoopType(TweenLoopType.YoYo).SetLoopCount(1);;
     }
     else if (go.name == "btnRight")
     {
         Refresh(false);
         m_BtnRight.transform.DoScale(-Vector3.one * 1.1f, 0.1f).SetAnimatorCurve(m_BtnCurve).SetLoopType(TweenLoopType.YoYo).SetLoopCount(1);
     }
     EazySoundManager.PlayUISound(Global.Instance.UISound, 1, true);
 }
Exemplo n.º 21
0
 protected override void OnBtnClick(GameObject go)
 {
     base.OnBtnClick(go);
     if (go.name == "btnStartGame")
     {
         UIDispatcher.Instance.Dispatc(ConstDefine.SceneInitSceneViewClickStartGameBtn, null);
     }
     else if (go.name == "btnMusic")
     {
         UIDispatcher.Instance.Dispatc(ConstDefine.MusicSetting, null);
         m_IsPlayMusic = !m_IsPlayMusic;
         SetMusic();
     }
     EazySoundManager.PlayUISound(Global.Instance.UISound, 1, true);
 }
        protected override void OnBtnClick(GameObject go)
        {
            base.OnBtnClick(go);
            switch (go.name)
            {
            case "btnAudio":
                UIDispatcher.Instance.Dispatc(ConstDefine.GameLevelSceneViewClickAudioBtn, null);
                SetMusic(Global.Instance.IsPlaySound);
                break;

            case "btnPause":
                UIDispatcher.Instance.Dispatc(ConstDefine.GameLevelSceneViewClickPauseBtn, null);
                break;
            }
            EazySoundManager.PlayUISound(Global.Instance.UISound);
        }
Exemplo n.º 23
0
        protected override void OnBtnClick(GameObject go)
        {
            base.OnBtnClick(go);
            switch (go.name)
            {
            case "btnStartGame":
                UIDispatcher.Instance.Dispatc(ConstDefine.StartGame, null);
                break;

            case "btnMusic":
                UIDispatcher.Instance.Dispatc(ConstDefine.MusicSetting, null);
                SetMusic();
                break;
            }
            EazySoundManager.PlayUISound(Global.Instance.UISound);
        }
        protected override void OnBtnClick(GameObject go)
        {
            base.OnBtnClick(go);
            switch (go.name)
            {
            case "btnAudio":
                UIDispatcher.Instance.Dispatc(ConstDefine.MusicSetting, null);
                m_IsPlayMusic = !m_IsPlayMusic;
                SetMusic();
                break;

            case "btnReturn":
                UIDispatcher.Instance.Dispatc(ConstDefine.SceneGameLevelSelectViewClickReturnBtn, null);
                break;
            }
            EazySoundManager.PlayUISound(Global.Instance.UISound, 1, true);
        }
Exemplo n.º 25
0
    private void Play(AudioType type, AudioClip clip)
    {
        switch (type)
        {
        case AudioType.MUSIC:
            EazySoundManager.PlayMusic(clip);
            break;

        case AudioType.SOUND:
            EazySoundManager.PlaySound(clip);
            break;

        case AudioType.UISOUND:
            EazySoundManager.PlayUISound(clip);
            break;
        }
    }
        public void GetStar(Vector3 pos)
        {
            EazySoundManager.PlayUISound(m_GetStarClip);
            Vector3 viewPos = Camera.main.WorldToScreenPoint(pos);
            Vector2 p       = Vector3.zero;

            RectTransformUtility.ScreenPointToLocalPointInRectangle(m_Star.transform.parent.GetComponent <RectTransform>(), viewPos, UICamera, out p);
            m_StarTemp.gameObject.SetActive(true);
            m_StarTemp.anchoredPosition = p;
            Vector2 relativePos = m_Star.GetComponent <RectTransform>().anchoredPosition - p;
            Vector2 speed       = Vector2.zero;

            //Y值自由落体
            speed.y = ((2 * relativePos.y) / m_Time - G * m_Time) / 2;
            //x值平行移动
            speed.x = relativePos.x / m_Time;
            StartCoroutine(StarMove(speed));
        }
Exemplo n.º 27
0
 protected override void OnBtnClick(GameObject go)
 {
     base.OnBtnClick(go);
     object[] objs = null;
     switch (go.name)
     {
     case "btnBuy":
         if (m_JobItem == null)
         {
             return;
         }
         objs    = new object[2];
         objs[0] = m_JobItem.Index;
         objs[1] = m_JobItem.Coin;
         UIDispatcher.Instance.Dispatc(ConstDefine.InitScene_ShopWindow_Buy, objs);
         break;
     }
     EazySoundManager.PlayUISound(Global.Instance.BtnClip);
 }
Exemplo n.º 28
0
    public void ApplyReplacement()
    {
        EazySoundManager.PlayUISound(sfx_click);

        var deck           = FindObjectOfType <Deck>();
        var selectedHolder = cardCase.GetComponentsInChildren <CardHolder>()
                             .Where(holder => holder.GetComponentInChildren <Card>().selected);
        var selectedCount = selectedHolder.Count();

        if (selectedCount <= 0)
        {
            var holders = cardCase.GetComponentsInChildren <CardHolder>();

            foreach (var holder in holders)
            {
                holder.GetComponentInChildren <CardBehaviour>().Select();
            }
        }
        else
        {
            foreach (var holder in selectedHolder)
            {
                Destroy(holder.gameObject);
            }

            Observable
            .Interval(TimeSpan.FromMilliseconds(250))
            .Take(selectedCount)
            .Subscribe(l =>
            {
                var holder = deck.DrawCard();
                holder.transform.SetParent(cardCase.transform, false);
            }).AddTo(this);

            gameObject.SetActive(false);
        }
    }
Exemplo n.º 29
0
 public void InitBubble(string textToDisplay, float timeToRead, string title = "")
 {
     StopAllCoroutines();
     upSpeed   = originalUpSpeed;
     fadeTimer = timeTilFade + timeToRead;
     canMove   = false;
     anim.Play("Idle", 0, 0);
     if (popSound != null)
     {
         EazySoundManager.PlayUISound(popSound, 0.15f);
     }
     bubbleText.text = textToDisplay;
     if (textPanel)
     {
         Vector2 textSize = bubbleText.GetPreferredValues() + new Vector2(spacingX, spacingY);
         textPanel.sizeDelta = textSize;
     }
     if (title == null || title.Length <= 1)
     {
         textTitlePanel?.gameObject.SetActive(false);
     }
     else
     {
         if (textTitle != null)
         {
             textTitle.text = title;
         }
         if (textTitlePanel)
         {
             Vector2 titleSize = textTitle.GetPreferredValues() + new Vector2(titleSpacingX, titleSpacingY);
             textTitlePanel.sizeDelta = titleSize;
         }
     }
     timeStopped = timeToRead;
     StartCoroutine(waitToMove());
 }
Exemplo n.º 30
0
    public void PlayMenuSound()
    {
        var sound = menuSounds[Random.Range(0, menuSounds.Length)];

        EazySoundManager.PlayUISound(sound);
    }