Exemplo n.º 1
0
 public virtual void OnAttackedHitFix(AttackedHitStatusFix status)
 {
     if (enableSend && owner.IsOriginal())
     {
         bool flag = false;
         if (status.afterHP <= 0)
         {
             flag = true;
         }
         if (status.breakRegion)
         {
             flag = true;
         }
         Coop_Model_ObjectAttackedHitFix coop_Model_ObjectAttackedHitFix = new Coop_Model_ObjectAttackedHitFix();
         coop_Model_ObjectAttackedHitFix.id = owner.id;
         coop_Model_ObjectAttackedHitFix.SetAttackedHitStatus(status);
         if (flag)
         {
             SendBroadcast(coop_Model_ObjectAttackedHitFix, true, null, delegate(Coop_Model_Base send_model)
             {
                 if (owner == null)
                 {
                     return(false);
                 }
                 Coop_Model_ObjectAttackedHitFix coop_Model_ObjectAttackedHitFix2 = send_model as Coop_Model_ObjectAttackedHitFix;
                 Character character = owner as Character;
                 if (character != null)
                 {
                     coop_Model_ObjectAttackedHitFix2.afterHP = character.hp;
                     Player player = owner as Player;
                     if (player != null)
                     {
                         coop_Model_ObjectAttackedHitFix2.afterHealHp = player.healHp;
                     }
                     if (coop_Model_ObjectAttackedHitFix2.afterHP > 0 && coop_Model_ObjectAttackedHitFix2.reactionType == 8)
                     {
                         coop_Model_ObjectAttackedHitFix2.reactionType = 0;
                     }
                 }
                 return(true);
             });
         }
         else
         {
             SendBroadcast(coop_Model_ObjectAttackedHitFix, false, null, null);
         }
     }
 }
Exemplo n.º 2
0
    private void Test2()
    {
        //IL_0043: Unknown result type (might be due to invalid IL or missing references)
        //IL_0095: Unknown result type (might be due to invalid IL or missing references)
        MemoryStream memoryStream = new MemoryStream();
        Coop_Model_ObjectAttackedHitFix coop_Model_ObjectAttackedHitFix = new Coop_Model_ObjectAttackedHitFix();

        coop_Model_ObjectAttackedHitFix.hitPos.x = 1f;
        coop_Model_ObjectAttackedHitFix.hitPos.y = 2.3f;
        coop_Model_ObjectAttackedHitFix.hitPos.z = 3.45f;
        Log("before pos=" + coop_Model_ObjectAttackedHitFix.hitPos);
        Type typeFromHandle = typeof(Coop_Model_ObjectAttackedHitFix);
        IMessagePackSingleObjectSerializer serializer = context.GetSerializer(typeFromHandle);

        serializer.Pack(memoryStream, coop_Model_ObjectAttackedHitFix);
        memoryStream.Position = 0L;
        Coop_Model_ObjectAttackedHitFix coop_Model_ObjectAttackedHitFix2 = (Coop_Model_ObjectAttackedHitFix)serializer.Unpack(memoryStream);

        Log("after pos=" + coop_Model_ObjectAttackedHitFix2.hitPos);
        string str = JSONSerializer.Serialize(coop_Model_ObjectAttackedHitFix, typeFromHandle);

        Log("json stream:" + str);
    }
Exemplo n.º 3
0
    protected override bool HandleCoopEvent(CoopPacket packet)
    {
        switch (packet.packetType)
        {
        case PACKET_TYPE.OBJECT_DESTROY:
            if (owner is Self)
            {
                return(true);
            }
            return(owner.DestroyObject());

        case PACKET_TYPE.OBJECT_ATTACKED_HIT_OWNER:
        {
            Coop_Model_ObjectAttackedHitOwner model5 = packet.GetModel <Coop_Model_ObjectAttackedHitOwner>();
            model5.CopyAttackedHitStatus(out AttackedHitStatusOwner status2);
            if (owner.IsEnableAttackedHitOwner())
            {
                owner.OnAttackedHitOwner(status2);
                AttackedHitStatusFix status3 = new AttackedHitStatusFix(status2.origin);
                owner.OnAttackedHitFix(status3);
                if (owner.packetSender != null)
                {
                    owner.packetSender.OnAttackedHitFix(status3);
                }
            }
            break;
        }

        case PACKET_TYPE.OBJECT_ATTACKED_HIT_FIX:
        {
            Coop_Model_ObjectAttackedHitFix model4 = packet.GetModel <Coop_Model_ObjectAttackedHitFix>();
            model4.CopyAttackedHitStatus(out AttackedHitStatusFix status);
            owner.OnAttackedHitFix(status);
            break;
        }

        case PACKET_TYPE.OBJECT_KEEP_WAITING_PACKET:
        {
            Coop_Model_ObjectKeepWaitingPacket model3 = packet.GetModel <Coop_Model_ObjectKeepWaitingPacket>();
            owner.KeepWaitingPacket((StageObject.WAITING_PACKET)model3.type);
            break;
        }

        case PACKET_TYPE.OBJECT_BULLET_OBSERVABLE_SET:
        {
            Coop_Model_ObjectBulletObservableSet model2 = packet.GetModel <Coop_Model_ObjectBulletObservableSet>();
            owner.RegisterObservableID(model2.observedID);
            break;
        }

        case PACKET_TYPE.OBJECT_BULLET_OBSERVABLE_BROKEN:
        {
            Coop_Model_ObjectBulletObservableBroken model = packet.GetModel <Coop_Model_ObjectBulletObservableBroken>();
            owner.OnBreak(model.observedID);
            break;
        }

        default:
            Log.Warning(LOG.COOP, "not valid packet");
            return(true);
        }
        return(true);
    }