trying to manage click events #6

This commit is contained in:
Marc Pouliquen 2016-02-05 02:26:43 +01:00
parent 8c08e4c1f3
commit 8a654b7d22
3 changed files with 83 additions and 12 deletions

View File

@ -21984,6 +21984,7 @@ GameObject:
- 222: {fileID: 1810421583}
- 114: {fileID: 1810421582}
- 225: {fileID: 1810421584}
- 114: {fileID: 1810421585}
m_Layer: 5
m_Name: PanelVotePendu
m_TagString: Untagged
@ -22054,6 +22055,17 @@ CanvasGroup:
m_Interactable: 0
m_BlocksRaycasts: 1
m_IgnoreParentGroups: 0
--- !u!114 &1810421585
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1810421580}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 89182886c2c540340a05783eb3657d20, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1810979657
GameObject:
m_ObjectHideFlags: 0
@ -23671,6 +23683,7 @@ GameObject:
- 222: {fileID: 1908007164}
- 114: {fileID: 1908007163}
- 114: {fileID: 1908007162}
- 114: {fileID: 1908007165}
m_Layer: 5
m_Name: ButtonInnocent
m_TagString: Untagged
@ -23770,6 +23783,17 @@ CanvasRenderer:
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1908007160}
--- !u!114 &1908007165
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1908007160}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 89182886c2c540340a05783eb3657d20, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1911482241
GameObject:
m_ObjectHideFlags: 0
@ -26572,6 +26596,7 @@ GameObject:
- 222: {fileID: 2110441795}
- 114: {fileID: 2110441794}
- 114: {fileID: 2110441793}
- 114: {fileID: 2110441796}
m_Layer: 5
m_Name: ButtonCoupable
m_TagString: Untagged
@ -26616,8 +26641,8 @@ MonoBehaviour:
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_NormalColor: {r: 0.9632353, g: 0.9632353, b: 0.9632353, a: 1}
m_HighlightedColor: {r: 1, g: 1, b: 1, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 5
@ -26635,7 +26660,18 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 2110441794}
m_OnClick:
m_PersistentCalls:
m_Calls: []
m_Calls:
- m_Target: {fileID: 0}
m_MethodName:
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName:
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
--- !u!114 &2110441794
@ -26671,6 +26707,17 @@ CanvasRenderer:
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2110441791}
--- !u!114 &2110441796
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2110441791}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 89182886c2c540340a05783eb3657d20, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &2130265910
GameObject:
m_ObjectHideFlags: 0

View File

@ -1,16 +1,40 @@
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.Events;
public class NewBehaviourScript : MonoBehaviour {
public class Gui_VotePendre : MonoBehaviour {
private Button votePenduInnocentButton;
private Button votePenduCoupableButton;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
// Use this for initialization
void Start () {
votePenduInnocentButton = GameObject.Find("ButtonInnocent").GetComponent<Button>();
votePenduCoupableButton = GameObject.Find("ButtonCoupable").GetComponent<Button>();
votePenduInnocentButton.interactable = true;
votePenduCoupableButton.interactable = true;
votePenduInnocentButton.GetComponentInChildren<Text>().text = "test";
votePenduInnocentButton.onClick.AddListener(() => InnocentClicked());
votePenduCoupableButton.onClick.AddListener(() => CoupableClicked());
}
void InnocentClicked()
{
Debug.Log("Innocent");
}
void CoupableClicked()
{
Debug.Log("Coupable");
}
// Update is called once per frame
void Update () {
}
}

View File

@ -25,7 +25,7 @@ public class OnClickChangeUI : MonoBehaviour
chatPos = new Vector3(-14.64F, 15.23F, 6.039996F); //chat.transform.position;
deadListPos = new Vector3(-2.162F, 0.115F, 3.507F);//deadlist.transform.position;
votePenduCanvas = votePendu.GetComponent<CanvasGroup>();
votePenduCanvas.alpha = 0;
//votePenduCanvas.alpha = 0;
away = new Vector3(1000, 1000);
chat.transform.localPosition = away;