public void Serialize(string title) { tile.name = title; STile original = new STile(tile); string content = original.ToBase64(); Application.ExternalEval("console.log('" + content + "')"); Application.ExternalEval("processTile('" + content + "')"); }
public void OnSubmit() { GameObject tile = GameObject.Find("My Tile"); tile.name = tileName.GetComponent <InputField>().text; // Serialize STile original = new STile(tile); string content = original.ToBase64(); Publish(content); }
void OnGUI() { GameObject tile = Selection.activeGameObject; if (!tile) { EditorGUILayout.HelpBox("Select a tile in the hierarchy view to enable Decentraland tile uploader.", MessageType.Warning); return; } GUILayout.Label("\n"); GUILayout.Label("Configuration\n"); nodeAddress = EditorGUILayout.TextField("Your Node RPC URL", nodeAddress); nodeAuth = EditorGUILayout.TextField("Node RPC Auth Token", nodeAuth); GUILayout.Label("\n"); GUILayout.Label("\n"); GUILayout.Label("Editor\n"); EditorGUILayout.BeginHorizontal(); GUILayout.Label("Tile Coordinates"); GUILayout.Label("X"); xOffset = EditorGUILayout.IntField(xOffset); GUILayout.Label("Y"); zOffset = EditorGUILayout.IntField(zOffset); EditorGUILayout.EndHorizontal(); if (GUILayout.Button("Publish Selected Tile ")) { // Serialize to file STile original = new STile(tile); Vector2 index = new Vector2( (tile.transform.position.x / TILE_SIZE) + xOffset, (tile.transform.position.z / TILE_SIZE) + zOffset ); string content = original.ToBase64(); PublishTile(index, content); } if (publishError) { EditorGUILayout.HelpBox("Error publishing tile!", MessageType.Error); } else { EditorGUILayout.HelpBox(publishing ? ("Publishing tile at (" + xOffset + "," + zOffset + ")") : (published?"Published!":""), MessageType.Info); } }