Exemplo n.º 1
0
    void SetRoleDynamicProperty()
    {
        ArkCrossEngine.RoleInfo player = ArkCrossEngine.LobbyClient.Instance.CurrentRole;
        if (player != null)
        {
            if (labellv != null)
            {
                labellv.text = "" + player.Level;
            }
            RoleInfo ri = ArkCrossEngine.LobbyClient.Instance.CurrentRole;
            if (ri != null)
            {
                UserInfo ui = ri.GetPlayerSelfInfo();
                if (ui != null)
                {
                    CharacterProperty cp = ui.GetActualProperty();
                    if (cp != null)
                    {
                        if (labellvfight != null)
                        {
                            labellvfight.text = cp.AttackBase.ToString();
                        }
                    }
                }
            }

            if (money != null)
            {
                money.text = player.Money.ToString();
            }
            if (diamond != null)
            {
                diamond.text = player.Gold.ToString();
            }
            int needexp = 0;
            ArkCrossEngine.PlayerLevelupExpConfig plec = ArkCrossEngine.PlayerConfigProvider.Instance.GetPlayerLevelupExpConfigById(player.HeroId);
            if (plec != null)
            {
                needexp = plec.m_ConsumeExp;
            }

            UpdateEx(player.Level, player.Exp);

            if (labelhpmax != null)
            {
                ArkCrossEngine.UserInfo ui = player.GetPlayerSelfInfo();
                if (ui != null)
                {
                    ArkCrossEngine.CharacterProperty cp = ui.GetActualProperty();
                    if (cp != null)
                    {
                        labelhpmax.text = cp.HpMax.ToString();
                    }
                }
            }
        }
    }
Exemplo n.º 2
0
 private void HeroUpdateProperty(ArkCrossEngine.CharacterProperty info, ArkCrossEngine.Network.GeneralOperationResult result)
 {
     try
     {
         if (result == ArkCrossEngine.Network.GeneralOperationResult.LC_Succeed)
         {
             UnityEngine.Transform tfroot = transform;
             if (tfroot != null)
             {
                 UnityEngine.Transform tf = tfroot.Find("RoleInfo/DragThing/Right0");
                 if (tf != null)
                 {
                     UILabel ul = tf.gameObject.GetComponent <UILabel>();
                     if (ul != null)
                     {
                         string str = "[ffffff]";
                         if (info != null)
                         {
                             str += info.AttackBase + "\n";
                             str += FormatDecimal(info.Critical * 100) + "%\n";
                             str += FormatDecimal(info.CriticalPow * 100) + "%\n";
                             str += FormatDecimal(info.CriticalBackHitPow * 100) + "%\n";
                             str += FormatDecimal(info.CriticalCrackPow * 100) + "%\n";
                             str += FormatDecimal(info.FireDamage) + "\n";
                             str += FormatDecimal(info.IceDamage) + "\n";
                             str += FormatDecimal(info.PoisonDamage) + "[-]";
                         }
                         ul.text = str;
                     }
                 }
                 tf = tfroot.Find("RoleInfo/DragThing/Right1");
                 if (tf != null)
                 {
                     UILabel ul = tf.gameObject.GetComponent <UILabel>();
                     if (ul != null)
                     {
                         string str = "[ffffff]";
                         if (info != null)
                         {
                             str += info.HpMax + "\n";
                             str += info.ADefenceBase + "\n";
                             str += info.MDefenceBase + "\n";
                             str += FormatDecimal(info.FireERD) + "\n";
                             str += FormatDecimal(info.IceERD) + "\n";
                             str += FormatDecimal(info.PoisonERD) + "[-]";
                         }
                         ul.text = str;
                     }
                 }
                 tf = tfroot.Find("RoleInfo/DragThing/Right2");
                 if (tf != null)
                 {
                     UILabel ul = tf.gameObject.GetComponent <UILabel>();
                     if (ul != null)
                     {
                         string str = "[ffffff]";
                         if (info != null)
                         {
                             str += "+" + FormatDecimal(info.MoveSpeed * 100) + "%\n";
                             str += FormatDecimal(info.HpRecover) + "/5S\n";
                             str += FormatDecimal(info.EnergyRecover) + "/5S\n";
                             str += "+" + /*info.EnergyRecover * 10*/ 0 + "%\n";
                         }
                         ul.text = str;
                     }
                 }
             }
         }
         else
         {
             ArkCrossEngine.LogicSystem.EventChannelForGfx.Publish("ge_show_dialog", "ui", result.ToString(), "understand", null, null, null, false);
         }
     }
     catch (Exception ex)
     {
         ArkCrossEngine.LogicSystem.LogFromGfx("[Error]:Exception:{0}\n{1}", ex.Message, ex.StackTrace);
     }
 }
Exemplo n.º 3
0
        public static NpcInfo SummonNpc(int id, int owner_id, int owner_skillid, int npc_type_id,
                                        string modelPrefab, int skillid,
                                        int ailogicid, bool followsummonerdead,
                                        float x, float y, float z, string aiparamstr, int signforskill, bool isSimulate = false,
                                        bool is_start_skill = true)
        {
            CharacterInfo charObj = WorldSystem.Instance.GetCharacterById(owner_id);

            if (charObj == null)
            {
                return(null);
            }
            Data_Unit data = new Data_Unit();

            data.m_Id       = -1;
            data.m_LinkId   = npc_type_id;
            data.m_CampId   = charObj.GetCampId();
            data.m_IsEnable = true;
            data.m_Pos      = new Vector3(x, y, z);
            data.m_RotAngle = 0;
            data.m_AiLogic  = ailogicid;
            if (!string.IsNullOrEmpty(aiparamstr))
            {
                string[] strarry = aiparamstr.Split(new char[] { ',' }, 8);
                int      i       = 0;
                foreach (string str in strarry)
                {
                    data.m_AiParam[i++] = str;
                }
            }
            NpcInfo npc;

            if (id <= 0)
            {
                npc = WorldSystem.Instance.NpcManager.AddNpc(data);
            }
            else
            {
                npc = WorldSystem.Instance.NpcManager.AddNpc(id, data);
            }
            if (WorldSystem.Instance.IsExpeditionScene() || WorldSystem.Instance.IsMultiPveScene())
            {
                float             fightscore = 0;
                CharacterProperty info       = charObj.GetActualProperty();
                if (null != info)
                {
                    CharacterProperty base_info                  = charObj.GetBaseProperty();
                    float             assit_critical_pow         = (null != base_info ? info.CriticalPow - base_info.CriticalPow : info.CriticalPow);
                    float             assit_critical_backhit_pow = (null != base_info ? info.CriticalBackHitPow - base_info.CriticalBackHitPow : info.CriticalBackHitPow);
                    float             assit_critical_crack_pow   = (null != base_info ? info.CriticalCrackPow - base_info.CriticalCrackPow : info.CriticalCrackPow);
                    fightscore = AttributeScoreConfigProvider.Instance.CalcAttributeScore(info.HpMax,
                                                                                          info.EnergyMax, info.AttackBase, info.ADefenceBase, info.MDefenceBase, info.Critical,
                                                                                          assit_critical_pow, assit_critical_backhit_pow, assit_critical_crack_pow, info.FireDamage,
                                                                                          info.IceDamage, info.PoisonDamage, info.FireERD, info.IceERD, info.PoisonERD) + charObj.GetSkillStateInfo().GetSkillAppendScore();
                }
                WorldSystem.Instance.AdditionNpcAttr(npc, Mathf.FloorToInt(fightscore));
            }
            if (!string.IsNullOrEmpty(modelPrefab))
            {
                npc.SetModel(modelPrefab);
            }
            npc.FollowSummonerDead = followsummonerdead;
            SkillInfo skillinfo = new SkillInfo(skillid);

            npc.GetSkillStateInfo().AddSkill(skillinfo);
            npc.SkillController = new SwordManSkillController(npc, GfxModule.Skill.GfxSkillSystem.Instance);
            npc.GetMovementStateInfo().SetPosition(data.m_Pos);
            npc.SummonOwnerId = charObj.GetId();
            npc.SignForSkill  = signforskill;
            EntityManager.Instance.CreateNpcView(npc.GetId());
            charObj.GetSkillStateInfo().AddSummonObject(npc);
            NpcView       npcview    = EntityManager.Instance.GetNpcViewById(npc.GetId());
            CharacterView owner_view = EntityManager.Instance.GetCharacterViewById(charObj.GetId());

            npcview.ObjectInfo.SummonOwnerActorId = owner_view.Actor;
            npcview.ObjectInfo.SummonOwnerSkillId = owner_skillid;
            npcview.ObjectInfo.SignForSkill       = signforskill;
            npcview.ObjectInfo.IsSimulate         = isSimulate;
            if (ailogicid > 0)
            {
                npcview.ObjectInfo.IsSummonWithAI = true;
            }
            //LogSystem.Debug("---summon npc: issimulate=" + isSimulate);
            owner_view.ObjectInfo.Summons.Add(npcview.Actor);

            if (is_start_skill)
            {
                npc.SkillController.ForceStartSkill(skillid);
            }
            //LogSystem.Debug("---create summon npc over!");
            return(npc);
        }