示例#1
0
 public Message MakeTurn(Client client)
 {
     Message message = new Message();
     message.AddProperty("sessionId", Client.Instance.SessionId.ToString());
     message.AddProperty("buildFabricCount", Client.Instance.BuyFCount.ToString());
     message.AddProperty("automateFabricCount", Client.Instance.UpFCount.ToString());
     message.AddProperty("buildAFabricCount", Client.Instance.BuyAFCount.ToString());
     message.AddProperty("buildAFabricCount", Client.Instance.BuyAFCount.ToString());
     message.AddProperty("loanCount", Client.Instance.NewLoan.ToString());
     message.AddProperty("produceESM", "{\"count\":" + Client.Instance.ProduceESMCount + ",\"price\":" + Client.Instance.ProduceESMCost + "}");
     message.AddProperty("esm", "{\"count\":" + Client.Instance.BuyESMCount + ",\"price\":" + Client.Instance.BuyESMCost + "}");
     message.AddProperty("egp", "{\"count\":" + Client.Instance.SellEGPCount + ",\"price\":" + Client.Instance.SellEGPCost + "}");
     return SendMesssage(message);
 }
示例#2
0
 public int Connect(Client client)
 {
     Message message = new Message();
     message.AddProperty("type", "connect");
     message.AddProperty("name", client.Name);
     Message resoponseMessage = SendMesssage(message);
     string sessionId = resoponseMessage.GetProperty("sessionId");
     if (sessionId == null) throw new NotEnouthSpaceException();
     return int.Parse(sessionId.Substring(1, sessionId.Length - 2));
 }