CaculatorResult ComputeResult(mmopb.CalculatorResultChange_ack ack) { CaculatorResult ret = new CaculatorResult(); ret.results[0] = ack.cal_1; ret.results[1] = ack.cal_2; ret.results[2] = ack.cal_3; ret.results[3] = ack.cal_4; ret.results[4] = ack.cal_5; ret.results[5] = ack.cal_6; return(ret); }
private void FixedUpdate() { //得到新ack if (Network.m_Actor.isNewResult) { newResult = ComputeResult(Network.m_Actor.calculatorResultChange_Ack); } //赋值新ack if (newResult != result) { for (int i = 0; i < 6; i++) { result.results[i] = newResult.results[i]; } Network.m_Actor.isNewResult = false; } }
public void SendCalculatorResultChangeReq(int res, int num, CaculatorResult result) { mmopb.CalculatorResultChange_req req = new mmopb.CalculatorResultChange_req(); req.cal_1 = result.results[0]; req.cal_2 = result.results[1]; req.cal_3 = result.results[2]; req.cal_4 = result.results[3]; req.cal_5 = result.results[4]; req.cal_6 = result.results[5]; switch (num) { case 1: req.cal_1 = res; break; case 2: req.cal_2 = res; break; case 3: req.cal_3 = res; break; case 4: req.cal_4 = res; break; case 5: req.cal_5 = res; break; case 6: req.cal_6 = res; break; } req.RoomID = Network.m_Actor.inRoomNum; Network.m_Actor.SendMessage(req); }