Commit 7c0c2978f0949fecb8e4d6ef21480614b5d22c6a
1 parent
0ab76131
Exists in
master
and in
8 other branches
Troca de sprite de botões; Funções de botões da barra na tela info e text_entry
Showing
19 changed files
with
169 additions
and
164 deletions
Show diff stats
Assets/Plugins/Android/AndroidPlugin.jar
No preview for this file type
Assets/Plugins/Android/AndroidPlugin.jar.meta
| 1 | fileFormatVersion: 2 | 1 | fileFormatVersion: 2 |
| 2 | guid: adceddb083d40cc4aaefba7e91837e28 | 2 | guid: adceddb083d40cc4aaefba7e91837e28 |
| 3 | -timeCreated: 1443633684 | 3 | +timeCreated: 1443646150 |
| 4 | licenseType: Free | 4 | licenseType: Free |
| 5 | PluginImporter: | 5 | PluginImporter: |
| 6 | serializedVersion: 1 | 6 | serializedVersion: 1 |
| @@ -0,0 +1,17 @@ | @@ -0,0 +1,17 @@ | ||
| 1 | +fileFormatVersion: 2 | ||
| 2 | +guid: f7bdbc30c69e5324dbf58ab70b70cfac | ||
| 3 | +folderAsset: yes | ||
| 4 | +timeCreated: 1443822734 | ||
| 5 | +licenseType: Free | ||
| 6 | +PluginImporter: | ||
| 7 | + serializedVersion: 1 | ||
| 8 | + iconMap: {} | ||
| 9 | + executionOrder: {} | ||
| 10 | + isPreloaded: 0 | ||
| 11 | + platformData: | ||
| 12 | + Any: | ||
| 13 | + enabled: 1 | ||
| 14 | + settings: {} | ||
| 15 | + userData: | ||
| 16 | + assetBundleName: | ||
| 17 | + assetBundleVariant: |
Assets/Scenes/Main.unity
| @@ -2358,7 +2358,7 @@ MonoBehaviour: | @@ -2358,7 +2358,7 @@ MonoBehaviour: | ||
| 2358 | - {fileID: 0} | 2358 | - {fileID: 0} |
| 2359 | - {fileID: 0} | 2359 | - {fileID: 0} |
| 2360 | - {fileID: 0} | 2360 | - {fileID: 0} |
| 2361 | - collider: {fileID: 0} | 2361 | + _collider: {fileID: 0} |
| 2362 | text_entry: {fileID: 1800578777} | 2362 | text_entry: {fileID: 1800578777} |
| 2363 | i_bar: {fileID: 317863996} | 2363 | i_bar: {fileID: 317863996} |
| 2364 | player_manager: {fileID: 578311381} | 2364 | player_manager: {fileID: 578311381} |
| @@ -7838,7 +7838,6 @@ GameObject: | @@ -7838,7 +7838,6 @@ GameObject: | ||
| 7838 | - 224: {fileID: 1381092951} | 7838 | - 224: {fileID: 1381092951} |
| 7839 | - 222: {fileID: 1381092954} | 7839 | - 222: {fileID: 1381092954} |
| 7840 | - 114: {fileID: 1381092953} | 7840 | - 114: {fileID: 1381092953} |
| 7841 | - - 114: {fileID: 1381092952} | ||
| 7842 | m_Layer: 5 | 7841 | m_Layer: 5 |
| 7843 | m_Name: b_text | 7842 | m_Name: b_text |
| 7844 | m_TagString: Untagged | 7843 | m_TagString: Untagged |
| @@ -7864,70 +7863,6 @@ RectTransform: | @@ -7864,70 +7863,6 @@ RectTransform: | ||
| 7864 | m_AnchoredPosition: {x: -300, y: -15.5} | 7863 | m_AnchoredPosition: {x: -300, y: -15.5} |
| 7865 | m_SizeDelta: {x: 106, y: 106} | 7864 | m_SizeDelta: {x: 106, y: 106} |
| 7866 | m_Pivot: {x: .5, y: .5} | 7865 | m_Pivot: {x: .5, y: .5} |
| 7867 | ---- !u!114 &1381092952 | ||
| 7868 | -MonoBehaviour: | ||
| 7869 | - m_ObjectHideFlags: 0 | ||
| 7870 | - m_PrefabParentObject: {fileID: 11407270, guid: 6506218ed7927bf45b508ebbec0c1222, | ||
| 7871 | - type: 2} | ||
| 7872 | - m_PrefabInternal: {fileID: 0} | ||
| 7873 | - m_GameObject: {fileID: 1381092950} | ||
| 7874 | - m_Enabled: 1 | ||
| 7875 | - m_EditorHideFlags: 0 | ||
| 7876 | - m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} | ||
| 7877 | - m_Name: | ||
| 7878 | - m_EditorClassIdentifier: | ||
| 7879 | - m_Navigation: | ||
| 7880 | - m_Mode: 3 | ||
| 7881 | - m_SelectOnUp: {fileID: 0} | ||
| 7882 | - m_SelectOnDown: {fileID: 0} | ||
| 7883 | - m_SelectOnLeft: {fileID: 0} | ||
| 7884 | - m_SelectOnRight: {fileID: 0} | ||
| 7885 | - m_Transition: 1 | ||
| 7886 | - m_Colors: | ||
| 7887 | - m_NormalColor: {r: 1, g: 1, b: 1, a: 1} | ||
| 7888 | - m_HighlightedColor: {r: .960784316, g: .960784316, b: .960784316, a: 1} | ||
| 7889 | - m_PressedColor: {r: .572549045, g: .752941251, b: .811764777, a: 1} | ||
| 7890 | - m_DisabledColor: {r: .784313738, g: .784313738, b: .784313738, a: .501960814} | ||
| 7891 | - m_ColorMultiplier: 1 | ||
| 7892 | - m_FadeDuration: .100000001 | ||
| 7893 | - m_SpriteState: | ||
| 7894 | - m_HighlightedSprite: {fileID: 0} | ||
| 7895 | - m_PressedSprite: {fileID: 0} | ||
| 7896 | - m_DisabledSprite: {fileID: 0} | ||
| 7897 | - m_AnimationTriggers: | ||
| 7898 | - m_NormalTrigger: Normal | ||
| 7899 | - m_HighlightedTrigger: Highlighted | ||
| 7900 | - m_PressedTrigger: Pressed | ||
| 7901 | - m_DisabledTrigger: Disabled | ||
| 7902 | - m_Interactable: 0 | ||
| 7903 | - m_TargetGraphic: {fileID: 1381092953} | ||
| 7904 | - m_OnClick: | ||
| 7905 | - m_PersistentCalls: | ||
| 7906 | - m_Calls: | ||
| 7907 | - - m_Target: {fileID: 1800578777} | ||
| 7908 | - m_MethodName: SetActive | ||
| 7909 | - m_Mode: 6 | ||
| 7910 | - m_Arguments: | ||
| 7911 | - m_ObjectArgument: {fileID: 0} | ||
| 7912 | - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine | ||
| 7913 | - m_IntArgument: 0 | ||
| 7914 | - m_FloatArgument: 0 | ||
| 7915 | - m_StringArgument: | ||
| 7916 | - m_BoolArgument: 1 | ||
| 7917 | - m_CallState: 2 | ||
| 7918 | - - m_Target: {fileID: 1740734478} | ||
| 7919 | - m_MethodName: | ||
| 7920 | - m_Mode: 6 | ||
| 7921 | - m_Arguments: | ||
| 7922 | - m_ObjectArgument: {fileID: 0} | ||
| 7923 | - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine | ||
| 7924 | - m_IntArgument: 0 | ||
| 7925 | - m_FloatArgument: 0 | ||
| 7926 | - m_StringArgument: | ||
| 7927 | - m_BoolArgument: 0 | ||
| 7928 | - m_CallState: 2 | ||
| 7929 | - m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, | ||
| 7930 | - Culture=neutral, PublicKeyToken=null | ||
| 7931 | --- !u!114 &1381092953 | 7866 | --- !u!114 &1381092953 |
| 7932 | MonoBehaviour: | 7867 | MonoBehaviour: |
| 7933 | m_ObjectHideFlags: 0 | 7868 | m_ObjectHideFlags: 0 |
| @@ -0,0 +1,12 @@ | @@ -0,0 +1,12 @@ | ||
| 1 | +fileFormatVersion: 2 | ||
| 2 | +guid: 6d83e5bebf7655944adc5d9a7bc02fde | ||
| 3 | +timeCreated: 1443550977 | ||
| 4 | +licenseType: Pro | ||
| 5 | +MonoImporter: | ||
| 6 | + serializedVersion: 2 | ||
| 7 | + defaultReferences: [] | ||
| 8 | + executionOrder: 0 | ||
| 9 | + icon: {instanceID: 0} | ||
| 10 | + userData: | ||
| 11 | + assetBundleName: | ||
| 12 | + assetBundleVariant: |
Assets/Scripts/ColorChangeState.cs
Assets/Scripts/ColorChangeState.cs.meta
| @@ -1,12 +0,0 @@ | @@ -1,12 +0,0 @@ | ||
| 1 | -fileFormatVersion: 2 | ||
| 2 | -guid: 6d83e5bebf7655944adc5d9a7bc02fde | ||
| 3 | -timeCreated: 1443550977 | ||
| 4 | -licenseType: Pro | ||
| 5 | -MonoImporter: | ||
| 6 | - serializedVersion: 2 | ||
| 7 | - defaultReferences: [] | ||
| 8 | - executionOrder: 0 | ||
| 9 | - icon: {instanceID: 0} | ||
| 10 | - userData: | ||
| 11 | - assetBundleName: | ||
| 12 | - assetBundleVariant: |
Assets/Scripts/ScreenReferences.cs
| @@ -34,7 +34,7 @@ public class ScreenReferences : MonoBehaviour { | @@ -34,7 +34,7 @@ public class ScreenReferences : MonoBehaviour { | ||
| 34 | 34 | ||
| 35 | public Button[] home_screen_bar_buttons; | 35 | public Button[] home_screen_bar_buttons; |
| 36 | 36 | ||
| 37 | - public BoxCollider collider; | 37 | + public BoxCollider _collider; |
| 38 | 38 | ||
| 39 | // screens | 39 | // screens |
| 40 | public GameObject text_entry; | 40 | public GameObject text_entry; |
| @@ -67,12 +67,12 @@ public class ScreenReferences : MonoBehaviour { | @@ -67,12 +67,12 @@ public class ScreenReferences : MonoBehaviour { | ||
| 67 | { | 67 | { |
| 68 | //home_screen_bar_buttons = new Button[4]; | 68 | //home_screen_bar_buttons = new Button[4]; |
| 69 | HOME_SCREEN = true; | 69 | HOME_SCREEN = true; |
| 70 | - collider = GameObject.FindGameObjectWithTag("avatar").GetComponent<BoxCollider>(); | 70 | + _collider = GameObject.FindGameObjectWithTag("avatar").GetComponent<BoxCollider>(); |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | void BackToHomeScreen() | 73 | void BackToHomeScreen() |
| 74 | { | 74 | { |
| 75 | - collider.enabled = true; | 75 | + _collider.enabled = true; |
| 76 | 76 | ||
| 77 | // if connection pop up not true | 77 | // if connection pop up not true |
| 78 | if(!player_manager.canvas_connection_error.isActiveAndEnabled){ | 78 | if(!player_manager.canvas_connection_error.isActiveAndEnabled){ |
Assets/Scripts/SwitchActiveStatus.cs
| 1 | using UnityEngine; | 1 | using UnityEngine; |
| 2 | using System; | 2 | using System; |
| 3 | 3 | ||
| 4 | -public class SwitchActiveStatus : MonoBehaviour, ColorChangeState { | 4 | +public class SwitchActiveStatus : MonoBehaviour, ChangeState { |
| 5 | 5 | ||
| 6 | public bool show = true; | 6 | public bool show = true; |
| 7 | 7 | ||
| 8 | - //Mostra ou esconde o GameObject associado ao script | 8 | + // Mostra ou esconde o GameObject associado ao script |
| 9 | public void SwitchStatus() | 9 | public void SwitchStatus() |
| 10 | { | 10 | { |
| 11 | - | ||
| 12 | show = !show; | 11 | show = !show; |
| 13 | gameObject.SetActive(show); | 12 | gameObject.SetActive(show); |
| 14 | - | ||
| 15 | } | 13 | } |
| 16 | 14 | ||
| 17 | - public bool getColorChangeState() | 15 | + public bool getChangeState() |
| 18 | { | 16 | { |
| 19 | return show; | 17 | return show; |
| 20 | } | 18 | } |
Assets/Scripts/SwitchButtonCollor.cs
| @@ -1,60 +0,0 @@ | @@ -1,60 +0,0 @@ | ||
| 1 | -using UnityEngine; | ||
| 2 | -using System.Collections; | ||
| 3 | -using UnityEngine.UI; | ||
| 4 | - | ||
| 5 | -public class SwitchButtonCollor : MonoBehaviour { | ||
| 6 | - | ||
| 7 | - public Button thisButton; | ||
| 8 | - public GameObject reference; | ||
| 9 | - private Graphic thisButtonGraphic; | ||
| 10 | - | ||
| 11 | - public bool isEnabled; | ||
| 12 | - private static Color enabledColor = new Color(0.31F, 0.75F, 0.913F, 1F); | ||
| 13 | - private static Color disabledColor = new Color(1F, 1F, 1F, 1F); | ||
| 14 | - | ||
| 15 | - | ||
| 16 | - void Start () | ||
| 17 | - { | ||
| 18 | - if (thisButton == null) | ||
| 19 | - thisButton = (Button) gameObject.GetComponent<Button>(); | ||
| 20 | - | ||
| 21 | - thisButtonGraphic = thisButton.GetComponent<Graphic>(); | ||
| 22 | - | ||
| 23 | - if (reference == null) | ||
| 24 | - updateColor(); | ||
| 25 | - else | ||
| 26 | - switchColorByReference(); | ||
| 27 | - } | ||
| 28 | - | ||
| 29 | - void OnEnable () | ||
| 30 | - { | ||
| 31 | - if (thisButtonGraphic != null && reference != null) | ||
| 32 | - switchColorByReference(); | ||
| 33 | - } | ||
| 34 | - | ||
| 35 | - | ||
| 36 | - public void updateColor() | ||
| 37 | - { | ||
| 38 | - thisButtonGraphic.color = isEnabled ? enabledColor : disabledColor; | ||
| 39 | - } | ||
| 40 | - | ||
| 41 | - public void switchColor(bool isEnabled) | ||
| 42 | - { | ||
| 43 | - this.isEnabled = isEnabled; | ||
| 44 | - updateColor(); | ||
| 45 | - } | ||
| 46 | - public void switchCollor() { | ||
| 47 | - switchColor( ! isEnabled); | ||
| 48 | - } | ||
| 49 | - | ||
| 50 | - public void switchColorByReference() | ||
| 51 | - { | ||
| 52 | - switchColorByReference(reference); | ||
| 53 | - } | ||
| 54 | - public void switchColorByReference(GameObject reference) | ||
| 55 | - { | ||
| 56 | - ColorChangeState state = reference.GetComponent<ColorChangeState>(); | ||
| 57 | - if (state != null) switchColor(state.getColorChangeState()); | ||
| 58 | - } | ||
| 59 | - | ||
| 60 | -} |
Assets/Scripts/SwitchButtonCollor.cs.meta
| @@ -1,12 +0,0 @@ | @@ -1,12 +0,0 @@ | ||
| 1 | -fileFormatVersion: 2 | ||
| 2 | -guid: 29f6ab4437be5fb45a87e188a0176b8d | ||
| 3 | -timeCreated: 1443550911 | ||
| 4 | -licenseType: Pro | ||
| 5 | -MonoImporter: | ||
| 6 | - serializedVersion: 2 | ||
| 7 | - defaultReferences: [] | ||
| 8 | - executionOrder: 0 | ||
| 9 | - icon: {instanceID: 0} | ||
| 10 | - userData: | ||
| 11 | - assetBundleName: | ||
| 12 | - assetBundleVariant: |
| @@ -0,0 +1,48 @@ | @@ -0,0 +1,48 @@ | ||
| 1 | +using UnityEngine; | ||
| 2 | +using UnityEngine.UI; | ||
| 3 | + | ||
| 4 | +public abstract class SwitchImageAttribute : MonoBehaviour { | ||
| 5 | + | ||
| 6 | + public Image image; | ||
| 7 | + public bool isEnabled; | ||
| 8 | + public GameObject updateReference; | ||
| 9 | + | ||
| 10 | + | ||
| 11 | + protected virtual void Start () | ||
| 12 | + { | ||
| 13 | + if (updateReference == null) | ||
| 14 | + updateAttribute(); | ||
| 15 | + else | ||
| 16 | + switchAttributeByReference(); | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + protected virtual void OnEnable () | ||
| 20 | + { | ||
| 21 | + if (updateReference != null) | ||
| 22 | + switchAttributeByReference(); | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + | ||
| 26 | + public abstract void updateAttribute(); | ||
| 27 | + | ||
| 28 | + public void switchAttribute(bool isEnabled) | ||
| 29 | + { | ||
| 30 | + this.isEnabled = isEnabled; | ||
| 31 | + updateAttribute(); | ||
| 32 | + } | ||
| 33 | + public void switchAttribute() | ||
| 34 | + { | ||
| 35 | + switchAttribute( ! isEnabled); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + public void switchAttributeByReference(GameObject updateReference) | ||
| 39 | + { | ||
| 40 | + ChangeState state = updateReference.GetComponent<ChangeState>(); | ||
| 41 | + if (state != null) switchAttribute(state.getChangeState()); | ||
| 42 | + } | ||
| 43 | + public void switchAttributeByReference() | ||
| 44 | + { | ||
| 45 | + switchAttributeByReference(updateReference); | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | +} |
| @@ -0,0 +1,12 @@ | @@ -0,0 +1,12 @@ | ||
| 1 | +fileFormatVersion: 2 | ||
| 2 | +guid: 9e1fe1fc88aa8084f8e8c67d88fbe6d4 | ||
| 3 | +timeCreated: 1444076893 | ||
| 4 | +licenseType: Pro | ||
| 5 | +MonoImporter: | ||
| 6 | + serializedVersion: 2 | ||
| 7 | + defaultReferences: [] | ||
| 8 | + executionOrder: 0 | ||
| 9 | + icon: {instanceID: 0} | ||
| 10 | + userData: | ||
| 11 | + assetBundleName: | ||
| 12 | + assetBundleVariant: |
| @@ -0,0 +1,18 @@ | @@ -0,0 +1,18 @@ | ||
| 1 | +using UnityEngine; | ||
| 2 | +using System.Collections; | ||
| 3 | +using UnityEngine.UI; | ||
| 4 | + | ||
| 5 | +public class SwitchImageColor : SwitchImageAttribute { | ||
| 6 | + | ||
| 7 | + public Color enabledColor = new Color(0.31F, 0.75F, 0.913F, 1F); | ||
| 8 | + public Color disabledColor = new Color(1F, 1F, 1F, 1F); | ||
| 9 | + | ||
| 10 | + private Graphic buttonGraphic; | ||
| 11 | + | ||
| 12 | + | ||
| 13 | + public override void updateAttribute() | ||
| 14 | + { | ||
| 15 | + base.image.color = base.isEnabled ? enabledColor : disabledColor; | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | +} |
| @@ -0,0 +1,12 @@ | @@ -0,0 +1,12 @@ | ||
| 1 | +fileFormatVersion: 2 | ||
| 2 | +guid: 5ea7adaac15fb3545b8ae42d73c16908 | ||
| 3 | +timeCreated: 1444076893 | ||
| 4 | +licenseType: Pro | ||
| 5 | +MonoImporter: | ||
| 6 | + serializedVersion: 2 | ||
| 7 | + defaultReferences: [] | ||
| 8 | + executionOrder: 0 | ||
| 9 | + icon: {instanceID: 0} | ||
| 10 | + userData: | ||
| 11 | + assetBundleName: | ||
| 12 | + assetBundleVariant: |
| @@ -0,0 +1,16 @@ | @@ -0,0 +1,16 @@ | ||
| 1 | +using UnityEngine; | ||
| 2 | +using System.Collections; | ||
| 3 | +using UnityEngine.UI; | ||
| 4 | + | ||
| 5 | +public class SwitchImageSprite : SwitchImageAttribute { | ||
| 6 | + | ||
| 7 | + public Sprite enabledImage; | ||
| 8 | + public Sprite disabledImage; | ||
| 9 | + | ||
| 10 | + | ||
| 11 | + public override void updateAttribute() | ||
| 12 | + { | ||
| 13 | + base.image.sprite = base.isEnabled ? enabledImage : disabledImage; | ||
| 14 | + } | ||
| 15 | + | ||
| 16 | +} |
| @@ -0,0 +1,12 @@ | @@ -0,0 +1,12 @@ | ||
| 1 | +fileFormatVersion: 2 | ||
| 2 | +guid: 9c2cb194d4eaf1c478dcb9c43fb5368b | ||
| 3 | +timeCreated: 1444076893 | ||
| 4 | +licenseType: Pro | ||
| 5 | +MonoImporter: | ||
| 6 | + serializedVersion: 2 | ||
| 7 | + defaultReferences: [] | ||
| 8 | + executionOrder: 0 | ||
| 9 | + icon: {instanceID: 0} | ||
| 10 | + userData: | ||
| 11 | + assetBundleName: | ||
| 12 | + assetBundleVariant: |