Ejemplo n.º 1
0
    void ContentSet()
    {
        stageChartInfos = StageGroupChart.instance.GetStageGroupCharts();
        content.GetComponent <RectTransform>().sizeDelta = new Vector2(0, contextHeightX * stageChartInfos.Length);
        GameObject pripab;

        for (int i = 0; i < stageChartInfos.Length; i++)
        {
            pripab = Instantiate(stagePripab, Vector3.zero, Quaternion.identity, content);
            pripab.transform.Find("Image").GetComponent <Image>().sprite = stageChartInfos[i].Image;
            pripab.transform.Find("타이틀").GetComponent <Text>().text      = TextChart.instance.GetText(stageChartInfos[i].stageName);
            pripab.transform.Find("타이틀").GetComponent <Text>().font      = TextChart.instance.GetFont();
            pripab.transform.Find("타이틀").GetComponent <Text>().fontStyle = TextChart.instance.GetFontStyle();
            pripab.transform.Find("설명").GetComponent <Text>().text       = TextChart.instance.GetText(stageChartInfos[i].Desc);
            pripab.transform.Find("설명").GetComponent <Text>().font       = TextChart.instance.GetFont();
            pripab.transform.Find("설명").GetComponent <Text>().fontStyle  = TextChart.instance.GetFontStyle();



            int   stageGroupInCount = StageChart.instance.StegeGroupInCount(i + 1);
            float maxStarCount      = stageGroupInCount * 3;
            float userStarCount     = 0;
            List <UserStageInfo> tempUserStageList = UserInfo.instance.UserStageGroupInfo(i + 1);
            for (int j = 0; j < tempUserStageList.Count; j++)
            {
                userStarCount += tempUserStageList[j].starCount;
            }
            pripab.transform.Find("fore").GetComponent <Image>().fillAmount      = userStarCount / maxStarCount;
            pripab.transform.Find("fore").GetChild(0).GetComponent <Text>().text = ((int)(userStarCount / maxStarCount * 100)) + "%";

            int siblingIndex = i + 1;
            pripab.GetComponent <Button>().onClick.RemoveAllListeners();

            if (stageChartInfos[i].OpenStageId != 0 && UserInfo.instance.GetUserStageInfo(stageChartInfos[i].OpenStageId) == null)
            {
                StageChartInfo stageChartInfo = StageChart.instance.GetStageChartInfo(stageChartInfos[i].OpenStageId);
                pripab.transform.Find("잠금").gameObject.SetActive(true);
                pripab.transform.Find("잠금").Find("Text").GetComponent <Text>().text = stageChartInfo.StageGroupId + "-" + stageChartInfo.StageGroupInId + " 클리어 시 해제";
            }
            else
            {
                pripab.transform.Find("잠금").gameObject.SetActive(false);

                pripab.GetComponent <Button>().onClick.AddListener(() => {
                    if (Tutorial02Manager.instance.tutorialFlag && Tutorial02Manager.instance.stage01Flag != siblingIndex - 1)
                    {
                        return;
                    }
                    StagePripab02Open(stageGroupInCount, siblingIndex);
                });
            }
        }
        content.GetComponent <VerticalLayoutGroup>().enabled = false;
        content.GetComponent <VerticalLayoutGroup>().enabled = true;
    }
Ejemplo n.º 2
0
    public void LoadChart(System.Action loadAction)
    {
        BackendAsyncClass.BackendAsync(Backend.Chart.GetChartContents, field, (backendCallback) => {
            JsonData jsonData = backendCallback.GetReturnValuetoJSON()["rows"];
            stageChartInfos   = new StageChartInfo[jsonData.Count];

            for (int i = 0; i < jsonData.Count; i++)
            {
                stageChartInfos[i] = new StageChartInfo();

                JsonData rowData = jsonData[i];
                if (rowData["StageId"]["S"].ToString() != "null")
                {
                    stageChartInfos[i].StageId = int.Parse(rowData["StageId"]["S"].ToString());
                }
                if (rowData["StageGroupId"]["S"].ToString() != "null")
                {
                    stageChartInfos[i].StageGroupId = int.Parse(rowData["StageGroupId"]["S"].ToString());
                }
                if (rowData["StageGroupInId"]["S"].ToString() != "null")
                {
                    stageChartInfos[i].StageGroupInId = int.Parse(rowData["StageGroupInId"]["S"].ToString());
                }
                if (rowData["PrevStageId"]["S"].ToString() != "null")
                {
                    stageChartInfos[i].PrevStageId = int.Parse(rowData["PrevStageId"]["S"].ToString());
                }
                if (rowData["ConditionCharacterID"]["S"].ToString() != "null")
                {
                    stageChartInfos[i].ConditionCharacterID = (CharacterType)int.Parse(rowData["ConditionCharacterID"]["S"].ToString());
                }
                if (rowData["ConditionCharacterGrade"]["S"].ToString() != "null")
                {
                    stageChartInfos[i].ConditionCharacterGrade = (GradeType)int.Parse(rowData["ConditionCharacterGrade"]["S"].ToString());
                }
                if (rowData["ConditionStarCount"]["S"].ToString() != "null")
                {
                    stageChartInfos[i].ConditionStarCount = int.Parse(rowData["ConditionStarCount"]["S"].ToString());
                }
                if (rowData["StarCondition"]["S"].ToString() != "null")
                {
                    stageChartInfos[i].StarCondition = rowData["StarCondition"]["S"].ToString().Split('-');
                }
                string[] tempStarRewardType = rowData["StarRewardType"]["S"].ToString().Split('-');
                string [] tempRewardId      = rowData["RewardId"]["S"].ToString().Split('-');
                string[] tempRewardCount    = rowData["RewardCount"]["S"].ToString().Split('-');
                if (rowData["StarRewardType"]["S"].ToString() != "null")
                {
                    stageChartInfos[i].StarRewardType = new RewardType[tempStarRewardType.Length];
                }
                if (rowData["RewardId"]["S"].ToString() != "null")
                {
                    stageChartInfos[i].RewardId = new int[tempStarRewardType.Length];
                }
                if (rowData["RewardCount"]["S"].ToString() != "null")
                {
                    stageChartInfos[i].RewardCount = new int[tempStarRewardType.Length];
                }
                for (int j = 0; j < stageChartInfos[i].StarRewardType.Length; j++)
                {
                    stageChartInfos[i].StarRewardType[j] = (RewardType)int.Parse(tempStarRewardType[j]);
                    stageChartInfos[i].RewardId[j]       = int.Parse(tempRewardId[j]);
                    stageChartInfos[i].RewardCount[j]    = int.Parse(tempRewardCount[j]);
                }

                string[] tempClearRewardType  = rowData["ClearRewardType"]["S"].ToString().Split('-');
                string[] tempClearRewardId    = rowData["ClearRewardId"]["S"].ToString().Split('-');
                string[] tempClearRewardCount = rowData["ClearRewardCount"]["S"].ToString().Split('-');
                if (rowData["ClearRewardType"]["S"].ToString() != "null")
                {
                    stageChartInfos[i].ClearRewardType = new RewardType[tempClearRewardType.Length];
                }
                if (rowData["ClearRewardId"]["S"].ToString() != "null")
                {
                    stageChartInfos[i].ClearRewardId = new int[tempClearRewardId.Length];
                }
                if (rowData["ClearRewardCount"]["S"].ToString() != "null")
                {
                    stageChartInfos[i].ClearRewardCount = new int[tempClearRewardCount.Length];
                }
                for (int j = 0; j < stageChartInfos[i].ClearRewardType.Length; j++)
                {
                    stageChartInfos[i].ClearRewardType[j]  = (RewardType)int.Parse(tempClearRewardType[j]);
                    stageChartInfos[i].ClearRewardId[j]    = int.Parse(tempClearRewardId[j]);
                    stageChartInfos[i].ClearRewardCount[j] = int.Parse(tempClearRewardCount[j]);
                }
                if (rowData["CharacterGroupId"]["S"].ToString() != "null")
                {
                    stageChartInfos[i].CharacterType = (CharacterType)int.Parse(rowData["CharacterGroupId"]["S"].ToString());
                }
                if (rowData["PrologueId"]["S"].ToString() != "null")
                {
                    stageChartInfos[i].PrologueId = int.Parse(rowData["PrologueId"]["S"].ToString());
                }
                if (rowData["EpilogueId"]["S"].ToString() != "null")
                {
                    stageChartInfos[i].EpilogueId = int.Parse(rowData["EpilogueId"]["S"].ToString());
                }
                if (rowData["RecipeId"]["S"].ToString() != "null")
                {
                    stageChartInfos[i].RecipeId = int.Parse(rowData["RecipeId"]["S"].ToString());
                }
                if (rowData["NumberOfFood"]["S"].ToString() != "null")
                {
                    stageChartInfos[i].NumberOfFood = int.Parse(rowData["NumberOfFood"]["S"].ToString());
                }
                if (rowData["TimeLimit"]["S"].ToString() != "null")
                {
                    stageChartInfos[i].TimeLimit = int.Parse(rowData["TimeLimit"]["S"].ToString());
                }
                if (rowData["GuideImage"]["S"].ToString() != "null")
                {
                    stageChartInfos[i].GuideImage = stageGuideSpriteAtlas.GetSprite(rowData["GuideImage"]["S"].ToString());
                }
            }
            if (loadAction != null)
            {
                loadAction();
            }
        });
    }