public void Add(int type, int value, bool isMerge = true)
        {
            if (!this.achives.ContainsKey(type.ToString()))
            {
                return;
            }
            LocalData localData = this.achives[type.ToString()];

            if (isMerge)
            {
                localData.value += value;
            }
            else
            {
                localData.value = value;
            }
            this.achives[type.ToString()] = localData;
            this.SetLocalData(localData.type, localData.value, localData.key, localData.status);
            GlobalEventHandle.EmitRefreshAchiveHandle(type);
            DotManager.GetInstance().CheckAchiev();
            if (localData.status != -1)
            {
                return;
            }
            TAchive tAchive = Configs.Configs.TAchives[localData.key.ToString()];

            if (localData.value >= tAchive.Value)
            {
                localData.status = -2;
            }
            this.achives[type.ToString()] = localData;
            this.SetLocalData(localData.type, localData.value, localData.key, localData.status);
            GlobalEventHandle.EmitRefreshAchiveHandle(type);
        }
        public void Update(int type)
        {
            if (!this.achives.ContainsKey(type.ToString()))
            {
                return;
            }
            LocalData localData = this.achives[type.ToString()];

            if (localData.status != -3)
            {
                return;
            }
            TAchive tAchive = Configs.Configs.TAchives[localData.key.ToString()];

            if (tAchive.Next == 0)
            {
                return;
            }
            TAchive tAchive2 = Configs.Configs.TAchives[tAchive.Next.ToString()];

            if (localData.value >= tAchive2.Value)
            {
                localData.status = -2;
                localData.key    = tAchive2.ID;
            }
            else
            {
                localData.status = -1;
                localData.key    = tAchive2.ID;
            }
            this.achives[type.ToString()] = localData;
            this.SetLocalData(localData.type, localData.value, localData.key, localData.status);
        }
    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;
    }
        public bool Finish(int type)
        {
            if (!this.achives.ContainsKey(type.ToString()))
            {
                return(false);
            }
            LocalData localData = this.achives[type.ToString()];

            if (localData.status != -2)
            {
                return(false);
            }
            TAchive tAchive = Configs.Configs.TAchives[localData.key.ToString()];

            if (tAchive.Next == 0)
            {
                localData.status = -3;
            }
            else
            {
                TAchive tAchive2 = Configs.Configs.TAchives[tAchive.Next.ToString()];
                if (localData.value >= tAchive2.Value)
                {
                    localData.status = -2;
                    localData.key    = tAchive2.ID;
                }
                else
                {
                    localData.status = -1;
                    localData.key    = tAchive2.ID;
                }
            }
            this.achives[type.ToString()] = localData;
            this.SetLocalData(localData.type, localData.value, localData.key, localData.status);
            DotManager.GetInstance().CheckAchiev();
            return(true);
        }
Esempio n. 5
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;
        }
    }
 internal int _Read_b__12_0(TAchive a, TAchive b)
 {
     return(a.Type.CompareTo(b.Type));
 }