Ejemplo n.º 1
0
    int Compare(AchievementContent ac1, AchievementContent ac2)
    {
        int a1score = 0;
        int a2score = 0;

        if (ac1.isAch_ && !ac1.isAward_)
        {
            a1score = 1000;
        }
        else if (!ac1.isAch_)
        {
            a1score = 500;
        }

        if (ac2.isAch_ && !ac2.isAward_)
        {
            a2score = 1000;
        }
        else if (!ac2.isAch_)
        {
            a2score = 500;
        }

        if (a1score > a2score)
        {
            return(-1);
        }
        if (a1score < a2score)
        {
            return(1);
        }
        return(0);
    }
Ejemplo n.º 2
0
    public static void SetData(AchieveData data)
    {
        AchievementContent ac = new AchievementContent(data);

        if (!achievementByTab.ContainsKey(data._Category))
        {
            achievementByTab.Add(data._Category, new Dictionary <AchievementType, List <AchievementContent> >());
        }

        if (!achievementByTab[data._Category].ContainsKey(data._AchieveType))
        {
            achievementByTab[data._Category].Add(data._AchieveType, new List <AchievementContent>());
        }

        achievementByTab[data._Category][data._AchieveType].Add(ac);
    }
Ejemplo n.º 3
0
	public void Percentage(int count, AchievementContent content, int maxcount)
	{
        content_ = content;
        float rate = (count*1f) / (maxcount*1f);
		float size = rate * 360f;
        if (size <= 0)
            size = 1;
        ProgressBarLabel.text = count.ToString();
		ProgressBarPanle.baseClipRegion = new Vector4 (ProgressBarPanle.baseClipRegion.x,ProgressBarPanle.baseClipRegion.y,ProgressBarPanle.baseClipRegion.z,size);
        if (content_ != null)
		{
            ReceiveBtn.isEnabled = (content_.isAch_ && !content_.isAward_);
		}
		else
		{
			ReceiveBtn.isEnabled = false;
		}
	}
Ejemplo n.º 4
0
 void Update()
 {
     if (SuccessSystem.isDirty)
     {
         AchievementContent ac = null;
         if (SuccessSystem.newAchieve.Count > 0)
         {
             ac = SuccessSystem.newAchieve.Dequeue();
             GameObject clone = (GameObject)GameObject.Instantiate(item);
             clone.SetActive(true);
             clone.transform.parent     = grid.transform;
             clone.transform.localScale = Vector3.one;
             Destroy des = clone.AddComponent <Destroy>();
             des.SetLifeTime(10.0f);
             SuccessTipsCell tipsCell = clone.GetComponent <SuccessTipsCell>();
             tipsCell.content = ac;
             UIManager.SetButtonEventHandler(clone.gameObject, EnumButtonEvent.OnClick, OnClickAchievement, 0, 0);
         }
         grid.repositionNow = true;
     }
 }
Ejemplo n.º 5
0
    // Use this for initialization
    void Start()
    {
        foreach (TextAsset t in Resources.LoadAll <TextAsset>("Story/" + storyChapter))
        {
            StoryContent s = StoryContent.CreateFromJSON(t.text);
            storyContentList.Add(s);
        }

        for (int i = 0; i < storyContentList.Count; i++)
        {
            if (storyContentList[i].title.Equals(story))
            {
                n = i;
                break;
            }
        }

        foreach (TextAsset t in Resources.LoadAll <TextAsset>("Achievement/" + achiChapter))
        {
            AchievementContent a = AchievementContent.CreateFromJSON(t.text);
            achiContentList.Add(a);
        }

        if (!hideStory)
        {
            StartCoroutine("ShowContent");
        }
        else
        {
            if (Menu.instance != null)
            {
                storyPanel.transform.parent.gameObject.SetActive(false);
                Menu.instance.isGameOn = true;
            }
        }
    }
Ejemplo n.º 6
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;
    }