Exemple #1
0
 /// <summary>
 /// 开始播放序列帧特效
 /// </summary>
 /// <param name="isLoop">If set to <c>true</c> is loop.</param>
 public void PlayAnimation(string atlasName, string spriteName, int spriteCount, int fps = 25, bool isLoop = false)
 {
     _AtlasName  = atlasName;
     _ImageCount = spriteCount;
     _SpriteName = spriteName;
     _Loop       = isLoop;
     //_CurrentImage = this.GameObject.Get<Image>();
     _CurrentImage.SetNativeSize();
     _IsCanPlay           = true;
     _CurrentIndex        = 0;
     _FPS                 = fps;
     _CurrentImage.sprite = GameHelper.GetSprite(_AtlasName, string.Format("{0}0{1}", _SpriteName, 0));
 }
Exemple #2
0
 public void Update()
 {
     if (_IsCanPlay == true)
     {
         _DeltaTime += Time.deltaTime;
         float rate = 1f / _FPS;
         if (rate < _DeltaTime)
         {
             if (rate > 0f)
             {
                 _DeltaTime = _DeltaTime - rate;
             }
             else
             {
                 _DeltaTime = 0f;
             }
             _CurrentIndex++;
             if (_CurrentIndex >= _ImageCount)
             {
                 _IsCanPlay = _Loop;
                 if (_IsCanPlay == false)
                 {
                     return;
                 }
                 _CurrentIndex = 0;
             }
             if (_CurrentIndex > 8)
             {
                 _CurrentImage.sprite = GameHelper.GetSprite(_AtlasName, string.Format("{0}{1}", _SpriteName, _CurrentIndex + 1));
             }
             else
             {
                 _CurrentImage.sprite = GameHelper.GetSprite(_AtlasName, string.Format("{0}0{1}", _SpriteName, _CurrentIndex + 1));
             }
         }
     }
 }
Exemple #3
0
        /// <summary>
        /// 通用场等级选择方法
        /// </summary>
        /// <param name="gameType"></param>
        public async Task <bool> OnSelectedArea(GameType gameType)
        {
            GameHelper.CurrentGameInfo = GameHelper.GetGameInfo(gameType);

            if (GameHelper.CurrentGameInfo == null)
            {
                Game.PopupComponent.ShowMessageBox(DataCenterComponent.Instance.tipInfo.GameNotOpenTip);

                return(false);
            }

            GameTypeImage.sprite = GameHelper.GetSprite("chooseareaatlas", $"choosearea_game{((int)gameType) - 1}");

            GameTypeImage.SetNativeSize();
            GameTypeBgImage.sprite = GameHelper.GetSprite("chooseareaatlas", $"bgchoosearea_game{((int)gameType) - 1}");
            // 获取场
            var ares = await GameHelper.GetGameAreaList(GameHelper.CurrentGameInfo.GameId);

            if (ares != null)
            {
                lobby.GameLobbyGameListPlugin._GameType.SetActive(false);

                _BackGameListsButton.SetActive(true);
            }
            else
            {
                return(false);
            }

            if (ares.Count == 2)
            {
                LevelButton_low.SetActive(true);

                LevelButton_middle.SetActive(false);

                LevelButton_high.SetActive(true);

                _GameLevelPanel.GetComponent <GridLayoutGroup>().spacing = new Vector2(250, 0);

                SetLevelUIData(LevelButton_low, ares[0]);

                SetLevelUIData(LevelButton_high, ares[1]);
            }
            else if (ares.Count == 3)
            {
                LevelButton_low.SetActive(true);

                LevelButton_middle.SetActive(true);

                LevelButton_high.SetActive(true);

                _GameLevelPanel.GetComponent <GridLayoutGroup>().spacing = new Vector2(139, 0);

                SetLevelUIData(LevelButton_low, ares[0]);

                SetLevelUIData(LevelButton_middle, ares[1]);

                SetLevelUIData(LevelButton_high, ares[2]);
            }
            else if (ares.Count == 1)
            {
                lobby.GameLobbyGameListPlugin._GameType.SetActive(true);

                _BackGameListsButton.SetActive(false);

                return(true);
            }
            else
            {
                return(false);
            }

            // 显示场等级选择
            _GameLevelPanel.SetActive(true);

            _GameTypeBg.SetActive(true);

            MaskBg.SetActive(true);

            _BackGameListsButton.SetActive(true);

            return(true);
        }