protected void UnitModelLoadPart2(GameObject _myUnit, uint skillSetId)
    {
        SetTrailRenderer(_myUnit, false);

        SkillTables.SkillSetInfo skillSetInfo = _LowDataMgr.instance.GetLowDataSkillSet(skillSetId);
        //Item.CostumeInfo costume = _LowDataMgr.instance.GetLowDataCostumeInfo(CostumeID);
        //무조건 플레이어의 애니메이션 ID는 코스튬에서 읽어와야한다
        ads = _LowDataMgr.instance.TownAniInfoSetting(skillSetInfo.AniPath,
                                                      _myUnit,
                                                      skillSetInfo.AniId,
                                                      false);

        _myUnit.transform.parent = transform;
        _myModel = _myUnit;

        Animator.Init(_myUnit, _myUnit.animation, ads);
        Animator.Animation.playAutomatically = false;

        Model.Init(gameObject, _myUnit);

        AniEvent aniEvent = _myUnit.AddComponent <AniEvent>();

        aniEvent.MyUnit = this;

        Animator.PlayAnim(eAnimName.Anim_idle);
        NGUITools.SetLayer(gameObject, 14);

        //Set_XRayShader();
        SetShaderEnvironment();
    }
    protected void UnitModelLoad()
    {
        //추후 다시한번 수정 요망
        GameObject _myUnit = UnitModelHelper.PCModelLoad(townunitData.character_id,
                                                         townunitData.EquipHeadItemIdx,
                                                         townunitData.costume_id,
                                                         townunitData.EquipClothItemIdx,
                                                         townunitData.EquipWeaponItemIdx,
                                                         townunitData.isHideCostume, ref WeaponEffects, QualityManager.instance.GetModelQuality());

        //Item.CostumeInfo cosinfo = _LowDataMgr.instance.GetLowDataCostumeInfo(townunitData.costume_id);
        uint skillSetId = townunitData.SkillSetID;//애니메이션을 코스튬이 아닌 스킬셋트에서 가져온다.

        if (skillSetId <= 0)
        {
            switch (townunitData.character_id)
            {
            case 11000:
                skillSetId = 100;
                break;

            case 12000:
                skillSetId = 200;
                break;

            case 13000:
                skillSetId = 300;
                break;
            }
        }

        SkillTables.SkillSetInfo skillSetInfo = _LowDataMgr.instance.GetLowDataSkillSet(skillSetId);
        //무조건 플레이어의 애니메이션 ID는 코스튬에서 읽어와야한다
        ads = _LowDataMgr.instance.TownAniInfoSetting(skillSetInfo.AniPath,
                                                      _myUnit,
                                                      skillSetInfo.AniId,
                                                      false);
        //inven.GetEquipCostume().GetLowData().AniId);

        _myUnit.transform.parent = transform;
        _myModel = _myUnit;

        Animator.Init(_myUnit, _myUnit.animation, ads);
        Animator.Animation.playAutomatically = false;

        Model.Init(gameObject, _myUnit);

        AniEvent aniEvent = _myUnit.AddComponent <AniEvent>();

        aniEvent.MyUnit = this;

        Animator.PlayAnim(eAnimName.Anim_idle);

        SetShaderEnvironment();
    }
    ////////////////////////여기부터 황비홍 프로젝트 신규 함수
    /// <summary>
    /// 플레이어 생성
    /// </summary>
    /// <param name="parent"></param>
    /// <param name="charIdx"></param>
    /// <param name="HeadItemIdx"></param>
    /// <param name="CostumeItemIdx"></param>
    /// <param name="ClothItemIdx"></param>
    /// <param name="WeaponItemIdx"></param>
    /// <param name="HideCostume"></param>
    /// <returns></returns>
    /// bool isLighting, bool isShadow, bool isRim=true, bool isEff=true
    public static GameObject CreatePcUIModel(string panelName, Transform parent, uint charIdx, uint HeadItemIdx, uint CostumeItemIdx, uint ClothItemIdx, uint WeaponItemIdx, uint skillSetId, byte aniState, bool HideCostume, bool isShadow, bool isWeapon = true)
    {
        if (0 < parent.childCount)
        {
            int count = parent.childCount;
            while (0 < count)
            {
                --count;
                if (parent.GetChild(count).name.Contains("pc"))//혹시모를 예외처리
                {
                    GameObject.Destroy(parent.GetChild(count).gameObject);
                }
            }
        }

        GameObject[] effect   = isWeapon ? new GameObject[2] : null;
        UnitAnimator unitAnim = new UnitAnimator();

        //뻑날때를 대비해 예외처리
        GameObject _unit = UnitModelHelper.PCModelLoadRimSpec(charIdx, HeadItemIdx, CostumeItemIdx, ClothItemIdx, WeaponItemIdx, HideCostume, ref effect, isWeapon);

        //Item.CostumeInfo lowData = _LowDataMgr.instance.GetLowDataCostumeInfo(CostumeItemIdx);

        Resource.AniInfo[] ads = null;

        SkillTables.SkillSetInfo setInfo = _LowDataMgr.instance.GetLowDataSkillSet(skillSetId);
        if (setInfo != null)
        {
            ads = _LowDataMgr.instance.UIAniInfoSetting(setInfo.AniPath, _unit, setInfo.AniId, aniState);
        }

        if (effect != null)//이펙트의 사이즈를 조정해야 하는데 미리 켜져있을 경우 활활 거리는게 있어서 추가함.
        {
            int loopCount = effect.Length;
            for (int i = 0; i < loopCount; i++)
            {
                if (effect[i] != null)
                {
                    effect[i].SetActive(false);
                }
            }
        }

        unitAnim.Init(_unit, _unit.animation, ads);
        unitAnim.Animation.playAutomatically = false;
        unitAnim.PlayAnim(eAnimName.Anim_idle);

        UIModel model = _unit.AddComponent <UIModel>();

        model.Init(parent, unitAnim, effect, charIdx == 13000, isShadow, panelName);

        return(_unit);
    }
Beispiel #4
0
    public PlayerUnitData MakeEnemySyncData(ulong uuID, string nick, uint charIdx, uint level, uint vipLv, int att, uint costumeIdx
                                            , bool isHideCostume, List <int> equipIdxList, List <_PartnerData> parList, uint prefix, uint suffix, uint skillSetId)
    {
        PlayerUnitData   enemyData = new PlayerUnitData();
        List <_ItemData> equipList = new List <_ItemData>();
        uint             HELMETID  = 0;
        uint             CLOTHID   = 0;
        uint             WEAPONID  = 0;

        for (int i = 0; i < equipIdxList.Count; i++)
        {
            Item.EquipmentInfo equipInfo = _LowDataMgr.instance.GetLowDataEquipItemInfo((uint)equipIdxList[i]);
            if (equipInfo == null)
            {
                continue;
            }

            switch ((ePartType)equipInfo.Type)
            {
            case ePartType.CLOTH:
                CLOTHID = equipInfo.Id;
                break;

            case ePartType.HELMET:
                HELMETID = equipInfo.Id;
                break;

            case ePartType.WEAPON:
                WEAPONID = equipInfo.Id;
                break;
            }

            equipList.Add(new _ItemData((ulong)equipIdxList[i], (uint)equipIdxList[i], 0, equipInfo.Grade, 0, 0));
        }

        ushort[] skillLevel = new ushort[] {        //스킬의 레벨을 현재는 알 수 없다. 1로 강제지정한다.
            1, 1, 1, 1, 1
        };
        Dictionary <AbilityType, float> playerStats = CalcPlayerStats(charIdx, level, equipList, new _CostumeData((ulong)costumeIdx, (uint)costumeIdx, 1, 0, skillLevel, true, true));

        if (isHideCostume)
        {
        }
        else
        {
        }

        //Item.CostumeInfo costumeData = _LowDataMgr.instance.GetLowDataCostumeInfo(costumeIdx);
        //서버에서 정상적인 데이터 오기전까지는 일렇게.
        if (skillSetId <= 0)
        {
            switch (charIdx)
            {
            case 11000:
                skillSetId = 100;
                break;

            case 12000:
                skillSetId = 200;
                break;

            case 13000:
                skillSetId = 300;
                break;
            }
        }
        enemyData.Init(0,
                       (int)eTeamType.Team2,
                       nick,
                       uuID,
                       uuID,
                       charIdx,
                       HELMETID,
                       costumeIdx,
                       CLOTHID,
                       WEAPONID,
                       skillSetId,
                       isHideCostume,
                       level,
                       prefix,
                       suffix,
                       playerStats);

        uint skillIndex = 0;

        SkillTables.SkillSetInfo setInfo = _LowDataMgr.instance.GetLowDataSkillSet(skillSetId);
        for (int i = 0; i < setInfo.skill0.Count; i++)
        {
            uint.TryParse(setInfo.skill0[i], out skillIndex);
            enemyData.NormalAttackData[i] = new SkillData(skillIndex, (byte)skillLevel[0]);
        }

        enemyData.SkillData[0] = new SkillData(setInfo.skill1, (byte)1);
        enemyData.SkillData[1] = new SkillData(setInfo.skill2, (byte)1);
        enemyData.SkillData[2] = new SkillData(setInfo.skill3, (byte)1);
        enemyData.SkillData[3] = new SkillData(setInfo.skill4, (byte)1);

        for (int i = 0; i < setInfo.Chain.Count; i++)
        {
            uint.TryParse(setInfo.Chain[i], out skillIndex);
            enemyData.SkillData[4 + i] = new SkillData(skillIndex, (byte)skillLevel[1]);
        }
        _playerSyncData.playerSyncDatas.Add(enemyData);

        for (int i = 0; i < parList.Count; i++)
        {
            _PartnerData partner = parList[i];

            if (partner != null)
            {
                Partner.PartnerDataInfo partnerInfo = partner.GetLowData();
                if (partnerInfo == null)                //테이블 변경으로 서버에서 가지고 있는 데이터와 다를 수 있다.
                {
                    Debug.LogWarning("not found partner lowData error " + partner._partnerDataIndex);
                    continue;
                }

                Dictionary <AbilityType, float> partnerStats = CalcPartnerStats(partner._NowLevel, partnerInfo, partnerInfo.Quality /*, partner._MinorGrade, partner._Enchant*/);

                PlayerUnitData partnerData = new PlayerUnitData();
                partnerData.Init((byte)(i + 1),
                                 (byte)eTeamType.Team2,
                                 partner.GetLocName(),                //"Partner0",
                                 2 + (ulong)i,
                                 2 + (ulong)i,
                                 partner._partnerDataIndex,
                                 partner._NowLevel,
                                 partnerStats);

                partnerData.NormalAttackData[0] = new SkillData(partnerInfo.skill0, 1);
                partnerData.SkillData[0]        = new SkillData(partnerInfo.skill1, 1);
                partnerData.SkillData[1]        = new SkillData(partnerInfo.skill2, 1);
                partnerData.SkillData[2]        = new SkillData(partnerInfo.skill3, 1);
                partnerData.SkillData[3]        = new SkillData(partnerInfo.skill4, 1);

                //파트너 버프 삭제
                //if (partner.GetBuffSkillToSlot(0) != null)
                //	if (partner.GetBuffSkillToSlot(0)._skillIndex != 0)
                //		partnerData.PassiveBuff[0] = new SkillData(partner.GetBuffSkillToSlot(0)._skillIndex, (byte)partner.GetBuffSkillToSlot(0)._skillLevel);

                //if (partner.GetBuffSkillToSlot(1) != null)
                //	if (partner.GetBuffSkillToSlot(1)._skillIndex != 0)
                //		partnerData.PassiveBuff[1] = new SkillData(partner.GetBuffSkillToSlot(1)._skillIndex, (byte)partner.GetBuffSkillToSlot(1)._skillLevel);

                //if (partner.GetBuffSkillToSlot(2) != null)
                //	if (partner.GetBuffSkillToSlot(2)._skillIndex != 0)
                //		partnerData.PassiveBuff[2] = new SkillData(partner.GetBuffSkillToSlot(2)._skillIndex, (byte)partner.GetBuffSkillToSlot(2)._skillLevel);

                //if (partner.GetBuffSkillToSlot(3) != null)
                //	if (partner.GetBuffSkillToSlot(3)._skillIndex != 0)
                //		partnerData.PassiveBuff[3] = new SkillData(partner.GetBuffSkillToSlot(3)._skillIndex, (byte)partner.GetBuffSkillToSlot(3)._skillLevel);

                _playerSyncData.partnerSyncDatas.Add(partnerData);
            }
        }

        return(enemyData);
    }
Beispiel #5
0
    public _PlayerSyncData OtherPcSyncData(ulong AccountUUID, ulong a_rUUID, string a_Nick, uint a_CharIdx, uint a_userCostumeIdx, uint a_userLevel, uint prefix, uint suffix, uint maxSuperArmor, uint skillSetId)
    {
        _PlayerSyncData otherPcSyncData = new _PlayerSyncData();
        //if (_playerSyncData == null)
        //    return;

        PlayerUnitData myData = new PlayerUnitData();

        Dictionary <AbilityType, float> playerStats = new Dictionary <AbilityType, float>();

        //기본 스탯 넣어주자
        uint iLevel = 1;

        //일단 기본캐릭만
        Character.CharacterInfo charInfo = _LowDataMgr.instance.GetCharcterData(11000);
        playerStats.Add(AbilityType.HP, (float)(charInfo.BaseHp + iLevel * _LowDataMgr.instance.GetFormula(FormulaType.LEVELUP_CALIBRATION, 1) * charInfo.LevelUpHp));
        playerStats.Add(AbilityType.DAMAGE, (float)(charInfo.BaseAtk + iLevel * _LowDataMgr.instance.GetFormula(FormulaType.LEVELUP_CALIBRATION, 1) * charInfo.LevelUpAtk));
        playerStats.Add(AbilityType.HIT_RATE, (float)(charInfo.BaseHit * 0.1f + iLevel * _LowDataMgr.instance.GetFormula(FormulaType.LEVELUP_CALIBRATION, 1) * charInfo.LevelHitRate));
        playerStats.Add(AbilityType.DODGE_RATE, (float)(charInfo.BaseAvoid * 0.1f + iLevel * _LowDataMgr.instance.GetFormula(FormulaType.LEVELUP_CALIBRATION, 1) * charInfo.LevelAvoidRate));
        playerStats.Add(AbilityType.CRITICAL_RATE, (float)(charInfo.BaseCriticalRate * 0.1f));
        playerStats.Add(AbilityType.CRITICAL_RES, (float)(charInfo.BaseCriticalResist * 0.1f));
        playerStats.Add(AbilityType.CRITICAL_DAMAGE, (float)(charInfo.BaseCriticalDamage * 0.1f));
        playerStats.Add(AbilityType.DRAIN_HP, (float)(charInfo.BaseLifeSteal * 0.1f));
        playerStats.Add(AbilityType.DEFENCE_IGNORE, (float)(charInfo.BaseIgnoreAtk));
        playerStats.Add(AbilityType.DAMAGE_DECREASE, (float)(charInfo.BaseDamageDown));
        playerStats.Add(AbilityType.DAMAGE_DECREASE_RATE, (float)(charInfo.BaseDamageDownRate * 0.1f));
        playerStats.Add(AbilityType.EXP_UP, 0f);
        playerStats.Add(AbilityType.ALLSTAT_RATE, 0f);
        playerStats.Add(AbilityType.SUPERARMOR, maxSuperArmor);
        playerStats.Add(AbilityType.SUPERARMOR_RECOVERY, (float)(charInfo.SuperArmorRecovery));
        playerStats.Add(AbilityType.SUPERARMOR_RECOVERY_RATE, (float)(charInfo.SuperArmorRecoveryRate));
        playerStats.Add(AbilityType.SUPERARMOR_RECOVERY_TIME, (float)(charInfo.SuperArmorRecoveryTime));

        /*
         * for (int i = 0; i < (int)ePartType.PART_MAX; i++)
         * _ItemData equipItem = GetUserInfo().GetEquipParts((ePartType)i);
         *
         * if (equipItem != null)
         * {
         * var enumerator = equipItem.Stats.GetEnumerator();
         * while (enumerator.MoveNext())
         * {
         *  if (playerStats.ContainsKey(enumerator.Current.Key))
         *  {
         *      //있는거면 더해주기
         *      playerStats[enumerator.Current.Key] += RealValue(enumerator.Current.Key, enumerator.Current.Value);
         *  }
         *  else
         *  {
         *      //없는거면 추가
         *      playerStats.Add(enumerator.Current.Key, RealValue(enumerator.Current.Key, enumerator.Current.Value));
         *  }
         *
         * }
         * }
         * }
         */

        uint HELMETID = 0;
        uint CLOTHID  = 0;
        uint WEAPONID = 0;

        Item.EquipmentInfo tempInfo = GetUserInfo().GetEquipPartsLowData(ePartType.HELMET);
        if (tempInfo == null)
        {
            HELMETID = 0;
        }
        else
        {
            HELMETID = tempInfo.Id;
        }

        tempInfo = GetUserInfo().GetEquipPartsLowData(ePartType.CLOTH);
        if (tempInfo == null)
        {
            CLOTHID = 0;
        }
        else
        {
            CLOTHID = tempInfo.Id;
        }

        tempInfo = GetUserInfo().GetEquipPartsLowData(ePartType.WEAPON);
        if (tempInfo == null)
        {
            WEAPONID = 0;
        }
        else
        {
            WEAPONID = tempInfo.Id;
        }

        //서버에서 정상적인 데이터 오기전까지는 일렇게.
        if (skillSetId <= 0)
        {
            switch (a_CharIdx)
            {
            case 11000:
                skillSetId = 100;
                break;

            case 12000:
                skillSetId = 200;
                break;

            case 13000:
                skillSetId = 300;
                break;
            }
        }

        myData.Init(0,
                    0,
                    a_Nick,
                    AccountUUID,
                    a_rUUID,
                    a_CharIdx,
                    0,
                    a_userCostumeIdx,
                    0,
                    0,
                    skillSetId,
                    false,
                    1,
                    prefix,
                    suffix,
                    playerStats);

        //Item.CostumeInfo costumeData = _LowDataMgr.instance.GetLowDataCostumeInfo(a_userCostumeIdx);

        uint skillIndex = 0;

        SkillTables.SkillSetInfo setInfo = _LowDataMgr.instance.GetLowDataSkillSet(skillSetId);
        for (int i = 0; i < setInfo.skill0.Count; i++)
        {
            uint.TryParse(setInfo.skill0[i], out skillIndex);
            myData.NormalAttackData[i] = new SkillData(skillIndex, (byte)1);
        }

        myData.SkillData[0] = new SkillData(setInfo.skill1, (byte)1);
        myData.SkillData[1] = new SkillData(setInfo.skill2, (byte)1);
        myData.SkillData[2] = new SkillData(setInfo.skill3, (byte)1);
        myData.SkillData[3] = new SkillData(setInfo.skill4, (byte)1);

        for (int i = 0; i < setInfo.Chain.Count; i++)
        {
            uint.TryParse(setInfo.Chain[i], out skillIndex);
            myData.SkillData[4 + i] = new SkillData(skillIndex, (byte)1);
        }

        otherPcSyncData.playerSyncDatas.Add(myData);

        return(otherPcSyncData);
    }
Beispiel #6
0
    public void MakePlayerSyncData(bool bMakePartnerData)
    {
        //내 플레이어용 싱크데이터
        _playerSyncData = null;
        _playerSyncData = new _PlayerSyncData();

        PlayerUnitData myData = new PlayerUnitData();

        _playerSyncData.Init();

        Dictionary <AbilityType, float> playerStats = CalcPlayerStats();

        uint HELMETID = 0;
        uint CLOTHID  = 0;
        uint WEAPONID = 0;

        Item.EquipmentInfo tempInfo = GetUserInfo().GetEquipPartsLowData(ePartType.HELMET);
        if (tempInfo == null)
        {
            HELMETID = 0;
        }
        else
        {
            HELMETID = tempInfo.Id;
        }

        tempInfo = GetUserInfo().GetEquipPartsLowData(ePartType.CLOTH);
        if (tempInfo == null)
        {
            CLOTHID = 0;
        }
        else
        {
            CLOTHID = tempInfo.Id;
        }

        tempInfo = GetUserInfo().GetEquipPartsLowData(ePartType.WEAPON);
        if (tempInfo == null)
        {
            WEAPONID = 0;
        }
        else
        {
            WEAPONID = tempInfo.Id;
        }

        ushort[] skillLevel     = null;
        uint     equipCostumeId = 0;

        if (GetUserInfo().GetEquipCostume() == null)
        {
            Newbie.NewbieInfo newbieinfo = _LowDataMgr.instance.GetNewbieCharacterData(GetUserInfo()._userCharIndex);
            equipCostumeId = newbieinfo.CostumIdx;

            skillLevel = new ushort[] {
                1, 1, 1, 1, 1
            };
        }
        else
        {
            equipCostumeId = GetUserInfo().GetEquipCostume()._costmeDataIndex;
            skillLevel     = GetUserInfo().GetEquipCostume()._skillLevel;
        }

        SkillSetData skillSetData = GetUserInfo().GetEquipSKillSet();
        uint         skillSetId   = 0;

        uint[] skillIds = new uint[4];
        uint[] skillLv  = new uint[4];

        if (skillSetData == null)
        {
            switch (GetUserInfo().GetCharIdx())
            {
            case 11000:
                skillSetId = 100;
                break;

            case 12000:
                skillSetId = 200;
                break;

            case 13000:
                skillSetId = 300;
                break;
            }

            SkillTables.SkillSetInfo info = _LowDataMgr.instance.GetLowDataSkillSet(skillSetId);
            skillIds[0] = info.skill1;
            skillIds[1] = info.skill2;
            skillIds[2] = info.skill3;
            skillIds[3] = info.skill4;
            for (int i = 0; i < skillLv.Length; i++)
            {
                skillLv[i] = 1;
            }
        }
        else
        {
            skillSetId = skillSetData.SkillSetId;
            for (int i = 0; i < skillIds.Length; i++)
            {
                skillIds[i] = skillSetData.SkillId[i];
                skillLv[i]  = skillSetData.SkillLevel[i];
            }
        }

        myData.Init(0,
                    (int)eTeamType.Team1,
                    Nickname,
                    AccountUUID,
                    0,
                    GetUserInfo().GetCharIdx(),
                    HELMETID,
                    equipCostumeId,
                    CLOTHID,
                    WEAPONID,
                    skillSetId,
                    GetUserInfo().isHideCostum,
                    GetUserInfo()._Level,
                    GetUserInfo()._LeftTitle,
                    GetUserInfo()._RightTitle,
                    playerStats);

        uint skillIndex = 0;

        SkillTables.SkillSetInfo setInfo = _LowDataMgr.instance.GetLowDataSkillSet(skillSetId);
        for (int i = 0; i < setInfo.skill0.Count; i++)
        {
            uint.TryParse(setInfo.skill0[i], out skillIndex);
            myData.NormalAttackData[i] = new SkillData(skillIndex, (byte)skillLevel[0]);
        }

        myData.SkillData[0] = new SkillData(skillIds[0], (byte)skillLv[0]);
        myData.SkillData[1] = new SkillData(skillIds[1], (byte)skillLv[1]);
        myData.SkillData[2] = new SkillData(skillIds[2], (byte)skillLv[2]);
        myData.SkillData[3] = new SkillData(skillIds[3], (byte)skillLv[3]);

        for (int i = 0; i < setInfo.Chain.Count; i++)
        {
            uint.TryParse(setInfo.Chain[i], out skillIndex);
            myData.SkillData[4 + i] = new SkillData(skillIndex, (byte)skillLevel[1]);
        }

        _playerSyncData.playerSyncDatas.Add(myData);

        if (!bMakePartnerData)
        {
            return;
        }

        for (int i = 0; i < 2; i++)                                      //GetUserInfo().GetPartnerList().Count
        {
            _PartnerData partner = GetUserInfo().GetEquipPartner(i + 1); //슬롯 시작값이 1부터이다. i를 1부터 시작시키게 했다.

            if (partner != null)
            {
                Partner.PartnerDataInfo         partnerInfo  = partner.GetLowData();
                Dictionary <AbilityType, float> partnerStats = CalcPartnerStats(partner._NowLevel, partnerInfo, partnerInfo.Quality /*, partner._MinorGrade, partner._Enchant*/);

                PlayerUnitData partnerData = new PlayerUnitData();
                partnerData.Init((byte)(i + 1),
                                 (byte)eTeamType.Team1,
                                 partner.GetLocName(),                //"Partner0",
                                 2 + (ulong)i,
                                 0,
                                 partner._partnerDataIndex,
                                 partner._NowLevel,
                                 partnerStats);

                partnerData.NormalAttackData[0] = new SkillData(partnerInfo.skill0, 1);
                partnerData.SkillData[0]        = new SkillData(partnerInfo.skill1, 1);
                partnerData.SkillData[1]        = new SkillData(partnerInfo.skill2, 1);
                partnerData.SkillData[2]        = new SkillData(partnerInfo.skill3, 1);
                partnerData.SkillData[3]        = new SkillData(partnerInfo.skill4, 1);

                //파트너 버프 삭제
                //if (partner.GetBuffSkillToSlot(0) != null)
                //	if (partner.GetBuffSkillToSlot(0)._skillIndex != 0)
                //		partnerData.PassiveBuff[0] = new SkillData(partner.GetBuffSkillToSlot(0)._skillIndex, (byte)partner.GetBuffSkillToSlot(0)._skillLevel);

                //if (partner.GetBuffSkillToSlot(1) != null)
                //	if (partner.GetBuffSkillToSlot(1)._skillIndex != 0)
                //		partnerData.PassiveBuff[1] = new SkillData(partner.GetBuffSkillToSlot(1)._skillIndex, (byte)partner.GetBuffSkillToSlot(1)._skillLevel);

                //if (partner.GetBuffSkillToSlot(2) != null)
                //	if (partner.GetBuffSkillToSlot(2)._skillIndex != 0)
                //		partnerData.PassiveBuff[2] = new SkillData(partner.GetBuffSkillToSlot(2)._skillIndex, (byte)partner.GetBuffSkillToSlot(2)._skillLevel);

                //if (partner.GetBuffSkillToSlot(3) != null)
                //	if (partner.GetBuffSkillToSlot(3)._skillIndex != 0)
                //		partnerData.PassiveBuff[3] = new SkillData(partner.GetBuffSkillToSlot(3)._skillIndex, (byte)partner.GetBuffSkillToSlot(3)._skillLevel);

                _playerSyncData.partnerSyncDatas.Add(partnerData);
            }
        }
    }
Beispiel #7
0
    public void MakePlayerFreeFightSyncData(PMsgBattleMapEnterMapS netData)
    {
        //내 플레이어용 싱크데이터
        _playerSyncData = null;
        _playerSyncData = new _PlayerSyncData();

        PlayerUnitData myData = new PlayerUnitData();

        _playerSyncData.Init();

        Dictionary <AbilityType, float> playerStats = CalcPlayerStats();

        playerStats[AbilityType.HP]         = netData.UnHp;
        playerStats[AbilityType.SUPERARMOR] = netData.UnMaxSuperArmor;

        uint HELMETID = 0;
        uint CLOTHID  = 0;
        uint WEAPONID = 0;

        Item.EquipmentInfo tempInfo = GetUserInfo().GetEquipPartsLowData(ePartType.HELMET);
        if (tempInfo == null)
        {
            HELMETID = 0;
        }
        else
        {
            HELMETID = tempInfo.Id;
        }

        tempInfo = GetUserInfo().GetEquipPartsLowData(ePartType.CLOTH);
        if (tempInfo == null)
        {
            CLOTHID = 0;
        }
        else
        {
            CLOTHID = tempInfo.Id;
        }

        tempInfo = GetUserInfo().GetEquipPartsLowData(ePartType.WEAPON);
        if (tempInfo == null)
        {
            WEAPONID = 0;
        }
        else
        {
            WEAPONID = tempInfo.Id;
        }

        //ushort[] skillLevel = null;
        //uint equipCostumeId = 0;
        //if (GetUserInfo().GetEquipCostume() == null)
        //{
        //    Newbie.NewbieInfo newbieinfo = _LowDataMgr.instance.GetNewbieCharacterData(GetUserInfo()._userCharIndex);
        //    equipCostumeId = newbieinfo.CostumIdx;

        //    skillLevel = new ushort[] {
        //        1, 1, 1, 1, 1
        //    };
        //}
        //else
        //{
        //    equipCostumeId = GetUserInfo().GetEquipCostume()._costmeDataIndex;
        //    skillLevel = GetUserInfo().GetEquipCostume()._skillLevel;
        //}

        ushort[] skillLevel     = null;
        uint     equipCostumeId = 0;

        equipCostumeId = (uint)netData.UnCostumeId;
        skillLevel     = new ushort[] { 1, 1, 1, 1, 1 };

        //Item.CostumeInfo costumeData = _LowDataMgr.instance.GetLowDataCostumeInfo(equipCostumeId);
        SkillSetData skillSetData = GetUserInfo().GetEquipSKillSet();

        myData.Init(0,
                    0,
                    Nickname,
                    NetData.instance.AccountUUID,
                    0,
                    GetUserInfo().GetCharIdx(),
                    HELMETID,
                    equipCostumeId,
                    CLOTHID,
                    WEAPONID,
                    skillSetData.SkillSetId,
                    GetUserInfo().isHideCostum,
                    GetUserInfo()._Level,
                    GetUserInfo()._LeftTitle,
                    GetUserInfo()._RightTitle,
                    playerStats);

        uint skillIndex = 0;

        SkillTables.SkillSetInfo setInfo = _LowDataMgr.instance.GetLowDataSkillSet(skillSetData.SkillSetId);
        for (int i = 0; i < setInfo.skill0.Count; i++)
        {
            uint.TryParse(setInfo.skill0[i], out skillIndex);
            myData.NormalAttackData[i] = new SkillData(skillIndex, (byte)skillLevel[0]);
        }

        myData.SkillData[0] = new SkillData(skillSetData.SkillId[0], (byte)skillSetData.SkillLevel[0]);
        myData.SkillData[1] = new SkillData(skillSetData.SkillId[1], (byte)skillSetData.SkillLevel[1]);
        myData.SkillData[2] = new SkillData(skillSetData.SkillId[2], (byte)skillSetData.SkillLevel[2]);
        myData.SkillData[3] = new SkillData(skillSetData.SkillId[3], (byte)skillSetData.SkillLevel[3]);

        for (int i = 0; i < setInfo.Chain.Count; i++)
        {
            uint.TryParse(setInfo.Chain[i], out skillIndex);
            myData.SkillData[4 + i] = new SkillData(skillIndex, (byte)skillLevel[1]);
        }
        _playerSyncData.playerSyncDatas.Add(myData);
    }
    IEnumerator CreateEquipment()
    {
        uint charId = NetData.instance.GetUserInfo().GetCharIdx();

        uint[] equipId;
        if (charId == 11000)
        {
            equipId = new uint[] { 410002, 410012, 410022, 410032, 410042, 410102, 410112, 410122, 410132, 410142,
                                   410202, 410212, 410222, 410232, 410242, 410302, 410312, 410322, 410332, 410342, 410402, 410412,
                                   410422, 410432, 410442, 410502, 410512, 410522, 410532, 410542, 410602, 410612, 410622, 410632,
                                   410642, 410702, 410712, 410722, 410732, 410742, 410652, 410752, 410852, 510001 }
        }
        ;
        else if (charId == 12000)
        {
            equipId = new uint[] {
                420002, 420012, 420022, 420032, 420042, 420102, 420112, 420122, 420132, 420142, 420202, 420212, 420222, 420232, 420242, 420302,
                420312, 420322, 420332, 420342, 420402, 420412, 420422, 420432, 420442, 420502, 420512, 420522, 420532, 420542,
                420602, 420612, 420622, 420632, 420642, 420702, 420712, 420722, 420732, 420742, 420652, 420752, 420852, 520001
            }
        }
        ;
        else
        {
            equipId = new uint[] {
                430002, 430012, 430022, 430032, 430042, 430102, 430112, 430122, 430132, 430142,
                430202, 430212, 430222, 430232, 430242, 430302, 430312, 430322, 430332, 430342, 430402, 430412, 430422, 430432, 430442, 430502, 430512,
                430522, 430532, 430542, 430602, 430612, 430622, 430632, 430642, 430702, 430712, 430722, 430732, 430742, 430652, 430752, 430852, 530001
            }
        };

        int         count  = 0;
        _LowDataMgr lowMgr = _LowDataMgr.instance;

        while (count < equipId.Length)
        {
            Item.EquipmentInfo item = lowMgr.GetLowDataEquipItemInfo(equipId[count]);
            if (item == null)
            {
                break;
            }

            NetworkClient.instance.SendPMsgTalkCS((int)Sw.TALK_CHANNEL_TYPE.TALK_CHANNEL_PRIVATE, 0, "", string.Format("/aq {0} 1", equipId[count++]), 1);

            yield return(new WaitForSeconds(0.1f));
        }

        UIMgr.instance.AddPopup("알림", "의상 생성 치트키 끝", "확인", null, null, delegate() {
            base.Close();
        });
    }

    void CreateMaterials(string type, int amount)
    {
        int[] ids = null;
        if (type.Equals("asd"))
        {
            ids = new int[] {
                554009, 554010, 554011, 554012, 554013, 554014,
                560450, 560451, 560452, 560453, 560454, 560455, 560456,
                560461, 560462, 560463, 560464, 560465, 560466, 560467, 560468, 560469,
                560470, 560471, 560472, 560473, 560474, 560475, 560476, 560477, 560478, 560479, 560480,
                560500, 560510, 560511, 560512, 560513,
                560530, 560531, 560532, 560533,
                560550, 560551, 560558, 560559, 560560, 567700, 567701, 599008
            };
        }
        else if (type.Equals("shard"))
        {
            List <int> idList = new List <int>();
            List <Partner.PartnerDataInfo> parList = _LowDataMgr.instance.GetPartnerDataToList();
            for (int i = 0; i < parList.Count; i++)
            {
                if (idList.Contains((int)parList[i].ShardIdx))
                {
                    continue;
                }

                idList.Add((int)parList[i].ShardIdx);
            }

            ids = idList.ToArray();
        }
        else if (type.Equals("costume"))
        {
            uint charIdx = NetData.instance.GetUserInfo()._userCharIndex;
            if (charIdx.Equals(11000))
            {
                //권사 코스튬 조각
                ids = new int[] {
                    560100,
                    560101,
                    560102
                };
            }
            else if (charIdx.Equals(12000))
            {
                //명장 코스튬 조각
                ids = new int[] {
                    560200,
                    560201,
                    560202
                };
            }
            else if (charIdx.Equals(13000))
            {
                //협녀 코스튬 조각
                ids = new int[] {
                    560300,
                    560301,
                    560302
                };
            }
        }

        for (int i = 0; i < ids.Length; i++)
        {
            string key = string.Format("/ai {0} {1}", ids[i], amount);
            NetworkClient.instance.SendPMsgTalkCS((int)Sw.TALK_CHANNEL_TYPE.TALK_CHANNEL_PRIVATE, 0, "", key, 1);
        }
    }

    void OnClickSend()
    {
        string str = Input.value;

        if (string.IsNullOrEmpty(str))
        {
            return;
        }

        if (str.Contains(" ") && !str.Contains("game"))//&& (str.Contains(" ") || str.CompareTo("s") == 0 ) )
        {
            string[] value = str.Split(' ');
            if (value.Length <= 0)
            {
                return;
            }
            switch (value[0])
            {
            case "ag":
            case "ac":
            case "af":
            case "ah":
            case "aco":
            case "ar":
            case "alk":
            case "ae":
            {
                uint   amount = uint.Parse(value[1]);
                string send   = string.Format("/{0} {1}", value[0], amount);
                NetworkClient.instance.SendPMsgTalkCS((int)Sw.TALK_CHANNEL_TYPE.TALK_CHANNEL_PRIVATE, 0, "", send, 1);
            }
            break;

            case "ai":
            case "aq":
            case "act":
            {
                uint   id     = uint.Parse(value[1]);
                uint   amount = uint.Parse(value[2]);
                string send   = string.Format("/{0} {1} {2}", value[0], id, amount);
                NetworkClient.instance.SendPMsgTalkCS((int)Sw.TALK_CHANNEL_TYPE.TALK_CHANNEL_PRIVATE, 0, "", send, 1);
            }
            break;

            case "sp":
            {
                uint   amount = uint.Parse(value[1]);
                string send   = string.Format("/ai 599007 {0}", amount);
                NetworkClient.instance.SendPMsgTalkCS((int)Sw.TALK_CHANNEL_TYPE.TALK_CHANNEL_PRIVATE, 0, "", send, 1);
            }
            break;

            case "mal":
            {
                uint   amount = uint.Parse(value[1]);
                string send   = string.Format("/{0} {1}", value[0], amount);
                NetworkClient.instance.SendPMsgTalkCS((int)Sw.TALK_CHANNEL_TYPE.TALK_CHANNEL_PRIVATE, 0, "", send, 1);
            }
            break;

            case "s":
            {
                //uint amount = uint.Parse(value[1]);
                //string send = string.Format("/{0} {1}", value[0], amount);
                //NetworkClient.instance.SendPMsgTalkCS((int)Sw.TALK_CHANNEL_TYPE.TALK_CHANNEL_PRIVATE, 0, "", send, 1);
                NetworkClient.instance.SendPMsgBuyPowerC();
            }
            break;

            case "ku":
            {
                long   amount = long.Parse(value[1]);
                string send   = string.Format("/{0} {1}", value[0], amount);
                NetworkClient.instance.SendPMsgTalkCS((int)Sw.TALK_CHANNEL_TYPE.TALK_CHANNEL_PRIVATE, 0, "", send, 1);
            }
            break;

            case "asd":
            case "shard":
            case "costume":
            {
                int amount = int.Parse(value[1]);
                CreateMaterials(value[0], amount);
            }
            break;

            case "preview":
            {
                uint amount = uint.Parse(value[1]);
                SceneManager.instance.SetNoticePanel(NoticeType.GetMailItem, amount);
            }
            break;

            case "opentask":
            {
                uint   amount = uint.Parse(value[1]);
                string send   = string.Format("/{0} {1}", value[0], amount);
                NetworkClient.instance.SendPMsgTalkCS((int)Sw.TALK_CHANNEL_TYPE.TALK_CHANNEL_PRIVATE, 0, "", send, 1);
            }
            break;

            case "setskill":
                uint skillId = uint.Parse(value[1]);

                NetData.instance.GetUserInfo().GetEquipSKillSet().IsEquip = false;
                bool isSet = false;
                List <NetData.SkillSetData> skillData = NetData.instance.GetUserInfo()._SKillSetList;
                for (int i = 0; i < skillData.Count; i++)
                {
                    if (!skillData[i].SkillSetId.Equals(skillId))
                    {
                        continue;
                    }

                    isSet = true;
                    skillData[i].IsEquip = true;
                    break;
                }

                if (!isSet)
                {
                    SkillTables.SkillSetInfo info = _LowDataMgr.instance.GetLowDataSkillSet(skillId);
                    skillData.Add(new NetData.SkillSetData(true, new uint[] { 1, 1, 1, 1 }, new uint[] { info.skill1, info.skill2, info.skill3, info.skill4 }, skillId, 0));
                }
                break;
            }
        }
        else
        {
            if (str.Equals("allclear"))
            {
                StartCoroutine("_ClearAllStage");
                return;
            }
            if (str.Equals("questclear"))
            {
                StartCoroutine("QuestClear");
                return;
            }
            else if (str.Equals("allequip"))
            {
                StartCoroutine("CreateEquipment");
                return;
            }
            else if (str.Equals("cg"))
            {
                NetworkClient.instance.SendPMsgTalkCS((int)Sw.TALK_CHANNEL_TYPE.TALK_CHANNEL_PRIVATE, 0, "", "/cg", 1);

                string loginType  = PlayerPrefs.GetString("logintype", "none");
                string user_id    = PlayerPrefs.GetString("user_id", "none");
                string user_token = PlayerPrefs.GetString("user_token", "none");

                if (loginType.Equals("google"))
                {
                    PlayerPrefs.DeleteKey("logintype");
                    PlayerPrefs.DeleteKey("user_id");
                    PlayerPrefs.DeleteKey("user_token");
                    NetData.instance._LoginType = eLoginType.GUEST;
                }

                return;
            }
            else if (str.Equals("cfb"))
            {
                NetworkClient.instance.SendPMsgTalkCS((int)Sw.TALK_CHANNEL_TYPE.TALK_CHANNEL_PRIVATE, 0, "", "/cfb", 1);

                string loginType  = PlayerPrefs.GetString("logintype", "none");
                string user_id    = PlayerPrefs.GetString("user_id", "none");
                string user_token = PlayerPrefs.GetString("user_token", "none");

                if (loginType.Equals("facebook"))
                {
                    PlayerPrefs.DeleteKey("logintype");
                    PlayerPrefs.DeleteKey("user_id");
                    PlayerPrefs.DeleteKey("user_token");
                    NetData.instance._LoginType = eLoginType.GUEST;
                }

                return;
            }
            else if (str.Contains("game"))
            {
                string[] split = str.Split(' ');
                if (split[1].Contains("single"))
                {
                    string[] split2   = split[1].Split('_');
                    uint     stageNum = 0;
                    if (uint.TryParse(split2[1], out stageNum))
                    {
                        SceneManager.instance.ShowLoadingTipPanel(true, GAME_MODE.SINGLE, () =>
                        {
                            //이상태에서의 데이터를 저장
                            NetData.instance.MakePlayerSyncData(true);

                            SingleGameState.lastSelectStageId = stageNum;
                            SingleGameState.verifyToken       = 1023;
                            SingleGameState.IsTest            = true;
                            SingleGameState.StageQuestList    = new System.Collections.Generic.List <NetData.StageClearData>();
                            SingleGameState.CurStageName      = split[1];

                            SceneManager.instance.ActionEvent(_ACTION.PLAY_SINGLE);

                            base.GotoInGame();
                        });
                    }
                }
                else if (split[1].Contains("devildom_tower"))
                {
                    uint stageNum = 0;
                    List <DungeonTable.TowerInfo> list = _LowDataMgr.instance.GetLowDataTowerList();
                    for (int i = 0; i < list.Count; i++)
                    {
                        if (!list[i].mapName.Equals(split[1]))
                        {
                            continue;
                        }

                        stageNum = list[i].StageIndex;
                        break;
                    }

                    if (0 < stageNum)
                    {
                        SceneManager.instance.ShowLoadingTipPanel(true, GAME_MODE.TOWER, () =>
                        {
                            //이상태에서의 데이터를 저장
                            NetData.instance.MakePlayerSyncData(true);

                            TowerGameState.lastSelectStageId = stageNum;
                            TowerGameState.IsTest            = true;

                            SceneManager.instance.ActionEvent(_ACTION.PLAY_TOWER);
                            base.GotoInGame();
                        });
                    }
                }
                else if (split[1].Contains("Raid_Dungeon"))
                {
                    uint stageNum = 0;
                    List <DungeonTable.SingleBossRaidInfo> list = _LowDataMgr.instance.GetLowDataBossRaidList();
                    for (int i = 0; i < list.Count; i++)
                    {
                        if (!list[i].stageName.Equals(split[1]))
                        {
                            continue;
                        }

                        stageNum = list[i].raidId;
                        break;
                    }

                    if (0 < stageNum)
                    {
                        SceneManager.instance.ShowLoadingTipPanel(true, GAME_MODE.RAID, () =>
                        {
                            //이상태에서의 데이터를 저장
                            NetData.instance.MakePlayerSyncData(true);

                            RaidGameState.lastSelectStageId = stageNum;
                            RaidGameState.IsTest            = true;

                            SceneManager.instance.ActionEvent(_ACTION.PLAY_RAID);

                            base.GotoInGame();
                        });
                    }
                }
                else if (split[1].Contains("tower"))
                {
                    string[] split2   = split[1].Split('_');
                    uint     stageNum = 0;
                    if (uint.TryParse(split2[1], out stageNum))
                    {
                        SceneManager.instance.ShowLoadingTipPanel(true, GAME_MODE.TOWER, () =>
                        {
                            //이상태에서의 데이터를 저장
                            NetData.instance.MakePlayerSyncData(true);

                            TowerGameState.lastSelectStageId = stageNum;
                            TowerGameState.IsTest            = true;

                            SceneManager.instance.ActionEvent(_ACTION.PLAY_TOWER);

                            base.GotoInGame();
                        });
                    }
                }
                else if (split[1].Contains("raid"))
                {
                    string[] split2   = split[1].Split('_');
                    uint     stageNum = 0;
                    if (uint.TryParse(split2[1], out stageNum))
                    {
                        SceneManager.instance.ShowLoadingTipPanel(true, GAME_MODE.RAID, () =>
                        {
                            //이상태에서의 데이터를 저장
                            NetData.instance.MakePlayerSyncData(true);

                            RaidGameState.lastSelectStageId = stageNum;
                            RaidGameState.IsTest            = true;

                            SceneManager.instance.ActionEvent(_ACTION.PLAY_RAID);

                            base.GotoInGame();
                        });
                    }
                }
            }
            else if (str.Equals("q"))
            {
                if (!TownState.TownActive)
                {
                    InGameHUDPanel.ZeroDamagePlay_01 = !InGameHUDPanel.ZeroDamagePlay_01;
                }
            }
            else if (str.Equals("qq"))
            {
                if (!TownState.TownActive)
                {
                    InGameHUDPanel.ZeroDamagePlay = !InGameHUDPanel.ZeroDamagePlay;
                }
            }
            else if (str.Equals("cooltime"))
            {
                if (!TownState.TownActive)
                {
                    InGameHUDPanel.ZeroSkillCoolTime = !InGameHUDPanel.ZeroSkillCoolTime;
                }
            }
            else if (str.Equals("tutoreset"))
            {
                string key = string.Format("TutorialData_{0}.json", NetData.instance.GetUserInfo().GetCharUUID());
                if (PlayerPrefs.HasKey(key))
                {
                    PlayerPrefs.DeleteKey(key);
                }
            }
            else
            {
                SceneManager.instance.ShowLoadingTipPanel(true, GAME_MODE.NONE, () =>
                {
                    //이상태에서의 데이터를 저장
                    NetData.instance.MakePlayerSyncData(true);

                    TutorialGameState.StageName         = str;
                    TutorialGameState.lastSelectStageId = 1;
                    TutorialGameState.verifyToken       = 1023;

                    SceneManager.instance.ActionEvent(_ACTION.PLAY_TUTORIAL);

                    base.GotoInGame();
                });
            }

            base.Close();
        }
    }
    protected IEnumerator UnitModelLoadAsync()
    {
        //추후 다시한번 수정 요망
        GameObject _myUnit = null;

        yield return(StartCoroutine(UnitModelHelper.PCModelLoadAsync(townunitData.character_id,
                                                                     townunitData.EquipHeadItemIdx,
                                                                     townunitData.costume_id,
                                                                     townunitData.EquipClothItemIdx,
                                                                     townunitData.EquipWeaponItemIdx,
                                                                     townunitData.isHideCostume,
                                                                     (retval, retval2) => {
            _myUnit = retval;
            WeaponEffects = retval2;
        }, QualityManager.instance.GetModelQuality())));

        //Item.CostumeInfo cosinfo = _LowDataMgr.instance.GetLowDataCostumeInfo(townunitData.costume_id);

        if (_myUnit == null)
        {
            Debug.LogError(string.Format("charId={0}, headIdx={1}, costumeId={2}, clothIdx={3}, weaponIdx={4}, isHide={5}, roleId={6}, nickName={7}",
                                         townunitData.character_id,
                                         townunitData.EquipHeadItemIdx,
                                         townunitData.costume_id,
                                         townunitData.EquipClothItemIdx,
                                         townunitData.EquipWeaponItemIdx,
                                         townunitData.isHideCostume,
                                         townunitData.c_usn,
                                         townunitData.nickname
                                         ));
            yield return(null);
        }

        uint skillSetId = townunitData.SkillSetID;//애니메이션을 코스튬이 아닌 스킬셋트에서 가져온다.

        if (skillSetId <= 0)
        {
            switch (townunitData.character_id)
            {
            case 11000:
                skillSetId = 100;
                break;

            case 12000:
                skillSetId = 200;
                break;

            case 13000:
                skillSetId = 300;
                break;
            }
        }

        SkillTables.SkillSetInfo skillSetInfo = _LowDataMgr.instance.GetLowDataSkillSet(skillSetId);
        //무조건 플레이어의 애니메이션 ID는 코스튬에서 읽어와야한다
        ads = _LowDataMgr.instance.TownAniInfoSetting(skillSetInfo.AniPath,
                                                      _myUnit,
                                                      skillSetInfo.AniId,
                                                      false);

        //inven.GetEquipCostume().GetLowData().AniId);

        _myUnit.transform.parent = transform;
        _myModel = _myUnit;

        Animator.Init(_myUnit, _myUnit.animation, ads);
        Animator.Animation.playAutomatically = false;

        Model.Init(gameObject, _myUnit);

        AniEvent aniEvent = _myUnit.AddComponent <AniEvent>();

        aniEvent.MyUnit = this;

        Animator.PlayAnim(eAnimName.Anim_idle);

        SetShaderEnvironment();
    }