示例#1
0
        private void SwitchCharacterImage(TextInfo textInfo)
        {
            /*Debug.Log(string.Format("{0}: {1} {2} {3}", textInfo.Name, textInfo.Dialogue, textInfo.Face, textInfo.Sound));*/
            switch (textInfo.Name)
            {
            case "메테스":
                switch (textInfo.Face)
                {
                case "놀람":
                    BgImg.gameObject.GetComponent <Image>().sprite =
                        Resources.Load <Sprite>("dialogueImg/metes/surprise-right");
                    break;

                case "슬픔":
                    BgImg.gameObject.GetComponent <Image>().sprite =
                        Resources.Load <Sprite>("dialogueImg/metes/sad-right");
                    break;

                case "웃음":
                    BgImg.gameObject.GetComponent <Image>().sprite =
                        Resources.Load <Sprite>("dialogueImg/metes/laugh-right");
                    break;

                case "화남":
                    BgImg.gameObject.GetComponent <Image>().sprite =
                        Resources.Load <Sprite>("dialogueImg/metes/angry-right");
                    break;

                default:     // 메인 혹은 기타
                    BgImg.gameObject.GetComponent <Image>().sprite =
                        Resources.Load <Sprite>("dialogueImg/metes/default-right");
                    break;
                }

                break;

            case "민":
            case "??? (민)":
                switch (textInfo.Face)
                {
                case "놀람":
                    BgImg.gameObject.GetComponent <Image>().sprite =
                        Resources.Load <Sprite>("dialogueImg/min/surprise-right");
                    break;

                case "슬픔":
                    BgImg.gameObject.GetComponent <Image>().sprite =
                        Resources.Load <Sprite>("dialogueImg/min/sad-right");
                    break;

                case "웃음":
                    BgImg.gameObject.GetComponent <Image>().sprite =
                        Resources.Load <Sprite>("dialogueImg/min/laugh-right");
                    break;

                case "화남":
                    BgImg.gameObject.GetComponent <Image>().sprite =
                        Resources.Load <Sprite>("dialogueImg/min/angry-right");
                    break;

                default:     // 메인 혹은 기타
                    BgImg.gameObject.GetComponent <Image>().sprite =
                        Resources.Load <Sprite>("dialogueImg/min/default-right");
                    break;
                }

                break;

            case "피터":
                switch (textInfo.Face)
                {
                case "놀람":
                    BgImg.gameObject.GetComponent <Image>().sprite =
                        Resources.Load <Sprite>("dialogueImg/peter/surprise-right");
                    break;

                case "슬픔":
                    BgImg.gameObject.GetComponent <Image>().sprite =
                        Resources.Load <Sprite>("dialogueImg/peter/sad-right");
                    break;

                case "웃음":
                    BgImg.gameObject.GetComponent <Image>().sprite =
                        Resources.Load <Sprite>("dialogueImg/peter/laugh-right");
                    break;

                case "화남":
                    BgImg.gameObject.GetComponent <Image>().sprite =
                        Resources.Load <Sprite>("dialogueImg/peter/angry-right");
                    break;

                default:     // 메인 혹은 기타
                    BgImg.gameObject.GetComponent <Image>().sprite =
                        Resources.Load <Sprite>("dialogueImg/peter/default-right");
                    break;
                }

                break;

            case "유노":
            case "??? (유노)":
                // TODO : 유노 기본 이미지 이외에 표정 이미지가 나오면 분기문 작성할 것
                BgImg.gameObject.GetComponent <Image>().sprite =
                    Resources.Load <Sprite>("dialogueImg/uno/default-right");
                break;

            case "아나":
            case "??? (아나)":
                // TODO : 아나 기본 이미지 이외에 표정 이미지가 나오면 분기문 작성할 것
                BgImg.gameObject.GetComponent <Image>().sprite =
                    Resources.Load <Sprite>("dialogueImg/ana/default-right");
                break;

            case "이르":
                // TODO : 이르 정식 이미지가 나오면 임시 이미지에서 교체할 것
                BgImg.gameObject.GetComponent <Image>().sprite =
                    Resources.Load <Sprite>("dialogueImg/ire/default-right");
                break;

            case "네퓨스":
                // TODO : 네퓨스 정식 이미지가 나오면 임시 이미지에서 교체할 것
                BgImg.gameObject.GetComponent <Image>().sprite =
                    Resources.Load <Sprite>("dialogueImg/nefus/default-right");
                break;

            case "나레이션":
                BgImg.gameObject.GetComponent <Image>().sprite = Resources.Load <Sprite>("dialogueImg/none");
                break;

            case "알림창":
                TextDisplayer.gameObject.SetActive(false);
                Notify.Text = textInfo.Dialogue;
                return;

            default:
                BgImg.gameObject.GetComponent <Image>().sprite = Resources.Load <Sprite>("dialogueImg/tmp");
                break;
            }
        }
示例#2
0
        private void ReadDataFile(string fileName, Fileinfo fileType)
        {
            var txtFile  = (TextAsset)Resources.Load(fileName);
            var lineList = txtFile.text.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None);

            var lineListLen = lineList.Length;

            var formerSceneName = "";
            var formerIndex     = 0;

            for (var i = 0; i < lineListLen; i++)
            {
                var wordList = lineList[i].Split('\t');
                int index;

                switch (fileType)
                {
                case Fileinfo.Combinetable:
                    var material1 = Convert.ToInt32(wordList[0]);
                    var material2 = Convert.ToInt32(wordList[1]);
                    var resultNum = Convert.ToInt32(wordList[2]);

                    Tuple <int, int> tuple;

                    if (material1 != material2)
                    {
                        tuple             = new Tuple <int, int>(material2, material1);
                        CombineDic[tuple] = new List <int>();

                        for (var j = 0; j < resultNum; j++)
                        {
                            CombineDic[tuple].Add(Convert.ToInt32(wordList[3 + j]));
                        }
                    }

                    tuple             = new Tuple <int, int>(material1, material2);
                    CombineDic[tuple] = new List <int>();

                    for (var j = 0; j < resultNum; j++)
                    {
                        CombineDic[tuple].Add(Convert.ToInt32(wordList[3 + j]));
                    }

                    break;

                case Fileinfo.Itemtable:
                    index = Convert.ToInt32(wordList[0]);
                    var group     = wordList[2];
                    var sellPrice = Convert.ToInt32(wordList[4]);

                    switch (group)
                    {
                    case "별":         // 별
                        StarNum++;
                        break;

                    case "재료":         // 재료
                        MaterialNum++;
                        break;

                    case "아이템":         // 아이템
                        CombineNum++;
                        break;

                    case "기타":         // 기타
                        EtcNum++;
                        break;
                    }

                    // 인덱스, 이름, 분류, 등급, 판매 가격, 설명, 이미지 경로
                    FindItemDic[index] = new ItemInfo(index, wordList[1], group, wordList[3], sellPrice,
                                                      wordList[5], "itemImg/item_" + index);

                    break;

                case Fileinfo.Setitemtable:
                    var setItemInfo = new SetItemInfo(Convert.ToInt32(wordList[0]), Convert.ToInt32(wordList[1]),
                                                      Convert.ToInt32(wordList[2]), Convert.ToInt32(wordList[3]), Convert.ToInt32(wordList[4]));

                    SetCombineList.Add(setItemInfo);

                    break;

                case Fileinfo.Questtable:
                    index = Convert.ToInt32(wordList[0]);


                    var dialogueStart = Convert.ToInt32(wordList[2]);
                    var dialogueEnd   = Convert.ToInt32(wordList[3]);
                    var termsNum      = Convert.ToInt32(wordList[6]);
                    var rewardNum     = Convert.ToInt32(wordList[19]);

                    FindQuestDic[index] = new QuestInfo(index, wordList[1], dialogueStart, dialogueEnd, wordList[4],
                                                        wordList[5]);

                    for (var arrIdx = 0; arrIdx < termsNum; arrIdx++)
                    {
                        FindQuestDic[index].SetTermsDic(Convert.ToInt32(wordList[7 + 2 * arrIdx]),
                                                        Convert.ToInt32(wordList[8 + 2 * arrIdx]));
                    }

                    for (var arrIdx = 0; arrIdx < rewardNum; arrIdx++)
                    {
                        FindQuestDic[index].SetRewardDic(Convert.ToInt32(wordList[20 + 2 * arrIdx]),
                                                         Convert.ToInt32(wordList[21 + 2 * arrIdx]));
                    }

                    /*Debug.Log(wordList[4]);*/

                    if (wordList[1] != formerSceneName)     // 씬의 첫 퀘스트의 인덱스 구하기
                    {
                        FirstQuestsOfScene.Add(index);
                        if (formerSceneName != "")
                        {
                            LastQuestsOfScene.Add(formerIndex);
                        }
                        formerSceneName = wordList[1];
                    }

                    if (i == lineListLen - 1)     //마지막 인덱스 집어넣기
                    {
                        LastQuestsOfScene.Add(index);
                    }
                    formerIndex = index;
                    break;

                case Fileinfo.Upgradetable:
                    index = Convert.ToInt32(wordList[0]);
                    var         len = (wordList.Length - 2) / 2; // wordList의 앞 두 개는 각각 이름과 설명이므로 -2, 그리고 (효과,값)쌍이므로 /2
                    UpgradeInfo upInfo;
                    upInfo.Index = index;
                    upInfo.Name  = wordList[1];

                    upInfo.Value = new int[len];
                    upInfo.Cost  = new int[len];

                    for (var j = 0; j < len; j++)
                    {
                        var value = Convert.ToInt32(wordList[2 * j + 2]);
                        var cost  = Convert.ToInt32(wordList[2 * j + 3]);
                        upInfo.Value[j] = value;
                        upInfo.Cost[j]  = cost;
                    }

                    FindUpDic[index] = upInfo;
                    break;

                case Fileinfo.Dialoguetable:
                    index = Convert.ToInt32(wordList[0]);

                    // wordList[1] : name, wordList[2] : dialogue, wordList[3] : face, wordList[4] : sound
                    //Debug.Log(String.Format("{0} {1}: {2} {3} + {4}",index, wordList[1], wordList[2], wordList[3], wordList[4])); 메테스가 민 대사 말하는 현상 수정용
                    DialogueDic[index] = new TextInfo(wordList[1], wordList[2], wordList[3], wordList[4]);
                    break;

                default:
                    throw new ArgumentOutOfRangeException("fileType", fileType, null);
                }
            }
        }