Ejemplo n.º 1
0
 private void ChangeHeroIntroduce(int heroid)
 {
     ArkCrossEngine.Data_PlayerConfig dpc = ArkCrossEngine.PlayerConfigProvider.Instance.GetPlayerConfigById(heroid);
     if (heroid >= 0 && UIRootGO != null && dpc != null)
     {
         UnityEngine.Transform tf = UIRootGO.transform.Find("IntroducePanelCopy/Container");
         if (tf != null)
         {
             tf = tf.Find("Sprite/Name");
             if (tf != null)
             {
                 UILabel ul = tf.gameObject.GetComponent <UILabel>();
                 if (ul != null)
                 {
                     ul.text = "[i]" + dpc.m_Name + "[-]";
                 }
             }
         }
         tf = UIRootGO.transform.Find("IntroducePanelCopy/Container");
         if (tf != null)
         {
             tf = tf.Find("Bula");
             if (tf != null)
             {
                 UILabel ul = tf.gameObject.GetComponent <UILabel>();
                 if (ul != null)
                 {
                     ul.text = dpc.m_HeroIntroduce2.Replace("\\n", "\n");
                 }
             }
         }
         tf = UIRootGO.transform.Find("IntroducePanelCopy/Container");
         if (tf != null)
         {
             tf = tf.Find("Introduce");
             if (tf != null)
             {
                 UILabel ul = tf.gameObject.GetComponent <UILabel>();
                 if (ul != null)
                 {
                     ul.text = dpc.m_HeroIntroduce1.Replace("\\n", "\n");
                 }
             }
         }
         tf = UIRootGO.transform.Find("IntroducePanelCopy/Container");
         if (tf != null)
         {
             tf = tf.Find("Sprite/Back/Head");
             if (tf != null)
             {
                 UISprite us = tf.gameObject.GetComponent <UISprite>();
                 if (us != null)
                 {
                     // us.spriteName = heroid == 1 ? "kuang-zhan-shi-tou-xiang2" : heroid == 2 ? "ci-ke-tou-xiang2" : "";
                     us.spriteName = "jue-se-xuan-zhong-kuang";
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
        private UserInfo CreateArenaTarget(ArenaTargetInfo target)
        {
            if (target == null)
            {
                return(null);
            }
            int      image_res_id = target.HeroId;
            UserInfo image_player = m_UserMgr.AddUser(image_res_id);

            if (null != image_player)
            {
                image_player.SceneContext = m_SceneContext;
                int campid = NetworkSystem.Instance.CampId == (int)CampIdEnum.Blue ? (int)CampIdEnum.Red : (int)CampIdEnum.Blue;
                image_player.SetCampId(campid);
                Data_Unit unit = m_CurScene.StaticData.ExtractData(DataMap_Type.DT_Unit, GlobalVariables.GetUnitIdByCampId(campid)) as Data_Unit;
                if (null != unit)
                {
                    image_player.GetAiStateInfo().AiLogic = unit.m_AiLogic;
                    image_player.SetAIEnable(true);
                    image_player.GetMovementStateInfo().SetPosition(unit.m_Pos);
                    image_player.GetMovementStateInfo().SetFaceDir(unit.m_RotAngle);
                }
                image_player.SetLevel(target.Level);
                image_player.SetNickName(target.Nickname);
                image_player.SkillController = new SwordManSkillController(image_player, GfxModule.Skill.GfxSkillSystem.Instance);
                if (null != m_SpatialSystem)
                {
                    m_SpatialSystem.AddObj(image_player.SpaceObject);
                }
                /// skills
                if (null != target.Skills)
                {
                    image_player.GetSkillStateInfo().RemoveAllSkill();
                    int skill_ct = target.Skills.Count;
                    for (int i = 0; i < skill_ct; i++)
                    {
                        SkillInfo info = target.Skills[i];
                        if (null != info)
                        {
                            SkillCategory cur_skill_pos = SkillCategory.kNone;
                            if (info.Postions.Presets[0] == SlotPosition.SP_A)
                            {
                                cur_skill_pos = SkillCategory.kSkillA;
                            }
                            else if (info.Postions.Presets[0] == SlotPosition.SP_B)
                            {
                                cur_skill_pos = SkillCategory.kSkillB;
                            }
                            else if (info.Postions.Presets[0] == SlotPosition.SP_C)
                            {
                                cur_skill_pos = SkillCategory.kSkillC;
                            }
                            else if (info.Postions.Presets[0] == SlotPosition.SP_D)
                            {
                                cur_skill_pos = SkillCategory.kSkillD;
                            }
                            info.Category = cur_skill_pos;
                            image_player.GetSkillStateInfo().AddSkill(info);
                            WorldSystem.Instance.AddSubSkill(image_player, info.SkillId, cur_skill_pos, info.SkillLevel);
                        }
                    }
                }
                Data_PlayerConfig playerData = PlayerConfigProvider.Instance.GetPlayerConfigById(image_player.GetLinkId());
                if (null != playerData && null != playerData.m_FixedSkillList &&
                    playerData.m_FixedSkillList.Count > 0)
                {
                    foreach (int skill_id in playerData.m_FixedSkillList)
                    {
                        SkillInfo info = new SkillInfo(skill_id, 1);
                        image_player.GetSkillStateInfo().AddSkill(info);
                    }
                }
                image_player.ResetSkill();
                /// equips
                if (null != target.Equips)
                {
                    int equip_ct = target.Equips.Length;
                    for (int i = 0; i < equip_ct; i++)
                    {
                        ItemDataInfo image_equip = target.Equips[i];
                        if (null != image_equip)
                        {
                            image_player.GetEquipmentStateInfo().ResetEquipmentData(i);
                            image_equip.ItemConfig = ItemConfigProvider.Instance.GetDataById(image_equip.ItemId);
                            if (null != image_equip.ItemConfig)
                            {
                                image_player.GetEquipmentStateInfo().SetEquipmentData(i, image_equip);
                            }
                        }
                    }
                }
                ///
                if (null != target.Legacys)
                {
                    int legacy_ct = target.Legacys.Length;
                    for (int i = 0; i < legacy_ct; i++)
                    {
                        ItemDataInfo image_legacy = target.Legacys[i];
                        if (null != image_legacy && image_legacy.IsUnlock)
                        {
                            image_player.GetLegacyStateInfo().ResetLegacyData(i);
                            image_legacy.ItemConfig = ItemConfigProvider.Instance.GetDataById(image_legacy.ItemId);
                            if (null != image_legacy.ItemConfig)
                            {
                                image_player.GetLegacyStateInfo().SetLegacyData(i, image_legacy);
                            }
                        }
                    }
                    image_player.GetLegacyStateInfo().UpdateLegacyComplexAttr();
                }
                foreach (ArenaXSoulInfo x in target.XSoulInfo)
                {
                    ItemDataInfo item = new ItemDataInfo();
                    item.ItemId     = x.ItemId;
                    item.Level      = x.Level;
                    item.Experience = x.Experience;
                    item.UpdateLevelByExperience();
                    ItemConfig config = ItemConfigProvider.Instance.GetDataById(item.ItemId);
                    if (config == null)
                    {
                        continue;
                    }
                    item.ItemConfig = config;
                    XSoulPartInfo part = new XSoulPartInfo((XSoulPart)config.m_WearParts, item);
                    part.ShowModelLevel = x.ModelLevel;
                    image_player.GetXSoulInfo().SetXSoulPartData((XSoulPart)config.m_WearParts, part);
                }
                image_player.SetPartnerInfo(target.ActivePartner);
                SetArenaCharacterCoefficient(image_player);
                UserAttrCalculator.Calc(image_player);
                image_player.SetHp(Operate_Type.OT_Absolute, image_player.GetActualProperty().HpMax);
                image_player.SetRage(Operate_Type.OT_Absolute, 0);
                image_player.SetEnergy(Operate_Type.OT_Absolute, image_player.GetActualProperty().EnergyMax);

                target.CreatedPartners.Clear();
                int total_hp = image_player.GetActualProperty().HpMax;
                //LogSystem.Error("---challenge target hp=" + image_player.GetActualProperty().HpMax);
                foreach (PartnerInfo partner in target.FightPartners)
                {
                    NpcInfo partner_npc = CreateParterner(image_player, partner);
                    if (partner_npc != null)
                    {
                        target.CreatedPartners.Add(partner.Id, partner_npc);
                        //LogSystem.Error("---parnter {0} hp={1}", partner.Id, partner_npc.GetBaseProperty().HpMax);
                        total_hp += partner_npc.GetBaseProperty().HpMax;
                    }
                }
                //LogSystem.Error("-----challenge target total hp=" + total_hp);
                EntityManager.Instance.CreateUserView(image_player.GetId());
                UserView image_view = EntityManager.Instance.GetUserViewById(image_player.GetId());
                image_view.UpdateEquipment();
                image_view.UpdateXSoulEquip();
            }
            SyncGfxUserInfo(image_player.GetId());
            return(image_player);
        }
Ejemplo n.º 3
0
        public void LoadData(int resId)
        {
            SetLinkId(resId);
            m_LevelupConfig = PlayerConfigProvider.Instance.GetPlayerLevelupConfigById(resId);
            Data_PlayerConfig playerData = PlayerConfigProvider.Instance.GetPlayerConfigById(resId);

            if (null != playerData)
            {
                SetName(playerData.m_Name);
                SetModel(playerData.m_Model);
                SetActionList(playerData.m_ActionList);

                m_AiEquipment      = playerData.m_AiEquipment;
                m_AiAttackSkill    = playerData.m_AiAttackSkill;
                m_AiMoveSkill      = playerData.m_AiMoveSkill;
                m_AiControlSkill   = playerData.m_AiControlSkill;
                m_AiSelfAssitSkill = playerData.m_AiSelfAssitSkill;
                m_AiTeamAssitSkill = playerData.m_AiTeamAssitSkill;
                ///
                GetAiStateInfo().AiLogic = playerData.m_AiLogic;

                m_Scale         = playerData.m_Scale;
                AvoidanceRadius = playerData.m_AvoidanceRadius;
                Shape           = new Circle(new Vector3(0, 0, 0), playerData.m_Radius);

                ViewRange   = playerData.m_ViewRange;
                ReleaseTime = playerData.m_ReleaseTime;
                SuperArmor  = playerData.m_SuperArmor;

                int   hp                 = (int)playerData.m_AttrData.GetAddHpMax(0, 0);
                int   energy             = (int)playerData.m_AttrData.GetAddEpMax(0, 0);
                float moveSpeed          = playerData.m_AttrData.GetAddSpd(0, 0);
                float walkSpeed          = playerData.m_AttrData.GetAddWalkSpd(0, 0);
                float runSpeed           = playerData.m_AttrData.GetAddRunSpd(0, 0);
                int   hpMax              = (int)playerData.m_AttrData.GetAddHpMax(0, 0);
                int   energyMax          = (int)playerData.m_AttrData.GetAddEpMax(0, 0);
                float hpRecover          = playerData.m_AttrData.GetAddHpRecover(0, 0);
                float energyRecover      = playerData.m_AttrData.GetAddEpRecover(0, 0);
                int   attackBase         = (int)playerData.m_AttrData.GetAddAd(0, 0);
                int   aDefenceBase       = (int)playerData.m_AttrData.GetAddADp(0, 0);
                int   mDefenceBase       = (int)playerData.m_AttrData.GetAddMDp(0, 0);
                float critical           = playerData.m_AttrData.GetAddCri(0, 0);
                float criticalPow        = playerData.m_AttrData.GetAddPow(0, 0);
                float criticalBackHitPow = playerData.m_AttrData.GetAddBackHitPow(0, 0);
                float criticalCrackPow   = playerData.m_AttrData.GetAddCrackPow(0, 0);
                float fireDam            = playerData.m_AttrData.GetAddFireDam(0, 0);
                float fireErd            = playerData.m_AttrData.GetAddFireErd(0, 0);
                float iceDam             = playerData.m_AttrData.GetAddIceDam(0, 0);
                float iceErd             = playerData.m_AttrData.GetAddIceErd(0, 0);
                float poisonDam          = playerData.m_AttrData.GetAddPoisonDam(0, 0);
                float poisonErd          = playerData.m_AttrData.GetAddPoisonErd(0, 0);
                float weight             = playerData.m_AttrData.GetAddWeight(0, 0);
                float rps                = playerData.m_AttrData.GetAddRps(0, 0);
                float attackRange        = playerData.m_AttrData.GetAddAttackRange(0, 0);

                m_Combat2IdleTime        = playerData.m_Combat2IdleTime;
                m_Combat2IdleSkill       = playerData.m_Combat2IdleSkill;
                m_Idle2CombatWeaponMoves = playerData.m_Idle2CombatWeaponMoves;
                m_IndicatorEffect        = playerData.m_IndicatorEffect;
                m_IndicatorDis           = playerData.m_IndicatorShowDis;

                GetBaseProperty().SetMoveSpeed(Operate_Type.OT_Absolute, moveSpeed);
                GetBaseProperty().SetWalkSpeed(Operate_Type.OT_Absolute, walkSpeed);
                GetBaseProperty().SetRunSpeed(Operate_Type.OT_Absolute, runSpeed);
                GetBaseProperty().SetHpMax(Operate_Type.OT_Absolute, hpMax);
                GetBaseProperty().SetRageMax(Operate_Type.OT_Absolute, (int)playerData.m_AttrData.GetAddRageMax(0, 0));
                GetBaseProperty().SetEnergyMax(Operate_Type.OT_Absolute, energyMax);
                GetBaseProperty().SetHpRecover(Operate_Type.OT_Absolute, hpRecover);
                GetBaseProperty().SetEnergyRecover(Operate_Type.OT_Absolute, energyRecover);
                GetBaseProperty().SetAttackBase(Operate_Type.OT_Absolute, attackBase);
                GetBaseProperty().SetADefenceBase(Operate_Type.OT_Absolute, aDefenceBase);
                GetBaseProperty().SetMDefenceBase(Operate_Type.OT_Absolute, mDefenceBase);
                GetBaseProperty().SetCritical(Operate_Type.OT_Absolute, critical);
                GetBaseProperty().SetCriticalPow(Operate_Type.OT_Absolute, criticalPow);
                GetBaseProperty().SetCriticalBackHitPow(Operate_Type.OT_Absolute, criticalBackHitPow);
                GetBaseProperty().SetCriticalCrackPow(Operate_Type.OT_Absolute, criticalCrackPow);
                GetBaseProperty().SetFireDamage(Operate_Type.OT_Absolute, fireDam);
                GetBaseProperty().SetFireERD(Operate_Type.OT_Absolute, fireErd);
                GetBaseProperty().SetIceDamage(Operate_Type.OT_Absolute, iceDam);
                GetBaseProperty().SetIceERD(Operate_Type.OT_Absolute, iceErd);
                GetBaseProperty().SetPoisonDamage(Operate_Type.OT_Absolute, poisonDam);
                GetBaseProperty().SetPoisonERD(Operate_Type.OT_Absolute, poisonErd);
                GetBaseProperty().SetWeight(Operate_Type.OT_Absolute, weight);
                GetBaseProperty().SetRps(Operate_Type.OT_Absolute, rps);
                GetBaseProperty().SetAttackRange(Operate_Type.OT_Absolute, attackRange);

                // 技能数据
                if (GetSkillStateInfo().GetAllSkill().Count <= 0)
                {
                    for (int i = 0; i < playerData.m_PreSkillList.Count; i++)
                    {
                        GetSkillStateInfo().AddSkill(new SkillInfo(playerData.m_PreSkillList[i], 1));
                    }
                    for (int i = 0; i < playerData.m_FixedSkillList.Count; i++)
                    {
                        GetSkillStateInfo().AddSkill(new SkillInfo(playerData.m_FixedSkillList[i], 1));
                    }

                    /*
                     * foreach (int id in playerData.m_PreSkillList) {
                     * GetSkillStateInfo().AddSkill(new SkillInfo(id, 1));
                     * }
                     * foreach (int id in playerData.m_FixedSkillList) {
                     * GetSkillStateInfo().AddSkill(new SkillInfo(id, 1));
                     * }*/
                }

                UserAttrCalculator.Calc(this);
                SetHp(Operate_Type.OT_Absolute, GetActualProperty().HpMax);
                SetRage(Operate_Type.OT_Absolute, 0);
                SetEnergy(Operate_Type.OT_Absolute, GetActualProperty().EnergyMax);

                m_Cross2StandTime = playerData.m_Cross2StandTime;
                m_Cross2RunTime   = playerData.m_Cross2RunTime;
            }
        }
Ejemplo n.º 4
0
    public void SaveSelected()
    {
#if UNITY_EDITOR
        // Get player id
        int        id = -1;
        int        normalAttackSkillId = -1;
        List <int> skillList           = new List <int>();

        ArkCrossEngine.FileReaderProxy.MakeSureAllHandlerRegistered();
        ArkCrossEngine.PlayerConfigProvider.Instance.Clear();
        ArkCrossEngine.PlayerConfigProvider.Instance.LoadPlayerConfig(Application.dataPath + "\\StreamingAssets\\Public\\PlayerConfig.txt", "PlayerConfig");
        var players = ArkCrossEngine.PlayerConfigProvider.Instance.PlayerConfigMgr.GetData();
        foreach (var p in players)
        {
            ArkCrossEngine.Data_PlayerConfig cfg = (ArkCrossEngine.Data_PlayerConfig)p.Value;

            if (cfg.m_Model.Contains(gameObject.name))
            {
                id = cfg.m_ActionList[0];
                normalAttackSkillId = cfg.m_FixedSkillList[1];
                skillList           = cfg.m_PreSkillList;
                break;
            }
        }
        // Get npc id
        if (id == -1)
        {
            ArkCrossEngine.NpcConfigProvider.Instance.Clear();
            ArkCrossEngine.NpcConfigProvider.Instance.LoadNpcConfig(Application.dataPath + "\\StreamingAssets\\Public\\NpcConfig.txt", "NPCConfig");

            var npcs = ArkCrossEngine.NpcConfigProvider.Instance.NpcConfigMgr.GetData();
            foreach (var npc in npcs)
            {
                ArkCrossEngine.Data_NpcConfig cfg = (ArkCrossEngine.Data_NpcConfig)npc.Value;

                if (cfg.m_Model.Contains(gameObject.name))
                {
                    id = cfg.m_ActionList[0];
                    break;
                }
            }
        }

        // Error
        if (id == -1)
        {
            UnityEditor.EditorUtility.DisplayDialog("SkillEdit", "没有找到当前选中角色的id,请联系程序!", "OK");
            return;
        }

        // Read ActionConfig.txt
        string[] lineTexts = File.ReadAllLines(Application.dataPath + "\\StreamingAssets\\Public\\ActionConfig.txt");
        for (int i = 1; i < lineTexts.Length; ++i)
        {
            string newLine;
            // idle
            if (_SetActionAnim(lineTexts[i], 角色行动动画配置.idleAnim, id, new int[] { 8, 9, 10, 11, 12, 16 }, out newLine))
            {
                lineTexts[i] = newLine;
            }
            // walk
            if (_SetActionAnim(lineTexts[i], 角色行动动画配置.walkAnim, id, new int[] { 13 }, out newLine))
            {
                lineTexts[i] = newLine;
            }
            // run
            if (_SetActionAnim(lineTexts[i], 角色行动动画配置.runAnim, id, new int[] { 14, 15, 17 }, out newLine))
            {
                lineTexts[i] = newLine;
            }
            // hurt
            if (_SetActionAnim(lineTexts[i], 角色行动动画配置.hurtAnim, id, new int[] { 18, 19, 20 }, out newLine))
            {
                lineTexts[i] = newLine;
            }
            // dead
            if (_SetActionAnim(lineTexts[i], 角色行动动画配置.deadAnim, id, new int[] { 22 }, out newLine))
            {
                lineTexts[i] = newLine;
            }
            // getup
            if (_SetActionAnim(lineTexts[i], 角色行动动画配置.getupAnim, id, new int[] { 28, 29 }, out newLine))
            {
                lineTexts[i] = newLine;
            }
            // airup
            if (_SetActionAnim(lineTexts[i], 角色行动动画配置.airupAnim, id, new int[] { 30 }, out newLine))
            {
                lineTexts[i] = newLine;
            }
            // airdown
            if (_SetActionAnim(lineTexts[i], 角色行动动画配置.airdownAnim, id, new int[] { 31 }, out newLine))
            {
                lineTexts[i] = newLine;
            }
            // airhurt
            if (_SetActionAnim(lineTexts[i], 角色行动动画配置.airhurtAnim, id, new int[] { 32 }, out newLine))
            {
                lineTexts[i] = newLine;
            }
            // airground
            if (_SetActionAnim(lineTexts[i], 角色行动动画配置.airgroundAnim, id, new int[] { 33 }, out newLine))
            {
                lineTexts[i] = newLine;
            }
        }


        // Save
        StreamWriter sw = new StreamWriter(Application.dataPath + "\\StreamingAssets\\Public\\ActionConfig.txt", false, Encoding.UTF8);

        foreach (string s in lineTexts)
        {
            sw.WriteLine(s);
        }
        sw.Flush();
        sw.Close();

        // Load skill files
        ArkCrossEngine.SkillConfigProvider.Instance.Clear();
        ArkCrossEngine.SkillConfigProvider.Instance.CollectData(ArkCrossEngine.SkillConfigType.SCT_SKILL, Application.dataPath + "\\StreamingAssets\\Public\\Skill\\SkillData.txt", "SkillConfig");

        // Normal attack skill
        _GenerateSkillFile(normalAttackSkillId, 普通攻击第一段.技能动画, 普通攻击第一段.攻击类型, 普通攻击第一段.动画长度, true);

        // Other skills
        int[] activeSkillLst = new int[6];
        foreach (int skillId in skillList)
        {
            var cat = _GetSkillCategory(skillId);
            if (cat >= ArkCrossEngine.SkillCategory.kSkillA && cat <= ArkCrossEngine.SkillCategory.kSkillE)
            {
                activeSkillLst[cat - ArkCrossEngine.SkillCategory.kSkillA] = skillId;
            }
        }

        int idx = 0;
        foreach (int skillId in activeSkillLst)
        {
            if (skillId > 0)
            {
                SkillCfg c = 技能配置[idx++];
                if (c.技能动画.Length > 0)
                {
                    _GenerateSkillFile(skillId, c.技能动画, c.攻击类型, c.动画长度, false);
                }
            }
        }

        UnityEditor.EditorUtility.DisplayDialog("SkillEdit", "保存完毕!", "OK");
#endif
    }