コード例 #1
0
 public override void CancellTweensAndSequences()
 {
     SimpleTween.Cancel(gameObject, false);
     zoomSequence?.Break();
     explodeSequence?.Break();
     base.CancellTweensAndSequences();
 }
コード例 #2
0
        internal void RefreshScoreStrip()
        {
            // refresh score text
            if (ScoreCount)
            {
                int newCount = BubblesPlayer.Instance.LevelScore;
                SimpleTween.Cancel(ScoreCount.gameObject, false);
                SimpleTween.Value(ScoreCount.gameObject, oldCount, newCount, 0.5f).SetOnUpdate((float val) =>
                {
                    oldCount        = (int)val;
                    ScoreCount.text = oldCount.ToString();
                });
            }

            //Refresh score strip
            if (!ScoreStrip)
            {
                return;
            }
            SimpleTween.Cancel(ScoreStrip.gameObject, false);
            float sizeX  = ScoreStrip.GetComponent <RectTransform>().sizeDelta.x;
            float amount = (BubblesPlayer.Instance.AverageScore > 0) ? (float)BubblesPlayer.Instance.LevelScore / (float)(BubblesPlayer.Instance.AverageScore) : 0;

            SimpleTween.Value(ScoreStrip.gameObject, ScoreStrip.fillAmount, amount, 0.3f).SetOnUpdate((float val) =>
            {
                ScoreStrip.fillAmount = val;
                if (yellowLight)
                {
                    yellowLight.anchoredPosition = new Vector2(sizeX * Mathf.Min(ScoreStrip.fillAmount, 0.93f), yellowLight.anchoredPosition.y);
                }
            }).SetEase(EaseAnim.EaseOutCubic);
        }
コード例 #3
0
        public void UpdateLevelBkgMusik()
        {
            bool play = musicOn;

            AudioClip nClip = bkgMusic;

            if (nClip != aSbkg.clip)
            {
                aSbkg.Stop();
                aSbkg.Play();
                aSbkg.clip = nClip;
            }

            SimpleTween.Cancel(gameObject, true);

            if (play && aSbkg && !aSbkg.isPlaying)
            {
                aSbkg.volume = 0;
                aSbkg.Play();
                SimpleTween.Value(gameObject, 0.0f, volume, 3.5f).SetOnUpdate((float val) => { aSbkg.volume = val; }).
                AddCompleteCallBack(() => { });
            }

            else if (!play && aSbkg && aSbkg.isPlaying)
            {
                SimpleTween.Value(gameObject, volume, 0.0f, 2f).SetOnUpdate((float val) => { aSbkg.volume = val; }).
                AddCompleteCallBack(() => { aSbkg.Stop(); });
            }
        }
コード例 #4
0
        /// <summary>
        /// Close panel
        /// </summary>
        /// <param name="panel"></param>
        public void CloseScrollPanel(bool destroy, Action completeCallBack)
        {
            RectTransform panel = GetComponent <RectTransform>();

            if (!panel)
            {
                return;
            }
            SetControlActivity(false);
            float startX = 1;
            float endX   = 0f;

            SimpleTween.Cancel(gameObject, true);
            SimpleTween.Value(gameObject, startX, endX, 0.2f).SetEase(EaseAnim.EaseInCubic).
            SetOnUpdate((float val) =>
            {
                transform.localScale = new Vector3(val, 1, 1);
            }).AddCompleteCallBack(() =>
            {
                if (destroy && this)
                {
                    Destroy(gameObject);
                }
                completeCallBack?.Invoke();
            });
        }
コード例 #5
0
 private void OnDestroy()
 {
     BubblesPlayer.Instance.ChangeScoreEvent -= RefreshScoreStrip;
     BubblesPlayer.Instance.ChangeStarsEvent -= RefreshStars;
     SimpleTween.Cancel(ScoreCount.gameObject, false);
     SimpleTween.Cancel(ScoreStrip.gameObject, false);
 }
コード例 #6
0
        internal void RefreshScoreStrip(int score, int averageScore)
        {
            // refresh score text
            if (ScoreCount)
            {
                int newCount = score;
                SimpleTween.Cancel(ScoreCount.gameObject, false);
                SimpleTween.Value(ScoreCount.gameObject, oldCount, newCount, 0.5f).SetOnUpdate((float val) =>
                {
                    oldCount        = (int)val;
                    ScoreCount.text = (MBoard.WinContr != null && MBoard.WinContr.ScoreTarget > 0) ? oldCount.ToString() + "/" + MBoard.WinContr.ScoreTarget : oldCount.ToString();
                    //ScoreCount.text = oldCount.ToString();
                });

                if (MatchBoard.GMode == GameMode.Play)
                {
                    ScoreComplete?.SetActive(MBoard.WinContr.HasScoreTarget && (score >= MBoard.WinContr.ScoreTarget));
                }
            }

            float amount = (averageScore > 0) ? (float)score / (float)(averageScore) : 0;

            if (ScoreStrip)
            {
                SimpleTween.Value(ScoreStrip.gameObject, ScoreStrip.fillAmount, amount, 0.3f).SetOnUpdate((float val) =>
                {
                    ScoreStrip.fillAmount = val;
                }).SetEase(EaseAnim.EaseOutCubic);
            }
        }
コード例 #7
0
 /// <summary>
 /// Show active footer booster with another color
 /// </summary>
 /// <param name="active"></param>
 private void ShowActive()
 {
     if (gameObject)
     {
         SimpleTween.Cancel(gameObject, true);
     }
     if (boosterImage)
     {
         Color c = boosterImage.color;
         boosterImage.color = new Color(1, 1, 1, 1);
         if (booster.IsActive)
         {
             SimpleTween.Value(gameObject, 1.0f, 0.5f, 0.5f).SetEase(EaseAnim.EaseLinear).
             SetOnUpdate((float val) =>
             {
                 if (booster.IsActive)
                 {
                     boosterImage.color = new Color(1, val, val, 1);
                 }
                 else
                 {
                     boosterImage.color = new Color(1, 1, 1, 1);
                     SimpleTween.Cancel(gameObject, true);
                 }
             }).SetCycled();
         }
     }
 }
コード例 #8
0
        /// <summary>
        /// Open panel
        /// </summary>
        /// <param name="panel"></param>
        public void OpenScrollPanel(Action completeCallBack)
        {
            RectTransform panel = GetComponent <RectTransform>();

            transform.localScale = new Vector3(0, 1, 1);
            if (!panel)
            {
                return;
            }
            SetControlActivity(false);
            float startX = 0;
            float endX   = 1f;

            SimpleTween.Cancel(gameObject, true);

            SimpleTween.Value(gameObject, startX, endX, 0.2f).SetEase(EaseAnim.EaseInCubic).
            SetOnUpdate((float val) =>
            {
                transform.localScale = new Vector3(val, 1, 1);
            }).AddCompleteCallBack(() =>
            {
                SetControlActivity(true);
                if (completeCallBack != null)
                {
                    completeCallBack();
                }
            });
        }
コード例 #9
0
 /// <summary>
 /// Stop music audiosource
 /// </summary>
 public void StopMusic()
 {
     SimpleTween.Cancel(musicVolumeTween, true);
     if (musicSource && musicSource.isPlaying)
     {
         musicVolumeTween = SimpleTween.Value(gameObject, Volume * musicVolumeMult, 0.0f, 1f).SetOnUpdate((float val) => { musicSource.volume = val; }).
                            AddCompleteCallBack(() => { musicSource.Stop(); musicSource.volume = 0; }).ID;
     }
 }
コード例 #10
0
 private void OnDestroy()
 {
     MPlayer.ChangeScoreEvent -= SetScore;
     MPlayer.ChangeStarsEvent -= SetStars;
     ts.Break();
     SimpleTween.Cancel(gameObject, false);
     SimpleTween.Cancel(starRightFull.gameObject, false);
     SimpleTween.Cancel(starLeftFull.gameObject, false);
     SimpleTween.Cancel(starMiddleFull.gameObject, false);
 }
コード例 #11
0
 private void OnDestroy()
 {
     if (gameObject)
     {
         SimpleTween.Cancel(gameObject, true);
     }
     if (booster != null)
     {
         booster.ChangeCountEvent -= ChangeCountEventHandler;
         booster.FooterClickEvent -= FooterClickEventHandler;
     }
 }
コード例 #12
0
 private void SetScore(int score, int averScore)
 {
     if (ScoreCount)
     {
         int newCount = score;
         SimpleTween.Cancel(ScoreCount.gameObject, false);
         SimpleTween.Value(ScoreCount.gameObject, oldCount, newCount, 0.5f).SetOnUpdate((float val) =>
         {
             oldCount        = (int)val;
             ScoreCount.text = oldCount.ToString();
         });
     }
 }
コード例 #13
0
 private void OnDestroy()
 {
     MPlayer.ChangeScoreEvent -= RefreshScoreStrip;
     MPlayer.ChangeStarsEvent -= RefreshStars;
     MPlayer.ChangeStarsEvent -= GetStarsSound;
     if (ScoreCount)
     {
         SimpleTween.Cancel(ScoreCount.gameObject, false);
     }
     if (ScoreStrip)
     {
         SimpleTween.Cancel(ScoreStrip.gameObject, false);
     }
 }
コード例 #14
0
        /// <summary>
        /// Play current music clip
        /// </summary>
        public void PlayCurrentMusic()
        {
            if (!musicSource || !currentMusic)
            {
                return;
            }
            SimpleTween.Cancel(musicVolumeTween, true);
            float volume = Volume * musicVolumeMult;

            if (MusicOn)
            {
                if ((currentMusic == musicSource.clip) && musicSource.isPlaying) // check volume
                {
                    float vol = musicSource.volume;
                    if (vol != volume)
                    {
                        musicVolumeTween = SimpleTween.Value(gameObject, vol, volume, 1f).SetOnUpdate((float val) => { musicSource.volume = val; }).
                                           AddCompleteCallBack(() => { musicSource.volume = volume; }).ID;
                    }
                }

                if ((currentMusic != musicSource.clip) && musicSource.isPlaying)
                {
                    musicSource.Stop();
                    musicSource.clip = currentMusic;
                    musicSource.Play();
                    float vol = musicSource.volume;
                    if (vol != volume)
                    {
                        musicVolumeTween = SimpleTween.Value(gameObject, vol, volume, 1f).SetOnUpdate((float val) => { musicSource.volume = val; }).
                                           AddCompleteCallBack(() => { musicSource.volume = volume; }).ID;
                    }
                }

                if (!musicSource.isPlaying)
                {
                    musicSource.clip   = currentMusic;
                    musicSource.volume = 0;
                    musicSource.Play();
                    musicVolumeTween = SimpleTween.Value(gameObject, 0.0f, volume, 1f).SetOnUpdate((float val) => { musicSource.volume = val; }).
                                       AddCompleteCallBack(() => { musicSource.volume = volume; }).ID;
                }
            }
            else
            {
                StopMusic();
            }
        }
コード例 #15
0
ファイル: PFAnchor.cs プロジェクト: AgostinoMatt/bubbleShoot
        void Update()
        {
            if (!canUpdate)
            {
                return;
            }

            if (pathChanged && moving)
            {
                SimpleTween.Cancel(tweenID, true);
                moving = false;
            }
            else if (pathChanged && !moving)
            {
                pathChanged = false;
                SimpleMoveAlongPath(0, EaseAnim.EaseLinear, () => { });
            }
        }
コード例 #16
0
        public void MoveStep(bool up, float time, Action completeCallBack)
        {
            SimpleTween.Cancel(parent.gameObject, true, SimpleTween.CancelCondition.SetEndValue);
            if (((Rows[0][0].transform.position.y > yStart) && !up) || ((Rows[Rows.Count - 1][0].transform.position.y < yStart) && up))
            {
                float   step   = (up) ? yStep : -yStep;
                Vector3 stPos  = parent.position;
                Vector3 endPos = new Vector3(stPos.x, stPos.y + step, stPos.z);

                SimpleTween.Move(parent.gameObject, stPos, endPos, time).AddCompleteCallBack(() =>
                {
                    Debug.Log("move " + (up ? "up" : "down"));
                    if (completeCallBack != null)
                    {
                        completeCallBack();
                    }
                });
            }
        }
コード例 #17
0
ファイル: GridCell.cs プロジェクト: dqchess/Tap-Match
 /// <summary>
 ///  cancel any tween on main MainObject object
 /// </summary>
 internal void CancelTween()
 {
     //   Debug.Log("Cancel tween");
     if (DynamicObject)
     {
         SimpleTween.Cancel(DynamicObject, false);
         DynamicObject.transform.localScale = Vector3.one;
         DynamicObject.transform.position   = transform.position;
     }
     if (Match)
     {
         Match.CancellTweensAndSequences();
         Match.ResetTween();
     }
     if (mObjectOld)
     {
         mObjectOld.CancellTweensAndSequences();
     }
 }
コード例 #18
0
        private IEnumerator SetMapPositionToAciveButton()
        {
            yield return(new WaitForSeconds(0.1f));

            if (sRect)
            {
                int   bCount       = biomesCount;
                float contentSizeY = content.sizeDelta.y / (bCount) * (bCount - 1.0f);
                float relPos       = content.InverseTransformPoint(ActiveButton.transform.position).y; // Debug.Log("contentY : " + contentSizeY +  " ;relpos : " + relPos + " : " + relPos / contentSizeY);
                float vpos         = (-contentSizeY / (bCount * 2.0f) + relPos) / contentSizeY;        //

                SimpleTween.Cancel(gameObject, false);
                float start = sRect.verticalNormalizedPosition;

                SimpleTween.Value(gameObject, start, vpos, 0.25f).SetOnUpdate((float f) => { sRect.verticalNormalizedPosition = Mathf.Clamp01(f); });
                //sRect.verticalNormalizedPosition = Mathf.Clamp01(vpos); // Debug.Log("vpos : " + Mathf.Clamp01(vpos));
            }
            else
            {
                Debug.Log("no scrolling rect");
            }
        }
コード例 #19
0
 /// <summary>
 /// Cancel all tweens and sequences
 /// </summary>
 public virtual void CancellTweensAndSequences()
 {
     if (collectSequence != null) collectSequence.Break();
     if (hitDestroySeq != null) hitDestroySeq.Break();
     SimpleTween.Cancel(gameObject, false);
 }
コード例 #20
0
ファイル: GuiFader_v2.cs プロジェクト: dqchess/Tap-Match
 private void OnDestroy()
 {
     SimpleTween.Cancel(gameObject, false);
 }
コード例 #21
0
 protected virtual void OnDestroy()
 {
     SimpleTween.Cancel(musicVolumeTween, false);
 }
コード例 #22
0
ファイル: PFAnchor.cs プロジェクト: AgostinoMatt/bubbleShoot
 private void OnDisable()
 {
     SimpleTween.Cancel(gameObject, false);
 }
コード例 #23
0
        public WinController(MissionConstruct mc, GameBoard gB, BubblesShooter bubblesShooter, Action LevelWin, Action LevelLoose, Action CheckTargetResult, TextMesh outTimerText, TextMesh outMovesText)
        {
            bGrid                   = gB.grid;
            anchor                  = gB.anchor;
            LevelWinEvent          += LevelWin;
            LevelLooseEvent        += LevelLoose;
            CheckTargetResultEvent += CheckTargetResult;

            timeCostrain  = mc.TimeConstrain;
            movesCostrain = mc.MovesConstrain;
            movesRest     = movesCostrain;
            loopTopRow    = mc.LoopTopRow;
            TopRowBubblesCountToCollect = Mathf.Min(mc.BubblesCount, bGrid.TopObjectRow.GetNotEmptyCells().Count); // default 6 bubbles in mission construct
            // Debug.Log( "loop: " + mc.BubblesCount + " : " + bGrid.TopObjectRow.GetNotEmptyCells().Count);
            raiseAnchor   = mc.RaiseAnchor;
            targets       = mc.Targets;
            GameLevelType = mc.GetLevelType();

            topRowBubblesCountAtStart = bGrid.TopObjectRow.GetNotEmptyCells().Count;

            targetsToCollect          = new Dictionary <int, int>();
            onBoardTargetsAtStart     = new Dictionary <int, int>();
            onBoardTargetsAtCheckTime = onBoardTargetsAtStart;

            useObjecTargets = (targets != null && targets.Count > 0);


            if (useObjecTargets)
            {
                foreach (var item in targets.ObjectsList) // use only first target
                {
                    targetID = item.ID;
                    int id     = item.ID;
                    int count  = item.Count;
                    int bCount = bGrid.GetObjectsCountByID(id);
                    Debug.Log("target: " + id + " : " + Mathf.Min(count, bCount));
                    if (!targetsToCollect.ContainsKey(id) && Mathf.Min(count, bCount) > 0)
                    {
                        targetsToCollect.Add(id, Mathf.Min(count, bCount));
                        onBoardTargetsAtStart.Add(id, Mathf.Min(count, bCount));
                        Debug.Log(" add target: " + id + " : " + Mathf.Min(count, bCount));
                    }

                    break; // use only first target
                }
            }

            GameResult = GameResult.None;
            if (timeCostrain > 0)
            {
                Timer = new SessionTimer(timeCostrain);
                //Timer.Start();

                UseTimer = true;
                Timer.OnTickRestSeconds = (sec) => { timeRest = (int)sec; if (timeRest <= 30 && !timeLeftShowed)
                                                     {
                                                         timeLeftShowed = true; GuiController.Instance.ShowMessageTimeLeft("Warning!", "30 seconds left", 1);
                                                     }
                };
                Timer.OnTimePassed = () => { if (GameResult == GameResult.None)
                                             {
                                                 CheckResult(false, false);
                                             }
                };

                if (outMovesText)
                {
                    outMovesText.gameObject.SetActive(false);
                }

                if (outTimerText)
                {
                    if (outTimerText)
                    {
                        outTimerText.gameObject.SetActive(true);
                    }
                    Timer.OnTickRestSeconds += (sec) => { outTimerText.text = sec.ToString(); };
                }
            }
            else
            {
                if (outTimerText)
                {
                    if (outTimerText)
                    {
                        outTimerText.gameObject.SetActive(false);
                    }
                }
                if (outMovesText)
                {
                    outMovesText.gameObject.SetActive(true);
                    outMovesText.text = movesRest.ToString();
                }
                bubblesShooter.ShootEvent += () =>
                {
                    if (!UseTimer)
                    {
                        movesRest--;
                        if (outMovesText)
                        {
                            outMovesText.text = movesRest.ToString();
                            if (movesRest == 5)
                            {
                                counterTweenID = SimpleTween.Value(outMovesText.gameObject, 1.0f, 0.5f, 0.5f).SetEase(EaseAnim.EaseLinear).
                                                 SetOnUpdate((float val) => { if (this != null && outMovesText)
                                                                              {
                                                                                  outMovesText.color = new Color(1, val, val, 1);
                                                                              }
                                                                              else
                                                                              {
                                                                                  SimpleTween.Cancel(counterTweenID, false);
                                                                              } }).SetCycled().ID;
                            }
                            if (movesRest == 0)
                            {
                                SimpleTween.Cancel(outMovesText.gameObject, false);
                            }
                        }
                    }
                };
            }

            Debug.Log("GameLevelType : " + GameLevelType);
            CheckTopRow();
            CheckTargetsOnBoard();
        }
コード例 #24
0
ファイル: GridObject.cs プロジェクト: dqchess/Tap-Match
 /// <summary>
 /// Cancel all tweens and sequences
 /// </summary>
 public virtual void CancellTweensAndSequences()
 {
     collectSequence?.Break();
     hitDestroySeq?.Break();
     SimpleTween.Cancel(gameObject, false);
 }