Example #1
0
    public void OnClickButton()
    {
        int status = AchiveData.GetInstance().Get(this.type).status;

        if (status == -3)
        {
            Debug.Log("이건 완료");

            //ToastManager.Show("TXT_NO_50017", true);
            return;
        }

        if (status == -1)
        {
            Debug.Log("업적달성 못함");
            //ToastManager.Show("TXT_NO_50016", true);
            return;
        }


        GameObject obj = UnityEngine.Object.Instantiate <GameObject>(Resources.Load("Prefabs/reward") as GameObject);

        obj.GetComponent <RewardPopup>().set_Achive(this.type);
        DialogManager.GetInstance().show(obj);


        //Utils.ShowVideoConfirm(tAchive.Item, "TXT_NO_50015", Confirm.ConfirmType.VIDEO2);
        AudioManager.GetInstance().PlayEffect("sound_eff_achive");
    }
    private void Delete(List <int> list, int index)
    {
        if (list.Count < 2)
        {
            this.SaveGame();
            this.DoNullDelete();
            return;
        }
        this.IsPlaying = true;
        int row = this.GetRow(index);
        int col = this.GetCol(index);
        int num = this.GetNumber(row, col);

        for (int i = list.Count / 2 + list.Count % 2; i > 0; i--)
        {
            num *= 2;
        }
        this.setNumber(row, col, num);
        foreach (int current in list)
        {
            int number = this.GetNumber(current);
            if (current != index)
            {
                UnityEngine.Debug.Log(Math.Log((double)number, 2.0));
                this.AddScore((int)Math.Log((double)number, 2.0));
                GM.GetInstance().AddExp((int)Math.Log((double)number, 2.0) * 2);
                AchiveData.GetInstance().Add(2, 1, true);
                TaskData.GetInstance().Add(100101, 1, true);
                this.setNumber(this.GetRow(current), this.GetCol(current), 0);
            }
            else
            {
                if (TaskData.GetInstance().Get(100104).value < number)
                {
                    TaskData.GetInstance().Add(100104, number, false);
                }
                if (AchiveData.GetInstance().Get(6).value < number)
                {
                    AchiveData.GetInstance().Add(6, number, false);
                    //AppsflyerUtils.TrackComp(2, number);
                    if (number > 64)
                    {
                        Action <int> expr_175 = this.DoCompMaxNumber;
                        if (expr_175 != null)
                        {
                            expr_175(number);
                        }
                    }
                }
            }
        }
        this.SaveGame();
        this.DoDeleteHandle(list, index);
    }
Example #3
0
 private void AddScore(int number)
 {
     number     *= 10;
     this.Score += number;
     if (this.Score <= this.MaxScore)
     {
         return;
     }
     this.MaxScore = this.Score;
     AchiveData.GetInstance().Add(5, this.MaxScore, false);
     GM.GetInstance().SaveScoreRecord(1, this.MaxScore);
 }
    public void CheckAchiev()
    {
        bool active = false;

        for (int i = 1; i <= 6; i++)
        {
            if (AchiveData.GetInstance().Get(i).status == -2)
            {
                active = true;
                break;
            }
        }
        this.m_achievDot.SetActive(active);
    }
Example #5
0
    private void Delete(List <int> list, int index)
    {
        if (list.Count < 3)
        {
            this.SaveGame();
            return;
        }
        this.IsPlaying = true;
        int row = this.GetRow(index);
        int col = this.GetCol(index);

        this.AddNumber(row, col, 1);
        foreach (int current in list)
        {
            int number = this.GetNumber(current);
            if (current != index)
            {
                this.AddScore(number);
                GM.GetInstance().AddExp(number);
                AchiveData.GetInstance().Add(2, 1, true);
                TaskData.GetInstance().Add(100101, 1, true);
                this.setNumber(this.GetRow(current), this.GetCol(current), 0);
            }
            else
            {
                if (TaskData.GetInstance().Get(100103).value < number)
                {
                    TaskData.GetInstance().Add(100103, number, false);
                }
                if (AchiveData.GetInstance().Get(3).value < number)
                {
                    AchiveData.GetInstance().Add(3, number, false);
                    //AppsflyerUtils.TrackComp(1, number);
                    if (number > 5)
                    {
                        Action <int> expr_FA = this.DoCompMaxNumber;
                        if (expr_FA != null)
                        {
                            expr_FA(number);
                        }
                    }
                }
            }
        }
        this.OnRandomHeart(this.GetIndex(row, col));
        this.SaveGame();
        this.DoDeleteHandle(list, index);
    }
    public void get_item()
    {
        switch (reward_Type)
        {
        case Reward_popop_type.Achive:
            FireBaseManager.Instance.LogEvent("Achive_Get");

            if (!AchiveData.GetInstance().Finish(type))
            {
                return;
            }

            GM.GetInstance().AddDiamond(val, true);
            FindObjectOfType <Achive>().Set_BindDataToUI();
            AudioManager.GetInstance().PlayEffect("sound_eff_achive");
            OnClickReturn();

            break;

        case Reward_popop_type.Task:
            FireBaseManager.Instance.LogEvent("Task_Get");

            if (!TaskData.GetInstance().Finish(type))
            {
                return;
            }

            GM.GetInstance().AddDiamond(val, true);
            FindObjectOfType <Task>().Refresh();
            AudioManager.GetInstance().PlayEffect("sound_eff_task");
            OnClickReturn();

            break;

        case Reward_popop_type.Gift:
            FireBaseManager.Instance.LogEvent("Gift_Get");

            Get_Gift();
            AudioManager.GetInstance().PlayEffect("sound_eff_task");

            break;

        default:
            break;
        }
    }
    public void set_Achive(int type)
    {
        this.reward_Type = Reward_popop_type.Achive;

        this.item_Type = Item_Type.coin;

        this.type = type;

        LocalData localData = AchiveData.GetInstance().Get(type);

        TAchive tAchive = Configs.TAchives[localData.key.ToString()];

        img_main.sprite = item_sp[(int)item_Type];
        img_ads.sprite  = item_sp[(int)item_Type];

        this.val = tAchive.Item;

        txt_val.text     = "x" + val;
        txt_ads_val.text = "x" + val * 2;
    }
Example #8
0
    public List <int> Use(int idx)
    {
        List <int> list = new List <int>();

        Debug.Log("아이템" + this.CurPropId + " 사용");

        switch (this.CurPropId)
        {
        case 1:
            FireBaseManager.Instance.LogEvent("Puzzle_Mix_Bomb");

            DataManager.Instance.state_Player.item_Localdata.Boom -= 1;
            this.setNumber(idx, 0);
            list.Add(idx);
            AudioManager.GetInstance().PlayEffect("sound_eff_item_bomb");
            break;

        case 2:
        {
            FireBaseManager.Instance.LogEvent("Puzzle_Mix_Cross_Hammer");

            DataManager.Instance.state_Player.item_Localdata.Hammer -= 1;

            int row = this.GetRow(idx);
            int col = this.GetCol(idx);
            for (int i = 0; i < m_board_size; i++)
            {
                this.setNumber(row, i, 0);
                int index = this.GetIndex(row, i);
                if (!list.Contains(index))
                {
                    list.Add(index);
                }
            }
            for (int j = 0; j < m_board_size; j++)
            {
                this.setNumber(j, col, 0);
                int index2 = this.GetIndex(j, col);
                if (!list.Contains(index2))
                {
                    list.Add(index2);
                }
            }
            AudioManager.GetInstance().PlayEffect("sound_eff_item_hammer");
            break;
        }

        case 3:
        {
            FireBaseManager.Instance.LogEvent("Puzzle_Mix_Color_Star");

            DataManager.Instance.state_Player.item_Localdata.Star -= 1;

            int number = this.GetNumber(idx);
            for (int k = 0; k < m_board_size; k++)
            {
                for (int l = 0; l < m_board_size; l++)
                {
                    if (this.GetNumber(l, k) == number)
                    {
                        this.setNumber(l, k, 0);
                        list.Add(this.GetIndex(l, k));
                    }
                }
            }
            AudioManager.GetInstance().PlayEffect("sound_eff_item_star");
            break;
        }
        }

        DataManager.Instance.Save_Player_Data();

        Game1Manager.GetInstance().Set_Txt_Item();
        AchiveData.GetInstance().Add(4, 1, true);
        this.SaveGame();

        return(list);
    }
Example #9
0
    public void BindDataToUI()
    {
        base_width = base_width != 0 ? base_width : btn_get.GetComponent <RectTransform>().sizeDelta.x;
        base_hight = base_hight != 0 ? base_hight : btn_get.GetComponent <RectTransform>().sizeDelta.y;

        width = btn_get.GetComponent <RectTransform>().sizeDelta.x;
        hight = btn_get.GetComponent <RectTransform>().sizeDelta.y;

        LocalData localData = AchiveData.GetInstance().Get(this.type);
        TAchive   tAchive   = Configs.TAchives[localData.key.ToString()];
        float     num       = (float)localData.value / (float)tAchive.Value;

        num = ((num >= 1f) ? 1f : num);
        this.img_progress.fillAmount = num;
        this.txt_desc.GetComponent <LanguageComponent>().SetText(tAchive.Desc);
        this.txt_src.text    = localData.value.ToString() + "/" + tAchive.Value.ToString();
        this.txt_awards.text = string.Format("{0}", tAchive.Item);

        obj_new.SetActive(false);


        DOTween.Kill(btn_get.gameObject);

        btn_get.transform.localScale = Vector3.one;

        switch (localData.status)
        {
        case -3:

            Debug.Log("모든 업적 완료");
            btn_get.interactable = false;
            btn_get.GetComponent <Image>().color = new Color(1, 1, 1, 0.5f);

            play_anim = false;
            this.m_btn_txt.GetComponent <LanguageComponent>().SetText("TXT_NO_20004");

            btn_get.GetComponent <RectTransform>().sizeDelta = new Vector2(base_width, base_hight);

            return;

        case -2:

            Debug.Log("완료");
            btn_get.interactable = true;
            btn_get.GetComponent <Image>().color = new Color(1, 1, 1, 1);

            play_anim = true;
            Debug.Log(width * 0.9f);

            DOTween.To(() => width, x => width = x, width * 0.9f, 1)
            .SetEase(Ease.Linear).SetLoops(-1, LoopType.Yoyo);

            DOTween.To(() => hight, x => hight = x, hight * 0.9f, 1)
            .SetEase(Ease.Linear).SetLoops(-1, LoopType.Yoyo);

            this.m_btn_txt.GetComponent <LanguageComponent>().SetText("TXT_NO_20001");

            EventTrigger eventTrigger = btn_get.gameObject.AddComponent <EventTrigger>();

            EventTrigger.Entry entry_PointerDown = new EventTrigger.Entry();
            entry_PointerDown.eventID = EventTriggerType.PointerDown;
            entry_PointerDown.callback.AddListener((data) => { FindObjectOfType <MainScene>().Pointer_Down(btn_get.transform); });
            eventTrigger.triggers.Add(entry_PointerDown);

            EventTrigger.Entry entry_PointerUp = new EventTrigger.Entry();
            entry_PointerUp.eventID = EventTriggerType.PointerUp;
            entry_PointerUp.callback.AddListener((data) => { FindObjectOfType <MainScene>().Pointer_Up(btn_get.transform); });
            eventTrigger.triggers.Add(entry_PointerUp);


            return;

        case -1:

            Debug.Log("미완료");
            btn_get.interactable = false;
            btn_get.GetComponent <Image>().color = new Color(1, 1, 1, 0.5f);
            play_anim = false;

            this.m_btn_txt.GetComponent <LanguageComponent>().SetText("TXT_NO_20001");

            btn_get.GetComponent <RectTransform>().sizeDelta = new Vector2(base_width, base_hight);

            return;

        default:
            return;
        }
    }
    public void Ads_Reward()
    {
        FireBaseManager.Instance.LogEvent("Reward_End");

        switch (reward_Type)
        {
        case Reward_Type.game1Finish:
            Debug.Log("첫번째 이어하기");
            FireBaseManager.Instance.LogEvent("Puzzle_Mix_Continue_Ads");

            GM.GetInstance().SetSavedGameID(GameID);
            Game1DataLoader.GetInstance().FillLife(false);
            Game1DataLoader.GetInstance().DoFillLife();
            DialogManager.GetInstance().Close(null);

            break;

        case Reward_Type.game2Finish:
            Debug.Log("두번째 이어하기");
            FireBaseManager.Instance.LogEvent("2048_Continue_Ads");

            GM.GetInstance().SetSavedGameID(GameID);
            DialogManager.GetInstance().Close(null);
            Game2Manager.GetInstance().video();

            break;

        case Reward_Type.again:

            break;

        case Reward_Type.block:

            Game1DataLoader.GetInstance().IsPlaying = true;
            Game1Manager.GetInstance().ControlPropsPannel(true);
            Game1Manager.GetInstance().UseProps(block);
            Game1Manager.GetInstance().m_markTips = true;

            break;

        case Reward_Type.skin:
            GM.GetInstance().SetSkinData(this.SkinID, 2);
            GM.GetInstance().SetSkinFreeTime(this.SkinID, DateTime.Now);
            //AppsflyerUtils.TrackBuySkin(this.SkinID, 1);
            Action <int> expr_38 = SkinUnLock.Instance.OnUnlockSuccess;
            if (expr_38 != null)
            {
                expr_38(this.SkinID);
            }
            DialogManager.GetInstance().Close(null);
            break;

        case Reward_Type.stimulate:

            int rans = UnityEngine.Random.Range(10, 100);
            GM.GetInstance().AddDiamond(rans);
            TaskData.GetInstance().Add(100105, 1, true);

            DateTime GiftTime = DateTime.Now.AddMinutes(10);
            DataManager.Instance.state_Player.LocalData_Main_Time = GiftTime.ToString();
            DataManager.Instance.Save_Player_Data();

            FindObjectOfType <MainScene>().Set_Timer();

            DotManager.GetInstance().CheckAds();

            break;

        case Reward_Type.Achive:

            if (!AchiveData.GetInstance().Finish(achive_type))
            {
                return;
            }

            GM.GetInstance().AddDiamond(achive_val * 2, true);
            FindObjectOfType <Achive>().Set_BindDataToUI();
            DialogManager.GetInstance().Close(null);

            break;

        case Reward_Type.Task:
            if (!TaskData.GetInstance().Finish(achive_type))
            {
                return;
            }

            GM.GetInstance().AddDiamond(achive_val * 2, true);
            FindObjectOfType <Task>().Refresh();
            DialogManager.GetInstance().Close(null);

            break;

        case Reward_Type.shop_ads:

            GiftTime = DateTime.Now.AddMinutes(10);
            DataManager.Instance.state_Player.LocalData_Shop_Time = GiftTime.ToString();
            DataManager.Instance.Save_Player_Data();

            FindObjectOfType <Shop>().ads_item.Set_Timer();

            int ran = UnityEngine.Random.Range(10, 100);
            GM.GetInstance().AddDiamond(ran);

            FireBaseManager.Instance.LogEvent("Shop_Ads");

            break;

        case Reward_Type.levelup:

            FindObjectOfType <LevelUp>().OnClickAds();


            break;

        case Reward_Type.stage:

            FindObjectOfType <G3WinDialog>().Reward();


            break;

        case Reward_Type.game:

            GiftTime = DateTime.Now.AddMinutes(10);
            DataManager.Instance.state_Player.LocalData_Game_Time = GiftTime.ToString();
            DataManager.Instance.Save_Player_Data();

            Game2Manager.GetInstance()?.Set_Timer();
            Game1Manager.GetInstance()?.Set_Timer();
            G3BoardManager.GetInstance()?.Set_Timer();

            ran = UnityEngine.Random.Range(10, 100);
            GM.GetInstance().AddDiamond(ran);

            break;

        case Reward_Type.coin:
            ran = UnityEngine.Random.Range(10, 100);
            GM.GetInstance().AddDiamond(ran);
            break;

        case Reward_Type.Daily:

            FindObjectOfType <Activity>().OnClickAds();


            break;

        case Reward_Type.gift:
            FindObjectOfType <RewardPopup>().Get_Gift();

            break;

        default:
            break;
        }
    }