Beispiel #1
0
 public void OnChangeMapClick(bool isRight)
 {
     if (!isBlockClick)
     {
         _isLeft      = !isRight;
         isBlockClick = true;
         if (isShowMap1)
         {
             if (isRight)
             {
                 _currentLevel++;
                 MapBox2.GetComponent <RectTransform>().localPosition = Right;
                 LeanTween.moveLocalX(MapBox1.gameObject, -800f, TimeTween).setOnComplete(OnMoveComplete);
             }
             else
             {
                 _currentLevel--;
                 MapBox2.GetComponent <RectTransform>().localPosition = new Vector3(-Right.x, Right.y);
                 LeanTween.moveLocalX(MapBox1.gameObject, 800f, TimeTween).setOnComplete(OnMoveComplete);
             }
             MapBox2.InitData(_currentLevel, SceneManager.instance.AllMapData[_currentLevel]);
             LeanTween.moveLocalX(MapBox2.gameObject, 0, TimeTween).setOnComplete(OnMoveComplete);
             AudioController.instance.PlaySoundSortCard();
         }
         else
         {
             if (isRight)
             {
                 _currentLevel++;
                 MapBox1.GetComponent <RectTransform>().localPosition = Right;
                 LeanTween.moveLocalX(MapBox2.gameObject, -800f, TimeTween).setOnComplete(OnMoveComplete);
             }
             else
             {
                 _currentLevel--;
                 MapBox1.GetComponent <RectTransform>().localPosition = new Vector3(-Right.x, Right.y);
                 LeanTween.moveLocalX(MapBox2.gameObject, 800f, TimeTween).setOnComplete(OnMoveComplete);
             }
             MapBox1.InitData(_currentLevel, SceneManager.instance.AllMapData[_currentLevel]);
             LeanTween.moveLocalX(MapBox1.gameObject, 0, TimeTween).setOnComplete(OnMoveComplete);
             AudioController.instance.PlaySoundSortCard();
         }
         SceneManager.instance.CurrentMap = _currentLevel;
         // Debug.Log(_currentLevel);
         isShowMap1 = !isShowMap1;
         ShowMiniMap();
     }
 }
Beispiel #2
0
    public void InitData()
    {
        dataReward.Clear();
        var data = PlayerPrefs.GetString("REWARD_DATA");

        if (!string.IsNullOrEmpty(data))
        {
            var temp = data.Split(';');
            foreach (var item in temp)
            {
                if (!string.IsNullOrEmpty(item))
                {
                    var        temp2  = item.Split('-');
                    List <int> reward = new List <int>();
                    for (int i = 1; i < temp2.Length; i++)
                    {
                        if (!string.IsNullOrEmpty(temp2[i]))
                        {
                            reward.Add(int.Parse(temp2[i]));
                        }
                    }
                    dataReward.Add(int.Parse(temp2[0]), reward);
                }
            }
        }

        int currentLevel = CheckCurrentMap();

        //Debug.Log(currentLevel);
        //Debug.Log(SceneManager.instance.AllMapData.Count);
        _currentLevel = currentLevel;
        MapBox1.InitData(currentLevel, SceneManager.instance.AllMapData[currentLevel]);
        if (currentLevel < SceneManager.instance.AllMapData.Count)
        {
            MapBox2.InitData(currentLevel + 1, SceneManager.instance.AllMapData[currentLevel + 1]);
        }
        else if (currentLevel > 1)
        {
            MapBox2.InitData(15, SceneManager.instance.AllMapData[15]);
        }
        MapBox1.transform.localPosition  = Center;
        MapBox2.transform.localPosition  = Right;
        SceneManager.instance.CurrentMap = _currentLevel;
    }