public bool TryFinishTutorialTown(EnumTutorial tutorialId)
    {
        isInTutorial = false;
        EnumTutorialState state = PlayerInfo.Instance.GetTutorialState(tutorialId);

        if (state != EnumTutorialState.Finished)
        {
            PlayerInfo.Instance.ChangeTutorialState(tutorialId, EnumTutorialState.Finished);
            DoFinishTutorialTown(tutorialId);

            if (tutorialId == EnumTutorial.Town_Fusion)
            {
                GameManager._showRateApp = true;
            }
            TutorialTown tutorialTown = GetTutorialTown(tutorialId);
            if (tutorialTown.only_once)
            {
                PlayerInfo.Instance.ChangeTutorialState(tutorialId, EnumTutorialState.Finished);
            }

            _needSaveFlag = true;

            return(true);
        }
        return(false);
    }
Esempio n. 2
0
    public void ReceiveStartTutorialEvent(EnumTutorial tutorialId)
    {
        if (LevelManager.Singleton.LevelFinishFlag)
        {
            return;
        }

        if (_inTutorialFlag)
        {
            return;
        }

        EnumTutorialState state = PlayerInfo.Instance.GetTutorialState(tutorialId);

        if (state != EnumTutorialState.Inactive)
        {
            return;
        }


        if (tutorialId == EnumTutorial.Battle_Move)
        {
            _joystick.BeginTutorial(tutorialId);
        }
        else if (tutorialId < EnumTutorial.Battle_Revive)
        {
            _skillHandler.BeginTutorial(tutorialId);
        }
    }
Esempio n. 3
0
 public void BeginTutorial(EnumTutorial tutorialId)
 {
     if (TutorialManager.Instance.TryStartTutorialLevel(tutorialId))
     {
         StartCoroutine(TryStartTutorial(1.0f));
     }
 }
 public TutorialTown GetTutorialTown(EnumTutorial tutorialId)
 {
     foreach (TutorialTown tutorialTown in tutorialDataList._dataList)
     {
         if (tutorialTown.id == tutorialId)
         {
             return(tutorialTown);
         }
     }
     return(null);
 }
Esempio n. 5
0
 public TutorialLevel GetTutorialLevel(EnumTutorial tutorialId)
 {
     foreach (TutorialLevel tutorialLevel in tutorialLevelList._dataList)
     {
         if (tutorialLevel.id == tutorialId)
         {
             return(tutorialLevel);
         }
     }
     return(null);
 }
Esempio n. 6
0
 public void ChangeTutorialState(EnumTutorial tutorialId, EnumTutorialState state)
 {
     if (_tutorialState.ContainsKey(tutorialId)) //0=close  , 1=active  ,2=finish
     {
         _tutorialState[tutorialId] = state;
     }
     else
     {
         _tutorialState.Add(tutorialId, state);
     }
     _hasTutorialDataChange = true;
 }
Esempio n. 7
0
    public void BeginTutorial(EnumTutorial tutorialId)
    {
        if (tutorialId == EnumTutorial.Battle_HealthPotion || tutorialId == EnumTutorial.Battle_EnergyPotion)
        {
            if (LevelManager.Singleton.IsTutorialLevel())
            {
                return;                 //don't active this tutorial in "tutorial level".
            }
        }

        if (TutorialManager.Instance.TryStartTutorialLevel(tutorialId))
        {
            if (tutorialId == EnumTutorial.Battle_Attack)
            {
                _buttonEffect[0].SetActive(true);
                TutorialManager.Instance.GetHUDSkillHandler().ChangeButtonState(0);
            }
            else if (tutorialId == EnumTutorial.Battle_KillAnEnemy)
            {
                StartCoroutine(DelayShowArrowFor30());
            }
            else if (tutorialId == EnumTutorial.Battle_Skill1)
            {
                TutorialManager.Instance.GetHUDSkillHandler().ChangeButtonState(1);
                _buttonEffect[1].SetActive(true);
            }
            else if (tutorialId == EnumTutorial.Battle_Skill2)
            {
                TutorialManager.Instance.GetHUDSkillHandler().ChangeButtonState(2);
                TutorialManager.Instance.StartTutorialDefense();
            }
            else if (tutorialId == EnumTutorial.Battle_Skill3)
            {
                _buttonEffect[3].SetActive(true);
            }
            else if (tutorialId == EnumTutorial.Battle_Skill4)
            {
                _buttonEffect[4].SetActive(true);
            }
            else if (tutorialId == EnumTutorial.Battle_HealthPotion)
            {
                _buttonEffect[5].SetActive(true);
                //StartCoroutine(DelayHideEffectFor80());
                TutorialManager.Instance.StartTutorialHp();
            }
            else if (tutorialId == EnumTutorial.Battle_EnergyPotion)
            {
                _buttonEffect[6].SetActive(true);
                //StartCoroutine(DelayHideEffectFor90());
                TutorialManager.Instance.StartTutorialEnergy();
            }
        }
    }
Esempio n. 8
0
    public override void Decode(BinaryReader reader)
    {
        errorCode = reader.ReadInt16();

        if (errorCode == 0)
        {
            int count = reader.ReadInt16();

            tutorialState = new Dictionary <EnumTutorial, EnumTutorialState>();

            for (int i = 0; i < count; i++)
            {
                EnumTutorial id = (EnumTutorial)reader.ReadInt32();

                EnumTutorialState state = (EnumTutorialState)reader.ReadInt32();

                tutorialState.Add(id, state);
            }
        }
    }
Esempio n. 9
0
 public void FinishTutorial(EnumTutorial tutorialId)
 {
     if (TutorialManager.Instance.TryFinishTutorialLevel(tutorialId))
     {
         if (tutorialId == EnumTutorial.Battle_Attack)
         {
             _buttonEffect[0].SetActive(false);
         }
         else if (tutorialId == EnumTutorial.Battle_KillAnEnemy)
         {
             _buttonEffect[0].SetActive(false);
         }
         else if (tutorialId == EnumTutorial.Battle_Skill1)
         {
             _buttonEffect[1].SetActive(false);
         }
         else if (tutorialId == EnumTutorial.Battle_Skill2)
         {
             _buttonEffect[2].SetActive(false);
             TutorialManager.Instance.FinishTutorialDefense();
         }
         else if (tutorialId == EnumTutorial.Battle_Skill3)
         {
             _buttonEffect[3].SetActive(false);
         }
         else if (tutorialId == EnumTutorial.Battle_Skill4)
         {
             _buttonEffect[4].SetActive(false);
         }
         else if (tutorialId == EnumTutorial.Battle_HealthPotion)
         {
             _buttonEffect[5].SetActive(false);
             TutorialManager.Instance.FinishTutorialHp();
         }
         else if (tutorialId == EnumTutorial.Battle_EnergyPotion)
         {
             _buttonEffect[6].SetActive(false);
             TutorialManager.Instance.FinishTutorialEnergy();
         }
     }
 }
    public bool TryStartTutorialTown(EnumTutorial tutorialId)
    {
        if (tutorialId == EnumTutorial.Town_Equip)
        {
            if (PlayerInfo.Instance.IsEquipedItem(k_equip_item1))
            {
                PlayerInfo.Instance.ChangeTutorialState(tutorialId, EnumTutorialState.Finished);
                return(false);
            }
        }

        EnumTutorialState state = PlayerInfo.Instance.GetTutorialState(tutorialId);

        if (state == 0)         //if this tutorial is not active or finish, check if can start.
        {
            TutorialTown      tutorialTown = GetTutorialTown(tutorialId);
            EnumTutorialState preState     = EnumTutorialState.Finished;
            if (tutorialTown.preId != EnumTutorial.None)
            {
                preState = PlayerInfo.Instance.GetTutorialState(tutorialTown.preId);
            }

            if (preState == EnumTutorialState.Finished)             //if pre turiral have finish
            {
                EnumLevelState levelState = EnumLevelState.D;
                if (!string.IsNullOrEmpty(tutorialTown.level))
                {
                    levelState = PlayerInfo.Instance.GetLevelState(tutorialTown.level);
                }

                if (levelState >= EnumLevelState.D)
                {
                    PlayerInfo.Instance.ChangeTutorialState(tutorialId, EnumTutorialState.Active);
                    isInTutorial = true;
                    return(true);
                }
            }
        }
        return(false);
    }
Esempio n. 11
0
    public bool TryFinishTutorialLevel(EnumTutorial tutorialId)
    {
        _inTutorialFlag      = false;
        isTutorialHpOrEnergy = false;

        EnumTutorialState state = PlayerInfo.Instance.GetTutorialState(tutorialId);

        if (state != EnumTutorialState.Finished)
        {
            TutorialLevel tutorialLevel = GetTutorialLevel(tutorialId);

            PlayerInfo.Instance.ChangeTutorialState(tutorialId, EnumTutorialState.Finished);

            if (tutorialLevel.only_once)
            {
                PlayerInfo.Instance.ChangeTutorialState(tutorialId, EnumTutorialState.Finished);
            }

            FinishTutorialLevel(tutorialLevel);
        }

        return(true);
    }
Esempio n. 12
0
    public void ReceiveFinishTutorialEvent(EnumTutorial tutorialId)
    {
        EnumTutorialState state = PlayerInfo.Instance.GetTutorialState(tutorialId);

        if (state != EnumTutorialState.Active)
        {
            //we will finish this two tutorial even it  is not active.
            if (tutorialId == EnumTutorial.Battle_HealthPotion || tutorialId == EnumTutorial.Battle_EnergyPotion)
            {
                PlayerInfo.Instance.ChangeTutorialState(tutorialId, EnumTutorialState.Finished);
            }
            return;
        }

        if (tutorialId == EnumTutorial.Battle_Move)
        {
            _joystick.FinishTutorial(tutorialId);
        }
        else if (tutorialId < EnumTutorial.Battle_Revive)
        {
            _skillHandler.FinishTutorial(tutorialId);
        }
    }
Esempio n. 13
0
    public bool TryStartTutorialLevel(EnumTutorial tutorialId)
    {
        EnumTutorialState state = PlayerInfo.Instance.GetTutorialState(tutorialId);

        if (state == EnumTutorialState.Inactive)         //if this tutorial is not active or finish, check if can start.
        {
            TutorialLevel     tutorialLevel = GetTutorialLevel(tutorialId);
            EnumTutorialState preState      = EnumTutorialState.Inactive;
            if (tutorialLevel.preId != EnumTutorial.None)
            {
                preState = PlayerInfo.Instance.GetTutorialState(tutorialLevel.preId);
            }
            else
            {
                preState = EnumTutorialState.Finished;
            }


            if (preState == EnumTutorialState.Finished)             //if pre turiral have finish , start this tutorial
            {
                PlayerInfo.Instance.ChangeTutorialState(tutorialId, EnumTutorialState.Active);
                StartTutorialLevel(tutorialLevel);
                _inTutorialFlag = true;


                if (tutorialId == EnumTutorial.Battle_HealthPotion || tutorialId == EnumTutorial.Battle_EnergyPotion)
                {
                    isTutorialHpOrEnergy = true;
                }

                return(true);
            }
        }

        return(false);
    }
 public void DoFinishTutorialTown(EnumTutorial tutorialId)
 {
     //_uITownHome.DoFinishTutorialTown(tutorialId);
 }
 public void DoStartTutorialTown(EnumTutorial tutorialId)
 {
     //_uITownHome.DoStartTutorialTown(tutorialId);
 }
Esempio n. 16
0
 public void FinishTutorial(EnumTutorial tutorialId)
 {
     TutorialManager.Instance.TryFinishTutorialLevel(tutorialId);
 }
Esempio n. 17
0
    public EnumTutorialState GetTutorialState(EnumTutorial tutorialId)
    {
        return(EnumTutorialState.Finished);

        EnumTutorialState tState = EnumTutorialState.Inactive;

        if (_tutorialState.ContainsKey(tutorialId))
        {
            tState = _tutorialState[tutorialId];
        }

        if (tutorialId == EnumTutorial.Battle_Skill1)
        {
            if (null != DataManager.Instance.GetSkillByKey(FC_KEY_BIND.ATTACK_2))
            {
                if (GetLevelState(LevelManager.Singleton.CurrentLevelData.levelName) >= EnumLevelState.NEW_UNLOCK)
                {
                    tState = EnumTutorialState.Finished;
                    ChangeTutorialState(tutorialId, EnumTutorialState.Finished);
                }
            }
        }

        if (tutorialId == EnumTutorial.Battle_Skill2)
        {
            if (null != DataManager.Instance.GetSkillByKey(FC_KEY_BIND.ATTACK_3))
            {
                if (GetLevelState(LevelManager.Singleton.CurrentLevelData.levelName) >= EnumLevelState.NEW_UNLOCK)
                {
                    tState = EnumTutorialState.Finished;
                    ChangeTutorialState(tutorialId, EnumTutorialState.Finished);
                }
            }
        }

        if (tutorialId == EnumTutorial.Town_Skill)
        {
            if (activeSkillList.Count >= 3)
            {
                tState = EnumTutorialState.Finished;
                ChangeTutorialState(tutorialId, EnumTutorialState.Finished);
            }
        }



        if (tState != EnumTutorialState.Finished)
        {
            TutorialTown tutorialTown = TutorialTownManager.Instance.GetTutorialTown(tutorialId);
            if (tutorialTown != null)
            {
                if (tutorialTown.only_once)
                {
                    int tmpState = 0;
                    if (tmpState == 2)
                    {
                        return(EnumTutorialState.Finished);
                    }
                }
            }
            else
            {
                TutorialLevel tutorialLevel = TutorialManager.Instance.GetTutorialLevel(tutorialId);
                if (tutorialLevel != null)
                {
                    if (tutorialLevel.only_once)
                    {
                        int tmpState = 0;
                        if (tmpState == 2)
                        {
                            return(EnumTutorialState.Finished);
                        }
                    }
                }
            }
        }
        return(tState);
    }