Ejemplo n.º 1
0
 private void OnEnable()
 {
     if (FindJobBtn != null)
     {
         FindJobBtn.interactable = false;
     }
     clicked      = false;
     bodytxt.text = "You have " + AD.CurrentPlayer.RemainingActionPoints + " action points.\nWhich job are you applying for?";
     //ColorBlock colors = btn1.colors;
     //colors.normalColor = new Color32(81, 169, 171, 255);
     //btn1.colors = colors;
     JobLimits.GetJobLimitsData();
 }
Ejemplo n.º 2
0
 private void OnEnable()
 {
     JobLimits.GetJobLimitsData();
     LoadCompanyAndJobData();
 }
    private IEnumerator LifeCardCorout_Server()
    {
        string          gameTocken = GameObject.FindObjectOfType <DataBase>().GameCode;
        UnityWebRequest www        = UnityWebRequest.Get("http://18.223.239.177/hello/get/game/" + gameTocken);

        yield return(www.SendWebRequest());

        string data = "";

        if (www.isNetworkError || www.isHttpError)
        {
            Debug.Log(www.error);
        }
        else
        {
            data = www.downloadHandler.text;
            if (data == "null")
            {
                BodyText.text = "Waiting for facilitator to create a New Game...";
                Debug.Log("Round not started by the facilitator yet, Checking again...");
                // Checking again...
                //StartCoroutine(LifeCardCorout_Server());
                StartCoroutine(Corout_Delay());
            }
            else
            {
                //Debug.Log("gameIDData: " + data);
                AD.gameIdData   = JsonUtility.FromJson <GameIdData>(data);
                AD.game_id_data = AD.gameIdData._id;
                AD.CurrentPlayer.RemainingActionPoints = AD.gameIdData.actionpoints;
                //AD.CurrentPlayer.Bank = AD.gameIdData.money;
                DB.RoundTimer     = AD.gameIdData.duration;
                DB.TotalRounds    = AD.gameIdData.totalrounds;
                DB.roundCounter   = DB.RoundCounter = AD.gameIdData.roundno;
                DB.isRoundStarted = AD.gameIdData.start;

                if (AD.CurrentPlayer.Bank == 0)
                {
                    AD.CurrentPlayer.Bank = AD.gameIdData.money;
                }

                if (AD.gameIdData.totalrounds == AD.gameIdData.roundno && AD.gameIdData.start == false)
                {
                    BodyText.text = "Waiting for facilitator to create a New Game...";
                    Debug.Log("Game not created by the facilitator yet, Checking again...");
                    // Checking again...
                    StartCoroutine(Corout_Delay());
                    //StartCoroutine(LifeCardCorout_Server());
                }
                else
                {
                    BodyText.text = "Waiting for round " + (DB.RoundCounter + 1) + "\n to begin!";
                }

                if (AD.gameIdData.start)
                {
                    //DB.roundCounter++;
                    //DB.RoundCounter++;

                    // Round Started here...
                    //AD.CurrentPlayer.RemainingActionPoints = AD.gameIdData.actionpoints;
                    //AD.CurrentPlayer.Bank = AD.gameIdData.money;
                    //DB.RoundTimer = AD.gameIdData.duration * 60f;
                    //DB.TotalRounds = AD.gameIdData.totalrounds;
                    //DB.isRoundStarted = AD.gameIdData.start;

                    // SEND DATA AT START OF ROUND HERE...
                    // send initial data here...
                    UploadData ud = GameObject.FindObjectOfType <UploadData>();
                    ud.UploadAllData(AD, DB, AD.gameIdData.roundno);

                    this.gameObject.SetActive(false);
                    nextScreen.SetActive(true);
                    // Get jobs limit data at start of each round
                    JobLimits.GetJobLimitsData();
                }
                else
                {
                    Debug.Log("Round not started by the facilitator yet, Checking again...");
                    // Checking again...
                    StartCoroutine(LifeCardCorout_Server());
                }
            }
        }
    }
Ejemplo n.º 4
0
 private void OnEnable()
 {
     NextBtn.interactable = false;
     JobLimits.GetJobLimitsData();
 }