예제 #1
0
 public void ClickUnlock()
 {
     Debug.Log("解锁");
     XPlayerPrefs.SetInt(levelID.ToString() + isUnlock, -1);
     XPlayerPrefs.Save();
     Destroy(transform.Find("unlockBtn").gameObject);
 }
예제 #2
0
파일: UIGM.cs 프로젝트: wuhuolong/MaxBooks
    private static void PassAllStage_Func(object[] objs)
    {
        Debug.Log("pass");
        //string numAllStar = "numAllStar";
        string isUnlock    = "isUnlock";
        string isCompleted = "isCompleted";
        //string numStar = "numStar";
        LevelConfig_ARRAY m_config = LevelMgr.GetInstance().GetLevelConfigArray();

        for (int i = 0; i < m_config.Items.Count; i++)
        {
            string id = m_config.Items[i].LevelId.ToString();

            //设置关卡解锁状态
            XPlayerPrefs.SetInt(id + isUnlock, -1);
            XPlayerPrefs.SetInt(id + isCompleted, 1);

            ////设置当前关卡星星
            //int preStar = XPlayerPrefs.GetInt(id + numStar);
            //XPlayerPrefs.SetInt(id + numStar, 3);

            ////设置总星星数量
            //int curNum = XPlayerPrefs.GetInt(numAllStar);
            //XPlayerPrefs.SetInt(numAllStar, curNum + 3 - preStar);
        }
        //保存
        XPlayerPrefs.Save();
    }
예제 #3
0
    private void FixedUpdate()
    {
        if (isShadow)
        {
            scrollbar.value = scrollValue;
            if (shadows[type].localScale != shadowMax)
            {
                shadows[type].localScale = Vector3.Lerp(shadows[type].localScale, shadowMax, Time.deltaTime * shadowSpeed);
                if (Mathf.Abs(shadows[type].localScale.x - shadowMax.x) <= 10.0f)
                {
                    shadows[type].localScale = Vector3.zero;
                    XPlayerPrefs.SetInt(shadowType, -1);
                    isShadow = false;
                }
            }
        }
        if (isShadowToLevel)
        {
            if (shadows[type].localScale != shadowMin)
            {
                shadows[type].localScale = Vector3.Lerp(shadows[type].localScale, shadowMin, Time.deltaTime * shadowSpeedToMain);

                if (Mathf.Abs(shadows[type].localScale.x - shadowMin.x) <= 0.1f)
                {
                    shadows[type].localScale = Vector3.zero;
                    //进入主界面
                    isShadowToLevel = false;
                    black.alpha     = 1.0f;
                    UIMgr.GetInstance().ShowPage_Play(UIPageEnum.Play_Page);
                }
            }
        }
        if (isShadowToMain)
        {
            if (shadows[type].localScale != shadowMin)
            {
                shadows[type].localScale = Vector3.Lerp(shadows[type].localScale, shadowMin, Time.deltaTime * shadowSpeedToMain);

                if (Mathf.Abs(shadows[type].localScale.x - shadowMin.x) <= 0.1f)
                {
                    shadows[type].localScale = Vector3.zero;
                    //进入主界面
                    isShadowToMain = false;
                    black.alpha    = 1.0f;
                    UIMgr.GetInstance().ShowPage(UIPageEnum.Main_Page);
                }
            }
        }
    }
예제 #4
0
    private void Start()
    {
        InitUI();

        //TODO:修改选择,上方界面的显示和下方界面的显示
        // 从主界面-每日挑战 默认选择最新一关
        // 每日结算界面-每日挑战 默认选当前关
        //重置选择:
        XPlayerPrefs.SetInt(selectedDateTimeStr, 0);

        calendarPanel.InitPanelSize();
        calendarPanel.InitAllCalendars();

        initFlag = true;
    }
예제 #5
0
 private void OnApplicationPause(bool pause)
 {
     if (pause)
     {
         m_last_timestamp = Time.time;
     }
     else
     {
         if (Time.time - m_last_timestamp >= Time_Interval)
         {
             int count = XPlayerPrefs.GetInt(StartUpCount_Tag) + 1;
             XPlayerPrefs.SetInt(StartUpCount_Tag, count);
         }
     }
 }
예제 #6
0
파일: UIEnd.cs 프로젝트: wuhuolong/MaxBooks
 private void ShadowInit()
 {
     //随机加载阴影图
     type = Random.Range(0, 3);
     //type = 1;
     XPlayerPrefs.SetInt(shadowType, type);
     for (int i = 0; i < shadows.Length; i++)
     {
         shadows[i].localScale = Vector3.zero;
     }
     if (type != -1)
     {
         shadows[type].localScale = shadowMax;
     }
     isShadow = false;
 }
예제 #7
0
    private void OnPayRemoveAD(JsonData data)
    {
        int retcode = (int)data["Ret"];

        if (retcode == 1)
        {
#if UNITY_EDITOR
            //UIMgr.GetInstance().ShowSimpleTips("购买去广告服务成功");
#endif
            XPlayerPrefs.SetInt(AdMgr.Pay2RemoveAD_Tag, 1);
        }
        else
        {
            XPlayerPrefs.SetInt(AdMgr.Pay2RemoveAD_Tag, 0);
        }
        AdMgr.GetInstance().isPaying = false;
    }
예제 #8
0
파일: UIEnd.cs 프로젝트: wuhuolong/MaxBooks
    private void SetToNextLevel()
    {
        //设置本关卡已完成
        XPlayerPrefs.SetInt(levelID + isCompleted, 1);
        //Debug.Log(XPlayerPrefs.GetInt(levelID + isCompleted));

        //下一关
        if (LevelMgr.GetInstance().GetNextLevelIDByID(levelID) == 0)
        {
            //Debug.Log("没有下一关了");
            return;
        }
        nextLevelID = LevelMgr.GetInstance().GetNextLevelIDByID(levelID);
        XPlayerPrefs.SetInt(curLevel, (int)nextLevelID);
        XPlayerPrefs.SetInt(nextLevelID + isUnlock, -1);
        LevelMgr.GetInstance().CurLevelID = nextLevelID;
    }
예제 #9
0
    public void Init()
    {
        Debuger.Init();
        Debuger.EnableLog = GameConfig.IsDebug;
        LanguageMgr.GetInstance().SetUp();
        int count = XPlayerPrefs.GetInt(StartUpCount_Tag) + 1;

        XPlayerPrefs.SetInt(StartUpCount_Tag, count);
        Application.targetFrameRate = 60;
        //UIMgr.ShowPage(UIPageEnum.Main_Page);
        processList = new List <PreProcess>()
        {
            new BinProcess(),
            new AtlasProcess(),
            new AbProcess()
        };
        StartCoroutine(Preprocess());
    }
예제 #10
0
 public void ClickEnterLevel()
 {
     if (XPlayerPrefs.GetInt(levelID.ToString() + isUnlock) == -1)
     {
         Debug.Log("enter");
         if (buttonCheck)
         {
             buttonCheck = false;
             setState();
             gameObject.transform.GetComponentInParent <UILevelList>().EnterLevel();
             XPlayerPrefs.SetInt(curLevel, (int)levelID);
             XPlayerPrefs.Save();
         }
     }
     else
     {
         Debug.Log("未解锁");
     }
 }
예제 #11
0
    public void ClickEnter()
    {
        if (canEnter)
        {
            if (buttonCheck)
            {
                buttonCheck = false;
                //随机加载阴影图
                type = Random.Range(0, 3);
                type = 1;
                XPlayerPrefs.SetInt(shadowType, type);
                Debug.Log("pre" + shadowType + type);

                shadows[type].localScale = shadowMax;
                isShadow = true;
                canEnter = false;
            }
        }
    }
예제 #12
0
    private void OnEnable()
    {
        levelID = LevelMgr.GetInstance().GetNewLevel().LevelId;
        Debug.Log("levelID" + levelID);
        LevelMgr.GetInstance().CurLevelID = levelID;
        XPlayerPrefs.SetInt(levelID + isUnlock, -1);
        //XPlayerPrefs.Save();

        buttonCheck = true;
        type        = XPlayerPrefs.GetInt(shadowType);

        updateFlag = false;
        StartCoroutine(TimeLeftUpdate(DateTime.Today.AddDays(1)));

        //if(isFlashOver==true && type!=-1)
        //{
        //    black.alpha = 1.0f;
        //    StartCoroutine(ShadowInit2());
        //}
        //ShadowInit();
    }
예제 #13
0
    private void SetSelectedDay(DateTime newSelectedDateTime, GameObject newSelectedDayObject)
    {
        //修改选择的日期以及显示
        m_selectedDateTime = newSelectedDateTime;
        DayTest m_selectedDay;

        if (m_selectedDayObject != null && m_selectedDayObject.GetComponent <DayTest>() != null)
        {
            m_selectedDay = m_selectedDayObject.GetComponent <DayTest>();
            // Debug.Log("oldSelectedDay isChallenged" + m_selectedDay.isChallenged);
            if (m_selectedDay.isChallenged)
            {
                m_selectedDay.dayBGSelectFinish.color   = Color.clear;
                m_selectedDay.dayBGUnSelectFinish.color = Color.white;
            }
            else
            {
                m_selectedDay.dayBGSelectUnFinish.color = Color.clear;
            }
        }
        m_selectedDayObject = newSelectedDayObject;
        m_selectedDay       = m_selectedDayObject.GetComponent <DayTest>();
        // Debug.Log("newSelectedDay isChallenged" + m_selectedDay.isChallenged);

        if (m_selectedDay.isChallenged)
        {
            m_selectedDay.dayBGSelectFinish.color   = Color.white;
            m_selectedDay.dayBGUnSelectFinish.color = Color.clear;
        }
        else
        {
            m_selectedDay.dayBGSelectUnFinish.color = Color.white;
            m_selectedDay.dayBGUnSelectFinish.color = Color.clear;
        }
        XPlayerPrefs.SetInt(selectedDateTimeStr, TimeUtil.getIntByDateTime(m_selectedDateTime));
    }
예제 #14
0
    private void FixedUpdate()
    {
        ////闪屏
        //if(isFlashOver==false)
        //{
        //    if (flashCheck == false)
        //    {
        //        if (black.alpha != alphaZero)
        //        {
        //            black.alpha = Mathf.Lerp(black.alpha, alphaZero, alphaSpeed * Time.deltaTime);
        //            if (Mathf.Abs(alphaZero - black.alpha) <= 0.01f)
        //            {
        //                black.alpha = alphaZero;
        //                Invoke("flashChange", 2.0f);
        //            }
        //        }
        //    }
        //    else
        //    {
        //        if (black.alpha != alphaOne)
        //        {
        //            black.alpha = Mathf.Lerp(black.alpha, alphaOne, alphaSpeed * Time.deltaTime);
        //            if (Mathf.Abs(alphaOne - black.alpha) <= 0.01f)
        //            {
        //                black.alpha = alphaOne;
        //                closeBlack();
        //                closeFlash();
        //                isFlashOver = true;
        //            }
        //        }
        //    }
        //}

        //转场动画
        if (isShadow)
        {
            if (type != -1)
            {
                if (shadows[type].localScale != shadowMin)
                {
                    shadows[type].localScale = Vector3.Lerp(shadows[type].localScale, shadowMin, Time.deltaTime * shadowSpeed);

                    if (Mathf.Abs(shadows[type].localScale.x - shadowMin.x) <= 0.1f)
                    {
                        shadows[type].localScale = Vector3.zero;
                        isShadow = false;
                        //进入游戏主界面
                        black.alpha = 1.0f;
                        //UIMgr.ShowPage(UIPageEnum.LevelList_Page);
                        UIMgr.GetInstance().ShowPage_Play(UIPageEnum.Play_Page);
                    }
                }
            }
        }

        if (isShadowFromList)
        {
            if (type != -1)
            {
                if (shadows[type].localScale != shadowMax)
                {
                    shadows[type].localScale = Vector3.Lerp(shadows[type].localScale, shadowMax, Time.deltaTime * shadowSpeedFromList);
                    if (Mathf.Abs(shadows[type].localScale.x - shadowMax.x) <= 10.0f)
                    {
                        shadows[type].localScale = Vector3.zero;
                        XPlayerPrefs.SetInt(shadowType, -1);
                        isShadowFromList = false;
                    }
                }
            }
        }
    }
예제 #15
0
 private void setState()
 {
     XPlayerPrefs.SetInt(curLevel, (int)levelID);
     LevelMgr.GetInstance().CurLevelID = levelID;
     //LevelMgr.GetInstance().SetCurThemeID(themeID);
 }
예제 #16
0
    private void FixedUpdate()
    {
        if (isShadow)
        {
            if (shadows[type].localScale != shadowMax)
            {
                shadows[type].localScale = Vector3.Lerp(shadows[type].localScale, shadowMax, Time.deltaTime * shadowSpeed);
                if (Mathf.Abs(shadows[type].localScale.x - shadowMax.x) <= 10.0f)
                {
                    shadows[type].localScale = Vector3.zero;
                    XPlayerPrefs.SetInt(shadowType, -1);
                    isShadow = false;
                    if (needMask == 1)
                    {
                        Debug.Log("init");
                        mask.SetActive(true);
                        shaderViewer.Init(1, 0);
                    }
                    if (needMask == 2)
                    {
                        var rec = XPlayerPrefs.GetRec(levelID);
                        if (rec == null)
                        {
                            SettlePuzzle newSettlePuzzle = new SettlePuzzle();
                            newSettlePuzzle.puzzleID          = 0;
                            newSettlePuzzle.puzzleRotateState = 0;
                            newSettlePuzzle.puzzleGridIndex   = 162;
                            generalPanelUI.SettlePuzzleFunc(newSettlePuzzle);
                            Debug.Log("init");
                            mask.SetActive(true);
                            shaderViewer.Init(2, 0);
                        }
                    }
                }
            }
        }
        if (isShadowToList)
        {
            if (type != -1)
            {
                if (shadows[type].localScale != shadowMin)
                {
                    shadows[type].localScale = Vector3.Lerp(shadows[type].localScale, shadowMin, Time.deltaTime * shadowSpeedToList);

                    if (Mathf.Abs(shadows[type].localScale.x - shadowMin.x) <= 0.1f)
                    {
                        shadows[type].localScale = Vector3.zero;
                        isShadowToList           = false;
                        //进入关卡列表界面
                        // pausePage.SetActive(false);
                        black.alpha = 1.0f;
                        UIMgr.GetInstance().ShowPage(UIPageEnum.LevelList_Page);
                    }
                }
            }
        }
        //if (isShadowSelf)
        //{
        //    if (type != -1)
        //    {
        //        if (shadows[type].localScale != shadowMin)
        //        {
        //            shadows[type].localScale = Vector3.Lerp(shadows[type].localScale, shadowMin, Time.deltaTime * shadowSpeedToList);

        //            if (Mathf.Abs(shadows[type].localScale.x - shadowMin.x) <= 0.1f)
        //            {
        //                shadows[type].localScale = Vector3.zero;
        //                isShadowSelf = false;
        //                //Resume();
        //                uint curLevelID = LevelMgr.GetInstance().GetCurLevelID();
        //                XPlayerPrefs.DelRec(curLevelID);
        //                // pausePage.SetActive(false);
        //                CloseUIPlay();
        //                black.alpha = 1.0f;
        //                UIMgr.ShowPage(UIPageEnum.Tips_Page);
        //                UIMgr.ShowPage_Play(UIPageEnum.Play_Page);
        //            }
        //        }
        //    }
        //}
    }
예제 #17
0
 private void RandomType()
 {
     type = UnityEngine.Random.Range(0, 3);
     XPlayerPrefs.SetInt(shadowType, type);
 }
예제 #18
0
 public void SetFirstLevel()
 {
     XPlayerPrefs.SetInt("curLevel", (int)m_config.Items[0].LevelId);
 }
예제 #19
0
    public void InitAllCalendars()
    {
        calendarList = new List <CalendarTest>();

        int selectedDateTimeInt = XPlayerPrefs.GetInt(ChallengeController.selectedDateTimeStr);

        Debug.Log("selectedDay:" + selectedDateTimeInt);

        if (selectedDateTimeInt != 0)
        {
            currentCalendarDateTime = TimeUtil.getDateTimeByInt(selectedDateTimeInt);
        }
        else
        {
            currentCalendarDateTime = DateTime.Today;

            X.Res.SignInConfig todaySignInConfig = SignInMgr.GetInstance().GetConfigByID((uint)TimeUtil.getIntByDateTime(currentCalendarDateTime));
            if (todaySignInConfig != null && LevelMgr.GetInstance().GetLevelConfig(todaySignInConfig.LevelId).Config != null)
            {
                XPlayerPrefs.SetInt(ChallengeController.selectedDateTimeStr, TimeUtil.getIntByDateTime(currentCalendarDateTime));
            }
            else
            {
                XPlayerPrefs.SetInt(ChallengeController.selectedDateTimeStr, (int)SignInMgr.GetInstance().MaxValidDay);
            }
        }

        selectedDateTimeInt = XPlayerPrefs.GetInt(ChallengeController.selectedDateTimeStr);
        Debug.Log("selectedDay:" + selectedDateTimeInt);



        int calendarCount  = transform.childCount;
        int centerCalendar = calendarCount / 2;
        int offsetMonth    = 0;


        for (int i = centerCalendar; i >= 0; i--)
        {
            Transform    calendarTrans = transform.GetChild(i);
            CalendarTest calendar      = calendarTrans.GetComponent <CalendarTest>();

            calendarList.Add(calendar);

            DateTime calendarDateTime = currentCalendarDateTime.AddMonths(offsetMonth);
            calendar.InitCalendar(calendarDateTime.Month, calendarDateTime.Year);
            offsetMonth--;
        }

        offsetMonth = 1;
        for (int i = centerCalendar + 1; i < calendarCount; i++)
        {
            Transform    calendarTrans = transform.GetChild(i);
            CalendarTest calendar      = calendarTrans.GetComponent <CalendarTest>();

            calendarList.Add(calendar);

            DateTime calendarDateTime = currentCalendarDateTime.AddMonths(offsetMonth);
            calendar.InitCalendar(calendarDateTime.Month, calendarDateTime.Year);
            offsetMonth++;
        }

        currentCalendarDateTime = new DateTime(currentCalendarDateTime.Year, currentCalendarDateTime.Month, 1);
        Debug.Log(currentCalendarDateTime.Year + " " + currentCalendarDateTime.Month + " " + currentCalendarDateTime.Day);
    }