コード例 #1
0
        void HandleServerData(ushort protocol, byte[] data)
        {
            switch (protocol)
            {
            case NetMsg.MSG_NWAR_BAR_APPEAR:
            {
                S2CNwarBarAppear pack = S2CPackBase.DeserializePack <S2CNwarBarAppear>(data);

                foreach (PkgNwarBarPos barPos in pack.poss)
                {
                    if (GetCollectionObject((int)(barPos.bar_id)) != null)
                    {
                        RemoveCollectionObject((int)(barPos.bar_id));
                    }
                    Neptune.Collection collection = Neptune.DataManager.Instance.Data.GetNode <Neptune.Collection>((int)(barPos.bar_id));
                    if (collection != null)
                    {
                        collection.ExcelId  = barPos.type;
                        collection.Position = PhysicsHelp.GetPosition(barPos.pos.px * GlobalConst.UnitScale, barPos.pos.py * GlobalConst.UnitScale);
                        CreateCollectionObject(collection);
                    }
                    else
                    {
                        CreateCollectionObject((int)barPos.bar_id, barPos.type, PhysicsHelp.GetPosition(barPos.pos.px * GlobalConst.UnitScale, barPos.pos.py * GlobalConst.UnitScale));
                    }
                }

                ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_COLLECTION_OBJECTS_COUNT_CHANGED, null);

                break;
            }

            case NetMsg.MSG_NWAR_BAR_DISAPPEAR:
            {
                S2CNwarBarDisappear pack = S2CPackBase.DeserializePack <S2CNwarBarDisappear>(data);

                RemoveCollectionObject((int)(pack.bar_id));

                ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_COLLECTION_OBJECTS_COUNT_CHANGED, null);

                break;
            }

            default:
                break;
            }
        }
コード例 #2
0
        public void HandleServerData(ushort protocol, byte[] data)
        {
            switch (protocol)
            {
            case NetMsg.MSG_NWAR_BAR_READ_FINISH:
            {
                S2CNwarBarReadFinish pack = S2CPackBase.DeserializePack <S2CNwarBarReadFinish>(data);

                if (pack.bar_id == mId)
                {
                    InterruptCollect(false);
                }

                break;
            }

            case NetMsg.MSG_NWAR_BAR_READ_FAIL:
            {
                S2CNwarBarReadFail pack = S2CPackBase.DeserializePack <S2CNwarBarReadFail>(data);

                if (pack.bar_id == mId)
                {
                    InterruptCollect(false);
                }

                break;
            }

            case NetMsg.MSG_NWAR_BAR_DISAPPEAR:
            {
                S2CNwarBarDisappear pack = S2CPackBase.DeserializePack <S2CNwarBarDisappear>(data);

                HandleBarDisappear(pack.bar_id);

                break;
            }

            default:
                break;
            }
        }