Exemple #1
0
    /// <summary>
    /// 读取拼图进度
    /// </summary>
    /// <param name="content"></param>
    /// <param name="progressBean"></param>
    public static void setGameProgress(BaseMonoBehaviour content, PuzzlesProgressBean progressBean)
    {
        JigsawContainerCpt[] cptList = UnityEngine.Object.FindObjectsOfType <JigsawContainerCpt>();
        if (cptList == null || cptList.Length == 0)
        {
            return;
        }

        List <PuzzlesProgressItemBean> progress = progressBean.progress;

        foreach (PuzzlesProgressItemBean itemProgress in progress)
        {
            JigsawContainerCpt tempCpt = null;

            //其次需要合并的子对象
            List <JigsawContainerCpt> tempListCpt = new List <JigsawContainerCpt>();
            foreach (JigsawContainerCpt itemCpt in cptList)
            {
                //首先获取父对象
                if (itemCpt.listJigsaw[0].MarkLocation == itemProgress.markPostion)
                {
                    tempCpt = itemCpt;
                }

                foreach (Vector2 listPuzzleItem in itemProgress.listPuzzles)
                {
                    if (listPuzzleItem == itemCpt.listJigsaw[0].MarkLocation)
                    {
                        tempListCpt.Add(itemCpt);
                    }
                }
            }
            JigsawContainerCpt[] tempArraryCpt = DevUtil.listToArray(tempListCpt);
            if (tempCpt != null)
            {
                //设置不可在拖拽
                CommonData.IsDargMove = false;
                content.StartCoroutine(delayComplete(content, tempArraryCpt, tempCpt, 1f));
            }
        }
    }