Пример #1
0
        internal void SummonPartner(Msg_CR_SummonPartner msg)
        {
            UserInfo userInfo = UserManager.GetUserInfo(msg.obj_id);

            if (null != userInfo)
            {
                // summonpartner
                PartnerInfo partnerInfo = userInfo.GetPartnerInfo();
                if (null != partnerInfo && (TimeUtility.GetServerMilliseconds() - userInfo.LastSummonPartnerTime > partnerInfo.CoolDown || userInfo.LastSummonPartnerTime == 0))
                {
                    Data_Unit data = new Data_Unit();
                    data.m_Id         = -1;
                    data.m_LinkId     = partnerInfo.LinkId;
                    data.m_CampId     = userInfo.GetCampId();
                    data.m_Pos        = userInfo.GetMovementStateInfo().GetPosition3D();
                    data.m_RotAngle   = 0;
                    data.m_AiLogic    = partnerInfo.GetAiLogic();
                    data.m_AiParam[0] = "";
                    data.m_AiParam[1] = "";
                    data.m_AiParam[2] = partnerInfo.GetAiParam().ToString();
                    data.m_IsEnable   = true;
                    NpcInfo npc = NpcManager.AddNpc(data);
                    if (null != npc)
                    {
                        AppendAttributeConfig aac       = AppendAttributeConfigProvider.Instance.GetDataById(partnerInfo.GetAppendAttrConfigId());
                        float inheritAttackAttrPercent  = partnerInfo.GetInheritAttackAttrPercent();
                        float inheritDefenceAttrPercent = partnerInfo.GetInheritDefenceAttrPercent();
                        if (null != aac)
                        {
                            // attack
                            npc.GetBaseProperty().SetAttackBase(Operate_Type.OT_Absolute, (int)(userInfo.GetActualProperty().AttackBase *inheritAttackAttrPercent));
                            npc.GetBaseProperty().SetFireDamage(Operate_Type.OT_Absolute, userInfo.GetActualProperty().FireDamage *inheritAttackAttrPercent);
                            npc.GetBaseProperty().SetIceDamage(Operate_Type.OT_Absolute, userInfo.GetActualProperty().IceDamage *inheritAttackAttrPercent);
                            npc.GetBaseProperty().SetPoisonDamage(Operate_Type.OT_Absolute, userInfo.GetActualProperty().PoisonDamage *inheritAttackAttrPercent);
                            // defence
                            npc.GetBaseProperty().SetHpMax(Operate_Type.OT_Absolute, (int)(userInfo.GetActualProperty().HpMax *inheritDefenceAttrPercent));
                            npc.GetBaseProperty().SetEnergyMax(Operate_Type.OT_Absolute, (int)(userInfo.GetActualProperty().EnergyMax *inheritDefenceAttrPercent));
                            npc.GetBaseProperty().SetADefenceBase(Operate_Type.OT_Absolute, (int)(userInfo.GetActualProperty().ADefenceBase *inheritDefenceAttrPercent));
                            npc.GetBaseProperty().SetMDefenceBase(Operate_Type.OT_Absolute, (int)(userInfo.GetActualProperty().MDefenceBase *inheritDefenceAttrPercent));
                            npc.GetBaseProperty().SetFireERD(Operate_Type.OT_Absolute, userInfo.GetActualProperty().FireERD *inheritDefenceAttrPercent);
                            npc.GetBaseProperty().SetIceERD(Operate_Type.OT_Absolute, userInfo.GetActualProperty().IceERD *inheritDefenceAttrPercent);
                            npc.GetBaseProperty().SetPoisonERD(Operate_Type.OT_Absolute, userInfo.GetActualProperty().PoisonERD *inheritDefenceAttrPercent);
                            // reset hp & energy
                            npc.SetHp(Operate_Type.OT_Absolute, npc.GetBaseProperty().HpMax);
                            npc.SetEnergy(Operate_Type.OT_Absolute, npc.GetBaseProperty().EnergyMax);
                        }
                        npc.SetAIEnable(true);
                        npc.GetSkillStateInfo().RemoveAllSkill();
                        npc.BornTime = TimeUtility.GetServerMilliseconds();
                        List <int> skillList = partnerInfo.GetSkillList();
                        if (null != skillList)
                        {
                            for (int i = 0; i < skillList.Count; ++i)
                            {
                                SkillInfo skillInfo = new SkillInfo(skillList[i]);
                                npc.GetSkillStateInfo().AddSkill(skillInfo);
                            }
                        }
                        userInfo.LastSummonPartnerTime = TimeUtility.GetServerMilliseconds();
                        npc.OwnerId        = userInfo.GetId();
                        userInfo.PartnerId = npc.GetId();
                        if (partnerInfo.BornSkill > 0)
                        {
                            SkillInfo skillInfo = new SkillInfo(partnerInfo.BornSkill);
                            npc.GetSkillStateInfo().AddSkill(skillInfo);
                        }
                        ArkCrossEngineMessage.Msg_RC_CreateNpc builder = DataSyncUtility.BuildCreateNpcMessage(npc);
                        NotifyAllUser(builder);
                    }
                }
            }
        }
Пример #2
0
        private void SummonPartner()
        {
            RoleInfo roleself = LobbyClient.Instance.CurrentRole;

            if (null == roleself)
            {
                return;
            }
            roleself.PartnerStateInfo.ActivePartnerHpPercent = 1.0f;
            if (WorldSystem.Instance.IsPveScene())
            {
                UserInfo playerself = WorldSystem.Instance.GetPlayerSelf();
                if (null == playerself)
                {
                    return;
                }
                ///
                // summonpartner
                PartnerInfo partnerInfo = roleself.PartnerStateInfo.GetActivePartner();
                if (null != partnerInfo && (TimeUtility.GetServerMilliseconds() - playerself.LastSummonPartnerTime > partnerInfo.CoolDown || playerself.LastSummonPartnerTime == 0))
                {
                    Data_Unit data = new Data_Unit();
                    data.m_Id         = -1;
                    data.m_LinkId     = partnerInfo.LinkId;
                    data.m_CampId     = playerself.GetCampId();
                    data.m_Pos        = playerself.GetMovementStateInfo().GetPosition3D();
                    data.m_RotAngle   = 0;
                    data.m_AiLogic    = partnerInfo.GetAiLogic();
                    data.m_AiParam[0] = "";
                    data.m_AiParam[1] = "";
                    data.m_AiParam[2] = partnerInfo.GetAiParam().ToString();
                    data.m_IsEnable   = true;
                    NpcInfo npc = WorldSystem.Instance.NpcManager.AddNpc(data);
                    if (null != npc)
                    {
                        AppendAttributeConfig aac       = AppendAttributeConfigProvider.Instance.GetDataById(partnerInfo.GetAppendAttrConfigId());
                        float inheritAttackAttrPercent  = partnerInfo.GetInheritAttackAttrPercent();
                        float inheritDefenceAttrPercent = partnerInfo.GetInheritDefenceAttrPercent();
                        if (null != aac)
                        {
                            // attack
                            npc.GetBaseProperty().SetAttackBase(Operate_Type.OT_Absolute, (int)(playerself.GetActualProperty().AttackBase *inheritAttackAttrPercent));
                            npc.GetBaseProperty().SetFireDamage(Operate_Type.OT_Absolute, playerself.GetActualProperty().FireDamage *inheritAttackAttrPercent);
                            npc.GetBaseProperty().SetIceDamage(Operate_Type.OT_Absolute, playerself.GetActualProperty().IceDamage *inheritAttackAttrPercent);
                            npc.GetBaseProperty().SetPoisonDamage(Operate_Type.OT_Absolute, playerself.GetActualProperty().PoisonDamage *inheritAttackAttrPercent);
                            // defence
                            npc.GetBaseProperty().SetHpMax(Operate_Type.OT_Absolute, (int)(playerself.GetActualProperty().HpMax *inheritDefenceAttrPercent));
                            npc.GetBaseProperty().SetEnergyMax(Operate_Type.OT_Absolute, (int)(playerself.GetActualProperty().EnergyMax *inheritDefenceAttrPercent));
                            npc.GetBaseProperty().SetADefenceBase(Operate_Type.OT_Absolute, (int)(playerself.GetActualProperty().ADefenceBase *inheritDefenceAttrPercent));
                            npc.GetBaseProperty().SetMDefenceBase(Operate_Type.OT_Absolute, (int)(playerself.GetActualProperty().MDefenceBase *inheritDefenceAttrPercent));
                            npc.GetBaseProperty().SetFireERD(Operate_Type.OT_Absolute, playerself.GetActualProperty().FireERD *inheritDefenceAttrPercent);
                            npc.GetBaseProperty().SetIceERD(Operate_Type.OT_Absolute, playerself.GetActualProperty().IceERD *inheritDefenceAttrPercent);
                            npc.GetBaseProperty().SetPoisonERD(Operate_Type.OT_Absolute, playerself.GetActualProperty().PoisonERD *inheritDefenceAttrPercent);
                            // reset hp & energy
                            npc.SetHp(Operate_Type.OT_Absolute, npc.GetBaseProperty().HpMax);
                            npc.SetEnergy(Operate_Type.OT_Absolute, npc.GetBaseProperty().EnergyMax);
                        }
                        npc.SetAIEnable(true);
                        npc.GetSkillStateInfo().RemoveAllSkill();
                        npc.BornTime = TimeUtility.GetServerMilliseconds();
                        List <int> skillList = partnerInfo.GetSkillList();
                        if (null != skillList)
                        {
                            for (int i = 0; i < skillList.Count; ++i)
                            {
                                SkillInfo skillInfo = new SkillInfo(skillList[i]);
                                npc.GetSkillStateInfo().AddSkill(skillInfo);
                            }
                        }
                        playerself.LastSummonPartnerTime = TimeUtility.GetServerMilliseconds();
                        npc.SkillController  = new SwordManSkillController(npc, GfxModule.Skill.GfxSkillSystem.Instance);
                        npc.OwnerId          = playerself.GetId();
                        playerself.PartnerId = npc.GetId();
                        EntityManager.Instance.CreateNpcView(npc.GetId());
                        if (partnerInfo.BornSkill > 0)
                        {
                            SkillInfo skillInfo = new SkillInfo(partnerInfo.BornSkill);
                            npc.GetSkillStateInfo().AddSkill(skillInfo);
                            npc.SkillController.ForceStartSkill(partnerInfo.BornSkill);
                        }
                        CharacterView view = EntityManager.Instance.GetCharacterViewById(npc.GetId());
                        if (null != view)
                        {
                            GfxSystem.SetLayer(view.Actor, "PhysicObj");
                        }
                        GfxSystem.PublishGfxEvent("ge_partner_summon_result", "ui", true);
                    }
                    else
                    {
                        GfxSystem.PublishGfxEvent("ge_partner_summon_result", "ui", false);
                    }
                }
                else
                {
                    GfxSystem.PublishGfxEvent("ge_partner_summon_result", "ui", false);
                }
            }
            if (WorldSystem.Instance.IsPvpScene() || WorldSystem.Instance.IsMultiPveScene())
            {
                NetworkSystem.Instance.SummonPartner();
            }
        }
Пример #3
0
    //设置选中的伙伴信息
    public void SetPartnerInfo(int partner_id)
    {
        if (uiPartnerList != null && m_SelectedPartnerId != partner_id)
        {
            uiPartnerList.SetPartnerSelected(m_SelectedPartnerId, false);
        }
        RoleInfo roleInfo = LobbyClient.Instance.CurrentRole;

        if (roleInfo != null && roleInfo.PartnerStateInfo.GetAllPartners() != null)
        {
            if (roleInfo.PartnerStateInfo.GetAllPartners().Count > 0)
            {
                EnableLeftPanel(true);
            }
            else
            {
                EnableLeftPanel(false);
            }
        }
        else
        {
            EnableLeftPanel(false);
        }
        m_SelectedPartnerId = partner_id;
        if (IsPlayedPartner(partner_id))
        {
            m_ActivePartnerId = partner_id;
        }
        CompareFighting(m_ActivePartnerId, m_SelectedPartnerId);
        PartnerInfo info = GetPartnerInfoById(partner_id);

        if (info == null)
        {
            return;
        }
        if (info.CurAdditionLevel <= RankOffset.Length)
        {
            if (RankOffset[info.CurAdditionLevel - 1] == 0)
            {
                if (lblRankOffset != null)
                {
                    NGUITools.SetActive(lblRankOffset.gameObject, false);
                }
            }
            else
            {
                if (lblRankOffset != null)
                {
                    NGUITools.SetActive(lblRankOffset.gameObject, true);
                    lblRankOffset.text = "+" + RankOffset[info.CurAdditionLevel - 1];
                }
            }
        }

        if (info.CurAdditionLevel <= RankColor.Length)
        {
            lblRankOffset.color = RankColor[info.CurAdditionLevel - 1];
            spRankColor.color   = RankColor[info.CurAdditionLevel - 1];
            if (lblPartnerName != null)
            {
                lblPartnerName.color = RankColor[info.CurAdditionLevel - 1];
            }
        }
        Data_NpcConfig npcCfg = NpcConfigProvider.Instance.GetNpcConfigById(info.LinkId);

        if (npcCfg != null)
        {
            if (lblPartnerName != null)
            {
                lblPartnerName.text = npcCfg.m_Name;
            }
            if (spPartnerPortrait != null)
            {
                spPartnerPortrait.spriteName = npcCfg.m_Portrait;
            }
        }
        PartnerConfig partnerCfg = PartnerConfigProvider.Instance.GetDataById(info.Id);

        if (partnerCfg != null && lblPartnerCd != null)
        {
            lblPartnerCd.text = partnerCfg.CoolDown.ToString() + "s";
        }
        float inheritAttack = info.GetInheritAttackAttrPercent();

        if (lblInheritAttack != null)
        {
            lblInheritAttack.text = (inheritAttack * 100) + "%";
        }
        float inheritDefence = info.GetInheritDefenceAttrPercent();

        if (lblInheritDefence != null)
        {
            lblInheritDefence.text = (inheritDefence * 100) + "%";
        }
        if (lblPartnerFighting != null)
        {
            lblPartnerFighting.text = "+" + GetPartnerFighting(info.GetAppendAttrConfigId()).ToString();
        }
        EnablePlayedButton(!IsPlayedPartner(partner_id));
        SetLeftSkillInfo(info.Id, info.CurSkillStage);
        SetLeftAppendAttr(info.GetAppendAttrConfigId());
        SetPartnerInfo(info);
        //是否能训练
        bool canUpgrade = false;

        if (CheckCanUpgrade(partner_id))
        {
            canUpgrade = true;
        }
        UnityEngine.Transform tf = transform.Find("left/Buttons/03Lift/Tip");
        if (tf != null)
        {
            NGUITools.SetActive(tf.gameObject, canUpgrade);
        }
    }
Пример #4
0
    //设置伙伴信息
    public void SetPartnerInfo(PartnerInfo info)
    {
        if (null == info)
        {
            return;
        }
        m_PartnerId = info.Id;
        PartnerConfig cfg = PartnerConfigProvider.Instance.GetDataById(info.Id);

        if (cfg != null)
        {
            SetBiographyDesc(cfg.Story);
            SetLiftSkillInfo(cfg, info.CurSkillStage, info.StageUpItemId);
            int currentId        = info.GetAppendAttrConfigId();
            int nextAddtionLevel = info.CurAdditionLevel + 1;
            int nextId           = -1;
            if (nextAddtionLevel <= cfg.AttrAppendList.Count)
            {
                nextId = cfg.AttrAppendList[nextAddtionLevel - 1];
            }
            //设置Current继承属性
            if (nextId == -1)
            {
                //表示已满级
                if (goAttrContainer != null)
                {
                    NGUITools.SetActive(goAttrContainer, false);
                }
                if (goFullLevel != null)
                {
                    NGUITools.SetActive(goFullLevel, true);
                }
                string str_des = StrDictionaryProvider.Instance.GetDictString(705);
                if (lblStrengthenBtn != null)
                {
                    lblStrengthenBtn.text = str_des;
                }
                if (btnStrengthen != null)
                {
                    btnStrengthen.defaultColor = AshColor;
                    btnStrengthen.isEnabled    = false;
                }
            }
            else
            {
                if (goAttrContainer != null && !NGUITools.GetActive(goAttrContainer))
                {
                    NGUITools.SetActive(goAttrContainer, true);
                }
                if (goFullLevel != null && !NGUITools.GetActive(goFullLevel))
                {
                    NGUITools.SetActive(goFullLevel, false);
                }
                string str_des = StrDictionaryProvider.Instance.GetDictString(706);
                if (lblStrengthenBtn != null)
                {
                    lblStrengthenBtn.text = str_des;
                }
                if (btnStrengthen != null)
                {
                    btnStrengthen.defaultColor = LightColor;
                    btnStrengthen.isEnabled    = true;
                }
            }
            float inheritAttack = info.GetInheritAttackAttrPercent();
            if (lblCurrentInheritAttack != null)
            {
                lblCurrentInheritAttack.text = (inheritAttack * 100) + "%";
            }
            float inheritDefence = info.GetInheritDefenceAttrPercent();
            if (lblCurrentInheritDefence != null)
            {
                lblCurrentInheritDefence.text = (inheritDefence * 100) + "%";
            }
            //设置Next继承属性
            inheritAttack = info.GetInheritAttackAttrPercent(nextAddtionLevel);
            if (lblNextInheritAttack != null)
            {
                lblNextInheritAttack.text = (inheritAttack * 100) + "%";
            }
            inheritDefence = info.GetInheritDefenceAttrPercent(nextAddtionLevel);
            if (lblNextInheritDefence != null)
            {
                lblNextInheritDefence.text = (inheritDefence * 100) + "%";
            }
            SetStrengthenAttr(currentId, nextId, info);
        }
    }