Esempio n. 1
0
 public static void Match()
 {
     if (Client.Instance.isConnect && Client.Instance.pl_info.isLogin)
     {
         Client.Instance.Send(SF.GetProtocolHead(ProtoName.Match));
     }
 }
Esempio n. 2
0
    /// <summary>
    /// Destroy a object.
    /// </summary>
    /// <param name="id">The id of the unit that being destroyed</param>
    public static void DestroyObj(byte id)
    {
        ProtocolBytes protocol = SF.GetProtocolHead(ProtoName.DestroyObj);

        protocol.AddByte(id);
        Client.Instance.Send(protocol);
    }
Esempio n. 3
0
    public static void Chatting(string msg)
    {
        ProtocolBytes protocol = SF.GetProtocolHead(ProtoName.Chatting);

        protocol.AddString(msg);
        Client.Instance.Send(protocol);
    }
Esempio n. 4
0
 public static void CanControll()
 {
     if (Client.Instance.isConnect && Client.Instance.pl_info.isLogin)
     {
         Client.Instance.Send(SF.GetProtocolHead(ProtoName.CanControll));
     }
 }
Esempio n. 5
0
    /// <summary>
    /// 同步鼠标左键松开事件。
    /// </summary>
    /// <param name="instant">发生时刻</param>
    public static void SyncMouseButton0Up(Unit unit, long instant)
    {
        ProtocolBytes protocol = SF.GetProtocolHead(ProtoName.SyncMouseButton0Up); //16 bits

        protocol.AddInt((int)instant);                                             //32 bits
        protocol.AddByte((byte)unit.attributes.ID);;                               //8 bits
        Client.Instance.Send(protocol);
    }
Esempio n. 6
0
    /// <summary>
    /// 同步切换到的技能栏的序号。
    /// </summary>
    /// <param name="instant">发生时刻</param>
    /// <param name="skillIndex">技能栏序号</param>
    public static void SyncSwitchSkill(Unit unit, long instant, int skillIndex)
    {
        ProtocolBytes protocol = SF.GetProtocolHead(ProtoName.SyncSwitchSkill); //16 bits

        protocol.AddInt((int)instant);                                          //32 bits
        protocol.AddByte((byte)unit.attributes.ID);                             //8 bits
        protocol.AddByte((byte)skillIndex);                                     //32 bits
        Client.Instance.Send(protocol);
    }
Esempio n. 7
0
    public static void Login(string username, string password)
    {
        ProtocolBytes protocol = SF.GetProtocolHead(ProtoName.Login);

        //MD5 md5p = MD5.Create(password);
        protocol.AddString(username);
        protocol.AddString(GetMd5(password));
        Client.Instance.Send(protocol);
    }
Esempio n. 8
0
    /// <summary>
    /// Send a message to server, which includes the message of unit and applies for permission.
    /// </summary>
    /// <param name="unit">The unit type enum</param>
    /// <param name="isLocal">Is this object local</param>
    /// <param name="position">The position of the unit that would be created at</param>
    /// <param name="rotation">The rotation of the unit</param>
    public static void CreateObject(UnitName unit, Vector3 position, Quaternion rotation)
    {
        ProtocolBytes protocol = SF.GetProtocolHead(ProtoName.CreateObject);

        protocol.AddByte((byte)unit);         //UnitName
        AppendVector3(protocol, position);    //Position
        AppendQuaternion(protocol, rotation); //Rotation
        Client.Instance.Send(protocol);
    }
Esempio n. 9
0
    public static void SyncAimTarget(long instant, int sourceId, int targetId)
    {
        ProtocolBytes protocol = SF.GetProtocolHead(ProtoName.SyncAimTarget);

        protocol.AddInt((int)instant);
        protocol.AddByte((byte)sourceId);
        protocol.AddByte((byte)targetId);

        Client.Instance.Send(protocol);
    }
Esempio n. 10
0
    /// <summary>
    /// 同步移动控制轴的值。即水平轴和垂直轴的值。
    /// </summary>
    /// <param name="instant">发生时刻</param>
    /// <param name="h">水平轴的值 Horizontal Axis</param>
    /// <param name="v">垂直轴的值 Vertical Axis</param>
    public static void SyncMobileControlAxes(Unit unit, long instant, int h, int v, Vector3 cameraFwd)
    {
        ProtocolBytes protocol = SF.GetProtocolHead(ProtoName.SyncMobileControlAxes);

        protocol.AddInt((int)instant);              //instant
        protocol.AddByte((byte)unit.attributes.ID); //unit id
        protocol.AddByte(PackHaV(h, v));            //h and v
        AppendVector3(protocol, cameraFwd);         // camera forward

        Client.Instance.Send(protocol);
    }
Esempio n. 11
0
    /// <summary>
    /// 同步单位的魔法值。
    /// </summary>
    /// <param name="instant">时刻,即单位处于该魔法值的时刻</param>
    /// <param name="MP">单位的魔法值</param>
    public static void SyncMP(Unit unit, long instant, float MP)
    {
        //8 bits
        ProtocolBytes protocol = SF.GetProtocolHead(ProtoName.SyncMP);

        //32 bits
        protocol.AddInt((int)instant);
        //8 bits
        protocol.AddByte((byte)unit.attributes.ID);
        //32 bits
        protocol.AddFloat(MP);
        Client.Instance.Send(protocol);
    }
Esempio n. 12
0
    /// <summary>
    /// To apply for register.
    /// </summary>
    /// <param name="username">At least 8 bits</param>
    /// <param name="password">At least 8 bits</param>
    public static void Register(string username, string password)
    {
        if (username == null || password == null)
        {
            return;
        }
        if (username.Length < 1 || password.Length < 1)
        {
            return;
        }
        ProtocolBytes protocol = SF.GetProtocolHead(ProtoName.Register);

        protocol.AddString(username);
        protocol.AddString(GetMd5(password));
        Client.Instance.Send(protocol);
    }
Esempio n. 13
0
    public static void SyncTransform(Unit unit, long instant, Vector3 position, Quaternion rotation, float speed)
    {
        //8 bits
        ProtocolBytes protocol = SF.GetProtocolHead(ProtoName.SyncTransform);

        //32 bits
        protocol.AddInt((int)instant);
        //8 bits
        protocol.AddByte((byte)unit.attributes.ID);
        //96 bits
        AppendVector3(protocol, position);
        //128 bits
        AppendQuaternion(protocol, rotation);
        //32 bits
        protocol.AddFloat(speed);

        Client.Instance.Send(protocol);
    }
Esempio n. 14
0
 /// <summary>
 /// More frequent than time check
 /// </summary>
 public static void Ping()
 {
     Client.Instance.Send(SF.GetProtocolHead(ProtoName.Ping));
 }
Esempio n. 15
0
 /// <summary>
 /// Heart beat, 5 or more seconds per
 /// </summary>
 public static void SyncTimeCheck()
 {
     Client.Instance.Send(SF.GetProtocolHead(ProtoName.SyncTimeCheck));
 }
Esempio n. 16
0
    public static void ReadyCancel()
    {
        ProtocolBytes protocol = SF.GetProtocolHead(ProtoName.Logout);

        Client.Instance.Send(protocol);
    }