コード例 #1
0
ファイル: AchieveDetailUI.cs プロジェクト: xophiix/taiji
    public void refresh()
    {
        AchievementConfig config = AchievementConfig.instance();
        int achieveCount         = config.getAchieveItemCount();

        for (int i = 0; i < achieveCount; ++i)
        {
            AchievementConfig.AchieveItem item = config.getAchieveItemByIndex(i);
            AchieveUIItem uiItem   = _achieveUIItems[i];
            bool          finished = PlayerPrefs.GetInt("finished_achieve_" + item.id, 0) > 0;
            uiItem.setAchieve(item, finished);
        }
    }
コード例 #2
0
    public void refresh()
    {
        AchievementConfig config = AchievementConfig.instance();
        int achieveCount         = config.getAchieveItemCount();

        for (int i = 0; i < achieveCount; ++i)
        {
            AchievementConfig.AchieveItem item = config.getAchieveItemByIndex(i);
            bool finished = PlayerPrefs.GetInt("finished_achieve_" + item.id, 0) > 0;
            if (i < _achieveIcons.Count)
            {
                Image icon = _achieveIcons[i];
                icon.enabled = finished;
            }
        }
    }
コード例 #3
0
    void initPlayerDefaults()
    {
        if (Application.isEditor)
        {
            PlayerPrefs.DeleteAll();

            /*long now = System.DateTime.Now.Ticks;
             * PlayerPrefs.SetString("achieve_finish_time1", now.ToString());
             * PlayerPrefs.SetString("achieve_finish_time2", now.ToString());
             * PlayerPrefs.SetInt("achieve_progress" + 1 + "_pawn_type0", 0);
             * PlayerPrefs.SetInt("achieve_progress" + 1 + "_pawn_type1", 1);
             * PlayerPrefs.SetInt("achieve_progress" + 2 + "_pawn_type0", 1);
             * PlayerPrefs.SetInt("achieve_progress" + 2 + "_pawn_type1", 0);
             * PlayerPrefs.SetInt("achieve_progress" + 1, 3);
             * PlayerPrefs.SetInt("achieve_progress" + 2, 3);
             *
             * PlayerPrefs.SetInt("achieve_progress" + 3, 1);
             * PlayerPrefs.SetInt("achieve_progress" + 3 + "_pawn_type0", 0);
             *
             * PlayerPrefs.SetInt("finished_achieve_" + 1, 1);
             * PlayerPrefs.SetInt("finished_achieve_" + 2, 1);*/

            PlayerPrefs.Save();
        }

        if (0 == PlayerPrefs.GetInt("first_create", 0))
        {
            PlayerPrefs.SetInt("first_create", 1);
            PlayerPrefs.SetInt("finished_achieve_" + 7, 1);
            PlayerPrefs.SetInt("finished_achieve_" + 8, 1);
            PlayerPrefs.Save();
        }

        AchievementConfig config = AchievementConfig.instance();
        int achieveCount         = config.getAchieveItemCount();

        for (int i = 0; i < achieveCount; ++i)
        {
            AchievementConfig.AchieveItem item = config.getAchieveItemByIndex(i);
            bool finished = PlayerPrefs.GetInt("finished_achieve_" + item.id, 0) > 0;
            if (finished)
            {
                _finishedAchieves.Add(item.id);
            }
        }
    }
コード例 #4
0
    private void initAchieveUI()
    {
        _achieveInfoLayer             = gameObject.transform.Find("AchieveInfoLayer").gameObject.GetComponent <Image>();
        _achieveInfoLayerCanvas       = _achieveInfoLayer.gameObject.GetComponent <CanvasGroup>();
        _achieveInfoLayerCanvas.alpha = 0;

        _achieveNameText         = _achieveInfoLayer.transform.Find("AchieveName").gameObject.GetComponent <Text>();
        _achieveFinishTimeText   = _achieveInfoLayer.transform.Find("AchieveFinishTime").gameObject.GetComponent <Text>();
        _achieveInfoText         = _achieveInfoLayer.transform.Find("AchieveInfo").gameObject.GetComponent <Text>();
        _achieveDetailFirstPawn  = _achieveInfoLayer.transform.Find("AchieveInfo/Pawn1").gameObject.GetComponent <PawnDisplayer>();
        _achieveDetailSecondPawn = _achieveInfoLayer.transform.Find("AchieveInfo/Pawn2").gameObject.GetComponent <PawnDisplayer>();
        _achieveDetailFirstPawn.disableSendMessage  = true;
        _achieveDetailSecondPawn.disableSendMessage = true;

        _achieveInfoLayer.gameObject.SetActive(false);

        AchievementConfig config   = AchievementConfig.instance();
        int       achieveCount     = config.getAchieveItemCount();
        Transform achieveIconLayer = gameObject.transform.Find("AchieveIconLayer");

        _achieveIconGlow = achieveIconLayer.Find("IconGlow").GetComponent <Image>();
        _achieveIconGlow.gameObject.SetActive(false);

        for (int i = 0; i < achieveCount; ++i)
        {
            AchievementConfig.AchieveItem item = config.getAchieveItemByIndex(i);
            bool finished = PlayerPrefs.GetInt("finished_achieve_" + item.id, 0) > 0;

            Transform achieveIcon = achieveIconLayer.Find("Achieve" + i);
            if (achieveIcon)
            {
                Image icon = achieveIcon.gameObject.GetComponent <Image>();
                _achieveIcons.Add(icon);
            }
        }

        refresh();
    }
コード例 #5
0
ファイル: AchieveDetailUI.cs プロジェクト: xophiix/taiji
    private void initAchieveUI()
    {
        Debug.Log("AchieveDetailUI initAchieveUI");

        AchievementConfig config   = AchievementConfig.instance();
        int       achieveCount     = config.getAchieveItemCount();
        Transform achieveItemLayer = gameObject.transform.Find("Panel/AchieveItemLayer");

        for (int i = 0; i < achieveCount; ++i)
        {
            AchievementConfig.AchieveItem item = config.getAchieveItemByIndex(i);
            bool finished = PlayerPrefs.GetInt("finished_achieve_" + item.id, 0) > 0;

            GameObject achieveUIItem = (GameObject)Instantiate(achieveItemPrefab);
            achieveUIItem.transform.SetParent(achieveItemLayer);
            achieveUIItem.transform.localScale = Vector3.one;
            achieveUIItem.name = "AchieveUIItem" + i;

            AchieveUIItem uiItem = achieveUIItem.GetComponent <AchieveUIItem>();
            _achieveUIItems.Add(uiItem);
        }

        refresh();
    }