Ejemplo n.º 1
0
    void OnEnable()
    {
        for (int i = 0; i < m_nMaxFilterLevel; i++)
        {
            m_nFilterLevel[i] = false;
        }
        if (RestaurantData.m_PlayerRestaurantInfo != null)
        {
            int nMyRestLevel = RestaurantData.m_PlayerRestaurantInfo.m_RestaurantLevel - 1;
            if (nMyRestLevel >= 0 && nMyRestLevel < m_nMaxFilterLevel)
            {
                m_nFilterLevel[nMyRestLevel] = true;
            }
        }
        m_bFilterRewardExp      = true;
        m_bFilterRewardCoin     = true;
        m_bFilterRewardMeterial = true;
        //for (int i = 0; i < m_nMaxFilterLevel; i++)
        //{
        //    m_nFilterLevel[i] = PlayerPreferenceData.GetRestaurantFilterLv(i + 1);
        //}

        //m_bFilterRewardExp = PlayerPreferenceData.RestaurantFilterExp;
        //m_bFilterRewardCoin = PlayerPreferenceData.RestaurantFilterCoin;
        //m_bFilterRewardMeterial = PlayerPreferenceData.RestaurantFilterMeterial;

        Dictionary <string, RestaurantConfigData> curRestaurantList = UserConfigData.GetRestaurantConfigList();

        if (curRestaurantList != null)
        {
            //UInt64 PlayerGuid = Singleton<ObjManager>.GetInstance().MainPlayer.GUID;
            UInt64 PlayerGuid = PlayerPreferenceData.LastRoleGUID;
            if (curRestaurantList.ContainsKey(PlayerGuid.ToString()))
            {
                RestaurantConfigData oRestaurantConfig = curRestaurantList[PlayerGuid.ToString()];
                if (oRestaurantConfig != null)
                {
                    for (int i = 0; i < m_nMaxFilterLevel; i++)
                    {
                        m_nFilterLevel[i] = oRestaurantConfig.GetRestaurantFilterLv(i + 1) != 0 ? true : false;
                    }
                    m_bFilterRewardExp      = oRestaurantConfig.RestaurantFilterExp != 0 ? true : false;
                    m_bFilterRewardCoin     = oRestaurantConfig.RestaurantFilterCoin != 0 ? true : false;
                    m_bFilterRewardMeterial = oRestaurantConfig.RestaurantFilterMeterial != 0 ? true : false;
                }
            }
        }

        //FilterFood();
        //LoadFoodItem();
    }
Ejemplo n.º 2
0
    void SaveRestaurantConfig()
    {
        if (null == Singleton <ObjManager> .GetInstance().MainPlayer)
        {
            return;
        }
        RestaurantConfigData RestaurantConfigData = new RestaurantConfigData();

        for (int i = 0; i < m_nMaxFilterLevel; i++)
        {
            RestaurantConfigData.SetRestaurantFilterLv(i + 1, m_nFilterLevel[i]? 1:0);
        }
        RestaurantConfigData.RestaurantFilterExp      = m_bFilterRewardExp? 1:0;
        RestaurantConfigData.RestaurantFilterCoin     = m_bFilterRewardCoin ? 1:0;
        RestaurantConfigData.RestaurantFilterMeterial = m_bFilterRewardMeterial ? 1:0;
        UserConfigData.AddRestaurantConfig(Singleton <ObjManager> .GetInstance().MainPlayer.GUID.ToString(), RestaurantConfigData);
    }