예제 #1
0
    public void OnEndDoc()
    {
        parrentDef = doe.defPanel;
        parrentDoc = doe.docPanel;

        RefreshController.R_Defc(parrentDef);
        RefreshController.R_Doc(parrentDoc);

        CancelInvoke("StartTickDoc");

        Destroy(this.gameObject);

        if (MainResourcesController.docDefInProgress.Count > 1)
        {
            if (GameObject.Find("DocDef").gameObject.activeInHierarchy)
            {
                doe = GameObject.Find("DocDef").GetComponent <DocOnEnabled>();
                doe.StartThis();
            }
        }
    }
예제 #2
0
    IEnumerator DropDownItem()
    {
        WWW www = new WWW("http://vg2.v-galaktike.ru/api/?class=planet&method=getplanet&token="
                          + MainResourcesController.userToken
                          + "&system_id="
                          + MainResourcesController.currentSystemID);

        yield return(www);

        if (www.error == null)
        {
            var result = JSON.Parse(www.text);

            MainResourcesController.timeNow = result["now"].AsLong;

            current_user        = result["user"];
            current_planet      = result["system"];
            buildingsInProgress = current_planet["building"];
            researchInProgress  = current_user["tech"];
            docDefInProgress    = current_planet["weapon"];

            MainResourcesController.main_titan_value      = current_planet["titan"].AsDouble;
            MainResourcesController.main_silicone_value   = current_planet["silicon"].AsDouble;
            MainResourcesController.main_antimatter_value = current_planet["antimatter"].AsDouble;
            MainResourcesController.energy_used           = current_planet["energy_used"].AsInt;
            MainResourcesController.energy_max            = current_planet["energy_max"].AsInt;
            MainResourcesController.weapone_update        = current_planet["weapon_update"].AsLong;
            MainResourcesController mrc = TopBlock.GetComponent <MainResourcesController>();
            mrc.ValOnTheirPlace();

            if (buildingsInProgress.Count != 0)
            {
                MainResourcesController.buildingInProgress.Clear();
                MainResourcesController.buildingInProgress.Add(new BuildingsInProgress(
                                                                   buildingsInProgress["system_id"].AsInt,
                                                                   buildingsInProgress["building_id"].AsInt,
                                                                   buildingsInProgress["building_end"].AsLong,
                                                                   buildingsInProgress["building_start"].AsLong));
            }
            else
            {
                MainResourcesController.buildingListIsFull = false;
                MainResourcesController.buildingInProgress.Clear();
            }

            if (researchInProgress.Count != 0)
            {
                MainResourcesController.researchInProgress.Clear();

                MainResourcesController.researchInProgress.Add(new ResearchInProgress(
                                                                   researchInProgress["user_id"].AsInt,
                                                                   researchInProgress["tech_id"].AsInt,
                                                                   researchInProgress["tech_end"].AsLong,
                                                                   researchInProgress["tech_start"].AsLong));
            }
            else
            {
                MainResourcesController.researchInProgress.Clear();
            }

            if (docDefInProgress.Count != 0)
            {
                MainResourcesController.docDefInProgress.Clear();

                for (int i = 0; i < docDefInProgress.Count; i++)
                {
                    MainResourcesController.docDefInProgress.Add(new DocDefInProgress(
                                                                     docDefInProgress[i]["system_id"].AsInt,
                                                                     docDefInProgress[i]["element_id"].AsInt,
                                                                     docDefInProgress[i]["count"].AsInt));
                }
            }
            else
            {
                MainResourcesController.docDefInProgress.Clear();
            }

            GetValForJson();

            MainResourcesController.CreadeDictionaryBuildingsLevel();
            MainResourcesController.CreadeDictionaryResearchLevel();

            loading.SetActive(true);
            yield return(new WaitForSeconds(0.5f));

            RefreshController.R_Buildings(buildingBlocks);
            RefreshController.R_Research(researchBlocks);
            yield return(new WaitForSeconds(0.5f));

            RefreshController.R_Doc(docBlocks);
            RefreshController.R_Defc(defBlocks);
            yield return(new WaitForSeconds(0.5f));

            RefreshController.R_Technology(techBlocks);
            loading.SetActive(false);

            DwopDownBtn_close();

            if (planetBlock.activeInHierarchy)
            {
                planetBlock.GetComponent <PlanetMenuItemController>().ChangePlanet();
            }

            if (scrM.currentPanel.name == "Building")
            {
                buildingBlocks.transform.GetComponent <BuildingOnEnabled>().StartThis();
            }
            else if (scrM.currentPanel.name == "Research")
            {
                researchBlocks.transform.GetComponent <ResearchOnEnabled>().StartThis();
            }

            else if (scrM.currentPanel.name == "DocDef")
            {
                docBlocks.transform.GetComponent <DocOnEnabled>().StartThis();
            }
        }
        else
        {
            Debug.Log(www.error);
        }
    }