From a06a5d1e41810701a95c94bf2da3e2136d0de50e Mon Sep 17 00:00:00 2001 From: Gregg Tavares Date: Tue, 28 Nov 2017 09:29:29 +0900 Subject: [PATCH] add camera example --- Assets/HappyFunTimes-README.txt | 25 ++++ Assets/HappyFunTimes/MoreSamples/camera.meta | 9 ++ .../MoreSamples/camera/Materials.meta | 9 ++ .../MoreSamples/camera/Prefabs.meta | 9 ++ .../Prefabs/PrefabForExampleCamera.prefab | Bin 0 -> 8356 bytes .../PrefabForExampleCamera.prefab.meta | 6 + .../MoreSamples/camera/Scenes.meta | 9 ++ .../HappyFunTimesCameraExample-README.txt | 21 +++ ...HappyFunTimesCameraExample-README.txt.meta | 8 ++ .../Scenes/HappyFunTimesCameraExample.unity | Bin 0 -> 23584 bytes .../HappyFunTimesCameraExample.unity.meta | 8 ++ .../MoreSamples/camera/Scripts.meta | 9 ++ .../Scripts/ExampleCameraGameSettings.cs | 40 ++++++ .../Scripts/ExampleCameraGameSettings.cs.meta | 10 ++ .../camera/Scripts/ExampleCameraPlayer.cs | 133 ++++++++++++++++++ .../Scripts/ExampleCameraPlayer.cs.meta | 10 ++ .../__dir__.txt | 2 +- .../controllers/camera.meta | 9 ++ .../controllers/camera/controller.html.bytes | 105 ++++++++++++++ .../camera/controller.html.bytes.meta | 8 ++ .../controllers/camera/css.meta | 9 ++ .../camera/css/controller.css.bytes | 75 ++++++++++ .../camera/css/controller.css.bytes.meta | 8 ++ .../controllers/camera/scripts.meta | 9 ++ .../camera/scripts/controller.js.bytes | 120 ++++++++++++++++ .../camera/scripts/controller.js.bytes.meta | 8 ++ .../HappyFunTimes/controllers/camera.meta | 9 ++ .../controllers/camera/controller.html | 105 ++++++++++++++ .../controllers/camera/controller.html.meta | 8 ++ .../HappyFunTimes/controllers/camera/css.meta | 9 ++ .../controllers/camera/css/controller.css | 75 ++++++++++ .../camera/css/controller.css.meta | 8 ++ .../controllers/camera/scripts.meta | 9 ++ .../controllers/camera/scripts/controller.js | 120 ++++++++++++++++ .../camera/scripts/controller.js.meta | 8 ++ 35 files changed, 1009 insertions(+), 1 deletion(-) create mode 100644 Assets/HappyFunTimes/MoreSamples/camera.meta create mode 100644 Assets/HappyFunTimes/MoreSamples/camera/Materials.meta create mode 100644 Assets/HappyFunTimes/MoreSamples/camera/Prefabs.meta create mode 100644 Assets/HappyFunTimes/MoreSamples/camera/Prefabs/PrefabForExampleCamera.prefab create mode 100644 Assets/HappyFunTimes/MoreSamples/camera/Prefabs/PrefabForExampleCamera.prefab.meta create mode 100644 Assets/HappyFunTimes/MoreSamples/camera/Scenes.meta create mode 100644 Assets/HappyFunTimes/MoreSamples/camera/Scenes/HappyFunTimesCameraExample-README.txt create mode 100644 Assets/HappyFunTimes/MoreSamples/camera/Scenes/HappyFunTimesCameraExample-README.txt.meta create mode 100644 Assets/HappyFunTimes/MoreSamples/camera/Scenes/HappyFunTimesCameraExample.unity create mode 100644 Assets/HappyFunTimes/MoreSamples/camera/Scenes/HappyFunTimesCameraExample.unity.meta create mode 100644 Assets/HappyFunTimes/MoreSamples/camera/Scripts.meta create mode 100644 Assets/HappyFunTimes/MoreSamples/camera/Scripts/ExampleCameraGameSettings.cs create mode 100644 Assets/HappyFunTimes/MoreSamples/camera/Scripts/ExampleCameraGameSettings.cs.meta create mode 100644 Assets/HappyFunTimes/MoreSamples/camera/Scripts/ExampleCameraPlayer.cs create mode 100644 Assets/HappyFunTimes/MoreSamples/camera/Scripts/ExampleCameraPlayer.cs.meta create mode 100644 Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/controllers/camera.meta create mode 100644 Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/controllers/camera/controller.html.bytes create mode 100644 Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/controllers/camera/controller.html.bytes.meta create mode 100644 Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/controllers/camera/css.meta create mode 100644 Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/controllers/camera/css/controller.css.bytes create mode 100644 Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/controllers/camera/css/controller.css.bytes.meta create mode 100644 Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/controllers/camera/scripts.meta create mode 100644 Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/controllers/camera/scripts/controller.js.bytes create mode 100644 Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/controllers/camera/scripts/controller.js.bytes.meta create mode 100644 Assets/WebPlayerTemplates/HappyFunTimes/controllers/camera.meta create mode 100644 Assets/WebPlayerTemplates/HappyFunTimes/controllers/camera/controller.html create mode 100644 Assets/WebPlayerTemplates/HappyFunTimes/controllers/camera/controller.html.meta create mode 100644 Assets/WebPlayerTemplates/HappyFunTimes/controllers/camera/css.meta create mode 100644 Assets/WebPlayerTemplates/HappyFunTimes/controllers/camera/css/controller.css create mode 100644 Assets/WebPlayerTemplates/HappyFunTimes/controllers/camera/css/controller.css.meta create mode 100644 Assets/WebPlayerTemplates/HappyFunTimes/controllers/camera/scripts.meta create mode 100644 Assets/WebPlayerTemplates/HappyFunTimes/controllers/camera/scripts/controller.js create mode 100644 Assets/WebPlayerTemplates/HappyFunTimes/controllers/camera/scripts/controller.js.meta diff --git a/Assets/HappyFunTimes-README.txt b/Assets/HappyFunTimes-README.txt index 5258529..6fe3830 100644 --- a/Assets/HappyFunTimes-README.txt +++ b/Assets/HappyFunTimes-README.txt @@ -38,6 +38,7 @@ Assets └── HappyFunTimes ├── 3rdparty see below ├── controllers + │   ├── camera deletable │   ├── character-select deletable │   ├── clean deletable │   ├── gamepad see below @@ -104,6 +105,30 @@ http://docs.happyfuntimes.net/docs/unity/rendezvous-server.html ## Change List +* 2.1.4 + + * Added MoreSamples/Camera sample + +* 2.1.3 + + * Updated for 2017 + +* 2.1.2 + + * Fix sounds example + +* 2.1.1 + + * Disable auto connect on iOS installation mode. + + Apple either removed or broke this feature on iOS + + * Upadte to Unity 5.6.1 + +* 2.1.0 + + * Add Character example + * 2.0.6 * Update to Unity 5.6 diff --git a/Assets/HappyFunTimes/MoreSamples/camera.meta b/Assets/HappyFunTimes/MoreSamples/camera.meta new file mode 100644 index 0000000..8e81662 --- /dev/null +++ b/Assets/HappyFunTimes/MoreSamples/camera.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 9ac27e66d78a14ea58b20de8f413028a +folderAsset: yes +timeCreated: 1511756490 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/HappyFunTimes/MoreSamples/camera/Materials.meta b/Assets/HappyFunTimes/MoreSamples/camera/Materials.meta new file mode 100644 index 0000000..f20bbb8 --- /dev/null +++ b/Assets/HappyFunTimes/MoreSamples/camera/Materials.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 1447f435dad4743eba88656926974dc6 +folderAsset: yes +timeCreated: 1511756732 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/HappyFunTimes/MoreSamples/camera/Prefabs.meta b/Assets/HappyFunTimes/MoreSamples/camera/Prefabs.meta new file mode 100644 index 0000000..75e98bb --- /dev/null +++ b/Assets/HappyFunTimes/MoreSamples/camera/Prefabs.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: e80db2ee453354be484edf5bdb9c5e34 +folderAsset: yes +timeCreated: 1511756716 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/HappyFunTimes/MoreSamples/camera/Prefabs/PrefabForExampleCamera.prefab b/Assets/HappyFunTimes/MoreSamples/camera/Prefabs/PrefabForExampleCamera.prefab new file mode 100644 index 0000000000000000000000000000000000000000..3286b5b8125824cb190af97954dec8a632e21577 GIT binary patch literal 8356 zcmdT}e~eT|9iMl52NbczpI|AtP_(pE%JHMcrqJCx4!Cj$#~pV~HO=vE_ucN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|~kOrq4`Uf#q`>N3a^rd+t?bv%?I6Us+%WM{8ZZ*mt&YEBnNqv zyE9y-vyEw<+HFkpG`fvxp4x3p^UQ`^X(_8AR^zz=m0_$-!b*Oo3C+Xb3|Zsv#jTw< zeHXVJ*stN>lR?UPG`RHrTR{YytvUSC?`G}0_22#T=DfM~8~<3rt?4i-!<~gTyHhpM z;`&qDjPE&>&64=7p3Rv0reibBQ)@HL)2PifPp!=~Pt;~d@#d?1`9qtjE#;FwPMfjl zttN#w-IX^ZL%FddJzA#kJlbOY#)yvJ?JZYfRmp`4@0CRKk8esw|q2r|k9U(^Fdlyh(l#Wpt2VdSsPz60r}W z(j#9cu5K0jgCe;Uf3p}sdpF*OJoHE+#b*iYLxbkJS9s!#?!+PRvjWkLw}4jm?PJYhEy3+3PFlQ%-)+QF@NsOWwv(TqAC; z@HW;g?Ls|Jp71uNK2&SFgtxJlm^{3VDf!hc{}}q@Srp*vR-t*q+n73zX!|CE@#>cL zJo@BW9N=*t`ny^;&U1Z$t1a@R-(SjSN{AlU8a9Wzovb}{0RVPS-4zhjF~d z(Uu>2>wN}}PAP-c8L?b%JcbaR#`M*QFS1zC)mg^DGdq1`x<;{t-@qz>4UY`ERQ*Dp6^lp9B z`ug6>cMrV2dhq2# zPwkedd65J_|n;K_aN$fs5j63+u;9-)i9 zZ1oZn{{)u8lP21A`4s-gmjz7Pf@cfrk=(m{h%sQC%M}mbwf@b=<{vVS1KWsx=u$$Q z9se#6wTAf3+~=P9{o8FPp5A)y?9ckQ;SX-nLQCr6T4kr=W~}lpl@gA#gF_WusqE6A zHHKrW9uywbi4^Q1*L26#gk%cWS{yE5>AG1L{o`5jY(Du~h^)oUgh(TiY#_O2VbN&ZwE#>h5 literal 0 HcmV?d00001 diff --git a/Assets/HappyFunTimes/MoreSamples/camera/Prefabs/PrefabForExampleCamera.prefab.meta b/Assets/HappyFunTimes/MoreSamples/camera/Prefabs/PrefabForExampleCamera.prefab.meta new file mode 100644 index 0000000..06b0101 --- /dev/null +++ b/Assets/HappyFunTimes/MoreSamples/camera/Prefabs/PrefabForExampleCamera.prefab.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 7cf4a4f04d4e24d4dbf6d6916575f949 +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/HappyFunTimes/MoreSamples/camera/Scenes.meta b/Assets/HappyFunTimes/MoreSamples/camera/Scenes.meta new file mode 100644 index 0000000..dd798ec --- /dev/null +++ b/Assets/HappyFunTimes/MoreSamples/camera/Scenes.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: afbd1386164564ddaaafbf57997135b5 +folderAsset: yes +timeCreated: 1511756684 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/HappyFunTimes/MoreSamples/camera/Scenes/HappyFunTimesCameraExample-README.txt b/Assets/HappyFunTimes/MoreSamples/camera/Scenes/HappyFunTimesCameraExample-README.txt new file mode 100644 index 0000000..c7eb78b --- /dev/null +++ b/Assets/HappyFunTimes/MoreSamples/camera/Scenes/HappyFunTimesCameraExample-README.txt @@ -0,0 +1,21 @@ +# Camera Example + +This sample is based of the Simple Example in `Assets/HappyFunTimes/MoreSamples/Simple` +It shows letting the user take or select an image on their camera then +sending that image to the game and using it as a texture. + +It uses a custom controller found in +`Assets/WebPlayerTemplates/HappyFunTimes/controllers/camera/controller.html` + +Tersely, if you select the `ExampleCameraSpawner` GameObject you'll see it has a `PlayerSpawner` +component set to spawn the `PrefabForExampleCamera` prefab anytime a player connects their phone. + +The `PrefabForExampleCamera` prefab has the `ExampleCameraPlayer` script which uses the `NetPlayer` +object passed to it to send and receive messages from the phone. + +The code in `Assets/WebPlayerTemplates/HappyFunTimes/controllers/camera/controller.html` +uses an input type=file tag to ask the user to select an image. It then scales that image to 256x256, +using a 2D canvas, converts it to a dataUrl and sends it to the game. The game converts the dataUrl +to binary and passes it to `Texture2D.Load` in unity. + +For more info see [http://docs.happyfuntimes.net/docs/unity/](http://docs.happyfuntimes.net/docs/unity/). diff --git a/Assets/HappyFunTimes/MoreSamples/camera/Scenes/HappyFunTimesCameraExample-README.txt.meta b/Assets/HappyFunTimes/MoreSamples/camera/Scenes/HappyFunTimesCameraExample-README.txt.meta new file mode 100644 index 0000000..245ec04 --- /dev/null +++ b/Assets/HappyFunTimes/MoreSamples/camera/Scenes/HappyFunTimesCameraExample-README.txt.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bedb0c1a14c924758884d9e7863ce71c +timeCreated: 1465053929 +licenseType: Free +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/HappyFunTimes/MoreSamples/camera/Scenes/HappyFunTimesCameraExample.unity b/Assets/HappyFunTimes/MoreSamples/camera/Scenes/HappyFunTimesCameraExample.unity new file mode 100644 index 0000000000000000000000000000000000000000..ad4fb671547d00bd75f47f003d208acdb2691f7e GIT binary patch literal 23584 zcmeHP3z%F*m9CzIhlspXgjHh)f+Qj2EpL+UnaN{9hD>IX0G~j(Gkr7Nq^IxDkGyOYdAcmCkp2HUb^1Q08zw96=l3o3 zrRG-sx9+J^r%s)7s`}m-v*ZC|PEH$R_BLk8^SGMXGiMz>eb)3@Yi60(w{PE`!VU95 z-q^l9H~7oBm7$Rv?>{8J<+*d8`nx@VK8@VQ+en8SQ=cY9`!{7$=Bja~eq+ki#{)?< za?0$F@(kqNk>&Y1?zfq(ps@%T+mAy=wSk|A8gb?*?mKL!2A(nxqQQF9_d?#;;_Sc8 z^0OIr(%2<|pX=~l6Zi!Ve@6oUg2Q)f;3@MZly67oxZc^o+sxzO=MmJ|FYk#g+RSvw z2lov7e3!$Q4Ga`(l|oSJs1=Ka(qNxot>RKKjT`OWTEBq~t!|E2hP-0YuT<^boL@Ey zEDnmk>GuZKuJH!^75TDX$p^)p8Cu;p;FtVGE4w;P&Z~MKoq38}XSwTacb#*J>FKGK zk7;!4`0T_(^FXE<4tQaq=!5jo>K?C}MSO6g#~lmw zIfzGRfm%h$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-AWde;I&2!+V-(O9j{d!#;4US)zv~iK0_JJ zo1CQfW_6JxbdgSfVh%Uz(HL2)x@mooq`QPyr zr`eF3QUA*O>VH{Q|ID)bZ z^}(_nHhjYp*CCU}JuGWn#InXsEN5M8#InX+EHjqs_6nu6doO_T7VECcCZp0=c+_}r zEN$7r|7Cmf^!>X#=Y8R_%jUiG;*0aPj*K|JNls*LF1z$n*zHZ7h+LeF8p+_^9XxAh zV#{cvU4wB1>2&tQBX5e(i?$kF)^UIPo~v#@$GiGFuV4S~M-A*+zT?*O-_>#UFQ#{V zdg?*nQ=a4+r=dC!N1NBE%S;->vaB&K%Nhf-tT8gnZ>9avc>J%;ekflYZzEadZM{|- z?V1#n-j3Q2eJ)OtJZPdFY0XocHXFlL+v>iAkLbRIWybZrzL&#q4>orHb7Kk8)V-40 z1zt7g=Y1yjJ976DTjqUjYk?Mjly3ZXeg0WDjNJN@>qc%DytUlyek1;H%bH#5xU2gw zHq`wY%esGK`8~)BHt@e(@x`RtpN0JLTM?U)zV07YMx4{6JUO~R$ zuY}DAq3QYRP?6N%x|HOTGEDM04J^wz8y-Op1jBAV!!w4BajWg+t_zlVyCvirVcxi67@AMdtKd}dT1 zJ@+qY{lw@y%I^!Qhvw}*XZZH|xF?SN-TP0QKY8Wu?e!BczUzt2Pk~3}o7Z?!9~DQN z*R-vkGq9DOL$Ivp6fEmG2Fq`yKhralzczoSd~v*uWGA<^>>KTx6qMeM`ZIklPLe!m NJp9J~Ol_?`|3AMdyFLH_ literal 0 HcmV?d00001 diff --git a/Assets/HappyFunTimes/MoreSamples/camera/Scenes/HappyFunTimesCameraExample.unity.meta b/Assets/HappyFunTimes/MoreSamples/camera/Scenes/HappyFunTimesCameraExample.unity.meta new file mode 100644 index 0000000..b1fd6ce --- /dev/null +++ b/Assets/HappyFunTimes/MoreSamples/camera/Scenes/HappyFunTimesCameraExample.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0b5a450f9afc149a2ac6aed56ca34015 +timeCreated: 1511756684 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/HappyFunTimes/MoreSamples/camera/Scripts.meta b/Assets/HappyFunTimes/MoreSamples/camera/Scripts.meta new file mode 100644 index 0000000..75d6d96 --- /dev/null +++ b/Assets/HappyFunTimes/MoreSamples/camera/Scripts.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: e31ac49faa1234c81b367532f47a5a9e +folderAsset: yes +timeCreated: 1511756723 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/HappyFunTimes/MoreSamples/camera/Scripts/ExampleCameraGameSettings.cs b/Assets/HappyFunTimes/MoreSamples/camera/Scripts/ExampleCameraGameSettings.cs new file mode 100644 index 0000000..b08e4f9 --- /dev/null +++ b/Assets/HappyFunTimes/MoreSamples/camera/Scripts/ExampleCameraGameSettings.cs @@ -0,0 +1,40 @@ +using UnityEngine; + +namespace HappyFunTimesExample { + +// A Singlton-ish class for some global settings. +// PS: I know Singltons suck but dependency injection is hard +// in Unity. +public class ExampleCameraGameSettings : MonoBehaviour { + + public int areaWidth = 300; // matches JavaScript + public int areaHeight = 300; + + public static ExampleCameraGameSettings settings() { + return s_settings; + } + + static private ExampleCameraGameSettings s_settings; + + void Awake() { + if (s_settings != null) { + throw new System.InvalidProgramException("there is more than one game settings object!"); + } + s_settings = this; + } + + void Cleanup() { + s_settings = null; + } + + void OnDestroy() { + Cleanup(); + } + + void OnApplicationExit() { + Cleanup(); + } +} + +} // namespace HappyFunTimesExample + diff --git a/Assets/HappyFunTimes/MoreSamples/camera/Scripts/ExampleCameraGameSettings.cs.meta b/Assets/HappyFunTimes/MoreSamples/camera/Scripts/ExampleCameraGameSettings.cs.meta new file mode 100644 index 0000000..585c15e --- /dev/null +++ b/Assets/HappyFunTimes/MoreSamples/camera/Scripts/ExampleCameraGameSettings.cs.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: da9ce00fa210f403d8df3e2f4693f869 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/HappyFunTimes/MoreSamples/camera/Scripts/ExampleCameraPlayer.cs b/Assets/HappyFunTimes/MoreSamples/camera/Scripts/ExampleCameraPlayer.cs new file mode 100644 index 0000000..1110f5c --- /dev/null +++ b/Assets/HappyFunTimes/MoreSamples/camera/Scripts/ExampleCameraPlayer.cs @@ -0,0 +1,133 @@ +using UnityEngine; +using System; +using System.Collections; +using System.Collections.Generic; +using HappyFunTimes; +using CSSParse; + +namespace HappyFunTimesExample { + +class ExampleCameraPlayer : MonoBehaviour { + private class MessageMove { + public float x = 0; + public float y = 0; + }; + + private class MessagePic { + public string dataUrl; + } + + void InitializeNetPlayer(SpawnInfo spawnInfo) { + // Save the netplayer object so we can use it send messages to the phone + m_netPlayer = spawnInfo.netPlayer; + + // Register handler to call if the player disconnects from the game. + m_netPlayer.OnDisconnect += Remove; + + // Track name changes + m_playerNameManager = new HFTPlayerNameManager(m_netPlayer); + m_playerNameManager.OnNameChange += ChangeName; + + // Setup events for the different messages. + m_netPlayer.RegisterCmdHandler("move", OnMove); + m_netPlayer.RegisterCmdHandler("pic", OnPicture); + + ExampleCameraGameSettings settings = ExampleCameraGameSettings.settings(); + m_position = new Vector3(UnityEngine.Random.Range(0, settings.areaWidth), 0, UnityEngine.Random.Range(0, settings.areaHeight)); + transform.localPosition = m_position; + + SetName(m_playerNameManager.Name); + } + + void Start() { + m_renderer = gameObject.GetComponent(); + m_position = gameObject.transform.localPosition; + SetColor(new Color(0.0f, 1.0f, 0.0f)); + } + + void Update() { + } + + void OnDestroy() { + if (m_playerNameManager != null) { + m_playerNameManager.Close(); + m_playerNameManager = null; + } + } + + void OnGUI() + { + Vector2 size = m_guiStyle.CalcSize(m_guiName); + Vector3 coords = Camera.main.WorldToScreenPoint(transform.position); + m_nameRect.x = coords.x - size.x * 0.5f - 5.0f; + m_nameRect.y = Screen.height - coords.y - 30.0f; + GUI.Box(m_nameRect, m_name, m_guiStyle); + } + + void SetName(string name) { + m_name = name; + gameObject.name = "Player-" + m_name; + m_guiName = new GUIContent(m_name); + m_guiStyle.normal.textColor = Color.black; + m_guiStyle.contentOffset = new Vector2(4.0f, 2.0f); + Vector2 size = m_guiStyle.CalcSize(m_guiName); + m_nameRect.width = size.x + 12; + m_nameRect.height = size.y + 5; + } + + void SetColor(Color color) + { + m_color = color; + m_renderer.material.color = m_color; + Color[] pix = new Color[1]; + pix[0] = color; + Texture2D tex = new Texture2D(1, 1); + tex.SetPixels(pix); + tex.Apply(); + m_guiStyle.normal.background = tex; + } + + void SetTexture(Byte[] binaryData) + { + Texture2D tex = new Texture2D(4, 4); + tex.LoadImage(binaryData); + m_renderer.material.mainTexture = tex; + m_renderer.material.color = Color.white; + } + + private void Remove(object sender, EventArgs e) { + Destroy(gameObject); + } + + + private static string s_dataUrlHeader = "data:image/png;base64,"; + + private void OnPicture(MessagePic data) { + SetTexture(Convert.FromBase64String(data.dataUrl.Substring(s_dataUrlHeader.Length))); + } + + private void OnMove(MessageMove data) { + ExampleCameraGameSettings settings = ExampleCameraGameSettings.settings(); + m_position.x = data.x * settings.areaWidth; + m_position.z = settings.areaHeight - (data.y * settings.areaHeight) - 1; // because in 2D down is positive. + + gameObject.transform.localPosition = m_position; + } + + private void ChangeName(string name) { + SetName(name); + } + + private NetPlayer m_netPlayer; + private HFTPlayerNameManager m_playerNameManager; + private Renderer m_renderer; + private Vector3 m_position; + private Color m_color; + private string m_name; + private GUIStyle m_guiStyle = new GUIStyle(); + private GUIContent m_guiName = new GUIContent(""); + private Rect m_nameRect = new Rect(0,0,0,0); +} + +} // namespace HappyFunTimesExample + diff --git a/Assets/HappyFunTimes/MoreSamples/camera/Scripts/ExampleCameraPlayer.cs.meta b/Assets/HappyFunTimes/MoreSamples/camera/Scripts/ExampleCameraPlayer.cs.meta new file mode 100644 index 0000000..38b187f --- /dev/null +++ b/Assets/HappyFunTimes/MoreSamples/camera/Scripts/ExampleCameraPlayer.cs.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 6d013b8addbe245baab48e0e5c55e484 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/__dir__.txt b/Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/__dir__.txt index c72a7b8..f05ad36 100644 --- a/Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/__dir__.txt +++ b/Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/__dir__.txt @@ -1 +1 @@ -["icon-16.png","3rdparty/audiomanager-min.js","3rdparty/audiomanager.js","3rdparty/chroma.min.js","3rdparty/game-utils-min.js","3rdparty/game-utils.js","3rdparty/gyronorm.complete.min.js","controllers/character-select/controller.html","controllers/character-select/css/controller.css","controllers/character-select/images/cube.svg","controllers/character-select/images/cylinder.svg","controllers/character-select/images/sphere.svg","controllers/character-select/scripts/controller.js","controllers/clean/controller.html","controllers/gamepad/controller.html","controllers/gamepad/css/controller.css","controllers/gamepad/images/bird.png","controllers/gamepad/images/hft-circle-button.svg","controllers/gamepad/images/hft-down-arrow-button.svg","controllers/gamepad/images/hft-left-arrow-button.svg","controllers/gamepad/images/hft-right-arrow-button.svg","controllers/gamepad/images/hft-up-arrow-button.svg","controllers/gamepad/scripts/controller.js","controllers/gamepad/sounds/explosion.mp3","controllers/gamepad/sounds/gameover.mp3","controllers/gamepad/sounds/launch.mp3","controllers/gamepad/sounds/sounds.jsfx.txt","controllers/multi-machine/controller.html","controllers/multi-machine/css/controller.css","controllers/multi-machine/images/bird.png","controllers/multi-machine/images/hft-circle-button.svg","controllers/multi-machine/images/hft-down-arrow-button.svg","controllers/multi-machine/images/hft-left-arrow-button.svg","controllers/multi-machine/images/hft-right-arrow-button.svg","controllers/multi-machine/images/hft-up-arrow-button.svg","controllers/multi-machine/scripts/controller.js","controllers/simple/controller.html","controllers/simple/css/controller.css","controllers/simple/scripts/controller.js","controllers/syncedclock/controller.html","controllers/syncedclock/assets/clocktick.mp3","controllers/syncedclock/assets/clocktick.ogg","controllers/syncedclock/css/controller.css","controllers/syncedclock/scripts/controller.js","hft/hft-min.js","hft/hft.js","hft/missing.html","hft/assets/gear-icon.svg","hft/captive-portal/captive-portal.html","hft/captive-portal/game-login.html","hft/captive-portal/login.css","hft/captive-portal/xtra2.bin","sample-ui/sample-ui-min.js","sample-ui/sample-ui.css","sample-ui/sample-ui.js"] \ No newline at end of file +["icon-16.png","3rdparty/audiomanager-min.js","3rdparty/audiomanager.js","3rdparty/chroma.min.js","3rdparty/game-utils-min.js","3rdparty/game-utils.js","3rdparty/gyronorm.complete.min.js","controllers/camera/controller.html","controllers/camera/css/controller.css","controllers/camera/scripts/controller.js","controllers/character-select/controller.html","controllers/character-select/css/controller.css","controllers/character-select/images/cube.svg","controllers/character-select/images/cylinder.svg","controllers/character-select/images/sphere.svg","controllers/character-select/scripts/controller.js","controllers/clean/controller.html","controllers/gamepad/controller.html","controllers/gamepad/css/controller.css","controllers/gamepad/images/bird.png","controllers/gamepad/images/hft-circle-button.svg","controllers/gamepad/images/hft-down-arrow-button.svg","controllers/gamepad/images/hft-left-arrow-button.svg","controllers/gamepad/images/hft-right-arrow-button.svg","controllers/gamepad/images/hft-up-arrow-button.svg","controllers/gamepad/scripts/controller.js","controllers/gamepad/sounds/explosion.mp3","controllers/gamepad/sounds/gameover.mp3","controllers/gamepad/sounds/launch.mp3","controllers/gamepad/sounds/sounds.jsfx.txt","controllers/multi-machine/controller.html","controllers/multi-machine/css/controller.css","controllers/multi-machine/images/bird.png","controllers/multi-machine/images/hft-circle-button.svg","controllers/multi-machine/images/hft-down-arrow-button.svg","controllers/multi-machine/images/hft-left-arrow-button.svg","controllers/multi-machine/images/hft-right-arrow-button.svg","controllers/multi-machine/images/hft-up-arrow-button.svg","controllers/multi-machine/scripts/controller.js","controllers/simple/controller.html","controllers/simple/css/controller.css","controllers/simple/scripts/controller.js","controllers/syncedclock/controller.html","controllers/syncedclock/assets/clocktick.mp3","controllers/syncedclock/assets/clocktick.ogg","controllers/syncedclock/css/controller.css","controllers/syncedclock/scripts/controller.js","hft/hft-min.js","hft/hft.js","hft/missing.html","hft/assets/gear-icon.svg","hft/captive-portal/captive-portal.html","hft/captive-portal/game-login.html","hft/captive-portal/login.css","hft/captive-portal/xtra2.bin","sample-ui/sample-ui-min.js","sample-ui/sample-ui.css","sample-ui/sample-ui.js"] \ No newline at end of file diff --git a/Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/controllers/camera.meta b/Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/controllers/camera.meta new file mode 100644 index 0000000..3746127 --- /dev/null +++ b/Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/controllers/camera.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: a0b9705ba19a9445795cf43bed3717cb +folderAsset: yes +timeCreated: 1511757953 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/controllers/camera/controller.html.bytes b/Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/controllers/camera/controller.html.bytes new file mode 100644 index 0000000..d32fe8d --- /dev/null +++ b/Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/controllers/camera/controller.html.bytes @@ -0,0 +1,105 @@ + + + + + + + + + + + + + happyfuntimes Controls + + + + + + +
+
+
+

status

+
+
Touch to Move
+
+
+
+
+ +
+
+
+
+
+
+
Switching Games...
+
+
+
+

+      
+
+
+ +
+
+
+ +
+
+ +
+
+
Set Name
+
Restart
+
Back
+
+
+ +
+
+
+ + + + + + + + diff --git a/Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/controllers/camera/controller.html.bytes.meta b/Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/controllers/camera/controller.html.bytes.meta new file mode 100644 index 0000000..5aac0ad --- /dev/null +++ b/Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/controllers/camera/controller.html.bytes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 03878c510f2214d8a8b938176a489468 +timeCreated: 1511757953 +licenseType: Free +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/controllers/camera/css.meta b/Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/controllers/camera/css.meta new file mode 100644 index 0000000..fd0e05e --- /dev/null +++ b/Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/controllers/camera/css.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 96f1dbb42e7e24f8b8eb5083058023f2 +folderAsset: yes +timeCreated: 1511757953 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/controllers/camera/css/controller.css.bytes b/Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/controllers/camera/css/controller.css.bytes new file mode 100644 index 0000000..721a006 --- /dev/null +++ b/Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/controllers/camera/css/controller.css.bytes @@ -0,0 +1,75 @@ +/* + * Copyright 2014, Gregg Tavares. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Gregg Tavares. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#gamearea { + width: 100%; + height: 100%; +} +#gamestatus { + position: absolute; + z-index: 4000; + border-radius: 5px; + background-color: rgba(0,0,0,0.5); + margin: 0.5em; + padding: 0.5em; + color: white; + font-size: medium; +} +#display { +} +#inputarea { + position: absolute; + z-index: 4100; + top: 0px; + left: 0px; + width: 100%; + height: 100%; +} +#picture { + text-align: center; + background: red; + position: absolute; + z-index: 4101; + font-size: 20pt; + top: 0px; + left: 0px; + width: 100%; + height: 100%; +} +#picture input[type=file] { + display: none; +} +#picture label { + display: block; + padding: 0.5em; + margin: 0.5em; + background: yellow; + border-radius: 0.5em; +} diff --git a/Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/controllers/camera/css/controller.css.bytes.meta b/Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/controllers/camera/css/controller.css.bytes.meta new file mode 100644 index 0000000..33a06f9 --- /dev/null +++ b/Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/controllers/camera/css/controller.css.bytes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9d865a2224850462f9a20e706f955c77 +timeCreated: 1511757953 +licenseType: Free +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/controllers/camera/scripts.meta b/Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/controllers/camera/scripts.meta new file mode 100644 index 0000000..2db736a --- /dev/null +++ b/Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/controllers/camera/scripts.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 7b32ac2d6a5e34bb3afa76d6f7df095c +folderAsset: yes +timeCreated: 1511757953 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/controllers/camera/scripts/controller.js.bytes b/Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/controllers/camera/scripts/controller.js.bytes new file mode 100644 index 0000000..1c0e06b --- /dev/null +++ b/Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/controllers/camera/scripts/controller.js.bytes @@ -0,0 +1,120 @@ +/* + * Copyright 2014, Gregg Tavares. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Gregg Tavares. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +"use strict"; + +// Start the main app logic. +var commonUI = sampleUI.commonUI; +var input = sampleUI.input; +var misc = sampleUI.misc; +var mobileHacks = sampleUI.mobileHacks; +var strings = sampleUI.strings; +var touch = sampleUI.touch; + +var globals = { + debug: false, + //orientation: "landscape-primary", +}; +misc.applyUrlSettings(globals); +mobileHacks.fixHeightHack(); +mobileHacks.disableContextMenu(); + +var score = 0; +var statusElem = document.getElementById("gamestatus"); +var inputElem = document.getElementById("inputarea"); +var colorElem = document.getElementById("display"); +var picFrameElem = document.getElementById("picture"); +var picElem = document.querySelector("#picture input[type=file]"); +var client = new hft.GameClient(); + +commonUI.setupStandardControllerUI(client, globals); +commonUI.askForNameOnce(); +commonUI.showMenu(true); + +function randInt(range) { + return Math.floor(Math.random() * range); +}; + +// Sends a move command to the game. +// +// This will generate a 'move' event in the corresponding +// NetPlayer object in the game. +function sendMoveCmd(position, target) { + client.sendCmd('move', { + x: position.x / target.clientWidth, + y: position.y / target.clientHeight, + }); +}; + +// Send a message to the game when the screen is touched +inputElem.addEventListener('pointermove', function(event) { + var position = input.getRelativeCoordinates(event.target, event); + sendMoveCmd(position, event.target); + event.preventDefault(); +}); + +// Send selected picture to game +picElem.addEventListener('change', function(event) { + if (this.files && this.files[0]) { + // NOTE: Older iOS could not handle camera images + // in web pages + picFrameElem.style.display = "none"; + // make image to load picture + var img = new Image(); + // call function when done loading + img.onload = function() { + // create a 256x256 canvas + var canvas = document.createElement("canvas"); + canvas.width = 256; + canvas.height = 256; + var ctx = canvas.getContext("2d"); + // scale the image using a css "cover" algo + var aspect = img.width / img.height; + var dstHeight = 256 + var dstWidth = dstHeight * aspect; + if (dstWidth < 256) { + dstWidth = 256; + dstHeight = dstWidth / aspect; + } + var dstX = (256 - dstWidth) / 2; + var dstY = (256 - dstHeight) / 2; + ctx.drawImage(img, dstX, dstY, dstWidth, dstHeight); + // send the image as a dataUrl to theg game + client.sendCmd('pic', { + dataUrl: canvas.toDataURL(), + }); + // tell the browser we're done + URL.revokeObjectURL(img.src); + }; + // load the image + img.src = URL.createObjectURL(this.files[0]); + } +}); + diff --git a/Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/controllers/camera/scripts/controller.js.bytes.meta b/Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/controllers/camera/scripts/controller.js.bytes.meta new file mode 100644 index 0000000..d12d1ba --- /dev/null +++ b/Assets/HappyFunTimes/Resources/HappyFunTimesAutoGeneratedDoNotEdit/controllers/camera/scripts/controller.js.bytes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a3dd0e94954f740fa974bb38d8c9c579 +timeCreated: 1511757953 +licenseType: Free +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WebPlayerTemplates/HappyFunTimes/controllers/camera.meta b/Assets/WebPlayerTemplates/HappyFunTimes/controllers/camera.meta new file mode 100644 index 0000000..db5fce9 --- /dev/null +++ b/Assets/WebPlayerTemplates/HappyFunTimes/controllers/camera.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: f506f563472a14485bb67505a8488a39 +folderAsset: yes +timeCreated: 1511757952 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WebPlayerTemplates/HappyFunTimes/controllers/camera/controller.html b/Assets/WebPlayerTemplates/HappyFunTimes/controllers/camera/controller.html new file mode 100644 index 0000000..d32fe8d --- /dev/null +++ b/Assets/WebPlayerTemplates/HappyFunTimes/controllers/camera/controller.html @@ -0,0 +1,105 @@ + + + + + + + + + + + + + happyfuntimes Controls + + + + + + +
+
+
+

status

+
+
Touch to Move
+
+
+
+
+ +
+
+
+
+
+
+
Switching Games...
+
+
+
+

+      
+
+
+ +
+
+
+ +
+
+ +
+
+
Set Name
+
Restart
+
Back
+
+
+ +
+
+
+ + + + + + + + diff --git a/Assets/WebPlayerTemplates/HappyFunTimes/controllers/camera/controller.html.meta b/Assets/WebPlayerTemplates/HappyFunTimes/controllers/camera/controller.html.meta new file mode 100644 index 0000000..ca49765 --- /dev/null +++ b/Assets/WebPlayerTemplates/HappyFunTimes/controllers/camera/controller.html.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3574210fe753c429f85af827dae4d16c +timeCreated: 1463116308 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WebPlayerTemplates/HappyFunTimes/controllers/camera/css.meta b/Assets/WebPlayerTemplates/HappyFunTimes/controllers/camera/css.meta new file mode 100644 index 0000000..3c69232 --- /dev/null +++ b/Assets/WebPlayerTemplates/HappyFunTimes/controllers/camera/css.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 8d8f0fe8757dc46269844a9fb5c58732 +folderAsset: yes +timeCreated: 1463116308 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WebPlayerTemplates/HappyFunTimes/controllers/camera/css/controller.css b/Assets/WebPlayerTemplates/HappyFunTimes/controllers/camera/css/controller.css new file mode 100644 index 0000000..721a006 --- /dev/null +++ b/Assets/WebPlayerTemplates/HappyFunTimes/controllers/camera/css/controller.css @@ -0,0 +1,75 @@ +/* + * Copyright 2014, Gregg Tavares. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Gregg Tavares. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#gamearea { + width: 100%; + height: 100%; +} +#gamestatus { + position: absolute; + z-index: 4000; + border-radius: 5px; + background-color: rgba(0,0,0,0.5); + margin: 0.5em; + padding: 0.5em; + color: white; + font-size: medium; +} +#display { +} +#inputarea { + position: absolute; + z-index: 4100; + top: 0px; + left: 0px; + width: 100%; + height: 100%; +} +#picture { + text-align: center; + background: red; + position: absolute; + z-index: 4101; + font-size: 20pt; + top: 0px; + left: 0px; + width: 100%; + height: 100%; +} +#picture input[type=file] { + display: none; +} +#picture label { + display: block; + padding: 0.5em; + margin: 0.5em; + background: yellow; + border-radius: 0.5em; +} diff --git a/Assets/WebPlayerTemplates/HappyFunTimes/controllers/camera/css/controller.css.meta b/Assets/WebPlayerTemplates/HappyFunTimes/controllers/camera/css/controller.css.meta new file mode 100644 index 0000000..e07b451 --- /dev/null +++ b/Assets/WebPlayerTemplates/HappyFunTimes/controllers/camera/css/controller.css.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 20654fdecebed4cb29d663e982922b82 +timeCreated: 1428745724 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WebPlayerTemplates/HappyFunTimes/controllers/camera/scripts.meta b/Assets/WebPlayerTemplates/HappyFunTimes/controllers/camera/scripts.meta new file mode 100644 index 0000000..c3b0316 --- /dev/null +++ b/Assets/WebPlayerTemplates/HappyFunTimes/controllers/camera/scripts.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 318e64c2bde9b44f48c19ef8ecc9e1ac +folderAsset: yes +timeCreated: 1463116308 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WebPlayerTemplates/HappyFunTimes/controllers/camera/scripts/controller.js b/Assets/WebPlayerTemplates/HappyFunTimes/controllers/camera/scripts/controller.js new file mode 100644 index 0000000..1c0e06b --- /dev/null +++ b/Assets/WebPlayerTemplates/HappyFunTimes/controllers/camera/scripts/controller.js @@ -0,0 +1,120 @@ +/* + * Copyright 2014, Gregg Tavares. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Gregg Tavares. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +"use strict"; + +// Start the main app logic. +var commonUI = sampleUI.commonUI; +var input = sampleUI.input; +var misc = sampleUI.misc; +var mobileHacks = sampleUI.mobileHacks; +var strings = sampleUI.strings; +var touch = sampleUI.touch; + +var globals = { + debug: false, + //orientation: "landscape-primary", +}; +misc.applyUrlSettings(globals); +mobileHacks.fixHeightHack(); +mobileHacks.disableContextMenu(); + +var score = 0; +var statusElem = document.getElementById("gamestatus"); +var inputElem = document.getElementById("inputarea"); +var colorElem = document.getElementById("display"); +var picFrameElem = document.getElementById("picture"); +var picElem = document.querySelector("#picture input[type=file]"); +var client = new hft.GameClient(); + +commonUI.setupStandardControllerUI(client, globals); +commonUI.askForNameOnce(); +commonUI.showMenu(true); + +function randInt(range) { + return Math.floor(Math.random() * range); +}; + +// Sends a move command to the game. +// +// This will generate a 'move' event in the corresponding +// NetPlayer object in the game. +function sendMoveCmd(position, target) { + client.sendCmd('move', { + x: position.x / target.clientWidth, + y: position.y / target.clientHeight, + }); +}; + +// Send a message to the game when the screen is touched +inputElem.addEventListener('pointermove', function(event) { + var position = input.getRelativeCoordinates(event.target, event); + sendMoveCmd(position, event.target); + event.preventDefault(); +}); + +// Send selected picture to game +picElem.addEventListener('change', function(event) { + if (this.files && this.files[0]) { + // NOTE: Older iOS could not handle camera images + // in web pages + picFrameElem.style.display = "none"; + // make image to load picture + var img = new Image(); + // call function when done loading + img.onload = function() { + // create a 256x256 canvas + var canvas = document.createElement("canvas"); + canvas.width = 256; + canvas.height = 256; + var ctx = canvas.getContext("2d"); + // scale the image using a css "cover" algo + var aspect = img.width / img.height; + var dstHeight = 256 + var dstWidth = dstHeight * aspect; + if (dstWidth < 256) { + dstWidth = 256; + dstHeight = dstWidth / aspect; + } + var dstX = (256 - dstWidth) / 2; + var dstY = (256 - dstHeight) / 2; + ctx.drawImage(img, dstX, dstY, dstWidth, dstHeight); + // send the image as a dataUrl to theg game + client.sendCmd('pic', { + dataUrl: canvas.toDataURL(), + }); + // tell the browser we're done + URL.revokeObjectURL(img.src); + }; + // load the image + img.src = URL.createObjectURL(this.files[0]); + } +}); + diff --git a/Assets/WebPlayerTemplates/HappyFunTimes/controllers/camera/scripts/controller.js.meta b/Assets/WebPlayerTemplates/HappyFunTimes/controllers/camera/scripts/controller.js.meta new file mode 100644 index 0000000..2c1070f --- /dev/null +++ b/Assets/WebPlayerTemplates/HappyFunTimes/controllers/camera/scripts/controller.js.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f87bc9623f5d34cc889dbbea8ef60b6c +timeCreated: 1428745724 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: