Exemplo n.º 1
0
 void OnClickReceive(ButtonScript obj, object args, int param1, int param2)
 {
     GuideManager.Instance.ProcEvent(ScriptGameEvent.SGE_AchievementReceived);
     if (SuccessSystem.isReceived(param1))
     {
         PopText.Instance.Show(LanguageManager.instance.GetValue("chengjiuWeiwangcheng"), PopText.WarningType.WT_Warning);
     }
     else
     {
         if (!BagSystem.instance.BagIsFull())
         {
             SuccessCell aCell = obj.GetComponentInParent <SuccessCell>();
             NetConnection.Instance.requestAchaward(param1);
             curCell = aCell;
         }
         else
         {
             PopText.Instance.Show(LanguageManager.instance.GetValue("EN_BagFull"));
         }
     }
 }
Exemplo n.º 2
0
    void UpdateUI()
    {
        CategoryType[] cTypes = new CategoryType[(int)CategoryType.ACH_Max];
        if (index == (int)CategoryType.ACH_All)
        {
            for (int i = 0; i < (int)CategoryType.ACH_Max; ++i)
            {
                cTypes[i] = (CategoryType)i;
            }
        }
        else
        {
            cTypes[index] = (CategoryType)index;
        }

        int        counter = 0;
        GameObject go      = null;
        Dictionary <AchievementType, List <AchievementContent> > data = null;
        List <AchievementContent> finalList = new List <AchievementContent>();

        for (int i = 0; i < cTypes.Length; ++i)
        {
            if (!SuccessSystem.achievementByTab.ContainsKey(cTypes[i]))
            {
                continue;
            }

            data = SuccessSystem.achievementByTab[cTypes[i]];
            foreach (List <AchievementContent> seris in data.Values)
            {
                AchievementContent ac = null;
                for (int j = 0; j < seris.Count; ++j)
                {
                    if (!seris[j].isAward_)
                    {
                        ac = seris[j];
                        break;
                    }
                }

                if (ac == null)
                {
                    ac = seris[seris.Count - 1];
                }

                if (AchieveData.GetData(ac.data_._Id)._AchieveType == AchievementType.AT_Reward50)
                {
                    continue;
                }

                finalList.Add(ac);
            }
        }

        finalList.Sort(Compare);
        for (int i = 0; i < finalList.Count; ++i)
        {
            if (counter >= objPool.Count)
            {
                go = GameObject.Instantiate(item) as GameObject;
                objPool.Add(go);
            }
            else
            {
                go = objPool[counter];
            }
            go.SetActive(true);
            SuccessCell aCell = go.GetComponent <SuccessCell>();
            aCell.Info = finalList[i];

            UIManager.SetButtonEventHandler(aCell.receiveBtn.gameObject, EnumButtonEvent.OnClick, OnClickReceive, finalList[i].data_._Id, 0);
            go.transform.parent        = grid.transform;
            go.transform.localPosition = Vector3.zero;
            go.transform.localScale    = Vector3.one;

            if (i == 0)
            {
                GuideManager.Instance.RegistGuideAim(aCell.receiveBtn.gameObject, GuideAimType.GAT_FirstAchievement);
            }

            counter++;
        }

        for (int i = counter; i < objPool.Count; ++i)
        {
            objPool[i].SetActive(false);
        }

        SpringPanel sp = contentPanel.GetComponent <SpringPanel>();

        if (sp != null)
        {
            sp.enabled = false;
        }
        contentPanel.clipOffset = Vector2.zero;
        contentPanel.transform.localPosition = Vector3.zero;
        contentPanel.GetComponent <UIScrollView>().ResetPosition();
        grid.Reposition();

        objInfo.GetComponent <RewardInfo>().Percentage(SuccessSystem.FinishCount, SuccessSystem.Reward50(), AchieveData.metaData.Count - 1); // remove reward50

        SuccessSystem.isDirty = false;
    }