コード例 #1
0
    private void LoadMissionData()
    {
        //Remove all child objects from related dropdown
        armCorp.ClearOptions();
        mission.ClearOptions();
        targetProvince.ClearOptions();

        //Make request to fill table
        string jsonToSend = @"{'email':'" + InterchangableVars.email + "', 'password':'******'}";

        //Add Corp Types
        apiConnector.makeRequest(AddCorps2List, "armyInformations", jsonToSend);
        armCorp.captionText.text = "Select Army Corp";

        //Add Mission Titles
        mission.GetComponent <Dropdown>().options.Add(new Dropdown.OptionData("Move"));
        mission.GetComponent <Dropdown>().options.Add(new Dropdown.OptionData("Attack"));
        mission.captionText.text = "Select Mission";

        //Add Targets
        foreach (Province province in InterchangableVars.provinces)
        {
            targetProvince.GetComponent <Dropdown>().options.Add(new Dropdown.OptionData(province.name));
        }
        targetProvince.captionText.text = "Select Target";
    }
コード例 #2
0
    public IEnumerator StartUpdateInfos()
    {
        string jsonToSend = @"{'email':'" + InterchangableVars.email + "', 'password':'******'}";

        while (true)
        {
            if (InterchangableVars.updateStatus == "finished")
            {
                InterchangableVars.updateStatus = "started";
                //Debug.Log("Update Started!");

                //Reset existing lists
                InterchangableVars.countries        = new Dictionary <int, Country>();
                InterchangableVars.provinces        = new List <Province>();
                InterchangableVars.armyCorpMissions = new List <ArmyCorpMission>();

                //Get New Values and Set them to lists
                apiConnector.makeRequest(AddCountries, "myCountryDetails", jsonToSend);
                apiConnector.makeRequest(AddCountries, "otherCountriesDetails", jsonToSend);
                apiConnector.makeRequest(AddProvinces, "myProvincesDetails", jsonToSend);
                apiConnector.makeRequest(AddProvinces, "otherProvincesDetails", jsonToSend);
                apiConnector.makeRequest(AddArmyCorpMissions, "armyCorpMissionDetails", jsonToSend);
            }
            yield return(new WaitForSeconds(60));
        }
    }
コード例 #3
0
    private void LoadMilitaryTable()
    {
        //Remove all child objects from militaryTablePanel
        for (int i = 0; i < militaryTablePanel.transform.childCount; i++)
        {
            Destroy(militaryTablePanel.transform.GetChild(i).gameObject);
        }

        //Add Column names row
        var columnNamesRow = Instantiate(tableRowPrefab, militaryTablePanel.transform, false);

        columnNamesRow.GetComponent <TableRow>().SetColumnNamesRow(new string[] { "Type", "Soldier Number", "Mission", "Where" });

        //Make request to fill table
        string jsonToSend = @"{'email':'" + InterchangableVars.email + "', 'password':'******'}";

        apiConnector.makeRequest(AddMilitaryUnit2List, "armyInformations", jsonToSend);
    }
コード例 #4
0
ファイル: Login.cs プロジェクト: aliihsank/SuperPower
    /*
     * Trigger : Login Button Pressed
     * Action : Check User by using API:
     *                              if exists => Save Session for later as JSON and change the scene to GameScene
     *                              if not    => Show a message in logger
     */
    public void BtnLoginPressed()
    {
        if (hasInternet)
        {
            jsonToSend = @"{'email':'" + email.text + "', 'password':'******'}";

            apiConnector.makeRequest(CheckLogin, "userLogin", jsonToSend);
        }
    }
コード例 #5
0
ファイル: Login.cs プロジェクト: aliihsank/SuperPower
    void Start()
    {
        Screen.orientation = ScreenOrientation.Portrait;

        //Make Connectivity Check
        apiConnector = new APIConnector(this);
        string jsonToSend = @"{'email':'" + "null" + "', 'password':'******'}";

        apiConnector.makeRequest(CheckConnectivity, "test", jsonToSend);
    }
コード例 #6
0
    public void btnRegisterClicked()
    {
        string uname    = unameObj.GetComponent <Text>().text;
        string cname    = cnameObj.GetComponent <Text>().text;
        string email    = emailObj.GetComponent <Text>().text;
        string password = passwordObj.GetComponent <Text>().text;

        if (uname != "" && cname != "" && email != "" && password != "")
        {
            string jsonToSend = @"{'uname':'" + uname + "', 'cname':'" + cname + "', 'email':'" + email + "', 'password':'******'}";

            apiConnector.makeRequest(CheckRegister, "userRegister", jsonToSend);
        }
    }