Пример #1
0
    void CollectionAndReportMarineStates(int ReportId, CodeBattle.Observer.ReportEnum ReportType)
    {
        CodeBattle.Observer.MarineReport.Builder rb = new CodeBattle.Observer.MarineReport.Builder();
        rb.Report     = ReportType;
        rb.ReporterId = ReportId;

        foreach (object _m in marines.Values)
        {
            Marine m = (Marine)(_m);
            if (m.status == CodeBattle.Status.Dead)
            {
                continue;
            }
            CodeBattle.Observer.MarineStatus.Builder msb = new CodeBattle.Observer.MarineStatus.Builder();
            msb.Id     = m.id;
            msb.Status = m.status;

            CodeBattle.Vector2.Builder vb = new CodeBattle.Vector2.Builder();
            vb.X = m.transform.position.x;
            vb.Z = m.transform.position.z;

            msb.Position = vb.BuildPartial();

            rb.AddMarines(msb);
        }

        CodeBattle.Observer.Cmd.Builder cmdBuilder = new CodeBattle.Observer.Cmd.Builder();
        cmdBuilder.Cmd_ = CodeBattle.Observer.CmdEnum.marinereport;
        cmdBuilder.Mrt  = rb.BuildPartial();

        CodeBattle.Observer.Cmd cmd = cmdBuilder.BuildPartial();
        byte[] Data = AddLengthHeader(CmdSerialize(cmd));
        SockSend(Data);
    }
Пример #2
0
    byte[] CmdMarineIdleReport(int MarineId, float cx, float cz)
    {
        CodeBattle.Observer.MarineReport.Builder reportBuilder = new CodeBattle.Observer.MarineReport.Builder();
        reportBuilder.Report = CodeBattle.Observer.ReportEnum.toidle;

        CodeBattle.Observer.MarineStatus.Builder msBuilder = new CodeBattle.Observer.MarineStatus.Builder();
        msBuilder.Id     = MarineId;
        msBuilder.Status = CodeBattle.Status.Idle;

        CodeBattle.Vector2.Builder positionBuilder = new CodeBattle.Vector2.Builder();
        positionBuilder.X = cx;
        positionBuilder.Z = cz;

        msBuilder.Position = positionBuilder.BuildPartial();


        reportBuilder.Midle = msBuilder.BuildPartial();

        CodeBattle.Observer.Cmd.Builder cmdBuilder = new CodeBattle.Observer.Cmd.Builder();
        cmdBuilder.Cmd_ = CodeBattle.Observer.CmdEnum.marinereport;
        cmdBuilder.Mrt  = reportBuilder.BuildPartial();

        CodeBattle.Observer.Cmd cmd = cmdBuilder.BuildPartial();
        return(CmdSerialize(cmd));
    }
Пример #3
0
    byte[] CmdCreateRoom(int MapId)
    {
        CodeBattle.Observer.CreateRoom.Builder crmBuilder = new CodeBattle.Observer.CreateRoom.Builder();
        crmBuilder.Map = MapId;

        CodeBattle.Observer.Cmd.Builder cmdBuilder = new CodeBattle.Observer.Cmd.Builder();
        cmdBuilder.Cmd_ = CodeBattle.Observer.CmdEnum.createroom;

        cmdBuilder.Crm = crmBuilder.BuildPartial();
        CodeBattle.Observer.Cmd cmd = cmdBuilder.BuildPartial();
        return(CmdSerialize(cmd));
    }
Пример #4
0
    byte[] CmdMarineDamageReport(int attackId, int damageId)
    {
        Marine attackMarineScript = (Marine)marines[attackId];
        Marine damageMarineScript = (Marine)marines[damageId];

        CodeBattle.Observer.MarineReport.Builder rb = new CodeBattle.Observer.MarineReport.Builder();
        rb.Report = CodeBattle.Observer.ReportEnum.damage;

        rb.Mattack = attackMarineScript.GetMarineStatus().BuildPartial();
        rb.Mdamage = damageMarineScript.GetMarineStatus().BuildPartial();

        CodeBattle.Observer.Cmd.Builder cmdBuilder = new CodeBattle.Observer.Cmd.Builder();
        cmdBuilder.Cmd_ = CodeBattle.Observer.CmdEnum.marinereport;
        cmdBuilder.Mrt  = rb.BuildPartial();

        CodeBattle.Observer.Cmd cmd = cmdBuilder.BuildPartial();
        return(CmdSerialize(cmd));
    }
Пример #5
0
    void CollectionAndReportMarineStates(int ReportId, CodeBattle.Observer.ReportEnum ReportType)
    {
        CodeBattle.Observer.MarineReport.Builder rb = new CodeBattle.Observer.MarineReport.Builder();
        rb.Report = ReportType;
        rb.ReporterId = ReportId;

        foreach(object _m in marines.Values) {
            Marine m = (Marine)(_m);
            if (m.status == CodeBattle.Status.Dead) continue;
            CodeBattle.Observer.MarineStatus.Builder msb = new CodeBattle.Observer.MarineStatus.Builder();
            msb.Id = m.id;
            msb.Status = m.status;

            CodeBattle.Vector2.Builder vb = new CodeBattle.Vector2.Builder();
            vb.X = m.transform.position.x;
            vb.Z = m.transform.position.z;

            msb.Position = vb.BuildPartial();

            rb.AddMarines(msb);
        }

        CodeBattle.Observer.Cmd.Builder cmdBuilder = new CodeBattle.Observer.Cmd.Builder();
        cmdBuilder.Cmd_ = CodeBattle.Observer.CmdEnum.marinereport;
        cmdBuilder.Mrt = rb.BuildPartial();

        CodeBattle.Observer.Cmd cmd = cmdBuilder.BuildPartial();
        byte[] Data = AddLengthHeader( CmdSerialize(cmd) );
        SockSend(Data);
    }
Пример #6
0
    byte[] CmdMarineIdleReport(int MarineId, float cx, float cz)
    {
        CodeBattle.Observer.MarineReport.Builder reportBuilder = new CodeBattle.Observer.MarineReport.Builder();
        reportBuilder.Report = CodeBattle.Observer.ReportEnum.toidle;

        CodeBattle.Observer.MarineStatus.Builder msBuilder = new CodeBattle.Observer.MarineStatus.Builder();
        msBuilder.Id = MarineId;
        msBuilder.Status = CodeBattle.Status.Idle;

        CodeBattle.Vector2.Builder positionBuilder = new CodeBattle.Vector2.Builder();
        positionBuilder.X = cx;
        positionBuilder.Z = cz;

        msBuilder.Position = positionBuilder.BuildPartial();

        reportBuilder.Midle = msBuilder.BuildPartial();

        CodeBattle.Observer.Cmd.Builder cmdBuilder = new CodeBattle.Observer.Cmd.Builder();
        cmdBuilder.Cmd_ = CodeBattle.Observer.CmdEnum.marinereport;
        cmdBuilder.Mrt = reportBuilder.BuildPartial();

        CodeBattle.Observer.Cmd cmd = cmdBuilder.BuildPartial();
        return CmdSerialize(cmd);
    }
Пример #7
0
    byte[] CmdMarineDamageReport(int attackId, int damageId)
    {
        Marine attackMarineScript = (Marine)marines[attackId];
        Marine damageMarineScript = (Marine)marines[damageId];

        CodeBattle.Observer.MarineReport.Builder rb = new CodeBattle.Observer.MarineReport.Builder();
        rb.Report = CodeBattle.Observer.ReportEnum.damage;

        rb.Mattack = attackMarineScript.GetMarineStatus().BuildPartial();
        rb.Mdamage = damageMarineScript.GetMarineStatus().BuildPartial();

        CodeBattle.Observer.Cmd.Builder cmdBuilder = new CodeBattle.Observer.Cmd.Builder();
        cmdBuilder.Cmd_ = CodeBattle.Observer.CmdEnum.marinereport;
        cmdBuilder.Mrt = rb.BuildPartial();

        CodeBattle.Observer.Cmd cmd = cmdBuilder.BuildPartial();
        return CmdSerialize(cmd);
    }
Пример #8
0
    byte[] CmdCreateRoom(int MapId)
    {
        CodeBattle.Observer.CreateRoom.Builder crmBuilder = new CodeBattle.Observer.CreateRoom.Builder();
        crmBuilder.Map = MapId;

        CodeBattle.Observer.Cmd.Builder cmdBuilder = new CodeBattle.Observer.Cmd.Builder();
        cmdBuilder.Cmd_ = CodeBattle.Observer.CmdEnum.createroom;

        cmdBuilder.Crm = crmBuilder.BuildPartial();
        CodeBattle.Observer.Cmd cmd = cmdBuilder.BuildPartial();
        return CmdSerialize(cmd);
    }