void OnGUI() { if (!finished) { Rect moveRect = new Rect((Screen.width - 300) - 25, Screen.height * 0.5f, 300, 30); GUI.Label(moveRect, "Shadow's Name:"); moveRect.Set(moveRect.left, moveRect.top + 30, moveRect.width, moveRect.height); shadowsName = GUI.TextField(moveRect, shadowsName, 28); moveRect.Set(moveRect.left, moveRect.top + 45, moveRect.width, moveRect.height); GUI.Label(moveRect, "Your Name:"); moveRect.Set(moveRect.left, moveRect.top + 30, moveRect.width, moveRect.height); yourName = GUI.TextField(moveRect, yourName, 28); moveRect.Set(moveRect.left, moveRect.top + 45, moveRect.width, moveRect.height); if (GUI.Button(moveRect, "Submit to Hall of Shadows")) { ShadowSerializer.SerializeMyShadow(shadowContoller.toyContainer); StartCoroutine(ShadowSerializer.Submit(shadowsName, yourName, HALL_OF_SHADOWS)); finished = true; } moveRect.Set(moveRect.left, moveRect.top + 45, moveRect.width, moveRect.height); if (GUI.Button(moveRect, "Don't Submit (But Finish)")) { ShadowSerializer.SerializeMyShadow(shadowContoller.toyContainer); Application.LoadLevel(HALL_OF_SHADOWS); } moveRect.Set(moveRect.left, moveRect.top + 45, moveRect.width, moveRect.height); if (GUI.Button(moveRect, "Continue Working on Shadow")) { shadowContoller.CancelZoom(); } } }
public IEnumerator LoadShadows() { WWW www = new WWW("http://api.hitchh1k3rsguide.com/LD33/get"); yield return(www); string[] data = www.data.Split('~'); for (int i = 0; i < data.Length - 2; i += 3) { string name = data[i]; string author = data[i + 1]; string serial = data[i + 2]; if (serial.GetHashCode() != ShadowSerializer.serialHash) { endWall.position += new Vector3(-spacing, 0, 0); GameObject newTile = (GameObject)Instantiate(tile, endWall.position, Quaternion.identity); Transform shadowText = newTile.transform.FindChild("about shadow"); Transform shadowBox = newTile.transform.FindChild("toybox"); ShadowSerializer.Deserialize(serial, shadowBox); TextMesh text = shadowText.GetComponent <TextMesh>(); text.text = name + "\nby\n" + author; } } yield break; }
void Start() { instance = this; if (MY_SERIALIZE_DATA != "") { Deserialize(MY_SERIALIZE_DATA, shadowbox); MY_SERIALIZE_DATA = ""; } }