Пример #1
0
    private void Awake()
    {
        WarriorCharacterMeshList[0].frame = GameObject.Find("WarriorFrame")?.transform.GetChild(1).GetChild(0).GetChild(0);
        WarriorCharacterMeshList[1].frame = GameObject.Find("WarriorFrame")?.transform.GetChild(0).GetChild(0).GetChild(0);
        WarriorCharacterMeshList[2].frame = GameObject.Find("WarriorFrame")?.transform.GetChild(1).GetChild(1).GetChild(0);
        WarriorCharacterMeshList[3].frame = GameObject.Find("WarriorFrame")?.transform.GetChild(0).GetChild(1).GetChild(0);

        ArcherCharacterMeshList[0].frame = GameObject.Find("ArcherFrame")?.transform.GetChild(1).GetChild(0).GetChild(0);
        ArcherCharacterMeshList[1].frame = GameObject.Find("ArcherFrame")?.transform.GetChild(0).GetChild(0).GetChild(0);
        ArcherCharacterMeshList[2].frame = GameObject.Find("ArcherFrame")?.transform.GetChild(1).GetChild(1).GetChild(0);
        ArcherCharacterMeshList[3].frame = GameObject.Find("ArcherFrame")?.transform.GetChild(0).GetChild(1).GetChild(0);

        TheifCharacterMeshList[0].frame = GameObject.Find("TheifFrame")?.transform.GetChild(1).GetChild(0).GetChild(0);
        TheifCharacterMeshList[1].frame = GameObject.Find("TheifFrame")?.transform.GetChild(0).GetChild(0).GetChild(0);
        TheifCharacterMeshList[2].frame = GameObject.Find("TheifFrame")?.transform.GetChild(1).GetChild(1).GetChild(0);
        TheifCharacterMeshList[3].frame = GameObject.Find("TheifFrame")?.transform.GetChild(0).GetChild(1).GetChild(0);

        MagicianCharacterMeshList[0].frame = GameObject.Find("MagicianFrame")?.transform.GetChild(1).GetChild(0).GetChild(0);
        MagicianCharacterMeshList[1].frame = GameObject.Find("MagicianFrame")?.transform.GetChild(0).GetChild(0).GetChild(0);
        MagicianCharacterMeshList[2].frame = GameObject.Find("MagicianFrame")?.transform.GetChild(1).GetChild(1).GetChild(0);
        MagicianCharacterMeshList[3].frame = GameObject.Find("MagicianFrame")?.transform.GetChild(0).GetChild(1).GetChild(0);

        ClericCharacterMeshList[0].frame = GameObject.Find("ClericFrame")?.transform.GetChild(1).GetChild(0).GetChild(0);
        ClericCharacterMeshList[1].frame = GameObject.Find("ClericFrame")?.transform.GetChild(0).GetChild(0).GetChild(0);
        ClericCharacterMeshList[2].frame = GameObject.Find("ClericFrame")?.transform.GetChild(1).GetChild(1).GetChild(0);
        ClericCharacterMeshList[3].frame = GameObject.Find("ClericFrame")?.transform.GetChild(0).GetChild(1).GetChild(0);

        WhiteHandCharacterMeshList[0].frame = GameObject.Find("WhiteHandFrame")?.transform.GetChild(1).GetChild(0).GetChild(0);
        WhiteHandCharacterMeshList[1].frame = GameObject.Find("WhiteHandFrame")?.transform.GetChild(0).GetChild(0).GetChild(0);
        WhiteHandCharacterMeshList[2].frame = GameObject.Find("WhiteHandFrame")?.transform.GetChild(1).GetChild(1).GetChild(0);
        WhiteHandCharacterMeshList[3].frame = GameObject.Find("WhiteHandFrame")?.transform.GetChild(0).GetChild(1).GetChild(0);

        characterInformation[0] = new CharacterInfo(0.65f, 1.0f, 1.5f, 1.0f);
        characterInformation[1] = new CharacterInfo(0.9f, 1.0f, 1.5f, 0.7f);
        characterInformation[2] = new CharacterInfo(0.9f, 1.0f, 1.5f, 0.7f);
        characterInformation[3] = new CharacterInfo(0.9f, 1.0f, 1.5f, 0.6f);
        characterInformation[4] = new CharacterInfo(2.0f, 0.46f, 1.5f, 0.0f);
        characterInformation[5] = new CharacterInfo(0.8f, 0.46f, 1.5f, 0.0f);

        if (SceneManager.GetActiveScene().name == "Lobby")
        {
            if (UserDataManager.Inst.GetMainCharInfo() != null)
            {
                if (UserDataManager.Inst.GetMainCharInfo().mainCharType == CHAR_TYPE.SERVANT)
                {
                    DBServantData servantData = CSVData.Inst.GetServantData(UserDataManager.Inst.GetMainCharInfo().mainCharID);
                    jobIndex   = servantData.job;
                    headIndex  = servantData.head;
                    hairIndex  = servantData.hair;
                    isMan      = servantData.gender;
                    isChildren = servantData.body;
                }
            }
        }

        Refresh();
    }
    void setData()
    {
        EquipmentList.Clear();

        if (partyInfo.getSelectedEquipType() == EQUIPMENT_TYPE.MAX)
        {
            DebugLog.Log(false, "Invalid Equipment type 'MAX'");
            return;
        }
        selectedEquipType = partyInfo.getSelectedEquipType();


        UserServantData servantData   = partyInfo.ServantList[partyInfo.selected_unit_idx];
        DBServantData   dbServantData = CSVData.Inst.GetServantData(servantData.id);

        for (int i = 0; i < UserDataManager.Inst.GetEquipmentList().Count; i++)
        {
            UserEquipmentData equipmentData   = UserDataManager.Inst.GetEquipmentList()[i];
            DBEquipmentData   dbEquipmentData = CSVData.Inst.GetEquipmentData(equipmentData.id);

            // 장착 가능 레벨 검사
            bool enable_equip_level = true;
            if (dbEquipmentData.tier == 2)
            {
                if (servantData.level <= 10)
                {
                    enable_equip_level = false;
                }
            }
            else if (dbEquipmentData.tier == 3)
            {
                if (servantData.level <= 20)
                {
                    enable_equip_level = false;
                }
            }
            else if (dbEquipmentData.tier == 4)
            {
                if (servantData.level <= 30)
                {
                    enable_equip_level = false;
                }
            }

            //선택된 파츠, 선택중인 서번트 직업, 장착가능한 레벨, 다른 서번트가 장착한 장비 , 장착할수 있는 상태인 장비
            if (equipmentData.equipmentType == selectedEquipType && equipmentData.isEquiped == false &&
                dbEquipmentData.isEquipAble(dbServantData.GetJobFlag) && enable_equip_level &&
                equipmentData.equipServantIndex == 0 && equipmentData.state == 1)
            {
                EquipmentList.Add(equipmentData);
            }
        }
    }
Пример #3
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);
        }
    }
Пример #4
0
    public void Popup(UserServantData result)
    {
        SetActiveButtons(true);

        DBServantData servantData = CSVData.Inst.GetServantData(result.id);

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

        resultName.text     = servantData.name;
        resultImage.texture = servantData.servantIcon.texture;
        gradeImage.texture  = CSVData.Inst.GetSpriteGachaGrade(servantData.grade).texture;

        resultStrStat.text = result.status.basicStr.ToString();
        resultIntStat.text = result.status.basicInt.ToString();
        resultDexStat.text = result.status.basicDex.ToString();
    }
    public void SetChangeAllValue()
    {
        UserServantData servantData = partyInfo.ServantList[partyInfo.selected_unit_idx];

        if (servantData == null)
        {
            DebugLog.Log(false, "Invalid Select Index : " + partyInfo.ServantList[partyInfo.selected_unit_idx]);
            return;
        }

        DBServantData dBServantData = CSVData.Inst.GetServantData(servantData.id);

        if (dBServantData == null)
        {
            DebugLog.Log(false, "Invalid Servant ID : " + servantData.id);
            return;
        }

        servant_stat_equip_current_item = Calculator.GetServantStatsEquipAllItem(servantData);

        textStr.text = string.Format("{0}", servant_stat_equip_current_item[(int)EQUIPMENT_OPTION_TYPE.STR] + SetChangeValue(textStrChange, EQUIPMENT_OPTION_TYPE.STR));
        textDex.text = string.Format("{0}", servant_stat_equip_current_item[(int)EQUIPMENT_OPTION_TYPE.DEX] + SetChangeValue(textDexChange, EQUIPMENT_OPTION_TYPE.DEX));
        textInt.text = string.Format("{0}", servant_stat_equip_current_item[(int)EQUIPMENT_OPTION_TYPE.INT] + SetChangeValue(textIntChange, EQUIPMENT_OPTION_TYPE.INT));

        textHp.text    = string.Format("{0}", servant_stat_equip_current_item[(int)EQUIPMENT_OPTION_TYPE.HP] + SetChangeValue(textHpChange, EQUIPMENT_OPTION_TYPE.HP));
        textAvoid.text = string.Format("{0}", dBServantData.avoid);

        textPAtk.text = string.Format("{0}", servant_stat_equip_current_item[(int)EQUIPMENT_OPTION_TYPE.ATK] + SetChangeValue(textPAtkChange, EQUIPMENT_OPTION_TYPE.ATK));
        textPDef.text = string.Format("{0}", servant_stat_equip_current_item[(int)EQUIPMENT_OPTION_TYPE.DEF] + SetChangeValue(textPDefChange, EQUIPMENT_OPTION_TYPE.DEF));
        textMAtk.text = string.Format("{0}", servant_stat_equip_current_item[(int)EQUIPMENT_OPTION_TYPE.MATK] + SetChangeValue(textMAtkChange, EQUIPMENT_OPTION_TYPE.MATK));
        textMDef.text = string.Format("{0}", servant_stat_equip_current_item[(int)EQUIPMENT_OPTION_TYPE.MDEF] + SetChangeValue(textMDefChange, EQUIPMENT_OPTION_TYPE.MDEF));

        textPCri.text = string.Format("{0}", servant_stat_equip_current_item[(int)EQUIPMENT_OPTION_TYPE.CriDmg]);
        //textPCriChange.text = string.Format("{0}", Calculator.GetCriticalDamage(current_status_equip_item, 0));
        textPCriPer.text = string.Format("{0}", servant_stat_equip_current_item[(int)EQUIPMENT_OPTION_TYPE.CriPer]);
        //textPCriPerChange.text = string.Format("{0}", Calculator.GetCriticalPercent(current_status_equip_item, 0));
    }
Пример #6
0
    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 updateServantInfo(UserServantData s_data)
    {
        //unit_idx = u_idx;
        for (int i = 0; i < buttonEquip.Length; i++)
        {
            buttonEquip[i].gameObject.SetActive(false);
        }
        for (int i = 0; i < 3; i++)
        {
            buttonEquip[i].gameObject.SetActive(true);
        }

        UserServantData unit_data = s_data;// UserDataManager.Inst.GetServantInfo(unit_idx);

        if (unit_data == null)
        {
            DebugLog.Log(false, "Invalid Servant data By ServantInfoManager");
        }
        DBServantData db_unit_data = CSVData.Inst.GetServantData(unit_data.id);

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

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


        for (EQUIPMENT_TYPE type = EQUIPMENT_TYPE.WEAPON; type < EQUIPMENT_TYPE.MAX; type++)
        {
            if (unit_data.equipmentDic[type] != 0)
            {
                UserEquipmentData equip_info = UserDataManager.Inst.GetEquipmentInfo(unit_data.equipmentDic[type]);
                if (equip_info == null)
                {
                    DebugLog.Log(true, "Invalid Index : " + unit_data.equipmentDic[type]);
                    return;
                }

                buttonEquip[(int)type].image.sprite = CSVData.Inst.GetSpriteGrade((GRADE_TYPE)equip_info.grade);
                buttonEquip[(int)type].transform.GetChild(0).GetComponent <Image>().enabled = false;
                buttonEquip[(int)type].transform.GetChild(1).GetComponent <Image>().enabled = true;
                buttonEquip[(int)type].transform.GetChild(1).GetComponent <Image>().sprite  = CSVData.Inst.GetEquipmentData(equip_info.id).equipmentIcon;
            }
            else
            {
                buttonEquip[(int)type].image.sprite = spriteEmptySlot;
                buttonEquip[(int)type].transform.GetChild(0).GetComponent <Image>().enabled = true;
                buttonEquip[(int)type].transform.GetChild(1).GetComponent <Image>().enabled = false;
            }
        }

        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);
        //textJobText.text;
        imagejob.sprite = CSVData.Inst.GetSpriteServantJob(unit_data.jobType);
        //textStatsText.text;

        int[] stat_by_set_equipment = Calculator.GetServantStatsEquipAllItem(unit_data);

        textStr.text = string.Format("{0}", stat_by_set_equipment[(int)EQUIPMENT_OPTION_TYPE.STR]);
        textDex.text = string.Format("{0}", stat_by_set_equipment[(int)EQUIPMENT_OPTION_TYPE.DEX]);
        textInt.text = string.Format("{0}", stat_by_set_equipment[(int)EQUIPMENT_OPTION_TYPE.INT]);

        textHP.text      = string.Format("{0}", stat_by_set_equipment[(int)EQUIPMENT_OPTION_TYPE.HP]);
        textAvoid.text   = string.Format("{0}", db_unit_data.avoid);
        textPAtk.text    = string.Format("{0}", stat_by_set_equipment[(int)EQUIPMENT_OPTION_TYPE.ATK]);
        textPDef.text    = string.Format("{0}", stat_by_set_equipment[(int)EQUIPMENT_OPTION_TYPE.DEF]);
        textMAtk.text    = string.Format("{0}", stat_by_set_equipment[(int)EQUIPMENT_OPTION_TYPE.MATK]);
        textMDef.text    = string.Format("{0}", stat_by_set_equipment[(int)EQUIPMENT_OPTION_TYPE.MDEF]);
        textPCri.text    = string.Format("{0}", stat_by_set_equipment[(int)EQUIPMENT_OPTION_TYPE.CriDmg]);
        textPCriPer.text = string.Format("{0}", stat_by_set_equipment[(int)EQUIPMENT_OPTION_TYPE.CriPer]);

        /*
         * 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);
         * textSpeed.text = string.Format("{0}", db_unit_data.speed);
         * 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.activeSkillList.Count > 0)
        {
            imageActive.gameObject.SetActive(true);
            imageActive.sprite = CSVData.Inst.GetSkillActiveData(unit_data.activeSkillList[0].id).activeIcon;
        }
        else
        {
            imageActive.gameObject.SetActive(false);
        }

        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);
        }
    }
    public void OnClickChange()
    {
        // 선택 서번트 인덱스
        int servantIndex = partyInfo.ServantList[partyInfo.selected_unit_idx].index;

        int equipmentIndex = EquipmentList[selectedItemIdx].index;

        // 서번트 인덱스 검사
        UserServantData servantData = UserDataManager.Inst.GetServantInfo(servantIndex);

        if (servantData == null)
        {
            DebugLog.Log(true, "Invalid Servant Index : " + servantIndex);
            SimpleErrorPopupVC.Inst.UpdateErrorText("Invalid Servant Index");
            return;
        }

        // 장비 타입 검사
        if (servantData.equipmentDic.ContainsKey(selectedEquipType) == false)
        {
            DebugLog.Log(true, "Invalid Servant Data");
            SimpleErrorPopupVC.Inst.UpdateErrorText("Invalid Servant Data");
            return;
        }

        // 서번트 동일 장비 검사
        if (servantData.equipmentDic[selectedEquipType] == equipmentIndex)
        {
            DebugLog.Log(false, "Already Equiped");
            SimpleErrorPopupVC.Inst.UpdateErrorText("Already Equiped");
            return;
        }

        // 장비 인덱스 검사
        UserEquipmentData equipmentData = UserDataManager.Inst.GetEquipmentInfo(equipmentIndex);

        if (equipmentData == null)
        {
            DebugLog.Log(true, "Invalid Equipment Index : " + equipmentIndex);
            SimpleErrorPopupVC.Inst.UpdateErrorText("Invalid Equipment");
            return;
        }

        // 장비 인덱스에 대한 타입 검사
        if (equipmentData.equipmentType != selectedEquipType)
        {
            DebugLog.Log(false, "Invalid Equipment Type : " + selectedEquipType.ToString() + ", ");
            SimpleErrorPopupVC.Inst.UpdateErrorText("Invalid Equipment Type");
            return;
        }

        // 장착중인 장비인지 검사
        if (equipmentData.isEquiped == true)
        {
            DebugLog.Log(false, "Already ServantEquiped : " + equipmentData.equipServantIndex);
            SimpleErrorPopupVC.Inst.UpdateErrorText("Already Servant Equiped");
            return;
        }

        // DB 장비 ID 검사
        DBEquipmentData dbEquipmentData = CSVData.Inst.GetEquipmentData(equipmentData.id);

        if (dbEquipmentData == null)
        {
            DebugLog.Log(false, "Invalid Equipment Data ID : " + equipmentData.id);
            return;
        }

        // DB 서번트 ID 검사
        DBServantData dbServantData = CSVData.Inst.GetServantData(servantData.id);

        if (dbServantData == null)
        {
            DebugLog.Log(false, "Invalid Servant Data ID : " + servantData.id);
            return;
        }

        // 장착 가능 직업 검사
        if (dbEquipmentData.isEquipAble(dbServantData.GetJobFlag) == false)
        {
            DebugLog.Log(false, "Invalid Servant Equipable Job : " + dbServantData.GetJobFlag + ", Need Job : " + dbEquipmentData.jobLimit);
            SimpleErrorPopupVC.Inst.UpdateErrorText("Invalid Servant Equipable Job");
            return;
        }

        // 장착 가능 레벨 검사
        if (dbEquipmentData.tier == 2)
        {
            if (servantData.level <= 10)
            {
                DebugLog.Log(false, "Invalid Servant Equipable Level : " + servantData.level + ", Need Level : 11");
                SimpleErrorPopupVC.Inst.UpdateErrorText("Invalid Servant Equipable Level, Need Level : 11");
                return;
            }
        }
        else if (dbEquipmentData.tier == 3)
        {
            if (servantData.level <= 20)
            {
                DebugLog.Log(false, "Invalid Servant Equipable Level : " + servantData.level + ", Need Level : 21");
                SimpleErrorPopupVC.Inst.UpdateErrorText("Invalid Servant Equipable Level, Need Level : 21");
                return;
            }
        }
        else if (dbEquipmentData.tier == 4)
        {
            if (servantData.level <= 30)
            {
                DebugLog.Log(false, "Invalid Servant Equipable Level : " + servantData.level + ", Need Level : 31");
                SimpleErrorPopupVC.Inst.UpdateErrorText("Invalid Servant Equipable Level, Need Level : 31");
                return;
            }
        }

#if UNITY_EDITOR
        Cheat.Inst.RequestEquipServantCheat(servantIndex, selectedEquipType, equipmentIndex);
#else
        PacketManager.Inst.RequestEquipServant(servantIndex, selectedEquipType, equipmentIndex);
#endif
    }
Пример #9
0
    public void UpdateTopInfo()
    {
        UserInfo userInfo = UserDataManager.Inst.GetUserInfo();

        if (userInfo != null)
        {
            UserName.text      = "Rank." + userInfo.level + " " + userInfo.userName;
            UserLevelText.text = userInfo.level.ToString();

            DBExpData dbExpData = CSVData.Inst.GetExpData(userInfo.level);
            if (dbExpData != null)
            {
                int exExp = 0;
                if (userInfo.level - 1 > 0)
                {
                    DBExpData exDBExpData = CSVData.Inst.GetExpData(userInfo.level - 1);
                    if (exDBExpData == null)
                    {
                        DebugLog.Log(false, "Invalid Level Data");
                    }
                    else
                    {
                        exExp = exDBExpData.rankExp;
                    }
                }

                ExpSlide.fillAmount = (exExp - userInfo.userEXP) / (float)(exExp - dbExpData.rankExp);
            }



            if (lastEOS != userInfo.userEOS)
            {
                NumberCountingEffect(EOSCount, lastEOS, userInfo.userEOS);
            }
            else
            {
                EOSCount.text = (userInfo.userEOS * 0.0001).ToString("N4");
            }

            if (lastUTG != userInfo.userUTG)
            {
                NumberCountingEffect(UTGCount, lastUTG, userInfo.userUTG);
            }
            else
            {
                UTGCount.text = (userInfo.userUTG * 0.0001).ToString("N4");
            }

            lastEOS = userInfo.userEOS;
            lastUTG = userInfo.userUTG;

            //EOSCount.text = (userInfo.userEOS * 0.0001).ToString("N4");
            //UTGCount.text = (userInfo.userUTG * 0.0001).ToString("N4");
        }
        if (UserDataManager.Inst.GetMainCharInfo() != null)
        {
            DBServantData servantData = CSVData.Inst.GetServantData(UserDataManager.Inst.GetMainCharInfo().mainCharID);
            if (servantData != null)
            {
                MainCharImage.sprite  = servantData.servantIcon;
                GradeCharImage.sprite = CSVData.Inst.GetSpriteGrade(servantData.grade);
            }
        }

        UserLobbyInfo lobbyInfo = UserDataManager.Inst.GetUserLobbyInfo();

        if (lobbyInfo == null)
        {
            return;
        }

        if (lobbyInfo.IsCPUAlert == true)
        {
            CPUImage.sprite = alertImage;
        }
        else
        {
            CPUImage.sprite = notAlertImage;
        }
        if (lobbyInfo.IsNETAlert == true)
        {
            NETImage.sprite = alertImage;
        }
        else
        {
            NETImage.sprite = notAlertImage;
        }
        if (lobbyInfo.IsRAMAlert == true)
        {
            RAMImage.sprite = alertImage;
        }
        else
        {
            RAMImage.sprite = notAlertImage;
        }

        if (lobbyInfo.mailCount > 0)
        {
            MailCountText.text = lobbyInfo.mailCount.ToString();

            MailCountImage.SetActive(true);
        }
        else
        {
            MailCountImage.SetActive(false);
        }
    }