diff --git a/Assets/CanvasController.cs b/Assets/CanvasController.cs new file mode 100644 index 0000000..eff77e2 --- /dev/null +++ b/Assets/CanvasController.cs @@ -0,0 +1,17 @@ +using UnityEngine; +using System.Collections; +using UnityEngine.UI; + + +public class CanvasController : MonoBehaviour { + public BookShelf shelf; + + void Next(){ + shelf.NextPage (); + } + void Exit(){ + Text txt = this.GetComponentInChildren (); + txt.text= ""; + this.GetComponent ().enabled = false; + } +} diff --git a/Assets/CanvasController.cs.meta b/Assets/CanvasController.cs.meta new file mode 100644 index 0000000..d4e601b --- /dev/null +++ b/Assets/CanvasController.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 51b4eaf7fd78b5c4ebf536423973f19e +timeCreated: 1454864041 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/CanvasDisable.cs b/Assets/CanvasDisable.cs index 17e93e2..9f9f1bc 100644 --- a/Assets/CanvasDisable.cs +++ b/Assets/CanvasDisable.cs @@ -1,6 +1,7 @@ using UnityEngine; using System.Collections; + public class CanvasDisable : MonoBehaviour { // Use this for initialization diff --git a/Assets/Scripts/BookShelf.cs b/Assets/Scripts/BookShelf.cs index be12938..5817475 100644 --- a/Assets/Scripts/BookShelf.cs +++ b/Assets/Scripts/BookShelf.cs @@ -5,20 +5,29 @@ public class BookShelf : TextDownload { private GameObject canvas; private Canvas canvasComponent; + private CanvasController canvasController; + private BookPosition book; void Start () { canvas = GameObject.Find ("Canvas"); canvasComponent = canvas.GetComponent (); - } - - void Interaction(){ - Debug.Log ("Interaction"); - canvasComponent.enabled = true; - BookPosition book; + canvasController = canvas.GetComponent (); + book.room = "1"; book.wall = 1; book.shelf = 1; book.volume = 1; book.page = 1; + } + + void Interaction(){ + Debug.Log ("Interaction"); + canvasComponent.enabled = true; + canvasController.shelf = this; + GetPage(book); + } + public void NextPage(){ + book.page++; + Debug.Log (book.page); GetPage(book); } diff --git a/Assets/Scripts/TextDownload.cs b/Assets/Scripts/TextDownload.cs index 3340ce4..7e08968 100644 --- a/Assets/Scripts/TextDownload.cs +++ b/Assets/Scripts/TextDownload.cs @@ -57,7 +57,11 @@ private static string ParseTitle(string html){ return title; } private static string generateUrl(BookPosition book){ - string fullUrl = url + "?" + book.room + "-w" + book.wall + "-s" + book.shelf + "-v" + book.volume + ":" + book.page; + string volume = book.volume.ToString (); + if (book.volume < 10) + volume = "0" + volume; + string fullUrl = url + "?" + book.room + "-w" + book.wall + "-s" + book.shelf + "-v" + volume + ":" + book.page; + Debug.Log (fullUrl); return fullUrl; } diff --git a/Assets/_Scene/TestInteraction.unity b/Assets/_Scene/TestInteraction.unity index eb504cb..8d24883 100644 Binary files a/Assets/_Scene/TestInteraction.unity and b/Assets/_Scene/TestInteraction.unity differ diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 197bbf0..e66d29a 100644 Binary files a/ProjectSettings/ProjectSettings.asset and b/ProjectSettings/ProjectSettings.asset differ diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt index 2a285eb..78b2941 100644 --- a/ProjectSettings/ProjectVersion.txt +++ b/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 5.1.0f3 +m_EditorVersion: 5.1.1f1 m_StandardAssetsVersion: 0