Example #1
0
    // 아군 파티 셋팅
    public void SettingCharacter(UserStageStateData stateData)
    {
        foreach (KeyValuePair <int, UserCharacterStateData> state in stateData.myStateList)
        {
            if (state.Value.charType == CHAR_TYPE.SERVANT)
            {
                DBServantData ServantInfo = CSVData.Inst.GetServantData(state.Value.id);

                character[state.Value.position]      = Instantiate(characterCustom.Create(ServantInfo.job, ServantInfo.head, ServantInfo.hair, ServantInfo.gender, ServantInfo.body), CharacterParent.transform.GetChild(0));
                character[state.Value.position].name = "Servant : " + state.Value.position + " - " + ServantInfo.name;
            }
            else if (state.Value.charType == CHAR_TYPE.MONSTER)
            {
                DBMonsterData MonsterInfo = CSVData.Inst.GetMonsterData(state.Value.id);

                character[state.Value.position]      = Instantiate(Resources.Load("InGameCharacterPrefabs/" + CSVData.Inst.GetMonsterDBResourceModel(state.Value.id)) as GameObject, CharacterParent.transform.GetChild(0));
                character[state.Value.position].name = "Monster : " + state.Value.position + " - " + MonsterInfo.name;
            }
            SettinGrid(state.Value.position);
            character[state.Value.position].AddComponent <CharacterIndex>().index = state.Value.position;
            SettingBoxCollider(character[state.Value.position]);
            animator[state.Value.position] = character[state.Value.position].GetComponent <Animator>();
            character[state.Value.position].AddComponent <BasicAttack>();
            charInfo[state.Value.position] = character[state.Value.position].GetComponent <CharInfo>();
            status[state.Value.position]   = new BattleStatus(stateData.myStateList[state.Value.position], true);
        }

        foreach (KeyValuePair <int, UserCharacterStateData> state in stateData.enemyStateList)
        {
            if (state.Value.charType == CHAR_TYPE.SERVANT)
            {
                DBServantData ServantInfo = CSVData.Inst.GetServantData(state.Value.id);

                character[state.Value.position]      = Instantiate(characterCustom.Create(ServantInfo.job, ServantInfo.head, ServantInfo.hair, ServantInfo.gender, ServantInfo.body), CharacterParent.transform.GetChild(1));
                character[state.Value.position].name = "Servant : " + state.Value.position + " - " + ServantInfo.name;
            }
            else if (state.Value.charType == CHAR_TYPE.MONSTER)
            {
                DBMonsterData MonsterInfo = CSVData.Inst.GetMonsterData(state.Value.id);

                character[state.Value.position]      = Instantiate(Resources.Load("InGameCharacterPrefabs/" + CSVData.Inst.GetMonsterDBResourceModel(state.Value.id)) as GameObject, CharacterParent.transform.GetChild(1));
                character[state.Value.position].name = "Monster : " + state.Value.position + " - " + MonsterInfo.name;
            }
            SettinGrid(state.Value.position);
            character[state.Value.position].AddComponent <CharacterIndex>().index = state.Value.position;
            SettingBoxCollider(character[state.Value.position]);
            animator[state.Value.position] = character[state.Value.position].GetComponent <Animator>();
            character[state.Value.position].AddComponent <BasicAttack>();
            charInfo[state.Value.position] = character[state.Value.position].GetComponent <CharInfo>();
            status[state.Value.position]   = new BattleStatus(stateData.enemyStateList[state.Value.position], false);
        }
    }
Example #2
0
    public void Popup(UserMonsterData result)
    {
        SetActiveButtons(true);

        DBMonsterData monsterData = CSVData.Inst.GetMonsterData(result.id);

        if (monsterData == null)
        {
            DebugLog.Log(false, "Invalid Monster ID : " + result.id);
            return;
        }

        resultName.text     = monsterData.name;
        resultImage.texture = monsterData.monsterIcon.texture;
        gradeImage.texture  = CSVData.Inst.GetSpriteGachaGrade((GRADE_TYPE)result.grade).texture;

        resultStrStat.text = result.status.basicStr.ToString();
        resultIntStat.text = result.status.basicInt.ToString();
        resultDexStat.text = result.status.basicDex.ToString();
    }
    public void OnEnable()
    {
        Sprite xSprite = Resources.Load <Sprite>("UI/Common/exit");

        UserPartyData partyData = UserDataManager.Inst.GetUserPartyInfo();

        if (partyData.partyIndex == 0)
        {
            DebugLog.Log(true, "Invalid User Data");
            return;
        }

        for (int i = 0; i < partyData.formationDataDic.Count; i++)
        {
            if (partyData.formationDataDic.ContainsKey(i) == false)
            {
                continue;
            }

            if (partyData.formationDataDic[i].index == 0)
            {
                GradeImage[i].sprite = CSVData.Inst.GetSpriteGrade(GRADE_TYPE.COMMON);
                IconImage[i].sprite  = xSprite;
                objectInfo[i].SetActive(false);
                continue;
            }

            if (i <= DEFINE.ServantMaxFormationNum)
            {
                UserServantData servantData = UserDataManager.Inst.GetServantInfo(partyData.formationDataDic[i].index);
                if (servantData == null)
                {
                    DebugLog.Log(true, "Invalid Servant Index : " + partyData.formationDataDic[i].index);
                }

                DBServantData dBServantData = CSVData.Inst.GetServantData(servantData.id);
                if (dBServantData == null)
                {
                    DebugLog.Log(true, "Invalid Servant ID : " + servantData.id);
                }

                GradeImage[i].sprite = CSVData.Inst.GetSpriteGrade((GRADE_TYPE)servantData.grade);
                IconImage[i].sprite  = dBServantData.servantIcon;

                imageClass[i].sprite = CSVData.Inst.GetSpriteServantJob(servantData.jobType);
                textLevel[i].text    = servantData.level.ToString();

                if (servantData.level >= DEFINE.MAX_LEVEL)
                {
                    textExpPer[i].text     = "MAX";
                    imageExp[i].fillAmount = 1f;
                }
                else
                {
                    DBExpData dbExpData = CSVData.Inst.GetExpData(servantData.level);
                    if (dbExpData == null)
                    {
                        DebugLog.Log(false, "Invalid Level Data");
                    }
                    else
                    {
                        int exExp = 0;
                        if (servantData.level - 1 > 0)
                        {
                            DBExpData exDBExpData = CSVData.Inst.GetExpData(servantData.level - 1);
                            if (exDBExpData == null)
                            {
                                DebugLog.Log(false, "Invalid Level Data");
                            }
                            else
                            {
                                exExp = exDBExpData.charExp;
                            }
                        }
                        float expPer = (exExp - servantData.exp) / (float)(exExp - dbExpData.charExp);
                        textExpPer[i].text     = (int)(expPer * 100) + "%";
                        imageExp[i].fillAmount = expPer;
                    }
                }

                objectInfo[i].SetActive(true);
            }
            else
            {
                UserMonsterData monsterData = UserDataManager.Inst.GetMonsterInfo(partyData.formationDataDic[i].index);
                if (monsterData == null)
                {
                    DebugLog.Log(true, "Invalid Monster Index : " + partyData.formationDataDic[i].index);
                }

                DBMonsterData dbMonsterData = CSVData.Inst.GetMonsterData(monsterData.id);
                if (dbMonsterData == null)
                {
                    DebugLog.Log(true, "Invalid Monster ID : " + monsterData.id);
                }

                GradeImage[i].sprite = CSVData.Inst.GetSpriteGrade((GRADE_TYPE)monsterData.grade);
                IconImage[i].sprite  = dbMonsterData.monsterIcon;

                imageClass[i].sprite    = CSVData.Inst.GetSmallSpriteTribeType(monsterData.tribeType);
                imageType[i - 5].sprite = CSVData.Inst.GetSpriteElementType(monsterData.elementType);
                textLevel[i].text       = monsterData.level.ToString();

                if (monsterData.level >= DEFINE.MAX_LEVEL)
                {
                    textExpPer[i].text     = "MAX";
                    imageExp[i].fillAmount = 1f;
                }
                else
                {
                    DBExpData dbExpData = CSVData.Inst.GetExpData(monsterData.level);
                    if (dbExpData == null)
                    {
                        DebugLog.Log(false, "Invalid Level Data");
                    }
                    else
                    {
                        int exExp = 0;
                        if (monsterData.level - 1 > 0)
                        {
                            DBExpData exDBExpData = CSVData.Inst.GetExpData(monsterData.level - 1);
                            if (exDBExpData == null)
                            {
                                DebugLog.Log(false, "Invalid Level Data");
                            }
                            else
                            {
                                exExp = exDBExpData.charExp;
                            }
                        }
                        float expPer = (exExp - monsterData.exp) / (float)(exExp - dbExpData.charExp);
                        textExpPer[i].text     = (int)(expPer * 100) + "%";
                        imageExp[i].fillAmount = expPer;
                    }
                }

                objectInfo[i].SetActive(true);
            }
        }
    }
    public void updateMonsterInfo(UserMonsterData m_data)
    {
        //unit_idx = u_idx;

        UserMonsterData unit_data = m_data;// UserDataManager.Inst.GetMonsterInfo(unit_idx);

        if (unit_data == null)
        {
            DebugLog.Log(false, "Invalid Monster data By MonsterInfoManager");
        }
        DBMonsterData db_unit_data = CSVData.Inst.GetMonsterData(unit_data.id);

        if (db_unit_data == null)
        {
            DebugLog.Log(false, "Invalid DB_Monster data By MonsterInfoManager");
        }

        textUnitName.text = db_unit_data.name;
        textLevel.text    = string.Format("{0}", unit_data.level);

        if (unit_data.level >= DEFINE.MAX_LEVEL)
        {
            textExp.text        = "MAX";
            imageExp.fillAmount = 1f;
        }
        else
        {
            DBExpData dbExpData = CSVData.Inst.GetExpData(unit_data.level);
            if (dbExpData == null)
            {
                DebugLog.Log(false, "Invalid Level Data");
            }
            else
            {
                int exExp = 0;
                if (unit_data.level - 1 > 0)
                {
                    DBExpData exDBExpData = CSVData.Inst.GetExpData(unit_data.level - 1);
                    if (exDBExpData == null)
                    {
                        DebugLog.Log(false, "Invalid Level Data");
                    }
                    else
                    {
                        exExp = exDBExpData.charExp;
                    }
                }

                textExp.text        = unit_data.exp + " / " + dbExpData.charExp;
                imageExp.fillAmount = (exExp - unit_data.exp) / (float)(exExp - dbExpData.charExp);
            }
        }


        //textGradeText.text;
        textGrade.text  = string.Format("{0}", unit_data.gradeType);
        textGrade.color = DEFINE.GetGradeColor(unit_data.gradeType);
        //textUpgradeText.text;
        textUpgrade.text = string.Format("+{0}", unit_data.upgrade);
        //textClassText.text;
        imageTribe.sprite = CSVData.Inst.GetSmallSpriteTribeType(db_unit_data.tribeType);
        //textTypeText.text;
        imageType.sprite = CSVData.Inst.GetSpriteElementType(db_unit_data.elementType);

        //textStatsText.text;

        textStr.text = string.Format("{0}", unit_data.status.basicStr);
        textDex.text = string.Format("{0}", unit_data.status.basicDex);
        textInt.text = string.Format("{0}", unit_data.status.basicInt);

        textHP.text      = string.Format("{0}", unit_data.maxHP);
        textAvoid.text   = string.Format("{0}", db_unit_data.avoid);
        textPAtk.text    = string.Format("{0}", unit_data.atk);
        textPDef.text    = string.Format("{0}", unit_data.def);
        textMAtk.text    = string.Format("{0}", unit_data.mAtk);
        textMDef.text    = string.Format("{0}", unit_data.mDef);
        textPCri.text    = string.Format("{0}", unit_data.criDmg);
        textPCriPer.text = string.Format("{0}", unit_data.criPer);

        if (unit_data.passiveSkillList.Count > 0)
        {
            imagePassive.gameObject.SetActive(true);
            imagePassive.sprite = CSVData.Inst.GetSkillPassiveData(unit_data.passiveSkillList[0].id).passiveIcon;
        }
        else
        {
            imagePassive.gameObject.SetActive(false);
        }

        //파티에 등록된 상태인지
        if (unit_data.upgrade >= DEFINE.MAX_MONSTER_UPGRADE_COUNT)
        {
            buttonUpgrade.interactable = false;
            textSetParty.fontSize      = 40;
            textSetParty.text          = "MAX";
        }
        else if (unit_data.partyIndex > 0)
        {
            buttonUpgrade.interactable = false;
            textSetParty.fontSize      = 60;
            textSetParty.text          = "P";
        }
        else
        {
            buttonUpgrade.interactable = true;
            textSetParty.text          = "";
        }
    }