protected void btnLogeo_Click(object sender, EventArgs e) { UsuarioAlumno user = null; try { user = new UsuarioAlumno(); user.run = txtUsermane.Text; user.clave = txtPassword.Text; Session["usuarioAlumno"] = user; if (UsuarioAlumnoBLL.getInstance.validUser(user)) { //Aqui debería validar el "estadoLogin" del usuario, si es 0 //deberá redireccionar a la página para cambiar su clave, //de lo contrario debe redireccionar al panel alumno, por problemas //de seguridad, en esta ocasión no se cambiará la clave. Response.Redirect("../Pages/PanelAlumno.aspx"); } else { UtilScript.executeJS("msgLoginError('Credenciales invalidas');", this.Page, 500); } } catch (Exception ex) { UtilScript.executeJS("msgLoginError('" + ex.Message + "');", this.Page, 500); } }
public override Vector3[] GenerateLine(int lineNum, Vector3 linePos, float topX, float bottomX, float topY, float bottomY, float topZ, float bottomZ) { Vector3[] result = new Vector3[0]; // // if(init){ // for(int i = 0; i < pulseCenter.Length; i++){ // if(Vector3.Distance(pulseCenter[i], linePos) <= // Vector3.Distance(pulseCenter[i], pulseClosest[i])){ // pulseClosest[i] = linePos; // } // } // } // result = new Vector3[2]; result[0] = UtilScript.CloneVec3(linePos); result[1] = UtilScript.CloneVec3(linePos); result[0].y = topY; result[1].y = bottomY; return(result); }
protected void btnLogeo_Click(object sender, EventArgs e) { UsuarioAdministrador usuario = null; try { usuario = new UsuarioAdministrador(); usuario.username = txtUsermane.Text; usuario.clave = txtPassword.Text; if (UsuarioAdministradorBLL.getInstance.validarUsuario(usuario)) { Session["administrador"] = usuario; Response.Redirect("../Paginas/PanelAdministrador.aspx"); } else { UtilScript.executeJS("msgLoginError('Credenciales inválidas');", this.Page, 500); } } catch (Exception ex) { UtilScript.executeJS("msgLoginError('" + ex.Message + "');", this.Page, 500);; } }
private void ExportItems(ItemList list) { if (list.Items.Count > 0) { if (GUILayout.Button("Export Sheet")) { string path = UtilScript.GetPath("Export_" + list.listName); IWorkSheetDataWriter workSheetDataWriter = new ES3WorkSheetDataWriter(); string[][] sheetvals = new string[list.Items.Count][]; int len = list.Items.Count; for (int i = 0; i < len; i++) { sheetvals[i] = list.Items[i].values.ToArray(); } List <string> headings = new List <string>(); foreach (var heading in list.Headings) { headings.Add(heading.Name.GetVal()); } workSheetDataWriter.WriteWorkSheetData(headings.ToArray(), sheetvals, System.IO.Directory.GetParent(path).FullName + "/" + list.listName) .Subscribe(_ => Debug.Log("Export completed at path " + path)); } } }
//TODO calc vert positions once, save performance List <float> GetIntersectList(Vector3 vec) { result.Clear(); for (int i = 0; i < tris.Length; i += 3) { int vert1 = tris[i]; int vert2 = tris[i + 1]; int vert3 = tris[i + 2]; vec1 = verts[vert1]; vec2 = verts[vert2]; vec3 = verts[vert3]; Vector3 inter = UtilScript.CloneVec3(vec); inter.y = front[2].y * 10; Vector3 normal = (normals[vert1] + normals[vert2] + normals[vert3]) / 3; inter = checkIntersectTri(vec1, vec2, vec3, inter, down, temp, normal); if (inter.y > -1001) { result.Add(inter.y); } } return(result); }
public override Vector3[] GenerateLine(int lineNum, Vector3 linePos, float topX, float bottomX, float topY, float bottomY, float topZ, float bottomZ) { Vector3[] result = new Vector3[2]; // Vector3 vec1 = UtilScript.CloneVec3(linePos); // Vector3 vec2 = UtilScript.CloneVec3(linePos); float midX = 0; //((topX + bottomX)/2); float midZ = ((topZ + bottomZ) / 2f); // print("+"+topZ); // print(bottomZ); float xPos = linePos.x; float zPos = linePos.z; float hypot = Mathf.Sqrt(Mathf.Pow(xPos - midX, 2) + Mathf.Pow(zPos - midZ, 2)); float hypotAdjusted = hypot * waxLengthMod - counter; // Debug.Log("hypotAdjusted: " + hypotAdjusted); float height = UtilScript.Map(Mathf.Sin(hypotAdjusted), -1, 1, topY, bottomY); float waveHeight = height; //Mathf.Sin(hypotAdjusted) * bottomY;//topY * .75f; result[0] = new Vector3(xPos, waveHeight, zPos); result[1] = new Vector3(xPos, topY, zPos); return(result); }
public void ReplaceBlankCard() { for (int i = 0; i < slots.Length; i++) { Card card = slots [i].GetComponentInChildren <Card> (); if (card != null) { if (card.myCardType == Card.CardType.BLANK_CARD) { int rnd = Random.Range(0, searchables.Count); GameObject newCard = searchables [rnd]; RectTransform rectTransform = newCard.GetComponent <RectTransform> (); UtilScript.AlignRectTransformToParent(rectTransform); newCard.transform.SetParent(slots [i].transform, false); newCard.SetActive(true); hand.Add(newCard); searchables.Remove(searchables[rnd]); DeactivateCard(card.gameObject, false); break; } else { } } } }
protected void btnCargaExcel_Click(object sender, EventArgs e) { List <ReporteFinanciero> list = null; List <string> listAlumnos = null; OleDbCommand command = null; OleDbDataReader reader = null; int cont = 0; //Comenzara a leer despues de la primera fila (nombre de columna) try { list = new List <ReporteFinanciero>(); listAlumnos = new List <string>(); using (OleDbConnection conn = new OleDbConnection(UtilString.obtenerRutaConexion(fileUp))) { conn.Open(); command = new OleDbCommand("SELECT * FROM [hh$]", conn); reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { cont++; if (cont > 1) { if (reader[6].ToString().Equals("") && reader[15].ToString().Equals("Arancel")) { //crea el objeto de reporte ReporteFinanciero rep = new ReporteFinanciero(); //guarda los valores rep.nroCuota = UtilNumero.parseInt(reader[1].ToString()); rep.runAlumno = reader[4].ToString(); rep.fechaVencimiento = DateTime.Parse(reader[13].ToString()); rep.montoCuota = UtilNumero.parseDouble(reader[17].ToString()); rep.fechaDocumento = DateTime.Now; list.Add(rep); listAlumnos.Add(rep.runAlumno); } } } } } var alumnos = ((from usu in listAlumnos select usu).Distinct()).ToList(); ReporteFinancieroBLL.getInstance.loadExcelList(list, alumnos); UtilScript.executeJS("msgSuccessExcel('" + cont.ToString("N0") + " registros cargados');", this.Page, 500); } catch (Exception ex) { UtilScript.executeJS("msgRespuesta('" + ex.Message + "','error');", this.Page, 500); } }
protected void btnCambiarPassword_Click(object sender, EventArgs e) { UsuarioAlumno usuario = null; string claveConfirmacion = ""; try { usuario = new UsuarioAlumno(); usuario.email = txtEmail.Text; usuario.clave = txtClave.Text; usuario.run = UtilString.quitarFormatoRun(txtRun.Text); claveConfirmacion = txtClaveConfirmar.Text; validLengthPw(usuario.clave); if (UsuarioAlumnoBLL.getInstance.cambiarClaveUsuario(usuario, claveConfirmacion)) { UsuarioAlumnoBLL.getInstance.enviarEmailInformativo(usuario); Session["OK"] = "Contraseña actualizada"; Response.Redirect("../Paginas/Login.aspx"); } } catch (Exception ex) { UtilScript.executeJS("msgRespuesta('" + ex.Message + "','error');", this.Page, 500); } }
public Color ChangeSegmentColor(int index, float min, float max, Color c1, Color c2) { float colorChange = UtilScript.remapRange(index, min, max, 0, 1); Color lerpedColor = Color.LerpUnclamped(c1, c2, colorChange); return(lerpedColor); }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.T)) { UtilScript.WriteTransToFile("RohanFile2.json", transform); } if (Input.GetKeyDown(KeyCode.L)) { UtilScript.ReadTransformFromFile("RohanFile2.json", transform); // transform.position=temp.position; // transform.localScale = temp.localScale; } if (Input.GetKeyDown(KeyCode.Space)) { UtilScript.WriteVector3ToFile("RohanFile1.json", transform.position); } if (Input.GetKeyDown(KeyCode.R)) { UtilScript.ReadVector3FromFile("RohanFile1.json"); transform.position = UtilScript.ReadVector3FromFile("RohanFile1.json"); } }
public override Vector3[] GenerateLine(int lineNum, Vector3 linePos, float topX, float bottomX, float topY, float bottomY, float topZ, float bottomZ) { Vector3[] result = new Vector3[2]; Vector3 vec1 = UtilScript.CloneVec3(linePos); Vector3 vec2 = UtilScript.CloneVec3(linePos); float midX = ((topX + bottomX) / 2); float midZ = ((topZ + bottomZ) / 2); float xPos = linePos.x; float zPos = linePos.z; float hypot = Mathf.Sqrt(Mathf.Pow(xPos - midX, 2) + Mathf.Pow(zPos - midZ, 2)); float hypotAdjusted = hypot - counter * 130f; float mod = (Mathf.Sin(linePos.x / 200f + linePos.z / 200f + counter / 3f) + Mathf.Sin(linePos.x / 200f - linePos.z / 200f - counter / 3f)) / 2f; float waveHeight = linePos.y + mod * topY * .4f; result[0] = new Vector3(xPos, waveHeight, zPos); result[1] = new Vector3(xPos, waveHeight - 50f, zPos); return(result); }
protected void Page_Load(object sender, EventArgs e) { if (Session["OK"] != null) { UtilScript.executeJS("msgRespuesta('Credenciales actualizadas','success');", this.Page, 500); Session.Clear(); Session.Abandon(); } }
// Use this for initialization // Use this for initialization void Start() { //Use UtilScript to write to a file in one line UtilScript.WriteStringToFile(Application.dataPath, "hello.txt", "hi!"); //Use UtilScript to clone and mod a Vector3 transform.position = UtilScript.CloneModVector3(transform.position, 1, 0, 0); //Use UtilScript to clone a Vector3 Vector3 pos = UtilScript.CloneVector3(transform.position); //Create a JSONClass object JSONClass subClass = new JSONClass(); //Add a value to subClass subClass["test"] = "value"; //Create another JSONClass object, must include "using SimpleJSON" above JSONClass json = new JSONClass(); //Add floats, strings, bools, even other classes to our json object json["x"].AsFloat = 7; json["y"].AsFloat = 0; json["z"].AsFloat = 2; json["name"] = "Matt"; json["Alt Facts"].AsBool = false; json["sub"] = subClass; //Write "json" to a file using UtilScript UtilScript.WriteStringToFile(Application.dataPath, "file.json", json.ToString()); //print out the string value of "json" Debug.Log(json); //Read in a file into a string using UtilScript string result = UtilScript.ReadStringFromFile(Application.dataPath, "file.json"); //Parse string we read in from a file into a JSONNode JSONNode readJSON = JSON.Parse(result); //print out a value from the JSONNode Debug.Log(readJSON["z"].AsFloat); //Create a webclient, must include "using System.Net" above WebClient client = new WebClient(); //Get the content from a webpage, in this case, a json value for the sunset time in Hawaii string content = client.DownloadString("https://query.yahooapis.com/v1/public/yql?q=select%20astronomy.sunset%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22maui%2C%20hi%22)&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys"); //turn string into a JSONNode JSONNode hawaii = JSON.Parse(content); //Get the sunset time from the JSONNode string sunset = hawaii["query"]["results"]["channel"]["astronomy"]["sunset"]; //print out the sunset time print(sunset); }
public override Vector3[] GenerateLine(int lineNum, Vector3 linePos, float topX, float bottomX, float topY, float bottomY, float topZ, float bottomZ) { if (frontBottomY < bottomY) { frontBottomY = bottomY; } if (frontBottomZ > bottomZ) { frontBottomZ = bottomZ; // + 0.01f; } Vector3[] result = new Vector3[2]; Vector3 vec1 = UtilScript.CloneVec3(linePos); Vector3 vec2 = UtilScript.CloneVec3(linePos); vec1.y = bottomY; vec2.y = bottomY; Vector3 pivot = new Vector3(vec1.x, frontBottomY, bottomZ); float dist = Vector3.Distance(vec1, pivot); if (maxDist < dist) { maxDist = dist; } float angle = Mathf.PI * 2; vec1.y = frontBottomY; vec1.z = dist + frontBottomZ; if (lineNum == 500) { // 500: 0.4266512 ,-0.3809375, -0.1321059 // 500: 0.4266512 ,-0.3809375, -0.1321059 print("500: " + vec1.x + " ," + vec1.y + ", " + vec1.z); } if (Time.frameCount == 10) { print("HERE"); botList.Add(vec1); topList.Add(new Vector3(linePos.x, topY, linePos.z)); } vec2 = new Vector3(vec1.x + 0.01f, vec1.y, vec1.z); result[0] = vec2; result[1] = vec1; return(result); }
public AsteroidData(string fileName) { JSONNode jason = UtilScript.ReadJSONFromFile(Application.dataPath, fileName); position = new Vector3( jason[POS_X].AsFloat, jason[POS_Y].AsFloat, jason[POS_Z].AsFloat); }
// Update is called once per frame void Update() { float moveTime = Time.realtimeSinceStartup * speedMod; transform.position = new Vector3( UtilScript.Map(Mathf.PerlinNoise(moveTime, 0), 0, 1, -range, range), transform.position.y, UtilScript.Map(Mathf.PerlinNoise(0, moveTime), 0, 1, -range, range)); }
void DrawLine(Vector3 top, Vector3 bottom, Material rMat) { if (top.y < bottom.y) { Vector3 temp = top; top = bottom; bottom = temp; } if (recordName) { Debug.Log(rMat.name); currentFrame.AddLine(new LumarcaLine(top, bottom, rMat.name)); } //Calc Dots float dotSize = cfs.physicalHeight / 75f; Vector3 newTop = UtilScript.CloneVec3(top); newTop.y -= dotSize; Vector3 newBot = UtilScript.CloneVec3(bottom); newBot.y += dotSize; //Draw material lines rMat.SetPass(0); GL.Begin(GL.LINES); if (calibration) { GL.Color(Color.red); } GL.Vertex(newTop); GL.Vertex(newBot); GL.End(); //Add Dots mat.SetPass(0); GL.Begin(GL.LINES); GL.Color(Color.white); GL.Vertex(newTop); GL.Vertex(top); GL.Vertex(newBot); GL.Vertex(bottom); GL.End(); }
void Update() { float energyFill = UtilScript.remapRange(GameManager.energy, 0, 100, 0, 1); energyAmount.fillAmount = energyFill; float energyNum = GameManager.energy; energyText.text = energyNum.ToString(); }
public static LumarcaLine LoadFromJSON(JObject jLine) { LumarcaLine ll = new LumarcaLine( UtilScript.JsonToVector3(jLine[JSON_TOP]), UtilScript.JsonToVector3(jLine[JSON_BOTTOM]), jLine[JSON_MATERIAL].ToString(), (bool)jLine[JSON_HAS_DOT]); return(ll); }
public JObject GetJSONLine() { JObject jsonLine = new JObject(); jsonLine[JSON_TOP] = UtilScript.Vector3ToJson(top); jsonLine[JSON_BOTTOM] = UtilScript.Vector3ToJson(bottom); jsonLine[JSON_MATERIAL] = material; jsonLine[JSON_HAS_DOT] = hasDots; return(jsonLine); }
void SendLoadMessage() { if (LevelLoader.levelNum < 1) { GameObject.Find("Level Holder").SendMessage("LoadNextLevel"); } else { UtilScript.WriteStringToFile(Application.dataPath, "best_times.txt", yourTime); } }
public PathData(string fileName) { JSONArray json = UtilScript.ReadJSONFromFile(Application.dataPath, fileName) as JSONArray; // Debug.Log (json); for (int i = 0; i < json.Count; i++) { position = new Vector3(json[i][POS_X].AsFloat, json[i][POS_Y].AsFloat, json[i][POS_Z].AsFloat); posData.Add(position); // Debug.Log(position); } }
public override Vector3[] GenerateLine(int lineNum, Vector3 linePos, float topX, float bottomX, float topY, float bottomY, float topZ, float bottomZ) { Vector3[] result = new Vector3[2]; float xPos = linePos.x; float zPos = linePos.z; // Debug.Log("hypotAdjusted: " + hypotAdjusted); float waveHeight = UtilScript.Map(Mathf.PerlinNoise(xPos / waxLengthMod + counter, zPos / waxLengthMod + counter), 0, 1, bottomY, topY); result[0] = new Vector3(xPos, waveHeight, zPos); result[1] = new Vector3(xPos, topY, zPos); if (!ceilingMounted) { result[1] = new Vector3(xPos, bottomY, zPos); } float range = topY - bottomY; float split = range / colors.Length; for (int i = 0; i < colors.Length - 1; i++) { float currentTop = bottomY + i * split * range; if (currentTop < waveHeight) { mat.SetColor("_Color1", colors[i]); mat.SetColor("_Color2", colors[i + 1]); mat.SetFloat("_LerpPer", (waveHeight - currentTop) / split); // mat = colors[colors.Length - i - 1]; } } // if(waveHeight > topY * .1f){ // mat = mat1; // } else if (waveHeight > bottomY * .1f){ // mat = mat2; // } else { // mat = mat3; // } return(result); }
public AsteroidData[] ReadAsteroids() { // Read array from file. asteroidArray = UtilScript.ReadJSONFromFile(Application.dataPath, "SavedAsteroids.txt") as JSONArray; AsteroidData[] asteroidDatas = new AsteroidData[asteroidArray.Count]; for (int i = 0; i < asteroidArray.Count; i++) { asteroidDatas[i] = new AsteroidData(asteroidArray[i] as JSONClass); } return(asteroidDatas); }
// Use this for initialization void Start() { // float input = 237.5654665f; // // float part1 = GetColorPart1(input, 0, 1024); // float part2 = GetColorPart2(input, 0, 1024); // // Debug.Log ("MAP1: " + part1); // Debug.Log ("MAP2: " + part2); // Debug.Log ("Convert: " + PartsToFloat(part1, part2, 0, 1024)); cam = Camera.main; cfs = cam.GetComponent <CameraFrustrumScript>(); front = cfs.GetFrontPlane(); back = new Vector3[4]; for (int i = 0; i < front.Length; i++) { back[i] = UtilScript.CloneVec3(front[i]); back[i].z = front[0].z + cam.farClipPlane - cam.nearClipPlane; } totalWidth = front[1].x - front[0].x; totalHeight = front[2].y - front[0].y; totalDepth = back[0].z - front[0].z; Debug.Log("totalWidth: " + totalWidth); Debug.Log("totalHeight: " + totalHeight); Debug.Log("totalDepth: " + totalDepth); camPos = cam.transform.position; gridDivide = (int)Mathf.Ceil(Mathf.Sqrt(lineConfiguration)); if (lumarcaMode == LUMARCA_MODE.Dots) { GenerateDots(); } else { GenerateLines(); MultiPerDepthAndCutOutsideOfCube(); } Debug.Log("Lines: " + lines.Count); SetColorToPart(); }
// Update is called once per frame void Update() { transform.position = UtilScript.Vector3Mod(transform.position, -0.1f, 0, 0); GameManagerScript manager = GameManagerScript.GetInstance(); Debug.Log("High Score: " + manager.HighScore); Debug.Log("Score: " + GameManagerScript.score); Debug.Log("MoonGravity: " + GameManagerScript.MoonGravity); //calling moongravity property of the class gamemanger //paraenthesis is calling function, doing something //. is just accessing, getting and setting value }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Space)) { Debug.Log("tolerance: " + tolerance); Debug.Log("End count:" + lines.Count); part1 = !part1; SetColorToPart(); int part = 2; if (part1) { part = 1; } StartCoroutine(UploadPNG("Lumarca" + Camera.main.pixelWidth + "x" + Camera.main.pixelHeight + "_DotSize" + dotSize + "Depth" + numDepths + "Part" + part)); JSONArray jPositions = new JSONArray(); for (int i = 0; i < lines.Count; i++) { jPositions[i] = UtilScript.Vector3ToJson(lines[i]); } BinaryWriter writer = new BinaryWriter(File.Open("positions.json", FileMode.Create)); jPositions.Serialize(writer); writer.Close(); BinaryReader reader = new BinaryReader(File.Open("positions.json", FileMode.Open)); JSONNode ja = SimpleJSON.JSONNode.Deserialize(reader); Debug.Log("Vec3: " + ja[0].ToString()); Debug.Log("Vec3: " + JSON.Parse(ja[0])["x"]); for (int i = 0; i < ja.Count; i++) { Debug.Log("jn: " + i + " : " + JSON.Parse(ja[i])["x"]); } } // DrawBox(); }
// Use this for initialization void Start() { Vector3 vec = new Vector3(2.67768348342f, 23.23432432432f, Mathf.PI); print(vec); print(UtilScript.ActualVector3(vec)); float f = 2.67768348342f; print(f); Debug.Log(f + ""); double d = f; print("d: " + d); }
public override Vector3[] GenerateLine(int lineNum, Vector3 linePos, float topX, float bottomX, float topY, float bottomY, float topZ, float bottomZ) { List <Vector3> result = new List <Vector3>(); if (!lefts.Contains(lineNum) && !rights.Contains(lineNum)) { if (linePos.x <= 0) { AddedSortToList(lefts, lineNum, linePos); } else { AddedSortToList(rights, lineNum, linePos); } allPos.Add(lineNum, linePos); } else { if (lineNum == lineLeftNum) { Vector3 vec1 = UtilScript.CloneVec3(linePos); Vector3 vec2 = UtilScript.CloneVec3(linePos); vec1.y = topY; vec2.y = bottomY; result.Add(vec1); result.Add(vec2); } else if (lineNum == lineRightNum) { Vector3 vec1 = UtilScript.CloneVec3(linePos); Vector3 vec2 = UtilScript.CloneVec3(linePos); vec1.y = topY; vec2.y = bottomY; result.Add(vec1); result.Add(vec2); } } return(result.ToArray()); }