Ajout des messages du chat sur la droite de l'écran.

Le scroll et l'animation sont gérés, mais pas la disparition des messages. De plus les bulles de messages ne sont pas responsive.

Ajout d'un début de fenêtre pour l'historique des logs sur la taverne.
This commit is contained in:
Romain Pellé 2015-01-13 22:54:43 +01:00
parent 9bd2e63188
commit b2ae190af3
17 changed files with 1619 additions and 1725 deletions

View File

@ -383,6 +383,34 @@ AnimationClip:
path: chat_field_bg
classID: 224
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- time: 0
value: -88
inSlope: 0
outSlope: 0
tangentMode: 10
m_PreInfinity: 2
m_PostInfinity: 2
attribute: m_AnchoredPosition.y
path: Log Chat/Scroll View
classID: 224
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- time: 0
value: -401
inSlope: 0
outSlope: 0
tangentMode: 10
m_PreInfinity: 2
m_PostInfinity: 2
attribute: m_SizeDelta.y
path: Log Chat/Scroll View
classID: 224
script: {fileID: 0}
m_PPtrCurves: []
m_SampleRate: 60
m_WrapMode: 0
@ -523,6 +551,18 @@ AnimationClip:
classID: 224
customType: 0
isPPtrCurve: 0
- path: 3809299950
attribute: 538195251
script: {fileID: 0}
classID: 224
customType: 0
isPPtrCurve: 0
- path: 3809299950
attribute: 38095219
script: {fileID: 0}
classID: 224
customType: 0
isPPtrCurve: 0
pptrCurveMapping: []
m_AnimationClipSettings:
serializedVersion: 2
@ -910,5 +950,33 @@ AnimationClip:
path: chat_field_bg
classID: 224
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- time: 0
value: -88
inSlope: 0
outSlope: 0
tangentMode: 10
m_PreInfinity: 2
m_PostInfinity: 2
attribute: m_AnchoredPosition.y
path: Log Chat/Scroll View
classID: 224
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- time: 0
value: -401
inSlope: 0
outSlope: 0
tangentMode: 10
m_PreInfinity: 2
m_PostInfinity: 2
attribute: m_SizeDelta.y
path: Log Chat/Scroll View
classID: 224
script: {fileID: 0}
m_EulerEditorCurves: []
m_Events: []

View File

@ -278,6 +278,34 @@ AnimationClip:
path: chat_field_bg
classID: 224
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- time: 0
value: -88
inSlope: 0
outSlope: 0
tangentMode: 10
m_PreInfinity: 2
m_PostInfinity: 2
attribute: m_AnchoredPosition.y
path: Log Chat/Scroll View
classID: 224
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- time: 0
value: -401
inSlope: 0
outSlope: 0
tangentMode: 10
m_PreInfinity: 2
m_PostInfinity: 2
attribute: m_SizeDelta.y
path: Log Chat/Scroll View
classID: 224
script: {fileID: 0}
m_PPtrCurves: []
m_SampleRate: 60
m_WrapMode: 0
@ -388,6 +416,18 @@ AnimationClip:
classID: 224
customType: 0
isPPtrCurve: 0
- path: 3809299950
attribute: 538195251
script: {fileID: 0}
classID: 224
customType: 0
isPPtrCurve: 0
- path: 3809299950
attribute: 38095219
script: {fileID: 0}
classID: 224
customType: 0
isPPtrCurve: 0
pptrCurveMapping: []
m_AnimationClipSettings:
serializedVersion: 2
@ -670,5 +710,33 @@ AnimationClip:
path: chat_field_bg
classID: 224
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- time: 0
value: -88
inSlope: 0
outSlope: 0
tangentMode: 10
m_PreInfinity: 2
m_PostInfinity: 2
attribute: m_AnchoredPosition.y
path: Log Chat/Scroll View
classID: 224
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- time: 0
value: -401
inSlope: 0
outSlope: 0
tangentMode: 10
m_PreInfinity: 2
m_PostInfinity: 2
attribute: m_SizeDelta.y
path: Log Chat/Scroll View
classID: 224
script: {fileID: 0}
m_EulerEditorCurves: []
m_Events: []

View File

@ -290,6 +290,25 @@ AnimationClip:
path: chat_field_bg
classID: 224
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- time: 0
value: 73
inSlope: -371.538452
outSlope: -371.538452
tangentMode: 10
- time: .433333337
value: -88
inSlope: -371.538452
outSlope: -371.538452
tangentMode: 10
m_PreInfinity: 2
m_PostInfinity: 2
attribute: m_AnchoredPosition.y
path: Log Chat/Scroll View
classID: 224
script: {fileID: 0}
m_PPtrCurves: []
m_SampleRate: 30
m_WrapMode: 0
@ -364,6 +383,12 @@ AnimationClip:
classID: 224
customType: 0
isPPtrCurve: 0
- path: 3809299950
attribute: 538195251
script: {fileID: 0}
classID: 224
customType: 0
isPPtrCurve: 0
- path: 678305014
attribute: 1460864421
script: {fileID: 0}
@ -682,5 +707,24 @@ AnimationClip:
path: chat_field_bg
classID: 224
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- time: 0
value: 73
inSlope: -371.538452
outSlope: -371.538452
tangentMode: 10
- time: .433333337
value: -88
inSlope: -371.538452
outSlope: -371.538452
tangentMode: 10
m_PreInfinity: 2
m_PostInfinity: 2
attribute: m_AnchoredPosition.y
path: Log Chat/Scroll View
classID: 224
script: {fileID: 0}
m_EulerEditorCurves: []
m_Events: []

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

View File

@ -0,0 +1,47 @@
fileFormatVersion: 2
guid: ba994c058cda7624d979020ee850d8eb
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 1024
textureSettings:
filterMode: -1
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 1
textureType: 8
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -0,0 +1,47 @@
fileFormatVersion: 2
guid: 0fbb10c1a4c230746a8880ded85ebc9f
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 1024
textureSettings:
filterMode: -1
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 1
textureType: 8
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:

View File

@ -0,0 +1,348 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &100000
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 224: {fileID: 22400000}
- 222: {fileID: 22200000}
- 114: {fileID: 11400000}
m_Layer: 5
m_Name: Message
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &100002
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 224: {fileID: 22400002}
- 222: {fileID: 22200002}
- 114: {fileID: 11400002}
m_Layer: 5
m_Name: Icon Image
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &100004
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 224: {fileID: 22400004}
- 222: {fileID: 22200004}
- 114: {fileID: 11400004}
- 114: {fileID: 11400006}
- 114: {fileID: 11400010}
- 114: {fileID: 11400012}
m_Layer: 5
m_Name: Sample Button
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!1 &100006
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 224: {fileID: 22400006}
- 222: {fileID: 22200006}
- 114: {fileID: 11400008}
m_Layer: 5
m_Name: Name Label
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 100000}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: .1953125, g: .1953125, b: .1953125, a: 1}
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 16
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: "Ma tatan, jeudi, elle m'emm\xE8ne au lac pour me noyer!"
--- !u!114 &11400002
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 100002}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Sprite: {fileID: 21300000, guid: 0beff39047f0d6549be1d3d2a75c08f8, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!114 &11400004
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 100004}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!114 &11400006
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 100004}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: .960784316, g: .960784316, b: .960784316, a: 1}
m_PressedColor: {r: .784313738, g: .784313738, b: .784313738, a: 1}
m_DisabledColor: {r: .784313738, g: .784313738, b: .784313738, a: .501960814}
m_ColorMultiplier: 1
m_FadeDuration: .100000001
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 11400004}
m_OnClick:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
--- !u!114 &11400008
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 100006}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: .195999995, g: .195999995, b: .195999995, a: 1}
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 4
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: 'Kadoc: '
--- !u!114 &11400010
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 100004}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreLayout: 0
m_MinWidth: -1
m_MinHeight: 100
m_PreferredWidth: -1
m_PreferredHeight: -1
m_FlexibleWidth: -1
m_FlexibleHeight: -1
--- !u!114 &11400012
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 100004}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5df4d2b20fc1d8d40a1558502c70299c, type: 3}
m_Name:
m_EditorClassIdentifier:
button: {fileID: 11400006}
nameLabel: {fileID: 11400008}
icon: {fileID: 11400002}
message: {fileID: 11400000}
--- !u!222 &22200000
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 100000}
--- !u!222 &22200002
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 100002}
--- !u!222 &22200004
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 100004}
--- !u!222 &22200006
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 100006}
--- !u!224 &22400000
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 100000}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 22400004}
m_RootOrder: 2
m_AnchorMin: {x: .5, y: .5}
m_AnchorMax: {x: .5, y: .5}
m_AnchoredPosition: {x: 15.1999998, y: -5.0999999}
m_SizeDelta: {x: 266.799988, y: 58.0999985}
m_Pivot: {x: .5, y: .5}
--- !u!224 &22400002
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 100002}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 22400004}
m_RootOrder: 1
m_AnchorMin: {x: .5, y: .5}
m_AnchorMax: {x: .5, y: .5}
m_AnchoredPosition: {x: -141.899994, y: 24.6000004}
m_SizeDelta: {x: 35.5, y: 36.0999985}
m_Pivot: {x: .5, y: .5}
--- !u!224 &22400004
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 100004}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 22400006}
- {fileID: 22400002}
- {fileID: 22400000}
m_Father: {fileID: 0}
m_RootOrder: 0
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: .5, y: .5}
--- !u!224 &22400006
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 100006}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 22400004}
m_RootOrder: 0
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -96.1999969, y: 32.4000015}
m_SizeDelta: {x: -278.200012, y: -83.1999969}
m_Pivot: {x: .5, y: .5}
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 100004}
m_IsPrefabParent: 1
m_IsExploded: 1

View File

@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: 9d931c9293ceea647879e5e9fd45fd5d
NativeFormatImporter:
userData:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,69 @@
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System.Collections.Generic;
using System.Collections;
[System.Serializable]
public class Item{
public string name;
public Sprite icon;
public string message;
Button.ButtonClickedEvent clickEvent;
}
public class CreateScrollList : MonoBehaviour {
public GameObject sampleButton;
public List<Item> itemList;
public Transform contentPanel;
public Image portrait;
public ScrollRect scrollrect;
GameObject chat_input;
TchatAnim tchatAnim;
string message_old;
// Use this for initialization
void Start () {
//PopulateList ();
chat_input = GameObject.Find ("tchat_complet");
tchatAnim = chat_input.GetComponent<TchatAnim> ();
}
void PopulateList(){
foreach (var item in itemList) {
GameObject newButton = Instantiate (sampleButton) as GameObject;
SampleButton button = newButton.GetComponent <SampleButton> ();
button.nameLabel.text = item.name;
button.icon.sprite = item.icon;
button.message.text = item.message;
newButton.transform.SetParent (contentPanel);
button.gameObject.SetActive(true);
}
}
// Update is called once per frame
void Update () {
scrollrect.verticalNormalizedPosition = 0;
if (Input.GetKeyDown ("space")&& tchatAnim.message != message_old) {
GameObject myNewButton = Instantiate (sampleButton) as GameObject;
SampleButton button = myNewButton.GetComponent<SampleButton> ();
button.nameLabel.text="perceval";
button.message.text = tchatAnim.message;
button.icon.sprite= portrait.sprite;
button.gameObject.SetActive(true);
myNewButton.transform.SetParent(contentPanel);
message_old= tchatAnim.message;
}
}
}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: aab5a535908bfb14284dca66586cb1da
guid: 9815f77cc9c27304c846113eee3d0e0b
MonoImporter:
serializedVersion: 2
defaultReferences: []

View File

@ -0,0 +1,13 @@
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class SampleButton : MonoBehaviour {
public Button button;
public Text nameLabel;
public Image icon;
public Text message;
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5df4d2b20fc1d8d40a1558502c70299c
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -2,7 +2,7 @@
using UnityEngine.UI;
using System.Collections;
public class tchat_anim : MonoBehaviour {
public class TchatAnim : MonoBehaviour {
public Animator machine;
public Text charac_nb;
@ -11,11 +11,11 @@ public class tchat_anim : MonoBehaviour {
public Image img_bg;
float timer_sec;
int max_timer;
public string message;
// Use this for initialization
void Start () {
timer_sec = 0;
max_timer = 15;
}
@ -31,7 +31,6 @@ public class tchat_anim : MonoBehaviour {
void Update () {
//print (machine.GetInteger("etat_chat"));
if (myfield.isFocused) {
img_bg.color = Color.green;
} else
@ -39,6 +38,7 @@ public class tchat_anim : MonoBehaviour {
if(machine.GetInteger("etat_chat")==0){
myfield.gameObject.SetActive(true);
message=myfield.text;
}
@ -47,6 +47,7 @@ public class tchat_anim : MonoBehaviour {
print ("trop long");
machine.SetInteger ("etat_chat", 1);
charac_nb.text = " ";
message=myfield.text;
}
@ -54,6 +55,7 @@ public class tchat_anim : MonoBehaviour {
if (myfield.text.Length > 110 && machine.GetInteger("etat_chat")==1) {
print ("trop trop long");
machine.SetInteger ("etat_chat", 2);
message=myfield.text;
}
@ -73,12 +75,14 @@ public class tchat_anim : MonoBehaviour {
if ((machine.GetInteger ("etat_chat") == 1 || machine.GetInteger ("etat_chat") == 2) && myfield.text.Length == 0 ) {
machine.SetInteger ("etat_chat", 0);
message="";
}
//En cas de validation du message
if(Input.GetKeyDown("space") && myfield.isFocused){
myfield.gameObject.SetActive(false);
myfield.text=" ";
charac_nb.text="";
print ("space pressed");
@ -97,6 +101,8 @@ public class tchat_anim : MonoBehaviour {
//Gestion de l'état Timer.
if (machine.GetInteger ("etat_chat") == 3) {
timer_sec += Time.deltaTime;
timer.text = (max_timer - (int) timer_sec ).ToString() + " secondes restantes";
@ -105,6 +111,8 @@ public class tchat_anim : MonoBehaviour {
timer.text="";
machine.SetInteger ("etat_chat", 0);
myfield.text="";
message="";
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d611aea44d22c944bb6175a85f41c430
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -13,6 +13,7 @@ public class chat_scrollbar : MonoBehaviour {
// Use this for initialization
void Start () {
scrollbar.value = 1;
}