Exemplo n.º 1
0
 public void SendPacket_Ring(OnlinePacket packet)
 {
     using (RTData data = RTData.Get()) {
         data.SetVector3(1, packet.position);
         data.SetVector3(2, packet.rotation);
         data.SetVector3(3, packet.velocity);
         session.SendData(101, GameSparksRT.DeliveryIntent.RELIABLE, data);
     }
 }
Exemplo n.º 2
0
 public void SendPacket_Field(OnlinePacket packet)
 {
     using (RTData data = RTData.Get()) {
         data.SetInt(1, packet.cola_score);
         data.SetInt(2, packet.pepsi_score);
         data.SetString(3, packet.cola_bottles);
         data.SetString(4, packet.pepsi_bottles);
         session.SendData(102, GameSparksRT.DeliveryIntent.RELIABLE, data);
     }
 }
Exemplo n.º 3
0
    void PacketRecieved_Field(RTPacket rt_packet)
    {
        OnlinePacket packet = new OnlinePacket(
            2,
            new Score((int)rt_packet.Data.GetInt(1), (int)rt_packet.Data.GetInt(2)),
            (string)rt_packet.Data.GetString(3),
            (string)rt_packet.Data.GetString(4)
            );

        ManagersController.Message(Message.Create(this, MessageData.EVENT_RECIEVE_PACKET, packet));
    }
Exemplo n.º 4
0
    void PacketRecieved_Ring(RTPacket rt_packet)
    {
        OnlinePacket packet = new OnlinePacket(
            1,
            new Vector3(rt_packet.Data.GetVector3(1).Value.x, rt_packet.Data.GetVector3(1).Value.y, rt_packet.Data.GetVector3(1).Value.z),
            new Vector3(rt_packet.Data.GetVector3(2).Value.x, rt_packet.Data.GetVector3(2).Value.y, rt_packet.Data.GetVector3(2).Value.z),
            new Vector3(rt_packet.Data.GetVector3(3).Value.x, rt_packet.Data.GetVector3(3).Value.y, rt_packet.Data.GetVector3(3).Value.z)
            );

        ManagersController.Message(Message.Create(this, MessageData.EVENT_RECIEVE_PACKET, packet));
    }
Exemplo n.º 5
0
 static void SendPacket(OnlinePacket packet)
 {
     if (packet.id == 1)
     {
         GameSparksManager.Instance.SendPacket_Ring(packet);
     }
     if (packet.id == 2)
     {
         GameSparksManager.Instance.SendPacket_Field(packet);
     }
 }
Exemplo n.º 6
0
 public void SendRingShootInfo(Vector3 velocity)
 {
     if (GameManager.Instance.currentMode == GameMode.MultiplayerOnline)
     {
         OnlinePacket packet = new OnlinePacket(
             1,
             transform.position,
             transform.rotation.eulerAngles,
             velocity
             );
         ManagersController.Message(Message.Create(this, MessageData.EVENT_SEND_PACKET, packet));
     }
 }
Exemplo n.º 7
0
    static void RecievePacket(OnlinePacket packet)
    {
        if (packet.id == 1)
        {
            GameManager.Instance.SetOnlineShoot(
                packet.position,
                packet.rotation,
                packet.velocity
                );
        }
        if (packet.id == 2)
        {
            List <string> temp;

            List <bool> cola_bottles = new List <bool> ();
            temp = packet.cola_bottles.Split(',').ToList();
            foreach (string s in temp)
            {
                if (s == "1")
                {
                    cola_bottles.Add(true);
                }
                else if (s == "0")
                {
                    cola_bottles.Add(false);
                }
            }

            List <bool> pepsi_bottles = new List <bool> ();
            temp = packet.pepsi_bottles.Split(',').ToList();
            foreach (string s in temp)
            {
                if (s == "1")
                {
                    pepsi_bottles.Add(true);
                }
                else if (s == "0")
                {
                    pepsi_bottles.Add(false);
                }
            }

            GameManager.Instance.SetOnlineScore(new Score(packet.cola_score, packet.pepsi_score), cola_bottles, pepsi_bottles);
        }
    }
Exemplo n.º 8
0
    void SendFieldStateInfo(Score score_info)
    {
        string cola_state = "";

        foreach (bool b in cola_bottles_state)
        {
            if (b)
            {
                cola_state += "1";
            }
            else
            {
                cola_state += "0";
            }
            cola_state += ",";
        }

        string pepsi_state = "";

        foreach (bool b in pepsi_bottles_state)
        {
            if (b)
            {
                pepsi_state += "1";
            }
            else
            {
                pepsi_state += "0";
            }
            pepsi_state += ",";
        }

        if (GameManager.Instance.currentMode == GameMode.MultiplayerOnline)
        {
            OnlinePacket packet = new OnlinePacket(
                2,
                score_info,
                cola_state,
                pepsi_state
                );
            ManagersController.Message(Message.Create(this, MessageData.EVENT_SEND_PACKET, packet));
        }
    }