コード例 #1
0
ファイル: UIPlay.cs プロジェクト: wuhuolong/MaxBooks
    IEnumerator Guiding()
    {
        yield return(new WaitForSeconds(0.15f));

        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   = 127;
                generalPanelUI.SettlePuzzleFunc(newSettlePuzzle);
                Debug.Log("init");
                mask.SetActive(true);
                shaderViewer.Init(2, 0);
            }
        }
    }
コード例 #2
0
 public void SetLevelId(uint levelId, bool isregen = false)
 {
     //判断当前关卡有没有存档
     if (isregen)
     {
         Recorder rec = XPlayerPrefs.GetRec(levelId);
         m_recoder = rec;
     }
     else
     {
         m_recoder         = new Recorder();
         m_recoder.LevelId = levelId;
     }
 }
コード例 #3
0
    public IEnumerator InitPuzzleContainPanel(bool isregen = false)
    {
        yield return(new WaitForFixedUpdate());

        //TODO:如果有存档,就根据存档把拼图加进去
        if (isregen)
        {
            uint     curLevelID = LevelMgr.GetInstance().CurLevelID;
            Recorder rec        = XPlayerPrefs.GetRec(curLevelID);

            List <SettlePuzzle> settlePuzzleList = rec.settlePuzzleList;

            Debug.Log("settlePuzzleList length:" + settlePuzzleList.Count);
            foreach (SettlePuzzle settlePuzzle in settlePuzzleList)
            {
                SettlePuzzleFunc(settlePuzzle);
            }
        }
    }
コード例 #4
0
    public void InitGeneralPanelData(bool isReGen = false)
    {
        //将数据读入,获得面板的长度和宽度(两个方向的格子数量),以及将面板基础格子的信息保存进一个一维int数组
        //FINISH:读入数据,获取面板的宽度和长度
        uint curLevelID = LevelMgr.GetInstance().CurLevelID;
        //Debug.Log("id = " + curLevelID);
        LevelData curLevelData = LevelMgr.GetInstance().GetLevelConfig(curLevelID);

        //插入逻辑判断是否有存档,有的话就直接读取,返回
        if (isReGen)
        {
            Recorder rec = XPlayerPrefs.GetRec(curLevelID);
            pwidth  = curLevelData.Map.MapWidth + 2;
            pheight = curLevelData.Map.MapHeight + 2;

            //保存数据进一个一维int数组
            playout = MatrixUtil.ArrayCopy(rec.layout);
        }
        else if (curLevelData == null || curLevelData.Map == null || curLevelID == 0)
        {
            Debug.Log("Sim");
            //!模拟读入长宽
            pwidth  = 15;
            pheight = 15;

            //!模拟读入一个一维数组
            playout = new int[] {
                1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
                1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
                1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1,
                1, 1, 1, 2, 1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 1,
                1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
                1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
                1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
                1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
                1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
                1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
                1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
                1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
                1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
                1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
                1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
            };
        }
        else
        {
            pwidth  = curLevelData.Map.MapWidth + 2;
            pheight = curLevelData.Map.MapHeight + 2;

            //保存数据进一个一维int数组
            int[] tempLayout = curLevelData.Map.MapArray;
            playout = new int[pwidth * pheight];

            // FINISH:扩充int数组的边界
            // UPDATE
            for (int i = 0; i < playout.Length; ++i)
            {
                int x = i % (pwidth);
                int y = i / (pwidth);
                if (x != 0 && x != pwidth - 1 && y != 0 && y != pheight - 1)
                {
                    playout[y * (pwidth) + x] = tempLayout[(y - 1) * (pwidth - 2) + (x - 1)];
                }
                else
                {
                    playout[y * (pwidth) + x] = (int)GridType.Non;
                }
            }
            // pwidth = curLevelData.Map.MapWidth;
            // pheight = curLevelData.Map.MapHeight;
            // playout = MatrixUtil.ArrayCopy(curLevelData.Map.MapArray);
        }
    }
コード例 #5
0
ファイル: UIPlay.cs プロジェクト: wuhuolong/MaxBooks
    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);
        //            }
        //        }
        //    }
        //}
    }