Beispiel #1
0
    public void doRequest()
    {
        var js     = new JavaScriptSerializer(new SimpleTypeResolver());
        var client = new WebClient();

        client.Headers.Add("Content-Type", "application/json");
        string json = js.Serialize(testplan);

        byte[] data          = Encoding.ASCII.GetBytes(json);
        byte[] responseArray = client.UploadData("http://localhost:8080/plans", data);
        var    response      = Encoding.ASCII.GetString(responseArray);

        Debug.Log("\nResponse received was: " + response);

        var dict = js.Deserialize <Dictionary <string, int> > (response);

        response = client.DownloadString("http://localhost:8080/plans/" + dict ["id"]);
        Debug.Log(response);
        Warplan wp = js.Deserialize <Warplan>(response);

        Debug.Log(wp.blueprints [1].armor.GetType());
    }
Beispiel #2
0
 public Player(Warplan warplan, bool isLeftPlayer, Battle battle)
 {
     this.warplan      = warplan;
     this.isLeftPlayer = isLeftPlayer;
     if (this.warplan == null)
     {
         this.warplan = new Warplan();
     }
     this.stencils = new Stencil[3];
     for (int i = 0; i < stencils.Length; i++)
     {
         stencils [i] = new Stencil(warplan.blueprints[i], this, battle);
     }
     if (isLeftPlayer)
     {
         this.homePosition = battle.leftHomePosition;
     }
     else
     {
         this.homePosition = battle.rightHomePosition;
     }
 }
Beispiel #3
0
    //public Blueprint activeBlueprint;

    // Use this for initialization
    void Start()
    {
        DontDestroyOnLoad(this);
        warplan = new Warplan();
        //activeBlueprint = warplan.blueprints [0];
    }
Beispiel #4
0
 // Use this for initialization
 void Start()
 {
     testplan = new Warplan();
 }