Exemplo n.º 1
0
    public void ButtonGet()
    {
        //Xet du lieu hoan thanh mission vao day
        //Debug.Log("Button get click " + currentLevelAchievement + " achievementGroup.Length " + achievementGroup.Length);
        if (achievementGroup.Length >= currentLevelAchievement)
        {
            finish = false;
            Transform diamondEffect = Instantiate(DiamondEffect) as Transform;
            diamondEffect.transform.position   = transform.FindChild("ItemAchievement").FindChild("ButtonGet").position;
            diamondEffect.transform.parent     = transform;
            diamondEffect.transform.localScale = new Vector3(1, 1, 1);
            //currentLevelAchievement - 1 Lay phan thuong cua nhiem vu truoc
            diamondEffect.GetComponent <DiamondEffect>().SetData(achievementGroup[currentLevelAchievement - 1].Reward, true);
            //Debug.Log("------------- " + diamondEffect.name);
            //neu nhiem vu cuoi cung cua group thi se an nut get di
            if (currentLevelAchievement == achievementGroup.Length)
            {
                transform.FindChild("ItemAchievement").FindChild("ButtonGet").gameObject.SetActive(false);
            }
            //currentLevelAchievement se duoc +1 trong ham sau
            SetData(groupAchievement, achievementGroup, currentLevelAchievement + 1, currentValue);
            DataCache.AddAchievementCache(groupAchievement, 0, 1);
            //Xet lai de group co the hien thi thong bao
            DataCache.dataAchievementCache[groupAchievement - 1].Notify = 0;

            transform.parent.parent.parent.parent.GetComponent <DialogAchievement>().CountAchievementFinish();
        }
    }
Exemplo n.º 2
0
    public static void AddDataAchievement(int groupLevel, int addValue)
    {
        DataCache.AddAchievementCache(groupLevel, addValue);
        //Debug.Log("Cap nhat nhiem vu " + groupLevel);
        //Check nhiem vu hoan thanh
        int currentLevel = DataCache.dataAchievementCache[groupLevel - 1].Level;

        if (arrGroupAchievement[groupLevel - 1].Length >= currentLevel && DataCache.dataAchievementCache[groupLevel - 1].Value >= arrGroupAchievement[groupLevel - 1][currentLevel - 1].Target && DataCache.dataAchievementCache[groupLevel - 1].Notify == 0)
        {
            Debug.Log("-------------------CO NHIEM VU HOAN THANH 1---------------------");
            GoogleAnalytics.instance.LogScreen("Complete Achievement: " + arrGroupAchievement[groupLevel - 1][currentLevel - 1].Title);
            AchievementInGameControl.achiFinish.finish = true;
            AchievementInGameControl.achiFinish.title  = arrGroupAchievement[groupLevel - 1][currentLevel - 1].Title;
            AchievementInGameControl.achiFinish.detail = arrGroupAchievement[groupLevel - 1][currentLevel - 1].Detail;
            if (VariableSystem.language != null && VariableSystem.language.Equals("Vietnamese"))
            {
                AchievementInGameControl.achiFinish.detail = arrGroupAchievement[groupLevel - 1][currentLevel - 1].Detail_Vi;
            }
            //Chi hien thi thong bao 1 lan
            DataCache.dataAchievementCache[groupLevel - 1].Notify = 1;
            countachievement++;
        }
    }