From 65b9cd039025ee3c59056a08497df3ee2d4c16ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Pell=C3=A9?= Date: Wed, 7 Jan 2015 09:20:05 +0100 Subject: [PATCH] correction horloge chat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - le timer qui indique le nombre de secondes restantes entre deux messages fonctionne. Cependant, du à un problème de synchro, le message '1 secondes restantes' n'a pas le temps d'apparaitre. -Création d'un état chat_empty: on considère (pour l'instant) que si jamais en supprimant des caractère, un message long ne fait plus qu'une ligne, on reste dans l'état actuel. Cependant si on supprime la totalité du message, le tchat doit revenir à l'état bas, et ce, sans imposer de timer. L'état chat_empty est crée dans c but. Aucun pb de fonctionnement détecté. --- .../anim_clips_ui/tchat_complet.controller | 86 ++++++++++++++- .../animation/anim_clips_ui/tchat_dispo.anim | 104 ++++++++++++++---- Assets/scripts/tchat_anim.cs | 22 ++-- 3 files changed, 181 insertions(+), 31 deletions(-) diff --git a/Assets/animation/anim_clips_ui/tchat_complet.controller b/Assets/animation/anim_clips_ui/tchat_complet.controller index 27c41e8..302d65d 100644 --- a/Assets/animation/anim_clips_ui/tchat_complet.controller +++ b/Assets/animation/anim_clips_ui/tchat_complet.controller @@ -66,6 +66,26 @@ Transition: m_Solo: 0 m_Mute: 0 m_CanTransitionToSelf: 0 +--- !u!1101 &110126581 +Transition: + serializedVersion: 2 + m_ObjectHideFlags: 3 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: + m_SrcState: {fileID: 110219388} + m_DstState: {fileID: 110220441} + m_TransitionDuration: .100000001 + m_TransitionOffset: 0 + m_Conditions: + - m_ConditionMode: 6 + m_ConditionEvent: etat_chat + m_EventTreshold: 0 + m_ExitTime: .899999976 + m_Atomic: 1 + m_Solo: 0 + m_Mute: 0 + m_CanTransitionToSelf: 0 --- !u!1101 &110129462 Transition: serializedVersion: 2 @@ -86,6 +106,46 @@ Transition: m_Solo: 0 m_Mute: 0 m_CanTransitionToSelf: 0 +--- !u!1101 &110145976 +Transition: + serializedVersion: 2 + m_ObjectHideFlags: 3 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: + m_SrcState: {fileID: 110220441} + m_DstState: {fileID: 110200000} + m_TransitionDuration: .100000001 + m_TransitionOffset: 0 + m_Conditions: + - m_ConditionMode: 5 + m_ConditionEvent: + m_EventTreshold: 0 + m_ExitTime: .899999976 + m_Atomic: 1 + m_Solo: 0 + m_Mute: 0 + m_CanTransitionToSelf: 0 +--- !u!1101 &110150240 +Transition: + serializedVersion: 2 + m_ObjectHideFlags: 3 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: + m_SrcState: {fileID: 110299434} + m_DstState: {fileID: 110220441} + m_TransitionDuration: .576923072 + m_TransitionOffset: 0 + m_Conditions: + - m_ConditionMode: 6 + m_ConditionEvent: etat_chat + m_EventTreshold: 0 + m_ExitTime: .423076928 + m_Atomic: 1 + m_Solo: 0 + m_Mute: 0 + m_CanTransitionToSelf: 0 --- !u!1101 &110153044 Transition: serializedVersion: 2 @@ -192,7 +252,22 @@ State: m_Motions: - {fileID: 0} m_ParentStateMachine: {fileID: 110700000} - m_Position: {x: 288, y: -120, z: 0} + m_Position: {x: 288, y: -72, z: 0} + m_IKOnFeet: 0 + m_Mirror: 0 + m_Tag: +--- !u!1102 &110220441 +State: + m_ObjectHideFlags: 3 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: chat_empty + m_Speed: 1 + m_CycleOffset: 0 + m_Motions: + - {fileID: 7400000, guid: cf807dffd8aae4e49a1d5f40102f2f21, type: 2} + m_ParentStateMachine: {fileID: 110700000} + m_Position: {x: 864, y: 36, z: 0} m_IKOnFeet: 0 m_Mirror: 0 m_Tag: @@ -237,7 +312,7 @@ State: m_Motions: - {fileID: 7400000, guid: cf807dffd8aae4e49a1d5f40102f2f21, type: 2} m_ParentStateMachine: {fileID: 110700000} - m_Position: {x: 636, y: -120, z: 0} + m_Position: {x: 636, y: -72, z: 0} m_IKOnFeet: 0 m_Mirror: 0 m_Tag: @@ -255,9 +330,14 @@ StateMachine: - {fileID: 110219388} - {fileID: 110260290} - {fileID: 110250990} + - {fileID: 110220441} m_ChildStateMachine: [] m_ChildStateMachinePosition: [] m_OrderedTransitions: + data: + first: {fileID: 110220441} + second: + - {fileID: 110145976} data: first: {fileID: 110200000} second: @@ -268,10 +348,12 @@ StateMachine: second: - {fileID: 110170679} - {fileID: 110117131} + - {fileID: 110150240} data: first: {fileID: 110219388} second: - {fileID: 110166587} + - {fileID: 110126581} data: first: {fileID: 110260290} second: diff --git a/Assets/animation/anim_clips_ui/tchat_dispo.anim b/Assets/animation/anim_clips_ui/tchat_dispo.anim index f7694d0..0585aa5 100644 --- a/Assets/animation/anim_clips_ui/tchat_dispo.anim +++ b/Assets/animation/anim_clips_ui/tchat_dispo.anim @@ -284,8 +284,13 @@ AnimationClip: m_Curve: - time: 0 value: -44 - inSlope: 0 - outSlope: 0 + inSlope: 12.5454502 + outSlope: 12.5454502 + tangentMode: 10 + - time: .183333337 + value: -41.7000008 + inSlope: 12.5454502 + outSlope: 12.5454502 tangentMode: 10 m_PreInfinity: 2 m_PostInfinity: 2 @@ -298,8 +303,13 @@ AnimationClip: m_Curve: - time: 0 value: 41.9999695 - inSlope: 0 - outSlope: 0 + inSlope: .000166459518 + outSlope: .000166459518 + tangentMode: 10 + - time: .183333337 + value: 42 + inSlope: .000166459518 + outSlope: .000166459518 tangentMode: 10 m_PreInfinity: 2 m_PostInfinity: 2 @@ -307,6 +317,25 @@ AnimationClip: path: timer_text classID: 224 script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - time: 0 + value: 207 + inSlope: 489.818115 + outSlope: 489.818115 + tangentMode: 10 + - time: .183333337 + value: 296.799988 + inSlope: 489.818115 + outSlope: 489.818115 + tangentMode: 10 + m_PreInfinity: 2 + m_PostInfinity: 2 + attribute: m_SizeDelta.x + path: timer_text + classID: 224 + script: {fileID: 0} m_PPtrCurves: [] m_SampleRate: 60 m_WrapMode: 0 @@ -369,6 +398,24 @@ AnimationClip: classID: 224 customType: 0 isPPtrCurve: 0 + - path: 2565742664 + attribute: 1460864421 + script: {fileID: 0} + classID: 224 + customType: 0 + isPPtrCurve: 0 + - path: 2565742664 + attribute: 538195251 + script: {fileID: 0} + classID: 224 + customType: 0 + isPPtrCurve: 0 + - path: 2565742664 + attribute: 1967290853 + script: {fileID: 0} + classID: 224 + customType: 0 + isPPtrCurve: 0 - path: 83635035 attribute: 38095219 script: {fileID: 0} @@ -411,18 +458,6 @@ AnimationClip: classID: 224 customType: 0 isPPtrCurve: 0 - - path: 2565742664 - attribute: 1460864421 - script: {fileID: 0} - classID: 224 - customType: 0 - isPPtrCurve: 0 - - path: 2565742664 - attribute: 538195251 - script: {fileID: 0} - classID: 224 - customType: 0 - isPPtrCurve: 0 pptrCurveMapping: [] m_AnimationClipSettings: serializedVersion: 2 @@ -711,8 +746,13 @@ AnimationClip: m_Curve: - time: 0 value: -44 - inSlope: 0 - outSlope: 0 + inSlope: 12.5454502 + outSlope: 12.5454502 + tangentMode: 10 + - time: .183333337 + value: -41.7000008 + inSlope: 12.5454502 + outSlope: 12.5454502 tangentMode: 10 m_PreInfinity: 2 m_PostInfinity: 2 @@ -725,8 +765,13 @@ AnimationClip: m_Curve: - time: 0 value: 41.9999695 - inSlope: 0 - outSlope: 0 + inSlope: .000166459518 + outSlope: .000166459518 + tangentMode: 10 + - time: .183333337 + value: 42 + inSlope: .000166459518 + outSlope: .000166459518 tangentMode: 10 m_PreInfinity: 2 m_PostInfinity: 2 @@ -734,5 +779,24 @@ AnimationClip: path: timer_text classID: 224 script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - time: 0 + value: 207 + inSlope: 489.818115 + outSlope: 489.818115 + tangentMode: 10 + - time: .183333337 + value: 296.799988 + inSlope: 489.818115 + outSlope: 489.818115 + tangentMode: 10 + m_PreInfinity: 2 + m_PostInfinity: 2 + attribute: m_SizeDelta.x + path: timer_text + classID: 224 + script: {fileID: 0} m_EulerEditorCurves: [] m_Events: [] diff --git a/Assets/scripts/tchat_anim.cs b/Assets/scripts/tchat_anim.cs index 144ec51..41c9dd4 100644 --- a/Assets/scripts/tchat_anim.cs +++ b/Assets/scripts/tchat_anim.cs @@ -50,6 +50,14 @@ public class tchat_anim : MonoBehaviour { charac_nb.text = (myfield.characterLimit - myfield.text.Length).ToString(); } + //transition vers chat_empty: si l'on vide complètement un message, le tcht se rabaisse. + //sinon on le laisse haut (y compris si le message est court). + if ((machine.GetInteger ("etat_chat") == 1 || machine.GetInteger ("etat_chat") == 2) && myfield.text.Length == 0 ) { + + machine.SetInteger ("etat_chat", 0); + } + + //En cas de validation du message if(Input.GetKeyDown("space") && myfield.isFocused){ @@ -69,23 +77,19 @@ public class tchat_anim : MonoBehaviour { } - //a voir avec des trigger... + //Gestion de l'état Timer. if (machine.GetInteger ("etat_chat") == 3) { timer_sec += Time.deltaTime; - timer.text = (max_timer - timer_sec ).ToString(); + timer.text = (max_timer - (int) timer_sec ).ToString() + " secondes restantes"; - if(timer_sec == 14){ + if(timer_sec >= (float)max_timer-1){ timer_sec=0; timer.text=""; + machine.SetInteger ("etat_chat", 0); } - } - - //on vérifie qu'on est toujours dans chat_down pour un texte court (transition timer->chat_down) - if (chat.text.Length < 20 && chat.text.Length > 0) { - machine.SetInteger ("etat_chat", 0); - } + }