Esempio n. 1
0
    IEnumerator crearPlanetaCOR(int id)
    {
        GameObject tr = sistemaSingleton.prebabSistema.transform.Find("sistema").gameObject;

        GameObject newSistema = Instantiate(planetas[id], tr.transform);


        while (!Input.GetMouseButtonDown(0))
        {
            Vector3 posMouse;
            Vector3 pos = Input.mousePosition;
            Ray     ray = Camera.main.ScreenPointToRay(pos);
            Plane   xy  = new Plane(Vector3.up, new Vector3(0, -40, 0));
            float   distance;
            xy.Raycast(ray, out distance);
            posMouse = ray.GetPoint(distance);
            newSistema.transform.position = posMouse;
            yield return(new WaitForSeconds(0.01f));
        }

        PlanetaPrebab planetaP = newSistema.GetComponent <PlanetaPrebab>();

        planetaP.actualizarDatos(sistemaSingleton.prebabSistema.GetComponent <SistemaplanetarioPrefab>().sistemaPlanetario.id, id);
        planetaP.planeta = PlanetaService.PostPlaneta(planetaP.planeta);
    }
Esempio n. 2
0
    // Update is called once per frame
    void LateUpdate()
    {
        Vector3 posicion = new Vector3(planeta.x, planeta.y, planeta.z);

        if (tr.localPosition != posicion && Input.GetMouseButtonUp(0))
        {
            planeta.x = tr.localPosition.x;
            planeta.y = tr.localPosition.y;
            planeta.z = tr.localPosition.z;

            PlanetaService.PutPlaneta(planeta);
        }
    }
Esempio n. 3
0
    private void validarCambio()
    {
        TMP_InputField iridio       = infoPlaneta.transform.Find("IridioInput").GetComponent <TMP_InputField>();
        TMP_InputField platino      = infoPlaneta.transform.Find("PlatinoInput").GetComponent <TMP_InputField>();
        TMP_InputField paladio      = infoPlaneta.transform.Find("PaladioInput").GetComponent <TMP_InputField>();
        TMP_InputField elementoZero = infoPlaneta.transform.Find("ElementoZeroInput").GetComponent <TMP_InputField>();
        Toggle         inicial      = infoPlaneta.transform.Find("Inicial").GetComponent <Toggle>();


        if (iridio.text != planeta.iridio.ToString() || iridio.text != planeta.iridio.ToString() ||
            iridio.text != planeta.iridio.ToString() || iridio.text != planeta.iridio.ToString() || inicial.isOn != planeta.inicial)
        {
            planeta.iridio       = double.Parse(iridio.text);
            planeta.paladio      = double.Parse(paladio.text);
            planeta.platino      = double.Parse(platino.text);
            planeta.elementoZero = double.Parse(elementoZero.text);
            planeta.inicial      = inicial.isOn;
            PlanetaService.PutPlaneta(planeta);
        }
    }
        protected async override void OnAppearing()
        {
            base.OnAppearing();

            string dbPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "TodoSQLite.db3");
            SQLiteAsyncConnection conn = new SQLiteAsyncConnection(dbPath);

            conn.CreateTableAsync <Planeta>().Wait();

            PlanetaService planetaService = new PlanetaService();

            List <Planeta> planetas = await planetaService.GetPlanetas();

            listadoPlanetas.ItemsSource = planetas;

            await conn.InsertAsync(planetas[0]);

            List <Planeta> planetasDB = await conn.Table <Planeta>().ToListAsync();

            await DisplayAlert("Cantidad", "Tengo " + planetasDB.Count, "OK");

            await conn.CloseAsync();
        }