void SettleNowInvenItem(E_Monster mob, E_Evidence evidence)
    {
        for (int i = 0; i < nowInven.Count; i++)
        {
            if (nowInven[i].qpm.IsIt(mob, evidence))
            {
                nowInven[i].qpm.number++;
                nowInven[i].numText.text = nowInven[i].qpm.number.ToString();
                return;
            }
        }
        QuestPerMob qpm = new QuestPerMob(mob, evidence, 1);

        GameObject temp = Instantiate(itemBtn);
        Text       numText;

        SetItemBtnCtx(temp, qpm, out numText);

        QCItem qc = new QCItem(temp, numText, qpm);

        nowInven.Add(qc);
        Button btn = temp.GetComponent <Button>();

        btn.onClick.AddListener(
            () =>
        {
            AudioThing.GetInstance().PlaySFX(AudioThing.E_SFX.CLICK);
            OnClickQCInven(qc);
        }
            );

        temp.transform.SetParent(nowInvenContents.transform);
    }
 void SetItemBtnCtx(GameObject btn, QuestPerMob qpm)
 {
     btn.transform.GetChild(0).GetComponent <Image>().sprite = SpriteManager.GetInstance().GetColoredEvidenceSprite(qpm.mob, qpm.evidence); //qpm 에 맞춰서 넣어주기.
     btn.transform.GetChild(1).GetComponent <Text>().text    = MobEviInfoManager.GetInstance().GetMobName(qpm.mob);
     btn.transform.GetChild(2).GetComponent <Text>().text    = MobEviInfoManager.GetInstance().GetEvidenceName(qpm.evidence);
     btn.transform.GetChild(3).GetComponent <Text>().text    = qpm.number.ToString();
 }
Exemplo n.º 3
0
 void SetTxtsItem(QuestPerMob qpm, GameObject btn)   //텍스트세팅.
 {
     btn.transform.GetChild(0).GetComponent <Image>().sprite = SpriteManager.GetInstance().GetColoredEvidenceSprite(qpm.mob, qpm.evidence);
     btn.transform.GetChild(1).GetComponent <Text>().text    = MobEviInfoManager.GetInstance().GetMobName(qpm.mob);
     btn.transform.GetChild(2).GetComponent <Text>().text    = MobEviInfoManager.GetInstance().GetEvidenceName(qpm.evidence);
     btn.transform.GetChild(3).GetComponent <Text>().text    = qpm.number.ToString();
 }
Exemplo n.º 4
0
 void SetTxtsOnEviOne(QuestPerMob qpm, GameObject eviOne)
 {
     eviOne.transform.GetChild(1).GetComponent <Image>().sprite = SpriteManager.GetInstance().GetColoredEvidenceSprite(qpm.mob, qpm.evidence);
     eviOne.transform.GetChild(2).GetComponent <Text>().text    = MobEviInfoManager.GetInstance().GetMobName(qpm.mob);
     eviOne.transform.GetChild(3).GetComponent <Text>().text    = MobEviInfoManager.GetInstance().GetEvidenceName(qpm.evidence);
     eviOne.transform.GetChild(4).GetComponent <Text>().text    = qpm.number.ToString();
 }
Exemplo n.º 5
0
    public void OnClickSell()
    {
        if (selected == null)
        {
            Debug.LogError("판매 오류!");
        }

        List <QuestPerMob> temp = new List <QuestPerMob>();

        QuestPerMob qpm = new QuestPerMob(
            msBtnDic[(int)selected].mob,
            msBtnDic[(int)selected].evidence,
            sellNumber
            );

        temp.Add(qpm);

        Inventory.GetInstance().MinusMobEviItem(temp);

        GoldManager.GetInstance().AdjustGold((msBtnDic[(int)selected].price * sellNumber), GoldManager.E_PayType.SELL_TO_MERCHANT);

        HideTab();
        ShowTab();
        //인벤토리에서 빼주고고.
        //골드 까주고.
    }
Exemplo n.º 6
0
    public string GetNormalClientQuestSay(E_ClientState sayNum, List <QuestPerMob> list)
    {
        // Debug.Log("겟노말클라이언트퀘스트세이" + CharactorFrame.GetInstance().clientIdea.CharaName);
        string result = "";

        for (int i = 0; i < list.Count; i++)
        {
            QuestPerMob qpm = list[i];

            int    idx   = (((int)E_Evidence.MAX) * ((int)qpm.mob)) + (int)qpm.evidence;
            string basic = "";

            switch (LanguageManager.GetInstance().Language)
            {
            case E_Language.KOREAN:
                switch (sayNum)
                {
                case E_ClientState.COMMISSION_SAY_1:
                    basic = clientSayNormal.dataArray[idx].Say1kor;

                    break;

                case E_ClientState.COMMISSION_SAY_2:
                    basic = clientSayNormal.dataArray[idx].Say2kor;

                    break;

                case E_ClientState.COMMISSION_SAY_3:
                    basic = clientSayNormal.dataArray[idx].Say3kor;

                    break;
                }
                break;

            case E_Language.ENGLISH:
                switch (sayNum)
                {
                case E_ClientState.COMMISSION_SAY_1:
                    basic = clientSayNormal.dataArray[idx].Say1eng;

                    break;

                case E_ClientState.COMMISSION_SAY_2:
                    basic = clientSayNormal.dataArray[idx].Say2eng;

                    break;

                case E_ClientState.COMMISSION_SAY_3:
                    basic = clientSayNormal.dataArray[idx].Say3eng;

                    break;
                }
                break;
            }

            result += basic.Replace("[0]", qpm.number.ToString()) + " ";
        }
        return(result);
    }
Exemplo n.º 7
0
    public void AddMobEvi(QuestPerMob qpm)
    {
        string key = Inventory.GetMobEviKey(qpm);

        if (mobEvidenceInven.ContainsKey(key))
        {
            mobEvidenceInven[key] += qpm.number;
            return;
        }
        mobEvidenceInven.Add(key, qpm.number);
    }
Exemplo n.º 8
0
 public void AdjustMobEviItemNumber(QuestPerMob qpm, int number) //아예 이 넘버로 수정하라는 얘기
                                                                 //이 넘버 만큼 빼는 함수가 아님!!
                                                                 //그런데 있던 애들 중에서만 불려와줘야함
                                                                 //추가가 절대 아님!!!!
 {
     if (number <= 0)
     {
         mobEvidenceInven.Remove(Inventory.GetMobEviKey(qpm));
         return;
     }
     mobEvidenceInven[Inventory.GetMobEviKey(qpm)] = number;
 }
Exemplo n.º 9
0
    public static void AddQPM(this List <QuestPerMob> qpmlist, QuestPerMob qpm)
    {
        if (qpmlist == null || qpm == null)
        {
            return;
        }

        for (int j = 0; j < qpmlist.Count; j++)
        {
            if (qpmlist[j].IsIt(qpm.mob, qpm.evidence))
            {
                qpmlist[j].number += qpm.number;
                return;
            }
        }
        qpmlist.Add(new QuestPerMob(qpm.mob, qpm.evidence, qpm.number));
    }
Exemplo n.º 10
0
    public void SettleSelectItem(E_Monster mob, E_Evidence evidence)  //셀렉티드 아이템이 만들어지는 곳.
    {
        QuestPerMob qpm = new QuestPerMob(mob, evidence, 1);

        if (selectedItem == null)
        {
            selectedItem = new List <QCItem>();
        }
        for (int i = 0; i < selectedItem.Count; i++)
        {
            if (selectedItem[i].qpm.IsIt(mob, evidence))
            {
                selectedItem[i].qpm.number++;
                selectedItem[i].numText.text = selectedItem[i].qpm.number.ToString();
                return;
            }
        }

        //새로 만들 차례
        GameObject temp = Instantiate(itemBtn);
        Text       numText;

        SetItemBtnCtx(temp, qpm, out numText);
        QCItem qc = new QCItem(temp, numText, qpm);

        selectedItem.Add(qc);

        Button btn = temp.GetComponent <Button>();

        btn.onClick.AddListener(
            () =>
        {
            AudioThing.GetInstance().PlaySFX(AudioThing.E_SFX.CLICK);
            OnClickQCSelected(qc);
        }
            );


        temp.transform.SetParent(nowSelectedContents.transform);
    }
Exemplo n.º 11
0
 public QCItem(GameObject g, Text t, QuestPerMob q)
 {
     go = g; numText = t; qpm = q;
 }
Exemplo n.º 12
0
    List <QuestPerMob> HuntCompactOrder(List <QuestPerMob> orderedQuestList, float capTillTonight)
    {
        if (huntedList == null)
        {
            Debug.LogError("사냥하던 리스트가 없음.");
        }

        //큰거 부터 잡되 안 되면 다음 놈으로 넘어가서 또 잡는 거.

        float usedCap = 0;

        for (int i = 0; i < huntedList.Count; i++)
        {
            usedCap += huntedList[i].GetWeight();
        }

        float tonightHuntingCap = capTillTonight - usedCap; //실제 오늘 사용할 수 있는 능력치.

        if (tonightHuntingCap <= 0)
        {
            return(null);
        }


        List <QuestPerMob> tonightHunt = new List <QuestPerMob>();    //오늘 잡을 애들 리스트

        var bo = from qpm in orderedQuestList
                 orderby qpm.GetMobEviTypeWeight() descending
                 select qpm;

        List <QuestPerMob> bigOrderedList = bo.ToList <QuestPerMob>();//가중치가 큰 애들 순서로 리스트를 맹긂

        bool matchedByHuntedAlready = false;

        for (int i = 0; i < bigOrderedList.Count; i++)
        {
            matchedByHuntedAlready = false;

            QuestPerMob bigOne   = bigOrderedList[i];
            E_Monster   mob      = bigOne.mob;
            E_Evidence  evidence = bigOne.evidence;

            float bigOneWeightForOne = bigOne.GetMobEviTypeWeight(); //지금 선택된 놈을 한 번 잡는데 소요되는 능력치.

            if (tonightHuntingCap < bigOneWeightForOne)              //제일 큰 놈을 하나 잡을 여유도 없으면.
            {
                continue;                                            //다음놈을 잡을 기회
            }


            for (int j = 0; j < huntedList.Count; j++)         //잡고 있던 녀석인지 체크 컴팩트 오더 경우 어떻게든 다음 빅 원으로 넘어가는 것.
            {
                if (huntedList[j].IsIt(mob, evidence))         //이미 잡고 있는 혹은 잡은 종류라면.
                {
                    if (huntedList[j].number >= bigOne.number) //다 잡은 종류라면.
                    {
                        matchedByHuntedAlready = true;
                        break;
                    }
                    else //잡다가 말은 경우라면.
                    {
                        int remainNum = bigOne.number - huntedList[j].number;
                        while (remainNum > 0)
                        {
                            tonightHunt.AddMobEviOnce(mob, evidence);
                            remainNum--;
                            tonightHuntingCap -= bigOneWeightForOne;
                            if (tonightHuntingCap < bigOneWeightForOne && remainNum > 0)//더 못잡는데 아직 남아있음.
                            {
                                matchedByHuntedAlready = true;
                                break;
                            }
                        }
                        matchedByHuntedAlready = true;  //뭐가 됐든 할 수 있는 한은 다 한것.
                    }
                }
            }

            if (matchedByHuntedAlready)
            {
                continue;                           //이미 잡던 놈이라, 처리가 끝남.
            }
            //잡고 있던 애가 아니라면

            int remainNumOfNewOne = bigOne.number;
            while (remainNumOfNewOne > 0)
            {
                tonightHunt.AddMobEviOnce(mob, evidence);
                remainNumOfNewOne--;
                tonightHuntingCap -= bigOneWeightForOne;
                if (tonightHuntingCap < bigOneWeightForOne && remainNumOfNewOne > 0) //더 못잡는데 아직 남아있음.
                {
                    break;                                                           //다음 빅 원으로 넘어감.
                }
            }
        }
        return(tonightHunt);
    }
Exemplo n.º 13
0
 public void AddQuestMob(QuestPerMob QPM) //있나 체크하고 넣기.
 {
     questList.AddQPM(QPM);
 }
Exemplo n.º 14
0
    void Init()
    {
        HunterIdea hunter = CharactorFrame.GetInstance().hunterIdea;

        Debug.Log("헌터 리워드, 원래 헌터." + hunter.HuntedList.DebugString());

        List <QuestPerMob> huntingOutcome;
        var hol = from ho in hunter.HuntedList
                  orderby(int) ho.mob
                  select ho;

        huntingOutcome = hol.ToList <QuestPerMob>();

        for (int i = 0; i < huntingOutcome.Count; i++)
        {
            QuestPerMob qpm  = huntingOutcome[i];
            GameObject  temp = Instantiate(itemBtn, hunterBringContent.transform);
            SetTxtsItem(qpm, temp);
        }
        List <QuestPerMob> writtenQuestList = QuestManager.GetInstance().GetQuest(
            hunter.associatedQuestKey
            ).QuestList;

        var wql = from wq in writtenQuestList
                  orderby(int) wq.mob
                  select wq;

        writtenQuestList = wql.ToList <QuestPerMob>();

        for (int i = 0; i < writtenQuestList.Count; i++)
        {
            QuestPerMob qpm  = writtenQuestList[i];
            GameObject  temp = Instantiate(itemBtn, writtenQuestContent.transform);
            SetTxtsItem(qpm, temp);
        }
        completeness = QuestManager.GetInstance().GetQuest(hunter.associatedQuestKey).GetCompleteness
                           (hunter.HuntedList);

        hunterName.text       = hunter.CharaName;
        completenessText.text = completeness.ToString();

        if (completeness <= 50)
        {
            completenessText.color = Color.red;
        }
        else if (completeness < 80)
        {
            completenessText.color = Color.yellow;
        }
        else
        {
            completenessText.color = Color.green;
        }


        allPayGolds = PayFormula.CalculateHuntLastPayment(QuestManager.GetInstance().GetQuest(
                                                              hunter.associatedQuestKey
                                                              ),
                                                          hunter.GetHunterExpireGap(),
                                                          hunter.HuntedList, E_RewardType.ALL_PAYMENT);

        partialPayGolds = PayFormula.CalculateHuntLastPayment(QuestManager.GetInstance().GetQuest(
                                                                  hunter.associatedQuestKey),
                                                              hunter.GetHunterExpireGap()
                                                              , hunter.HuntedList, E_RewardType.PARTIAL_PAYMENT);

        //지불 금액 텍스트 표시.
        allPaymentText.text = allPayGolds.ToString() + " " + paymentTxt;

        if (completeness < 100 && completeness > 0)
        {
            partialPaymentText.text = partialPayGolds.ToString() + " " + paymentTxt;
        }
        else
        {
            partialBtn.interactable = false;
            partialPaymentText.text = "";
        }

        denyPaymentText.text = "0 " + paymentTxt;
    }
Exemplo n.º 15
0
    List <QuestPerMob> HuntBigOrder(List <QuestPerMob> orderedQuestList, float capTillTonight)
    {
        if (huntedList == null)
        {
            Debug.LogError("사냥하던 리스트가 없음.");
        }

        float usedCap = 0;

        for (int i = 0; i < huntedList.Count; i++)
        {
            usedCap += huntedList[i].GetWeight();
        }

        float tonightHuntingCap = capTillTonight - usedCap; //실제 오늘 사용할 수 있는 능력치.

        if (tonightHuntingCap <= 0)
        {
            return(null);
        }


        List <QuestPerMob> tonightHunt = new List <QuestPerMob>();    //오늘 잡을 애들 리스트

        var bo = from qpm in orderedQuestList
                 orderby qpm.GetMobEviTypeWeight() descending
                 select qpm;

        List <QuestPerMob> bigOrderedList = bo.ToList <QuestPerMob>();//가중치가 큰 애들 순서로 리스트를 맹긂

        Debug.Log("빅오더 정렬 리스트 = " + bigOrderedList.DebugString());

        bool matchedByHuntedAlready = false;

        for (int i = 0; i < bigOrderedList.Count; i++)
        {
            matchedByHuntedAlready = false;

            QuestPerMob bigOne   = bigOrderedList[i];
            E_Monster   mob      = bigOne.mob;
            E_Evidence  evidence = bigOne.evidence;

            float bigOneWeightForOne = bigOne.GetMobEviTypeWeight(); //지금 선택된 놈을 한 번 잡는데 소요되는 능력치.

            if (tonightHuntingCap < bigOneWeightForOne)              //제일 큰 놈을 하나 잡을 여유도 없으면.
            {
                return(tonightHunt);
            }

            for (int j = 0; j < huntedList.Count; j++)         //잡고 있던 녀석인지 체크
            {
                if (huntedList[j].IsIt(mob, evidence))         //이미 잡고 있는 혹은 잡은 종류라면.
                {
                    if (huntedList[j].number >= bigOne.number) //다 잡은 종류라면.
                    {
                        matchedByHuntedAlready = true;
                        break;
                    }
                    else //잡다가 말은 경우라면.
                    {
                        int remainNum = bigOne.number - huntedList[j].number;
                        while (remainNum > 0)
                        {
                            tonightHunt.AddMobEviOnce(mob, evidence);
                            remainNum--;
                            tonightHuntingCap -= bigOneWeightForOne;
                            if (tonightHuntingCap < bigOneWeightForOne && remainNum > 0)//더 못잡는데 아직 남아있으면 쫑
                            {
                                return(tonightHunt);
                            }
                        }
                        matchedByHuntedAlready = true;  //다 잡았다.
                    }
                }
            }

            if (matchedByHuntedAlready)
            {
                continue;                           //다 잡았던 놈이라면
            }
            //잡고 있던 애가 아니라면

            int remainNumOfNewOne = bigOne.number;
            while (remainNumOfNewOne > 0)
            {
                tonightHunt.AddMobEviOnce(mob, evidence);
                remainNumOfNewOne--;
                tonightHuntingCap -= bigOneWeightForOne;
                if (tonightHuntingCap < bigOneWeightForOne && remainNumOfNewOne > 0)//더 못잡는데 아직 남아있으면 쫑
                {
                    return(tonightHunt);
                }
            }

            //새로운 애도 다 잡아버린 경우.
        }
        return(tonightHunt);
    }
Exemplo n.º 16
0
    public static QuestPerMob MakeQPMByInvenKey(string key, int number)
    {
        string[] splitted = key.Split('/');
        if (splitted.Length != 2)
        {
            Debug.LogError("키 qpm 변환 실패");
        }

        E_Monster  mob      = E_Monster.GOBLIN;
        E_Evidence evidence = E_Evidence.FINGER;

        switch (splitted[0])
        {
        case "0":
            mob = (E_Monster)0;
            break;

        case "1":
            mob = (E_Monster)1;
            break;

        case "2":
            mob = (E_Monster)2;
            break;

        case "3":
            mob = (E_Monster)3;
            break;

        case "4":
            mob = (E_Monster)4;
            break;

        case "5":
            mob = (E_Monster)5;
            break;

        case "6":
            mob = (E_Monster)6;
            break;

        case "7":
            mob = (E_Monster)7;
            break;

        default:
            Debug.LogError("키 오류");
            break;
        }
        switch (splitted[1])
        {
        case "0":
            evidence = (E_Evidence)0;
            break;

        case "1":
            evidence = (E_Evidence)1;
            break;

        case "2":
            evidence = (E_Evidence)2;
            break;

        case "3":
            evidence = (E_Evidence)3;
            break;

        default:
            Debug.LogError("키 오류");
            break;
        }
        QuestPerMob qpm = new QuestPerMob(mob, evidence, number);

        return(qpm);
    }
Exemplo n.º 17
0
 public static string GetMobEviKey(QuestPerMob qpm)
 {
     return(((int)qpm.mob).ToString() + "/" + ((int)qpm.evidence).ToString());
 }
Exemplo n.º 18
0
    public void AddQuestMob(E_Monster mob, E_Evidence evidence, int number) //있나 체크하고 넣기.
    {
        QuestPerMob qpm = new QuestPerMob(mob, evidence, number);

        AddQuestMob(qpm);
    }