Exemplo n.º 1
0
        internal static ArkCrossEngineMessage.ArenaInfoMsg CreateArenaInfoMsg(ArenaInfo entity, bool is_detail = true)
        {
            if (null == entity)
            {
                return(null);
            }
            ArkCrossEngineMessage.ArenaInfoMsg info_msg = new ArkCrossEngineMessage.ArenaInfoMsg();
            info_msg.Guid       = entity.GetId();
            info_msg.HeroId     = entity.HeroId;
            info_msg.Level      = entity.Level;
            info_msg.NickName   = entity.NickName;
            info_msg.Rank       = entity.GetRank();
            info_msg.FightScore = entity.FightScore;

            foreach (PartnerInfo partner in entity.FightPartners)
            {
                ArkCrossEngineMessage.PartnerDataMsg partner_msg = new ArkCrossEngineMessage.PartnerDataMsg();
                partner_msg.Id            = partner.Id;
                partner_msg.AdditionLevel = partner.CurAdditionLevel;
                partner_msg.SkillStage    = partner.CurSkillStage;
                info_msg.FightParters.Add(partner_msg);
            }
            if (!is_detail)
            {
                return(info_msg);
            }
            if (entity.ActivePartner != null)
            {
                ArkCrossEngineMessage.PartnerDataMsg active_partner_msg = new ArkCrossEngineMessage.PartnerDataMsg();
                active_partner_msg.Id            = entity.ActivePartner.Id;
                active_partner_msg.AdditionLevel = entity.ActivePartner.CurAdditionLevel;
                active_partner_msg.SkillStage    = entity.ActivePartner.CurSkillStage;
                info_msg.ActivePartner           = active_partner_msg;
            }

            foreach (ItemInfo item in entity.EquipInfo)
            {
                ArkCrossEngineMessage.ItemDataMsg equip = new ArkCrossEngineMessage.ItemDataMsg();
                equip.ItemId = item.ItemId;
                equip.Level  = item.Level;
                equip.Num    = item.ItemNum;
                info_msg.EquipInfo.Add(equip);
            }
            foreach (SkillDataInfo skill in entity.SkillDataInfo)
            {
                ArkCrossEngineMessage.SkillDataInfo skill_msg = new ArkCrossEngineMessage.SkillDataInfo();
                skill_msg.ID       = skill.ID;
                skill_msg.Level    = skill.Level;
                skill_msg.Postions = (int)skill.Postions.Presets[0];
                info_msg.ActiveSkills.Add(skill_msg);
            }
            foreach (ArenaItemInfo legacy in entity.LegacyInfo)
            {
                ArkCrossEngineMessage.LegacyDataMsg legacy_msg = new ArkCrossEngineMessage.LegacyDataMsg();
                legacy_msg.ItemId         = legacy.ItemId;
                legacy_msg.Level          = legacy.Level;
                legacy_msg.AppendProperty = legacy.AppendProperty;
                legacy_msg.IsUnlock       = legacy.IsUnlocked;
                info_msg.LegacyAttr.Add(legacy_msg);
            }
            foreach (ArenaXSoulInfo xsoul in entity.XSoulInfo)
            {
                ArkCrossEngineMessage.XSoulDataMsg msg = new ArkCrossEngineMessage.XSoulDataMsg();
                msg.ItemId     = xsoul.ItemId;
                msg.Level      = xsoul.Level;
                msg.Experience = xsoul.Experience;
                msg.ModelLevel = xsoul.ModelLevel;
                info_msg.XSouls.Add(msg);
            }
            return(info_msg);
        }
Exemplo n.º 2
0
        private void SyncCombatData(UserInfo ui)
        {
            JsonMessageWithGuid syncCombatDataMsg = new JsonMessageWithGuid(JsonMessageID.SyncCombatData);

            syncCombatDataMsg.m_Guid = ui.Guid;
            ArkCrossEngineMessage.Msg_LC_SyncCombatData protoData = new ArkCrossEngineMessage.Msg_LC_SyncCombatData();
            int legacyCount = ui.Legacy.SevenArcs.Length;

            if (legacyCount > 0)
            {
                for (int i = 0; i < legacyCount; ++i)
                {
                    ArkCrossEngineMessage.LegacyDataMsg legacy_data = new ArkCrossEngineMessage.LegacyDataMsg();
                    legacy_data.ItemId         = ui.Legacy.SevenArcs[i].ItemId;
                    legacy_data.Level          = ui.Legacy.SevenArcs[i].Level;
                    legacy_data.AppendProperty = ui.Legacy.SevenArcs[i].AppendProperty;
                    legacy_data.IsUnlock       = ui.Legacy.SevenArcs[i].IsUnlock;
                    protoData.m_Legacys.Add(legacy_data);
                }
            }
            foreach (ItemInfo item in ui.XSoul.GetAllXSoulPartData().Values)
            {
                ArkCrossEngineMessage.XSoulDataMsg item_msg = new ArkCrossEngineMessage.XSoulDataMsg();
                item_msg.ItemId     = item.ItemId;
                item_msg.Level      = item.Level;
                item_msg.Experience = item.Experience;
                item_msg.ModelLevel = item.ShowModelLevel;
                protoData.m_XSouls.Add(item_msg);
            }
            for (int i = 0; i < ui.Skill.Skills.Count; ++i)
            {
                if (ui.Skill.Skills[i].Postions.Presets[0] != SlotPosition.SP_None)
                {
                    ArkCrossEngineMessage.SkillDataInfo skill_data = new ArkCrossEngineMessage.SkillDataInfo();
                    skill_data.ID       = ui.Skill.Skills[i].ID;
                    skill_data.Level    = ui.Skill.Skills[i].Level;
                    skill_data.Postions = (int)ui.Skill.Skills[i].Postions.Presets[0];
                    protoData.m_Skills.Add(skill_data);
                }
            }
            for (int i = 0; i < ui.Equip.Armor.Length; ++i)
            {
                if (null != ui.Equip.Armor[i])
                {
                    ArkCrossEngineMessage.ItemDataMsg equip = new ArkCrossEngineMessage.ItemDataMsg();
                    equip.ItemId         = ui.Equip.Armor[i].ItemId;
                    equip.Level          = ui.Equip.Armor[i].Level;
                    equip.AppendProperty = ui.Equip.Armor[i].AppendProperty;
                    protoData.m_Equipments.Add(equip);
                }
            }
            ArkCrossEngineMessage.SelectedPartnerDataMsg partnerData = new ArkCrossEngineMessage.SelectedPartnerDataMsg();
            PartnerInfo partnerInfo = ui.PartnerStateInfo.GetActivePartner();

            if (null != partnerInfo)
            {
                partnerData.m_Id            = partnerInfo.Id;
                partnerData.m_SkillStage    = partnerInfo.CurSkillStage;
                partnerData.m_AdditionLevel = partnerInfo.CurAdditionLevel;
            }
            else
            {
                partnerData.m_Id            = 0;
                partnerData.m_SkillStage    = 0;
                partnerData.m_AdditionLevel = 0;
            }
            protoData.m_PartnerData       = partnerData;
            syncCombatDataMsg.m_ProtoData = protoData;
            JsonMessageDispatcher.SendDcoreMessage(ui.NodeName, syncCombatDataMsg);
        }