From 5d4ceaa170291e724449e00ab9f3f0845b41f9ac Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Wed, 23 Apr 2014 12:47:09 +0100 Subject: [PATCH] Renamed ManualPan to SwipePan --- Assets/Fungus/Prefabs/Game.prefab | Bin 7608 -> 7648 bytes Assets/Fungus/Scripts/CameraController.cs | 44 +++++++++--------- .../Fungus/Scripts/Commands/CameraCommands.cs | 14 +++--- Assets/Fungus/Scripts/Game.cs | 24 +++++----- Assets/Fungus/Scripts/GameController.cs | 16 +++---- Assets/FungusExample/Scenes/Example.unity | Bin 61704 -> 62576 bytes Assets/FungusExample/Scripts/MenuRoom.cs | 2 +- Assets/FungusExample/Scripts/ParallaxRoom.cs | 4 +- 8 files changed, 52 insertions(+), 52 deletions(-) diff --git a/Assets/Fungus/Prefabs/Game.prefab b/Assets/Fungus/Prefabs/Game.prefab index 1dabbf3e424006218fcdafdb821046d6722632ff..fc2b8be444cf606761e3f573da2037073e862610 100644 GIT binary patch delta 243 zcmdmC{lHp)fkDQSfkE~G0|NsmkR32lz@AZlV}LmuYjJsILF(pSwiqTB-_*R)$!|F% zHPUkO6H6G9GxGC`Q$d2^nJFb13@kv+ra%k=j39zz5~m`g*<=NF6-M*P4_QmazlN^l}L?+D~4>#7h2sA)ZMt-t^4CmwtvKj#K C?n3ea delta 197 zcmaE0y~A37fkB3sfkAc$0|NsmkZmwgz@AZVV}LmuTW(@rX=2Xi9<~@JmVm_c)X8r+ zBqtklN;8^HmS{2PEb>CYNNEr7|!AU0^@?7neGt!(>Gc;mxMp`2vC)fP(*lpa@7W bNdL~7FnO!=>d6aac{V4==rc~9F6#*ZS!g+Z diff --git a/Assets/Fungus/Scripts/CameraController.cs b/Assets/Fungus/Scripts/CameraController.cs index 1777f428..c99dc5a9 100644 --- a/Assets/Fungus/Scripts/CameraController.cs +++ b/Assets/Fungus/Scripts/CameraController.cs @@ -14,9 +14,9 @@ namespace Fungus { Game game; - // Manual panning control - View manualPanViewA; - View manualPanViewB; + // Swipe panning control + View swipePanViewA; + View swipePanViewB; Vector3 previousMousePos; class CameraView @@ -39,7 +39,7 @@ namespace Fungus public void FadeToView(View view, float fadeDuration, Action fadeAction) { - game.manualPanActive = false; + game.swipePanActive = false; // Fade out Fade(0f, fadeDuration / 2f, delegate { @@ -87,7 +87,7 @@ namespace Fungus */ public void CenterOnSprite(SpriteRenderer spriteRenderer) { - game.manualPanActive = false; + game.swipePanActive = false; Sprite sprite = spriteRenderer.sprite; Vector3 extents = sprite.bounds.extents; @@ -104,7 +104,7 @@ namespace Fungus */ public void PanToPosition(Vector3 targetPosition, float targetSize, float duration, Action arriveAction) { - game.manualPanActive = false; + game.swipePanActive = false; if (duration == 0f) { @@ -207,7 +207,7 @@ namespace Fungus */ public void PanToPath(View[] viewList, float duration, Action arriveAction) { - game.manualPanActive = false; + game.swipePanActive = false; List pathList = new List(); @@ -257,22 +257,22 @@ namespace Fungus } /** - * Activates manual panning mode. + * Activates swipe panning mode. * The player can pan the camera within the area between viewA & viewB. */ - public void StartManualPan(View viewA, View viewB, float duration, Action arriveAction) + public void StartSwipePan(View viewA, View viewB, float duration, Action arriveAction) { - manualPanViewA = viewA; - manualPanViewB = viewB; + swipePanViewA = viewA; + swipePanViewB = viewB; Vector3 cameraPos = Camera.main.transform.position; - Vector3 targetPosition = CalcCameraPosition(cameraPos, manualPanViewA, manualPanViewB); - float targetSize = CalcCameraSize(cameraPos, manualPanViewA, manualPanViewB); + Vector3 targetPosition = CalcCameraPosition(cameraPos, swipePanViewA, swipePanViewB); + float targetSize = CalcCameraSize(cameraPos, swipePanViewA, swipePanViewB); PanToPosition(targetPosition, targetSize, duration, delegate { - game.manualPanActive = true; + game.swipePanActive = true; if (arriveAction != null) { @@ -282,13 +282,13 @@ namespace Fungus } /** - * Deactivates manual panning mode. + * Deactivates swipe panning mode. */ - public void StopManualPan() + public void StopSwipePan() { - game.manualPanActive = false; - manualPanViewA = null; - manualPanViewB = null; + game.swipePanActive = false; + swipePanViewA = null; + swipePanViewB = null; } /** @@ -306,7 +306,7 @@ namespace Fungus void Update() { - if (!game.manualPanActive) + if (!game.swipePanActive) { return; } @@ -340,8 +340,8 @@ namespace Fungus cameraPos += cameraDelta; - Camera.main.transform.position = CalcCameraPosition(cameraPos, manualPanViewA, manualPanViewB); - Camera.main.orthographicSize = CalcCameraSize(cameraPos, manualPanViewA, manualPanViewB); + Camera.main.transform.position = CalcCameraPosition(cameraPos, swipePanViewA, swipePanViewB); + Camera.main.orthographicSize = CalcCameraSize(cameraPos, swipePanViewA, swipePanViewB); } // Clamp camera position to region defined by the two views diff --git a/Assets/Fungus/Scripts/Commands/CameraCommands.cs b/Assets/Fungus/Scripts/Commands/CameraCommands.cs index f582b964..d98c9f9d 100644 --- a/Assets/Fungus/Scripts/Commands/CameraCommands.cs +++ b/Assets/Fungus/Scripts/Commands/CameraCommands.cs @@ -154,16 +154,16 @@ namespace Fungus } /** - * Switches on manual pan mode. + * Switches on swipe panning mode. * This allows the player to swipe the screen to pan around a region defined by 2 views. */ - public class StartManualPan : CommandQueue.Command + public class StartSwipePan : CommandQueue.Command { View viewA; View viewB; float duration; - public StartManualPan(View _viewA, View _viewB, float _duration) + public StartSwipePan(View _viewA, View _viewB, float _duration) { if (_viewA == null || _viewB == null) @@ -183,7 +183,7 @@ namespace Fungus game.waiting = true; - game.cameraController.StartManualPan(viewA, viewB, duration, delegate { + game.cameraController.StartSwipePan(viewA, viewB, duration, delegate { game.waiting = false; @@ -196,15 +196,15 @@ namespace Fungus } /** - * Switches off manual pan mode. + * Switches off pan-to-swipe mode. */ - public class StopManualPan : CommandQueue.Command + public class StopSwipePan : CommandQueue.Command { public override void Execute(CommandQueue commandQueue, Action onComplete) { Game game = Game.GetInstance(); - game.cameraController.StopManualPan(); + game.cameraController.StopSwipePan(); if (onComplete != null) { diff --git a/Assets/Fungus/Scripts/Game.cs b/Assets/Fungus/Scripts/Game.cs index 8067d7af..dac258d1 100644 --- a/Assets/Fungus/Scripts/Game.cs +++ b/Assets/Fungus/Scripts/Game.cs @@ -54,9 +54,9 @@ namespace Fungus public Texture2D fadeTexture; /** - * Icon to display when manual pan mode is active. + * Icon to display when swipe pan mode is active. */ - public Texture2D manualPanTexture; + public Texture2D swipePanTexture; /** * Icon to display when waiting for player input to continue @@ -119,7 +119,7 @@ namespace Fungus public bool waiting; [HideInInspector] - public bool manualPanActive; + public bool swipePanActive; [HideInInspector] public float fadeAlpha = 0f; @@ -189,16 +189,16 @@ namespace Fungus void OnGUI() { - if (manualPanActive) + if (swipePanActive) { - // Draw the swipe-to-pan icon - if (manualPanTexture) + // Draw the swipe panning icon + if (swipePanTexture) { - Rect rect = new Rect(Screen.width - manualPanTexture.width, - Screen.height - manualPanTexture.height, - manualPanTexture.width, - manualPanTexture.height); - GUI.DrawTexture(rect, manualPanTexture); + Rect rect = new Rect(Screen.width - swipePanTexture.width, + Screen.height - swipePanTexture.height, + swipePanTexture.width, + swipePanTexture.height); + GUI.DrawTexture(rect, swipePanTexture); } } @@ -209,7 +209,7 @@ namespace Fungus if (continueTexture) { Rect rect = new Rect(Screen.width - continueTexture.width, - Screen.height - manualPanTexture.height, + Screen.height - swipePanTexture.height, continueTexture.width, continueTexture.height); GUI.DrawTexture(rect, continueTexture); diff --git a/Assets/Fungus/Scripts/GameController.cs b/Assets/Fungus/Scripts/GameController.cs index f2eb5fd5..0417c82a 100644 --- a/Assets/Fungus/Scripts/GameController.cs +++ b/Assets/Fungus/Scripts/GameController.cs @@ -142,28 +142,28 @@ namespace Fungus } /** - * Activates manual pan mode. + * Activates swipe panning mode. * The camera first pans to the nearest point between the two views over a period of time. - * The player can pan around the rectangular area defined between viewA & viewB. - * Manual panning remains active until a ManualPanOff, SetView, PanToView, FadeToPath or FadeToView command is executed. + * The player can then pan around the rectangular area defined between viewA & viewB. + * Swipe panning remains active until a StopSwipePan, SetView, PanToView, FadeToPath or FadeToView command is executed. * This method returns immediately but it queues an asynchronous command for later execution. * @param viewA View object which defines one extreme of the pan area. * @param viewB View object which defines the other extreme of the pan area. */ - public static void StartManualPan(View viewA, View viewB, float duration = 1f) + public static void StartSwipePan(View viewA, View viewB, float duration = 1f) { CommandQueue commandQueue = Game.GetInstance().commandQueue; - commandQueue.AddCommand(new Command.StartManualPan(viewA, viewB, duration)); + commandQueue.AddCommand(new Command.StartSwipePan(viewA, viewB, duration)); } /** - * Deactivates manual pan mode. + * Deactivates swipe panning mode. * This method returns immediately but it queues an asynchronous command for later execution. */ - public static void StopManualPan() + public static void StopSwipePan() { CommandQueue commandQueue = Game.GetInstance().commandQueue; - commandQueue.AddCommand(new Command.StopManualPan()); + commandQueue.AddCommand(new Command.StopSwipePan()); } /** diff --git a/Assets/FungusExample/Scenes/Example.unity b/Assets/FungusExample/Scenes/Example.unity index f92e865425f89e6de730362cbf924663940be27a..ee561b448e4fd84dd47da8f9511459d3e4719e84 100644 GIT binary patch delta 4223 zcmbuC3s6+o8OP7vU39@!7TD-2Fo-Vl6c=HaOMLK%8bWw1rbaZ1yFo0>Ag=ge#mCa7 znkCWbc$`Yx(BLDZrisN~lhBM08cl|@SXYA)Q#IB&4)s+unwqM$|Fe4+&UKn}roA(V zd++aluk)Sne0%U*R`>O)^@KD>5pvf_2nois`G9^yl(cyG12w&97!@qLT%{^# zS$(y$Qks)6PbC&XiwN+Rfx#~JOrB$Z2w7CK#Ic-IR4rMutda@Nu3osjifHh~LjN!~ zf}T!_6s&Yj86tb<4xX zbajN3;hjyIjh;>0410CNO%~%N;N%>jaj4%(K=4bjDzM3r`={*WFH9MXcQXIFXZYx0 zgj90&%E3HfcCd%C?gFr0Fg6hl{QIKWv-;~1VkjZAIOV-yTfnM(f_^#uM;}Mt2Xk<8 zVPJODo8O>cE*z{4j1RDU!iAWGFhb5_wt-BKa#y5|(MAwO79zo1V7$R7uud>O3(-v1 zpmgGxYBe>2b#TkMVMm)OX9OW8d3l-hKaEa_s~Sa!n_u@+m%8Jsq6tail=G9Klbd6d zQNJhFTV1h)yvfa^?QD6baV#NoxXc^?bAj;_`5jm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5Rm!482<>@#fslL2iWz2g+HGBDn8+mVh(!eIQ8 z-TBq&s*qRTTrYyzex~oEm%t=2-rmb#fdN2%-g|yrT%9^kZ}1pcI~Xtb4%jeQ84}Po zsdvHb*tK{kry8EG=>(IwX^MO-J~6gHY2d&_xyAv@O7%{D0P6&+g%fR4xzYUS6Ia2G zbG@+Yxt~@IEYz2OHJEQv)ZUM3`Rl2ld_RWy)ZDcIW25vta;?H#h<& zmg^n=6|5bs1i@*$=y|3K#@l<~jm%bG1?K-c*GSWru59%!)o&`7>YLkIQ6eYT!N#(I zwnGo;d%*;j{jffm7_e3_tXfi|j##j6FeMoHS57*UnKF(fMR>lf_QLm{ySLVY@%wxP zEDXla@i>^RQol+PmYBBr!5})(tTwO#RW927grxlN(AV3tA3+Cm*=5O}zH-q(`}PEB zcW1o3s592IyDwF)eXT|i=Cixuu3Up?hUw6Dwh{_%n+^2oV>bE9zA-_5_@HQciQSUHJutPSNS~ z6l*5k9+z7b#o}Vcq?zTW9Q>uvGR(zpkF(eu!m_r@uk_CoJHYHlov3kLkf=A!wqwIJ~R@bko+qkZU{R1R5J=M_C z(A22(D!#W9KO=mkQR$LHh^N-UY`N>wKLn(Mx&EfeDBMYBN16l&U3g(Gl_Hbq%t(xo zMOXg%_FTR>*`CTbCo7xQoNVn--x=Q>Oo(|^GMjMEZi1!DY1f&VwDz!xcJ!O*x>1XT km!@aWl+&S63k`i>+C6?mu*gTpA7nMRnX6A18d*yJ2M!0GssI20 diff --git a/Assets/FungusExample/Scripts/MenuRoom.cs b/Assets/FungusExample/Scripts/MenuRoom.cs index acc67937..64a9e190 100644 --- a/Assets/FungusExample/Scripts/MenuRoom.cs +++ b/Assets/FungusExample/Scripts/MenuRoom.cs @@ -18,7 +18,7 @@ public class MenuRoom : Room AddOption("Writing a story with Pages", MoveToWritingRoom); AddOption("Controlling the camera with Views", MoveToViewRoom); AddOption("Sprites and Animations", MoveToSpriteRoom); - AddOption("Manual pan and parallax", MoveToParallaxRoom); + AddOption("Swipe panning and parallax", MoveToParallaxRoom); AddOption("Using Buttons", MoveToButtonsRoom); AddOption("Playing music and sound effects", MoveToAudioRoom); Choose("Choose an example"); diff --git a/Assets/FungusExample/Scripts/ParallaxRoom.cs b/Assets/FungusExample/Scripts/ParallaxRoom.cs index b27a2df6..8ec448ba 100644 --- a/Assets/FungusExample/Scripts/ParallaxRoom.cs +++ b/Assets/FungusExample/Scripts/ParallaxRoom.cs @@ -19,7 +19,7 @@ public class ParallaxRoom : Room { SetView(viewA); - Say("Let's zoom in!"); + Say("Let's move the camera!"); PanToView(viewB, 2); Say("Oooh! Nice parallax!"); PanToView(viewA, 2); @@ -28,7 +28,7 @@ public class ParallaxRoom : Room ShowButton(menuButton, OnHomeButtonClicked); - StartManualPan(viewA, viewB, 0f); + StartSwipePan(viewA, viewB, 0f); } void OnHomeButtonClicked()