Correction bug au démarrage sur le focus de l'icone de sélection
This commit is contained in:
parent
93d10a2e52
commit
0fb52688ad
@ -509,6 +509,8 @@ GameObject:
|
|||||||
- component: {fileID: 750695359}
|
- component: {fileID: 750695359}
|
||||||
- component: {fileID: 750695361}
|
- component: {fileID: 750695361}
|
||||||
- component: {fileID: 750695362}
|
- component: {fileID: 750695362}
|
||||||
|
- component: {fileID: 750695364}
|
||||||
|
- component: {fileID: 750695363}
|
||||||
m_Layer: 5
|
m_Layer: 5
|
||||||
m_Name: ButtonsPanel
|
m_Name: ButtonsPanel
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@ -605,6 +607,30 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
Icon: {fileID: 0}
|
Icon: {fileID: 0}
|
||||||
|
--- !u!114 &750695363
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_PrefabParentObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 750695357}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 707553e60d808304989bed65f2c1bec1, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
--- !u!114 &750695364
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_PrefabParentObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 750695357}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: -1862395651, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_Delegates: []
|
||||||
|
delegates: []
|
||||||
--- !u!1 &808525958
|
--- !u!1 &808525958
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@ -35,6 +35,11 @@ public class ManageButtonsSelectionWithIcon : MonoBehaviour, ISelectHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void OnSelect(BaseEventData eventData)
|
public void OnSelect(BaseEventData eventData)
|
||||||
|
{
|
||||||
|
Select();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Select()
|
||||||
{
|
{
|
||||||
if (Icon == null || !started) return;
|
if (Icon == null || !started) return;
|
||||||
var iconPosition = new Vector3(transform.position.x - 200, transform.position.y, 0);
|
var iconPosition = new Vector3(transform.position.x - 200, transform.position.y, 0);
|
||||||
|
|||||||
32
Assets/Scripts/StayFocusBehavior.cs
Normal file
32
Assets/Scripts/StayFocusBehavior.cs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using System.Collections;
|
||||||
|
|
||||||
|
public class StayFocusBehavior : MonoBehaviour
|
||||||
|
{
|
||||||
|
private bool firstChildPositionned;
|
||||||
|
private Vector3 firstChildStartPosition;
|
||||||
|
// Use this for initialization
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
firstChildPositionned = false;
|
||||||
|
firstChildStartPosition = transform.GetChild(0).position;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update is called once per frame
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
if (!firstChildPositionned)
|
||||||
|
{
|
||||||
|
var position = transform.GetChild(0).position;
|
||||||
|
if(position != firstChildStartPosition)
|
||||||
|
{
|
||||||
|
firstChildPositionned = true;
|
||||||
|
var script = transform.GetChild(0).GetComponent(typeof(ManageButtonsSelectionWithIcon)) as ManageButtonsSelectionWithIcon;
|
||||||
|
if (script != null)
|
||||||
|
{
|
||||||
|
script.Select();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
13
Assets/Scripts/StayFocusBehavior.cs.meta
Normal file
13
Assets/Scripts/StayFocusBehavior.cs.meta
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 707553e60d808304989bed65f2c1bec1
|
||||||
|
timeCreated: 1518812460
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Loading…
Reference in New Issue
Block a user