Example #1
0
    public void Deserialize(PacketReader stream)
    {
        int mask = stream.ReadInt32();

        if ((mask & (int)ENSerializeMask.enSerializeDirty) > 0)
        {
            Debug.Log("Sync item bag error, mask & enSerializeDirty > 0 ");
            return;
        }
        byte version = stream.ReadByte();
        int  count   = stream.ReadInt32();

        m_items.Clear();
        //MyEquips.Singleton.myEquips.Clear();
        CSItemSegmentDefine segmentDef = CSItemSegmentDefine.Singleton;

        for (uint i = 0; i < count; i++)
        {
            CSItem item = new CSItem();
            item.m_guid.m_lowPart  = stream.ReadInt32();
            item.m_guid.m_highPart = stream.ReadInt32();
            item.m_id   = stream.ReadInt16();
            item.m_flag = stream.ReadInt16();
            int readDataLength = stream.ReadInt32();
            item.Init();
            for (int seg = 0; seg <= segmentDef.MaxSegmentType; seg++)
            {
                if ((item.m_flag & (0x1 << seg)) > 0)
                {
                    readDataLength -= segmentDef.ReadSegment(item, seg, stream, readDataLength);
                }
            }
            stream.Seek(readDataLength, SeekOrigin.Current);
            //MyEquips.Singleton.myEquips.Add(item.m_guid, item);
            AddItem(item);
            item.Init();
        }
    }
Example #2
0
    public void OnMsgSyncBagItem_S2C(PacketReader p, object state)
    {
        Debug.Log("OnMsgSyncBagItem_S2C");
        int    optType = p.ReadInt32();
        CSItem item    = new CSItem();

        item.Read(p);
        item.Init();
        CSItem userItem = User.Singleton.ItemBag.GetItemByGuid(item.m_guid);

        if (userItem == null)
        {
            userItem = item;
            User.Singleton.ItemBag.AddItem(item);

            BattleSummary.Singleton.SummaryGetNewCard(item.m_id);
            // 更新背包提示 获得新卡的数量
            MainButtonList.Singleton.GotNewCard();
            User.Singleton.GetCardChangeIllustrated(item.m_id);
        }
        else
        {
            userItem.ReplaceSegmentData(item);
        }

        // 背包更新
        CardBag.Singleton.OnUpdateCardBag();
        switch (optType)
        {
        // 进化
        case (int)ENPlayerCardOptTypen.enCardEvolve:
        {
            Loading.Singleton.Hide();
            CardEvolution.Singleton.OnHeroCardEvolve(item.Guid);
            break;
        }

        // 强化
        case (int)ENPlayerCardOptTypen.enCardMerge:
        {
            Loading.Singleton.Hide();
            Debug.Log("强化成功后的 卡牌  item.Exp:" + userItem.Exp + ",item.Level:" + userItem.Level + ",userItem.IDInTable:" + userItem.IDInTable + ",userItem:" + userItem.Guid.m_lowPart + "," + userItem.Guid.m_highPart);
            CardUpdateProp.Singleton.OnS2CLevelUpSuccess(item.Guid);
            break;
        }
        }
    }
Example #3
0
    public void OnClickDemoButton(GameObject obj)
    {
        int floorId = 20101;

        SM.RandomRoomLevel.Singleton.m_curFloorId = floorId;
        CSItem item = null;

        Helper helper = User.Singleton.HelperList.LookupHelper(StageMenu.Singleton.m_curHelperGuid);

        if (null != helper)
        {
            item             = new CSItem();
            item.m_guid      = helper.m_cardGuid;
            item.IDInTable   = (short)helper.m_cardId;
            item.Level       = helper.m_cardLevel;
            item.BreakCounts = helper.m_cardBreakCounts;

            item.Init();

            // 测试用
            HeroInfo heroInfo = GameTable.HeroInfoTableAsset.Lookup(helper.m_cardId);
            if (null != heroInfo)
            {
                List <int> skillIDList = heroInfo.GetAllSkillIDList();
                foreach (int skillId in skillIDList)
                {
                    HeroCardSkill info = new HeroCardSkill();
                    info.m_skillID = skillId;

                    item.AddSkill(info);
                }
                foreach (var item1 in heroInfo.PassiveSkillIDList)
                {//被动技能
                    HeroCardSkill info = new HeroCardSkill();
                    info.m_skillID = item1;

                    item.AddSkill(info);
                }
            }
        }

        Team.Singleton.Comrade = item;
        BattleArena.Singleton.PrepareEnterDungeons();
//         MainGame.Singleton.CurrentState.SwitchNexted = true;
//         StageMenu.Singleton.m_isReqHelpData = true;
    }
Example #4
0
    // 进入战斗准备界面
    void OnHelperConfirm(object sender)
    {
        HideHelper();

        CSItem item = null;

        Helper helper = User.Singleton.HelperList.LookupHelper(StageMenu.Singleton.m_curHelperGuid);

        if (null != helper)
        {
            item             = new CSItem();
            item.m_guid      = helper.m_cardGuid;
            item.IDInTable   = (short)helper.m_cardId;
            item.Level       = helper.m_cardLevel;
            item.BreakCounts = helper.m_cardBreakCounts;

            item.Init();

            // 测试用
            HeroInfo heroInfo = GameTable.HeroInfoTableAsset.Lookup(helper.m_cardId);
            if (null != heroInfo)
            {
                List <int> skillIDList = heroInfo.GetAllSkillIDList();
                foreach (int skillId in skillIDList)
                {
                    HeroCardSkill info = new HeroCardSkill();
                    info.m_skillID = skillId;

                    item.AddSkill(info);
                }
                foreach (var item1 in heroInfo.PassiveSkillIDList)
                {//被动技能
                    HeroCardSkill info = new HeroCardSkill();
                    info.m_skillID = item1;

                    item.AddSkill(info);
                }
            }
        }

        Team.Singleton.Comrade = item;
        BattleArena.Singleton.PrepareEnterDungeons();
        //UpdateBattlePreparation();
    }
Example #5
0
    // 离线状态的 增加卡牌 纯客户端处理 测试用
    public void AddCardOffLine(int cardId)
    {
        int index = m_GuidIndex++;

        CSItemGuid guid = new CSItemGuid();

        guid.m_lowPart = index;

        CSItem item = new CSItem();

        item.Level     = 1;
        item.Love      = false;
        item.Exp       = 2;
        item.GotTime   = (uint)UnityEngine.Time.time;
        item.IDInTable = (short)cardId;
        item.Guid      = guid;

        item.Init();

        AddCard(item);
    }