/// <summary>
 /// 清空数据
 /// </summary>
 public void cleanData()
 {
     if (uploadPath != null)
     {
         uploadPath = null;
     }
     if (uploadImage != null)
     {
         uploadImage.color  = new Color(0, 0, 0, 0);
         uploadImage.sprite = null;
     }
     if (inputName != null)
     {
         inputName.text = null;
     }
     if (inputHorizontalNumber != null)
     {
         inputHorizontalNumber.text = null;
     }
     if (inputVerticalNumber != null)
     {
         inputVerticalNumber.text = null;
     }
     if (oldInfoBean != null)
     {
         oldInfoBean = null;
     }
     if (tvHint != null)
     {
         tvHint.text = "";
     }
 }
    /// <summary>
    /// 提交按钮
    /// </summary>
    private void SubmitOnClick()
    {
        if (!CheckData())
        {
            return;
        }
        PuzzlesInfoBean infoBean = new PuzzlesInfoBean();

        infoBean.mark_file_name    = fileName;
        infoBean.horizontal_number = Convert.ToInt32(inputHorizontalNumber.text);
        infoBean.Vertical_number   = Convert.ToInt32(inputVerticalNumber.text);
        string infoStr = JsonUtil.ToJson(infoBean);

        List <string> selectedTags = new List <string>();

        foreach (Toggle item in listTag)
        {
            if (item.isOn)
            {
                selectedTags.Add(item.gameObject.name);
            }
        }
        SteamWorkshopUpdateBean updateData = new SteamWorkshopUpdateBean();

        updateData.title       = inputName.text;
        updateData.description = inputDescription.text;
        updateData.metadata    = infoStr;
        updateData.content     = fileSavePath;
        updateData.preview     = fileNamePath + "_Thumb";
        updateData.tags        = selectedTags;
        loadingBT.gameObject.SetActive(true);
        SteamWorkshopHandle.CreateWorkshopItem(this, updateData, new UpdateCallBack(this));
    }
Exemplo n.º 3
0
    /// <summary>
    /// 初始化数据
    /// </summary>
    private void initData()
    {
        jigsawInfoData = CommonData.SelectPuzzlesInfo.puzzlesInfo;
        if (jigsawInfoData == null)
        {
            LogUtil.log("没有拼图数据");
            return;
        }
        string resFilePath          = jigsawInfoData.Data_file_path + jigsawInfoData.Mark_file_name;
        int    horizontalNumber     = jigsawInfoData.Horizontal_number;
        int    verticalJigsawNumber = jigsawInfoData.Vertical_number;

        if (resFilePath == null)
        {
            LogUtil.log("没有拼图图片路径");
            return;
        }
        if (horizontalNumber == 0 || verticalJigsawNumber == 0)
        {
            LogUtil.log("没有拼图生成数量");
            return;
        }
        Texture2D pic2D;

        if (jigsawInfoData.Data_type.Equals((int)JigsawResourcesEnum.Custom))
        {
            WWW www = ResourcesManager.LoadLocationData(resFilePath);
            pic2D = www.texture;
        }
        else
        {
            pic2D = ResourcesManager.LoadAssetBundlesTexture2DForBytes(resFilePath, jigsawInfoData.Mark_file_name);
        }

        if (pic2D == null)
        {
            LogUtil.log("没有源图片");
            return;
        }
        //生成拼图
        createJigsaw(CommonConfigure.PuzzlesShape, pic2D, horizontalNumber, verticalJigsawNumber);
        //获取图片的高和宽
        if (listJigsawBean != null && listJigsawBean.Count > 0)
        {
            JigsawBean itemJigsawBean = listJigsawBean[0];
            picAllWith = itemJigsawBean.JigsawWith * horizontalNumber;
            picAllHigh = itemJigsawBean.JigsawHigh * verticalJigsawNumber;
        }
        //生成围墙
        createWall(CommonConfigure.BorderShape, CommonConfigure.BorderColor, picAllWith, picAllHigh);
        //生成背景
        createBackground(CommonConfigure.Background, picAllWith, picAllHigh);
        //增加镜头控制
        addCameraControl(picAllWith * CreateGameWallUtil.wallScale / 2f, picAllHigh * CreateGameWallUtil.wallScale / 2f);
        //增加拼图控制
        addJigsawControl(picAllWith * CreateGameWallUtil.wallScale / 2f, picAllHigh * CreateGameWallUtil.wallScale / 2f);
        //启动动画
        startAnim();
    }
Exemplo n.º 4
0
    public static List <PuzzlesGameInfoBean> MergePuzzlesInfo(List <PuzzlesInfoBean> listInfo, List <PuzzlesCompleteStateBean> listCompleteState, List <PuzzlesProgressBean> listProgressInfo)
    {
        List <PuzzlesGameInfoBean> listData = new List <PuzzlesGameInfoBean>();

        if (listInfo == null)
        {
            LogUtil.log("合并拼图数据和完成数据失败-没有原始数据");
            return(listData);
        }
        int listInfoSize = listInfo.Count;

        for (int i = 0; i < listInfoSize; i++)
        {
            PuzzlesGameInfoBean itemData = new PuzzlesGameInfoBean();
            PuzzlesInfoBean     tempInfo = listInfo[i];
            itemData.puzzlesInfo = tempInfo;

            //合并完成状态
            if (listCompleteState != null)
            {
                int listCompleteStateSize = listCompleteState.Count;
                for (int f = 0; f < listCompleteStateSize; f++)
                {
                    PuzzlesCompleteStateBean tempCompleteState = listCompleteState[f];
                    if (tempInfo.data_type.Equals((int)JigsawResourcesEnum.Custom))
                    {
                        if (tempInfo.mark_file_name.Equals(tempCompleteState.puzzleMarkName) && tempInfo.Data_type.Equals(tempCompleteState.puzzleType))
                        {
                            itemData.completeStateInfo = tempCompleteState;
                        }
                    }
                    else
                    {
                        if (tempInfo.Id.Equals(tempCompleteState.puzzleId) && tempInfo.Data_type.Equals(tempCompleteState.puzzleType))
                        {
                            itemData.completeStateInfo = tempCompleteState;
                        }
                    }
                }
            }
            //合并进度信息
            if (listProgressInfo != null)
            {
                int listProgressSize = listProgressInfo.Count;
                for (int f = 0; f < listProgressSize; f++)
                {
                    PuzzlesProgressBean tempProgressInfo = listProgressInfo[f];
                    if (tempInfo.id.Equals(tempProgressInfo.puzzleId) && tempInfo.mark_file_name.Equals(tempProgressInfo.markFileName))
                    {
                        itemData.progressInfo = tempProgressInfo;
                    }
                }
            }
            listData.Add(itemData);
        }
        return(listData);
    }
 /// <summary>
 /// 设置初始化数据
 /// </summary>
 /// <param name="infoBean"></param>
 public void setInitData(PuzzlesInfoBean infoBean)
 {
     this.oldInfoBean           = infoBean;
     inputName.text             = infoBean.Name;
     inputHorizontalNumber.text = infoBean.Horizontal_number + "";
     inputVerticalNumber.text   = infoBean.Vertical_number + "";
     uploadPath = infoBean.Data_file_path + infoBean.Mark_file_name;
     StartCoroutine(ResourcesManager.LoadAsyncLocationImage(uploadPath, uploadImage));
 }
    /// <summary>
    /// 提交数据
    /// </summary>
    public void submitCustomData()
    {
        if (!checkData())
        {
            return;
        }
        SoundUtil.playSoundClip(AudioButtonOnClickEnum.btn_sound_1);

        string          markFileName = SystemUtil.getUUID();
        PuzzlesInfoBean infoBean     = new PuzzlesInfoBean();

        infoBean.id   = -1;
        infoBean.Name = inputName.text;
        infoBean.Horizontal_number = Convert.ToInt32(inputHorizontalNumber.text);
        infoBean.Vertical_number   = Convert.ToInt32(inputVerticalNumber.text);
        infoBean.Level             = 1;
        infoBean.Data_type         = (int)JigsawResourcesEnum.Custom;
        infoBean.Mark_file_name    = markFileName;
        infoBean.Data_file_path    = CommonInfo.Custom_Res_Save_Path + "/";
        FileUtil.CreateDirectory(CommonInfo.Custom_Res_Save_Path);
        FileUtil.CopyFile(uploadPath, CommonInfo.Custom_Res_Save_Path + "/" + markFileName, true);

        List <PuzzlesInfoBean> listInfoData = DataStorageManage.getCustomPuzzlesInfoDSHandle().getAllData();

        if (listInfoData == null)
        {
            listInfoData = new List <PuzzlesInfoBean>();
        }

        listInfoData.Add(infoBean);

        //保存数据
        CustomPuzzlesInfoDSHandle handle = (CustomPuzzlesInfoDSHandle)DataStorageManage.getCustomPuzzlesInfoDSHandle();

        handle.saveAllData(listInfoData);

        jumpSelectUI();
    }
Exemplo n.º 7
0
    /// <summary>
    /// 创建相对应按钮
    /// </summary>
    /// <param name="itemInfo"></param>
    private void createSelectItem(int position, PuzzlesGameInfoBean itemInfo)
    {
        PuzzlesInfoBean          infoBean          = itemInfo.puzzlesInfo;
        PuzzlesCompleteStateBean completeStateBean = itemInfo.completeStateInfo;

        GameObject selectItem;

        if (infoBean.data_type.Equals((int)JigsawResourcesEnum.Custom))
        {
            selectItem = createCustomItem(itemInfo);
        }
        else
        {
            if (completeStateBean == null || completeStateBean.unlockState.Equals(JigsawUnlockEnum.Lock))
            {
                if (infoBean.level == 1)
                {
                    selectItem = createNormalItem(itemInfo);
                }
                else
                {
                    selectItem = createLockItem(position, itemInfo);
                }
            }
            else
            {
                selectItem = createNormalItem(itemInfo);
            }
        }
        //添加动画
        //if(selectItem!=null)
        //{
        //    CanvasGroup itemCG= selectItem.GetComponent<CanvasGroup>();
        //    itemCG.alpha = 0;
        //    itemCG.DOFade(1, 1);
        //}
    }
Exemplo n.º 8
0
    private List <PuzzlesInfoBean> CreateGameInfoListByInstallInfo(List <SteamWorkshopQueryInstallInfoBean> listData)
    {
        List <PuzzlesInfoBean> listInfoData = new List <PuzzlesInfoBean>();

        foreach (SteamWorkshopQueryInstallInfoBean itemData in listData)
        {
            if (CheckUtil.StringIsNull(itemData.metaData))
            {
                continue;
            }
            PuzzlesInfoBean infoData = JsonUtil.FromJson <PuzzlesInfoBean>(itemData.metaData);
            infoData.id   = -1;
            infoData.name = itemData.detailsInfo.m_rgchTitle;
            infoData.introduction_content = itemData.detailsInfo.m_rgchDescription;
            if (!CheckUtil.StringIsNull(itemData.pchFolder))
            {
                infoData.data_file_path = itemData.pchFolder + "\\";
            }
            infoData.data_type       = (int)JigsawResourcesEnum.Custom;
            infoData.thumb_file_path = itemData.previewUrl;
            listInfoData.Add(infoData);
        }
        return(listInfoData);
    }
Exemplo n.º 9
0
    private GameObject CreateInstallItem(PuzzlesGameInfoBean itemInfo)
    {
        PuzzlesInfoBean          infoBean          = itemInfo.puzzlesInfo;
        PuzzlesCompleteStateBean completeStateBean = itemInfo.completeStateInfo;

        itemInfo.completeStateInfo = completeStateBean;
        itemInfo.puzzlesInfo       = infoBean;

        GameObject itemObj = Instantiate(installModel);

        itemObj.transform.parent     = this.transform;
        itemObj.transform.localScale = new Vector3(1f, 1f, 1f);
        itemObj.SetActive(true);

        itemObj.name = infoBean.Mark_file_name;
        itemObj.transform.SetParent(transform);

        //设置背景图片
        Image  backImage = CptUtil.getCptFormParentByName <Transform, Image>(itemObj.transform, "JigsawPic");
        string filePath  = infoBean.thumb_file_path;

        StartCoroutine(ResourcesManager.LoadAsyncHttpImage(filePath, backImage));

        //设置按键
        Button startBT     = CptUtil.getCptFormParentByName <Transform, Button>(itemObj.transform, "JigsawStart");
        Text   startBTText = CptUtil.getCptFormParentByName <Transform, Text>(itemObj.transform, "JigsawStartText");

        if (!CheckUtil.StringIsNull(infoBean.data_file_path))
        {
            startBT.onClick.AddListener(delegate()
            {
                SoundUtil.playSoundClip(AudioButtonOnClickEnum.btn_sound_1);
                CommonData.SelectPuzzlesInfo = itemInfo;
                SceneUtil.jumpGameScene();
            });

            if (itemInfo.progressInfo != null)
            {
                startBTText.text = CommonData.getText(85);
            }
            else
            {
                startBTText.text = CommonData.getText(14);
            }
        }
        else
        {
            startBTText.text = CommonData.getText(130);
        }


        //最好分数
        Transform bestScoreTF = CptUtil.getCptFormParentByName <Transform, Transform>(itemObj.transform, "JigsawBestScore");
        Text      bestScore   = CptUtil.getCptFormParentByName <Transform, Text>(itemObj.transform, "JigsawBestScoreText");

        if (completeStateBean != null && completeStateBean.completeTime != null)
        {
            bestScore.text = GameUtil.GetTimeStr(completeStateBean.completeTime.totalSeconds);
        }
        else
        {
            bestScoreTF.gameObject.SetActive(false);
        }

        //设置文本信息
        Text jigsawNameText = CptUtil.getCptFormParentByName <Transform, Text>(itemObj.transform, "JigsawName");

        jigsawNameText.text = infoBean.Name;
        return(itemObj);
    }
Exemplo n.º 10
0
    public void loadData(PuzzlesInfoBean selectJigsawInfo)
    {
        if (selectJigsawInfo == null)
        {
            return;
        }
        this.selectJigsawInfo = selectJigsawInfo;
        string name = selectJigsawInfo.Name;
        string introductionContent = selectJigsawInfo.Introduction_content;

        string storageArea    = selectJigsawInfo.Storage_area;
        string specifications = selectJigsawInfo.Specifications;
        string timeOfCreation = selectJigsawInfo.Time_creation;
        string workOfCreator  = selectJigsawInfo.Work_creator;

        string moveOfDirector = selectJigsawInfo.Move_director;
        string stars          = selectJigsawInfo.Stars;
        string length         = selectJigsawInfo.Length;
        string releaseDate    = selectJigsawInfo.Release_date;

        string bornAndDeath = selectJigsawInfo.Born_death;
        string country      = selectJigsawInfo.Country;
        string knownFor     = selectJigsawInfo.Known_for;
        string works        = selectJigsawInfo.Works;

        if (name != null && name.Length != 0)
        {
            createTextItem(CommonData.getText(41), name, nameTextSize);
        }
        else
        {
            createTextItem(CommonData.getText(41), CommonData.getText(42), nameTextSize);
        }

        if (workOfCreator != null && workOfCreator.Length != 0)
        {
            createTextItem(CommonData.getText(43), workOfCreator);
        }
        if (storageArea != null && storageArea.Length != 0)
        {
            createTextItem(CommonData.getText(44), storageArea);
        }
        if (specifications != null && specifications.Length != 0)
        {
            createTextItem(CommonData.getText(45), specifications);
        }
        if (timeOfCreation != null && timeOfCreation.Length != 0)
        {
            createTextItem(CommonData.getText(46), timeOfCreation);
        }

        if (moveOfDirector != null && moveOfDirector.Length != 0)
        {
            createTextItem(CommonData.getText(47), moveOfDirector);
        }
        if (stars != null && stars.Length != 0)
        {
            createTextItem(CommonData.getText(48), stars);
        }
        if (length != null && length.Length != 0)
        {
            createTextItem(CommonData.getText(49), length);
        }
        if (releaseDate != null && releaseDate.Length != 0)
        {
            createTextItem(CommonData.getText(50), releaseDate);
        }

        if (knownFor != null && knownFor.Length != 0)
        {
            createTextItem(CommonData.getText(51), knownFor);
        }
        if (bornAndDeath != null && bornAndDeath.Length != 0)
        {
            createTextItem(CommonData.getText(52), bornAndDeath);
        }
        if (country != null && country.Length != 0)
        {
            createTextItem(CommonData.getText(53), country);
        }
        if (works != null && works.Length != 0)
        {
            createTextItem(CommonData.getText(54), works);
        }

        if (introductionContent != null && introductionContent.Length != 0)
        {
            createTextItem(CommonData.getText(55), introductionContent);
        }
    }
Exemplo n.º 11
0
    /// <summary>
    /// 记录完成时间
    /// </summary>
    /// <param name="selectItem"></param>
    /// <param name="completeTime"></param>
    public static void FinshSaveCompleteData(PuzzlesGameInfoBean selectItem, TimeBean completeTime)
    {
        PuzzlesInfoBean          puzzlesInfo       = selectItem.puzzlesInfo;
        PuzzlesCompleteStateBean completeStateBean = selectItem.completeStateInfo;

        if (completeStateBean == null)
        {
            completeStateBean = new PuzzlesCompleteStateBean();
        }
        List <PuzzlesCompleteStateBean> listCompleteState = DataStorageManage.getPuzzlesCompleteDSHandle().getAllData();

        if (listCompleteState == null || listCompleteState.Count == 0)
        {
            listCompleteState                = new List <PuzzlesCompleteStateBean>();
            completeStateBean.puzzleId       = puzzlesInfo.id;
            completeStateBean.puzzleType     = puzzlesInfo.data_type;
            completeStateBean.puzzleName     = puzzlesInfo.name;
            completeStateBean.puzzleMarkName = puzzlesInfo.mark_file_name;
            completeStateBean.completeTime   = completeTime;
            completeStateBean.unlockState    = JigsawUnlockEnum.UnLock;
            listCompleteState.Add(completeStateBean);
        }
        else
        {
            int  listCompleteSize = listCompleteState.Count;
            bool hasData          = false;
            for (int i = 0; i < listCompleteSize; i++)
            {
                PuzzlesCompleteStateBean itemCompleteBean = listCompleteState[i];
                bool isThisPuzzles = false;
                if (itemCompleteBean.puzzleType.Equals((int)JigsawResourcesEnum.Custom))
                {
                    if (itemCompleteBean.puzzleMarkName.Equals(puzzlesInfo.mark_file_name))
                    {
                        isThisPuzzles = true;
                    }
                }
                else
                {
                    if (itemCompleteBean.puzzleId.Equals(puzzlesInfo.Id))
                    {
                        isThisPuzzles = true;
                    }
                }
                if (isThisPuzzles)
                {
                    hasData = true;
                    if (itemCompleteBean.completeTime.totalSeconds != 0 &&
                        !TimeUtil.isFasterTime(itemCompleteBean.completeTime, completeTime))
                    {
                        //存时间更快的
                    }
                    else
                    {
                        itemCompleteBean.puzzleId        = puzzlesInfo.id;
                        itemCompleteBean.puzzleType      = puzzlesInfo.data_type;
                        completeStateBean.puzzleName     = puzzlesInfo.name;
                        completeStateBean.puzzleMarkName = puzzlesInfo.mark_file_name;
                        itemCompleteBean.unlockState     = JigsawUnlockEnum.UnLock;
                        itemCompleteBean.completeTime    = completeTime;
                        completeStateBean = itemCompleteBean;
                    }
                    break;
                }
            }
            if (!hasData)
            {
                completeStateBean.puzzleId       = puzzlesInfo.id;
                completeStateBean.puzzleType     = puzzlesInfo.data_type;
                completeStateBean.puzzleName     = puzzlesInfo.name;
                completeStateBean.puzzleMarkName = puzzlesInfo.mark_file_name;
                completeStateBean.completeTime   = completeTime;
                completeStateBean.unlockState    = JigsawUnlockEnum.UnLock;
                listCompleteState.Add(completeStateBean);
            }
        }
        DataStorageManage.getPuzzlesCompleteDSHandle().saveAllData(listCompleteState);
    }
Exemplo n.º 12
0
    /// <summary>
    /// 创建自定义样式
    /// </summary>
    /// <param name="itemInfo"></param>
    private GameObject createCustomItem(PuzzlesGameInfoBean itemInfo)
    {
        PuzzlesInfoBean          infoBean          = itemInfo.puzzlesInfo;
        PuzzlesCompleteStateBean completeStateBean = itemInfo.completeStateInfo;

        GameObject itemObj = Instantiate(ResourcesManager.LoadData <GameObject>(JigsawSelectCustomItemPath));

        //设置大小
        setItemSize(itemObj);

        itemObj.name = infoBean.Mark_file_name;
        itemObj.transform.SetParent(transform);

        //设置背景图片
        Image  backImage = CptUtil.getCptFormParentByName <Transform, Image>(itemObj.transform, "JigsawPic");
        string filePath  = infoBean.Data_file_path + infoBean.Mark_file_name;

        StartCoroutine(ResourcesManager.LoadAsyncLocationImage(filePath, backImage));

        //设置按键
        Button startBT = CptUtil.getCptFormParentByName <Transform, Button>(itemObj.transform, "JigsawStart");

        startBT.onClick.AddListener(delegate()
        {
            SoundUtil.playSoundClip(AudioButtonOnClickEnum.btn_sound_1);
            CommonData.SelectPuzzlesInfo = itemInfo;
            SceneUtil.jumpGameScene();
        });
        //最好分数
        Transform bestScoreTF = CptUtil.getCptFormParentByName <Transform, Transform>(itemObj.transform, "JigsawBestScore");
        Text      bestScore   = CptUtil.getCptFormParentByName <Transform, Text>(itemObj.transform, "JigsawBestScoreText");

        if (completeStateBean != null && completeStateBean.completeTime != null)
        {
            bestScore.text = GameUtil.GetTimeStr(completeStateBean.completeTime.totalSeconds);
        }
        else
        {
            bestScoreTF.gameObject.SetActive(false);
        }

        //设置文本信息
        Text jigsawNameText = CptUtil.getCptFormParentByName <Transform, Text>(itemObj.transform, "JigsawName");
        Text startBTText    = CptUtil.getCptFormParentByName <Transform, Text>(itemObj.transform, "JigsawStartText");

        if (itemInfo.progressInfo != null)
        {
            startBTText.text = CommonData.getText(85);
        }
        else
        {
            startBTText.text = CommonData.getText(14);
        }


        jigsawNameText.text = infoBean.Name;

        //设置按钮信息
        //编辑按钮
        //Button editBT = CptUtil.getCptFormParentByName<Transform, Button>(itemObj.transform, "JigsawEdit");
        //editBT.onClick.AddListener(delegate ()
        //{
        //    SoundUtil.playSoundClip(AudioButtonOnClickEnum.btn_sound_1);
        //    MenuCustomUpLoadUIControl upLoadUIControl = menuSelectUIControl.mUIMasterControl.getUIByType<MenuCustomUpLoadUIControl>(UIEnum.MenuCustomUpLoadUI);
        //    upLoadUIControl.setInitData(infoBean);
        //    menuSelectUIControl.mUIMasterControl.openUIByTypeAndCloseOther(UIEnum.MenuCustomUpLoadUI);
        //});
        //删除按钮
        Button deleteBT = CptUtil.getCptFormParentByName <Transform, Button>(itemObj.transform, "JigsawDelete");

        deleteBT.onClick.AddListener(delegate()
        {
            SoundUtil.playSoundClip(AudioButtonOnClickEnum.btn_sound_1);
            FileUtil.DeleteFile(filePath);
            CustomPuzzlesInfoDSHandle handle = (CustomPuzzlesInfoDSHandle)DataStorageManage.getCustomPuzzlesInfoDSHandle();
            handle.removeData(infoBean);
            menuSelectUIControl.setJigsawSelectData(JigsawResourcesEnum.Custom);
        });
        return(itemObj);
    }
Exemplo n.º 13
0
    /// <summary>
    /// 创建正常样式
    /// </summary>
    public GameObject createNormalItem(PuzzlesGameInfoBean itemInfo)
    {
        PuzzlesInfoBean          infoBean          = itemInfo.puzzlesInfo;
        PuzzlesCompleteStateBean completeStateBean = itemInfo.completeStateInfo;

        GameObject itemObj = Instantiate(ResourcesManager.LoadData <GameObject>(JigsawSelectItemPath));
        Button     itemBT  = itemObj.GetComponent <Button>();

        //设置大小
        setItemSize(itemObj);

        itemObj.name = infoBean.Mark_file_name;
        itemObj.transform.SetParent(transform);

        //设置背景图片
        Image  backImage = CptUtil.getCptFormParentByName <Transform, Image>(itemObj.transform, "JigsawPic");
        string filePath  = infoBean.Data_file_path + infoBean.Mark_file_name;

        StartCoroutine(ResourcesManager.LoadAsyncDataImage(filePath + "_Thumb", backImage));

        //设置状态
        Text puzzleStatus = CptUtil.getCptFormParentByName <Transform, Text>(itemObj.transform, "JigsawStatus");

        if (completeStateBean == null || completeStateBean.completeTime == null || completeStateBean.completeTime.totalSeconds == 0)
        {
            Material material = new Material(Shader.Find("Custom/Gray"));
            backImage.material = material;
            puzzleStatus.gameObject.SetActive(true);
            puzzleStatus.text = CommonData.getText(32);
        }
        else
        {
            puzzleStatus.gameObject.SetActive(false);
            puzzleStatus.text = CommonData.getText(32);
        }

        //设置按键
        Button startBT = CptUtil.getCptFormParentByName <Transform, Button>(itemObj.transform, "JigsawStart");

        startBT.onClick.AddListener(delegate()
        {
            SoundUtil.playSoundClip(AudioButtonOnClickEnum.btn_sound_1);
            CommonData.SelectPuzzlesInfo = itemInfo;
            SceneUtil.jumpGameScene();
        });
        Button scoreBT = CptUtil.getCptFormParentByName <Transform, Button>(itemObj.transform, "JigsawScore");

        scoreBT.onClick.AddListener(delegate()
        {
            SoundUtil.playSoundClip(AudioButtonOnClickEnum.btn_sound_1);
            DialogManager.createLeaderBoradDialog(1, itemInfo);
        });

        //设置文本信息
        Text jigsawNameText = CptUtil.getCptFormParentByName <Button, Text>(itemBT, "JigsawName");
        Text startBTText    = CptUtil.getCptFormParentByName <Button, Text>(itemBT, "JigsawStartText");
        Text scoreBTText    = CptUtil.getCptFormParentByName <Button, Text>(itemBT, "JigsawScoreText");

        jigsawNameText.text = infoBean.Name;

        scoreBTText.text = CommonData.getText(15);
        if (itemInfo.progressInfo != null)
        {
            startBTText.text = CommonData.getText(85);
        }
        else
        {
            startBTText.text = CommonData.getText(14);
        }
        //设置拼图等级
        setLevel(itemObj, infoBean.level);
        return(itemObj);
    }
Exemplo n.º 14
0
    /// <summary>
    /// 创建未解锁样式
    /// </summary>
    /// <param name="itemInfo"></param>
    private GameObject createLockItem(int position, PuzzlesGameInfoBean itemInfo)
    {
        PuzzlesInfoBean          infoBean          = itemInfo.puzzlesInfo;
        PuzzlesCompleteStateBean completeStateBean = itemInfo.completeStateInfo;

        //解锁点数处理
        if (infoBean.unlock_point == 1)
        {
            infoBean.unlock_point = infoBean.level;
        }

        GameObject itemObj = Instantiate(ResourcesManager.LoadData <GameObject>(JigsawSelectLockItemPath));
        Button     itemBT  = itemObj.GetComponent <Button>();

        //设置大小
        setItemSize(itemObj);

        itemObj.name = infoBean.Mark_file_name;
        itemObj.transform.SetParent(transform);

        //设置按键
        Button unLockBT = CptUtil.getCptFormParentByName <Transform, Button>(itemObj.transform, "JigsawUnLock");

        unLockBT.onClick.AddListener(
            delegate()
        {
            SoundUtil.playSoundClip(AudioButtonOnClickEnum.btn_sound_1);
            long userPoint = DataStorageManage.getUserInfoDSHandle().getData(0).puzzlesPoint;
            if (userPoint < infoBean.unlock_point)
            {
                //如果没有PP则提示不足
                DialogManager.createToastDialog().setToastText(CommonData.getText(16));
            }
            else
            {
                //如果有PP则解锁
                //保存信息
                ((UserInfoDSHandle)DataStorageManage.getUserInfoDSHandle()).decreaseUserPuzzlesPoint(infoBean.unlock_point);
                menuSelectUIControl.refreshPuzzlesPoint();
                //解锁拼图
                if (completeStateBean == null)
                {
                    completeStateBean            = new PuzzlesCompleteStateBean();
                    completeStateBean.puzzleId   = infoBean.id;
                    completeStateBean.puzzleType = infoBean.data_type;
                }
                completeStateBean.unlockState = JigsawUnlockEnum.UnLock;
                DataStorageManage.getPuzzlesCompleteDSHandle().saveData(completeStateBean);
                //menuSelectUIControl.refreshJigsawSelectData();
                menuSelectUIControl.refreshItemJigsawSelectData(position, itemObj, itemInfo);
                //解锁成功动画
                string filePath = infoBean.Data_file_path + infoBean.Mark_file_name;
                DialogManager.createUnlockPuzzlesDialog(infoBean.name, infoBean.mark_file_name, filePath);
            }
        });
        //设置文本信息
        Text jigsawUnLockText = CptUtil.getCptFormParentByName <Button, Text>(itemBT, "JigsawUnLockText");

        jigsawUnLockText.text = CommonData.getText(13) + "( " + infoBean.unlock_point + "PP )";

        //设置拼图等级
        setLevel(itemObj, infoBean.level);
        return(itemObj);
    }