Nettoyage de printemps
This commit is contained in:
parent
739d098072
commit
9009ee4ae6
|
@ -17,3 +17,6 @@ ExportedObj/
|
|||
*.user
|
||||
*.unityproj
|
||||
*.booproj
|
||||
|
||||
#Sublime
|
||||
*.sublime-workspace
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
//Required Sublime Text plugins:
|
||||
// - SublimeAStyleFormatter: https://github.com/timonwong/SublimeAStyleFormatter
|
||||
//
|
||||
{
|
||||
"folders":
|
||||
[
|
||||
|
@ -7,8 +10,27 @@
|
|||
"file_exclude_patterns":
|
||||
[
|
||||
"*.dll",
|
||||
"*.meta"
|
||||
"*.meta",
|
||||
"*.csproj",
|
||||
"*.sln"
|
||||
],
|
||||
"folder_exclude_patterns":
|
||||
[
|
||||
"Temp",
|
||||
"Library"
|
||||
]
|
||||
}
|
||||
]
|
||||
],
|
||||
"settings": {
|
||||
"AStyleFormatter": {
|
||||
"options_default": {
|
||||
"autoformat_on_save": true,
|
||||
"attach-namespaces": true,
|
||||
"attach-classes": true,
|
||||
"pad-oper": false,
|
||||
"pad-header": false,
|
||||
"unpad-paren": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,13 +7,13 @@ public class CameraController : MonoBehaviour {
|
|||
public Quaternion targetRot;
|
||||
|
||||
// Use this for initialization
|
||||
void Awake () {
|
||||
void Awake() {
|
||||
targetPos = transform.position;
|
||||
targetRot = transform.rotation;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
void Update() {
|
||||
transform.position = Vector3.Lerp(transform.position, targetPos, Time.deltaTime*10);
|
||||
transform.rotation = Quaternion.Lerp(transform.rotation, targetRot, Time.deltaTime*10);
|
||||
}
|
||||
|
|
|
@ -10,27 +10,27 @@ public class ChatWindow : MonoBehaviour {
|
|||
string message_old;
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
void Start() {
|
||||
text_chat.text = "";
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
void Update() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
//permet d'écrire du texte en brut dans la fenetre de chat. Sans style. A priori, ne doit pas etre utilisé...
|
||||
public void writeText(string text){
|
||||
public void writeText(string text) {
|
||||
|
||||
text_chat.text += text;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//prend en arguement le nombre de jour écoulé pour l'afficher dans la fenetre de chat.
|
||||
public void writeDay(int nbDay){
|
||||
public void writeDay(int nbDay) {
|
||||
|
||||
text_chat.text += "\n\n\n <b><color=#000080ff>Day " + nbDay.ToString() + "\n</color></b>" ;
|
||||
scrollrect.verticalNormalizedPosition = 0;
|
||||
|
@ -38,7 +38,7 @@ public class ChatWindow : MonoBehaviour {
|
|||
}
|
||||
|
||||
//prend en argument le pseudo et le message reçu par TchatAnim.cs et l'inscrit dans la fenetre.
|
||||
public void writeMessage(string nom, string message){
|
||||
public void writeMessage(string nom, string message) {
|
||||
|
||||
text_chat.text += "<color=#0000ffff>" + nom + ": </color>"+ message + "\n";
|
||||
scrollrect.verticalNormalizedPosition = 0;
|
||||
|
|
|
@ -12,8 +12,8 @@ public class Clock : MonoBehaviour {
|
|||
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
day_controller = GameObject.Find ("day_controller");
|
||||
void Start() {
|
||||
day_controller = GameObject.Find("day_controller");
|
||||
daycontroller = day_controller.GetComponent<DayController> ();
|
||||
|
||||
maxDay = daycontroller.maxDay;
|
||||
|
@ -21,16 +21,16 @@ public class Clock : MonoBehaviour {
|
|||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
void Update() {
|
||||
//TODO: Sync clock with the server
|
||||
//TODO: Set var as for day % or hour
|
||||
|
||||
float fRot = clock.transform.rotation.z;
|
||||
|
||||
if(fRot>=0 && fRot>-180){
|
||||
if(fRot>=0 && fRot>-180) {
|
||||
clock.transform.Rotate(0, 0, (float)(Time.deltaTime * (-180.0)/maxNight));//2.5min
|
||||
}
|
||||
else{
|
||||
else {
|
||||
clock.transform.Rotate(0, 0, (float)(Time.deltaTime * (-180.0)/maxDay));//1min
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ using System.Collections.Generic;
|
|||
using System.Collections;
|
||||
|
||||
[System.Serializable]
|
||||
public class Item{
|
||||
public class Item {
|
||||
public string name;
|
||||
public Sprite icon;
|
||||
public string message;
|
||||
|
@ -13,7 +13,7 @@ public class Item{
|
|||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class Notification{
|
||||
public class Notification {
|
||||
public string message;
|
||||
Button.ButtonClickedEvent clickEvent;
|
||||
}
|
||||
|
@ -34,54 +34,54 @@ public class CreateScrollList : MonoBehaviour {
|
|||
public GameObject logNotification;
|
||||
public List<Notification> notificationList;
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
// Use this for initialization
|
||||
void Start() {
|
||||
//PopulateList ();
|
||||
chat_input = GameObject.Find ("tchat_complet");
|
||||
chat_input = GameObject.Find("tchat_complet");
|
||||
tchatAnim = chat_input.GetComponent<TchatAnim> ();
|
||||
|
||||
|
||||
}
|
||||
|
||||
void PopulateList(){
|
||||
foreach (var item in itemList) {
|
||||
GameObject newButton = Instantiate (sampleButton) as GameObject;
|
||||
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);
|
||||
newButton.transform.SetParent(contentPanel);
|
||||
button.gameObject.SetActive(true);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
void Update() {
|
||||
|
||||
}
|
||||
|
||||
public void writeMessage(string name, string message){
|
||||
public void writeMessage(string name, string message) {
|
||||
|
||||
scrollrect.verticalNormalizedPosition = 0;
|
||||
GameObject myNewButton = Instantiate (sampleButton) as GameObject;
|
||||
GameObject myNewButton = Instantiate(sampleButton) as GameObject;
|
||||
SampleButton button = myNewButton.GetComponent<SampleButton> ();
|
||||
button.nameLabel.text= name;
|
||||
button.nameLabel.text = name;
|
||||
button.message.text = tchatAnim.message;
|
||||
button.icon.sprite= portrait.sprite;
|
||||
button.icon.sprite = portrait.sprite;
|
||||
button.gameObject.SetActive(true);
|
||||
myNewButton.transform.SetParent(contentPanel);
|
||||
|
||||
}
|
||||
|
||||
public void writeNotification(string message){
|
||||
public void writeNotification(string message) {
|
||||
|
||||
scrollrect.verticalNormalizedPosition = 0;
|
||||
GameObject myNewButton = Instantiate (logNotification) as GameObject;
|
||||
GameObject myNewButton = Instantiate(logNotification) as GameObject;
|
||||
LogNotification notif = myNewButton.GetComponent<LogNotification> ();
|
||||
notif.message.text = message;
|
||||
myNewButton.transform.SetParent (contentPanel);
|
||||
}
|
||||
myNewButton.transform.SetParent(contentPanel);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,82 +27,82 @@ public class DayController : MonoBehaviour {
|
|||
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
void Start() {
|
||||
|
||||
//calcul des différent timing.
|
||||
machine.SetInteger ("day_status", 0);
|
||||
machine.SetInteger("day_status", 0);
|
||||
maxDiscussion = (int) maxDay / 2;
|
||||
maxAccusation = maxDay - maxDiscussion;
|
||||
|
||||
//appel de Window Chat
|
||||
chatWindowScroll = GameObject.Find ("ChatWindowScroll");
|
||||
chatWindowScroll = GameObject.Find("ChatWindowScroll");
|
||||
chatWindow = chatWindowScroll.GetComponent<ChatWindow> ();
|
||||
|
||||
//appel de CreateScrollList
|
||||
createScrollListObject = GameObject.Find ("log_controller");
|
||||
createScrollListObject = GameObject.Find("log_controller");
|
||||
createScrollList = createScrollListObject.GetComponent<CreateScrollList> ();
|
||||
|
||||
//appel de ManaStack
|
||||
manaStackObject = GameObject.Find ("mana_controller");
|
||||
manaStackObject = GameObject.Find("mana_controller");
|
||||
manaStack = manaStackObject.GetComponent<ManaStack> ();
|
||||
|
||||
dayNb = 1;
|
||||
chatWindow.writeDay (dayNb);
|
||||
manaStack.addDaily (dayNb);
|
||||
chatWindow.writeDay(dayNb);
|
||||
manaStack.addDaily(dayNb);
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
void Update() {
|
||||
|
||||
//DISUCSSION
|
||||
if (machine.GetInteger("day_status")==0){
|
||||
if(machine.GetInteger("day_status") == 0) {
|
||||
|
||||
|
||||
if (timer >= (float)maxDiscussion){
|
||||
machine.SetInteger("day_status",1);
|
||||
if(timer >= (float)maxDiscussion) {
|
||||
machine.SetInteger("day_status", 1);
|
||||
print("Accusation!");
|
||||
createScrollList.writeNotification("Denoncez-vous, pauvres fous!!!");
|
||||
}
|
||||
|
||||
else{
|
||||
else {
|
||||
timer += Time.deltaTime;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//ACCUSATION
|
||||
if (machine.GetInteger("day_status")==1){
|
||||
if(machine.GetInteger("day_status") == 1) {
|
||||
|
||||
|
||||
if (timer >= (float)maxDay){
|
||||
machine.SetInteger("day_status",3);
|
||||
if(timer >= (float)maxDay) {
|
||||
machine.SetInteger("day_status", 3);
|
||||
print("il fait nuit!");
|
||||
timer = 0;
|
||||
}
|
||||
|
||||
else{
|
||||
else {
|
||||
timer += Time.deltaTime;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//NUIT
|
||||
if (machine.GetInteger("day_status")==3){
|
||||
if(machine.GetInteger("day_status") == 3) {
|
||||
|
||||
|
||||
if (timer >= (float)maxNight){
|
||||
machine.SetInteger("day_status",0);
|
||||
if(timer >= (float)maxNight) {
|
||||
machine.SetInteger("day_status", 0);
|
||||
timer = 0;
|
||||
dayNb ++;
|
||||
|
||||
chatWindow.writeDay(dayNb);
|
||||
manaStack.addDaily (dayNb);
|
||||
manaStack.addDaily(dayNb);
|
||||
print("le jour se lève, discutez!");
|
||||
|
||||
}
|
||||
|
||||
else{
|
||||
else {
|
||||
timer += Time.deltaTime;
|
||||
}
|
||||
|
||||
|
@ -113,5 +113,5 @@ public class DayController : MonoBehaviour {
|
|||
}
|
||||
|
||||
|
||||
public int getDay(){return dayNb;}
|
||||
public int getDay() {return dayNb;}
|
||||
}
|
||||
|
|
|
@ -6,21 +6,21 @@ public class ManaItem : MonoBehaviour {
|
|||
|
||||
public Image manaImage;
|
||||
|
||||
void Start () {
|
||||
void Start() {
|
||||
//manaImage = GetComponent<Image> ();
|
||||
|
||||
}
|
||||
|
||||
public void setDisabled(){
|
||||
public void setDisabled() {
|
||||
manaImage.color = Color.red;
|
||||
|
||||
}
|
||||
|
||||
public void setEnabled(){
|
||||
public void setEnabled() {
|
||||
manaImage.color = Color.blue;
|
||||
}
|
||||
|
||||
public void setSelected(){
|
||||
public void setSelected() {
|
||||
manaImage.color = Color.white;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,57 +12,57 @@ public class ManaStack : MonoBehaviour {
|
|||
int manaLeft;
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
void Start() {
|
||||
//création de la barre de mana.
|
||||
for(int i=0; i<manaMax; i++){
|
||||
createMana ();
|
||||
GameObject.Find("ManaItem(Clone)").name="ManaItem"+i;
|
||||
//GameObject.Find("ManaItem"+i).GetComponent("ManaItem").setDisabled();
|
||||
for(int i = 0; i < manaMax; i++) {
|
||||
createMana();
|
||||
GameObject.Find("ManaItem(Clone)").name = "ManaItem" + i;
|
||||
//GameObject.Find("ManaItem"+i).GetComponent("ManaItem").setDisabled();
|
||||
}
|
||||
}
|
||||
|
||||
public int getMana(){return manaLeft;}
|
||||
public int getMana() {return manaLeft;}
|
||||
|
||||
//crée un cristaux de mana. (appelée dix fois lors de la fonction Start).
|
||||
void createMana(){
|
||||
GameObject myNewButton = Instantiate (manaItem) as GameObject;
|
||||
void createMana() {
|
||||
GameObject myNewButton = Instantiate(manaItem) as GameObject;
|
||||
ManaItem mana = myNewButton.GetComponent<ManaItem> ();
|
||||
mana.setDisabled ();
|
||||
myNewButton.transform.SetParent (contentPanel);
|
||||
}
|
||||
mana.setDisabled();
|
||||
myNewButton.transform.SetParent(contentPanel);
|
||||
}
|
||||
|
||||
|
||||
//ajoute le bon nombre de cristaux de mana chaque jour
|
||||
public void addDaily(int nbDay){
|
||||
public void addDaily(int nbDay) {
|
||||
nbDay--;
|
||||
GameObject manaItemObject;
|
||||
ManaItem manaButton;
|
||||
|
||||
if (nbDay > manaMax-1) {
|
||||
nbDay = manaMax-1;
|
||||
}
|
||||
if(nbDay > manaMax - 1) {
|
||||
nbDay = manaMax - 1;
|
||||
}
|
||||
|
||||
manaLeft = nbDay + 1;
|
||||
|
||||
for (int i=0; i<=nbDay; i++) {
|
||||
manaItemObject = GameObject.Find("ManaItem"+i);
|
||||
for(int i = 0; i <= nbDay; i++) {
|
||||
manaItemObject = GameObject.Find("ManaItem" + i);
|
||||
manaButton = manaItemObject.GetComponent<ManaItem> ();
|
||||
manaButton.setEnabled();
|
||||
//GameObject.Find("ManaItem"+i).GetComponent("Button").int
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//ajoute la quantité de mana indiqué.
|
||||
public void addMana(int manaPlus){
|
||||
public void addMana(int manaPlus) {
|
||||
}
|
||||
|
||||
//soustrait la quantité de mana indiqué.
|
||||
public void subMana(int manaLess){
|
||||
public void subMana(int manaLess) {
|
||||
}
|
||||
|
||||
//selectionne la quantité de mana indiqué
|
||||
//(quand on passe la souris sur un sort par exemple)
|
||||
public void selMana (int sel){
|
||||
public void selMana(int sel) {
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class NewBehaviourScript : MonoBehaviour {
|
||||
CanvasGroup grp;
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
}
|
||||
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: da0f09705b89fa346b50f7e244179a80
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
|
@ -13,7 +13,7 @@ public class OnClickedMoveCamera : MonoBehaviour {
|
|||
private Renderer[] children;
|
||||
public Canvas canva;
|
||||
|
||||
void Awake(){
|
||||
void Awake() {
|
||||
clrBase = GetComponent<Renderer>().material.color;
|
||||
clrTarget = clrBase;
|
||||
children = GetComponentsInChildren<Renderer>();
|
||||
|
@ -21,7 +21,7 @@ public class OnClickedMoveCamera : MonoBehaviour {
|
|||
}
|
||||
|
||||
|
||||
void OnMouseDown(){
|
||||
void OnMouseDown() {
|
||||
//Move to position
|
||||
|
||||
|
||||
|
@ -30,22 +30,22 @@ public class OnClickedMoveCamera : MonoBehaviour {
|
|||
camCtrl.targetRot = destination.rotation;
|
||||
}
|
||||
|
||||
void OnMouseEnter(){
|
||||
void OnMouseEnter() {
|
||||
//Lerp to hilight color
|
||||
clrTarget = new Color(1.0F, 0.87F, 0.75F);
|
||||
}
|
||||
|
||||
void OnMouseExit(){
|
||||
void OnMouseExit() {
|
||||
//Lerp to base color
|
||||
clrTarget = clrBase;
|
||||
}
|
||||
|
||||
void Update(){
|
||||
void Update() {
|
||||
//Lerp to clrTarget
|
||||
Color clr = Color.Lerp(GetComponent<Renderer>().material.color, clrTarget, Time.deltaTime * 10);
|
||||
|
||||
//Fixme? Any newly created chilren wont be lerped
|
||||
foreach (Renderer child in children) {
|
||||
foreach(Renderer child in children) {
|
||||
child.material.color = clr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,115 +22,115 @@ public class TchatAnim : MonoBehaviour {
|
|||
CreateScrollList createScrollList;
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
void Start() {
|
||||
timer_sec = 0;
|
||||
max_timer = 15;
|
||||
|
||||
//appel de WindowChat
|
||||
chatWindowScroll = GameObject.Find ("ChatWindowScroll");
|
||||
chatWindowScroll = GameObject.Find("ChatWindowScroll");
|
||||
chatWindow = chatWindowScroll.GetComponent<ChatWindow> ();
|
||||
|
||||
//appel de CreateScrollList
|
||||
createScrollListObject = GameObject.Find ("log_controller");
|
||||
createScrollListObject = GameObject.Find("log_controller");
|
||||
createScrollList = createScrollListObject.GetComponent<CreateScrollList> ();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void Awake(){
|
||||
void Awake() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Update is called once per frame
|
||||
|
||||
void Update () {
|
||||
void Update() {
|
||||
|
||||
|
||||
//print (machine.GetInteger("etat_chat"));
|
||||
if (myfield.isFocused) {
|
||||
img_bg.color = Color.green;
|
||||
} else
|
||||
img_bg.color = Color.white;
|
||||
if(myfield.isFocused) {
|
||||
img_bg.color = Color.green;
|
||||
} else
|
||||
img_bg.color = Color.white;
|
||||
|
||||
if(machine.GetInteger("etat_chat")==0){
|
||||
if(machine.GetInteger("etat_chat") == 0) {
|
||||
myfield.gameObject.SetActive(true);
|
||||
message=myfield.text;
|
||||
message = myfield.text;
|
||||
|
||||
}
|
||||
|
||||
//transition vers chat_up
|
||||
if (myfield.textComponent.cachedTextGenerator.lineCount > 1 && machine.GetInteger("etat_chat")==0) {
|
||||
print ("trop long");
|
||||
machine.SetInteger ("etat_chat", 1);
|
||||
charac_nb.text = " ";
|
||||
message=myfield.text;
|
||||
if(myfield.textComponent.cachedTextGenerator.lineCount > 1 && machine.GetInteger("etat_chat") == 0) {
|
||||
print("trop long");
|
||||
machine.SetInteger("etat_chat", 1);
|
||||
charac_nb.text = " ";
|
||||
message = myfield.text;
|
||||
|
||||
}
|
||||
|
||||
//transition vers chat_long
|
||||
if (myfield.text.Length > 110 && machine.GetInteger("etat_chat")==1) {
|
||||
print ("trop trop long");
|
||||
machine.SetInteger ("etat_chat", 2);
|
||||
message=myfield.text;
|
||||
if(myfield.text.Length > 110 && machine.GetInteger("etat_chat") == 1) {
|
||||
print("trop trop long");
|
||||
machine.SetInteger("etat_chat", 2);
|
||||
message = myfield.text;
|
||||
}
|
||||
|
||||
|
||||
//affichage nombre de caractère restant.
|
||||
if(Input.anyKey && machine.GetInteger("etat_chat")==2 ){
|
||||
if(Input.anyKey && machine.GetInteger("etat_chat") == 2) {
|
||||
charac_nb.text = (myfield.characterLimit - myfield.text.Length).ToString();
|
||||
}
|
||||
|
||||
//les derniers caractères sont écris en rouges
|
||||
if (myfield.text.Length > 130) {
|
||||
charac_nb.color = Color.red;
|
||||
} else
|
||||
charac_nb.color = Color.white;
|
||||
if(myfield.text.Length > 130) {
|
||||
charac_nb.color = Color.red;
|
||||
} else
|
||||
charac_nb.color = Color.white;
|
||||
|
||||
//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 ) {
|
||||
if((machine.GetInteger("etat_chat") == 1 || machine.GetInteger("etat_chat") == 2) && myfield.text.Length == 0) {
|
||||
|
||||
machine.SetInteger ("etat_chat", 0);
|
||||
message="";
|
||||
machine.SetInteger("etat_chat", 0);
|
||||
message = "";
|
||||
}
|
||||
|
||||
|
||||
//En cas de validation du message
|
||||
if(Input.GetKeyDown("space") && myfield.isFocused){
|
||||
if(Input.GetKeyDown("space") && myfield.isFocused) {
|
||||
|
||||
chatWindow.writeMessage("perceval",myfield.text); //inscription du message dans la fenetre de chat
|
||||
chatWindow.writeMessage("perceval", myfield.text); //inscription du message dans la fenetre de chat
|
||||
createScrollList.writeMessage("perceval", myfield.text); //inscription du message dans les logs.
|
||||
myfield.gameObject.SetActive(false);
|
||||
myfield.text=" ";
|
||||
charac_nb.text="";
|
||||
print ("space pressed");
|
||||
myfield.text = " ";
|
||||
charac_nb.text = "";
|
||||
print("space pressed");
|
||||
|
||||
//texte long
|
||||
if(machine.GetInteger("etat_chat")==1 || machine.GetInteger("etat_chat")==2){
|
||||
machine.SetInteger ("etat_chat", 3);
|
||||
if(machine.GetInteger("etat_chat") == 1 || machine.GetInteger("etat_chat") == 2) {
|
||||
machine.SetInteger("etat_chat", 3);
|
||||
}
|
||||
|
||||
//texte court
|
||||
if(machine.GetInteger("etat_chat")==0){
|
||||
machine.SetInteger("etat_chat",3);
|
||||
if(machine.GetInteger("etat_chat") == 0) {
|
||||
machine.SetInteger("etat_chat", 3);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Gestion de l'état Timer.
|
||||
if (machine.GetInteger ("etat_chat") == 3) {
|
||||
if(machine.GetInteger("etat_chat") == 3) {
|
||||
|
||||
|
||||
timer_sec += Time.deltaTime;
|
||||
timer.text = (max_timer - (int) timer_sec ).ToString() + " secondes restantes";
|
||||
timer.text = (max_timer - (int) timer_sec).ToString() + " secondes restantes";
|
||||
|
||||
if(timer_sec >= (float)max_timer-1){
|
||||
timer_sec=0;
|
||||
timer.text="";
|
||||
machine.SetInteger ("etat_chat", 0);
|
||||
myfield.text="";
|
||||
message="";
|
||||
if(timer_sec >= (float)max_timer - 1) {
|
||||
timer_sec = 0;
|
||||
timer.text = "";
|
||||
machine.SetInteger("etat_chat", 0);
|
||||
myfield.text = "";
|
||||
message = "";
|
||||
|
||||
}
|
||||
|
||||
|
@ -138,8 +138,8 @@ public class TchatAnim : MonoBehaviour {
|
|||
|
||||
}
|
||||
|
||||
public void submit(){
|
||||
print ("submit entered");
|
||||
public void submit() {
|
||||
print("submit entered");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ public class chat_scrollbar : MonoBehaviour {
|
|||
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
void Start() {
|
||||
scrollbar.value = 1;
|
||||
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ public class chat_scrollbar : MonoBehaviour {
|
|||
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
void Update() {
|
||||
|
||||
|
||||
|
||||
|
@ -31,11 +31,11 @@ public class chat_scrollbar : MonoBehaviour {
|
|||
|
||||
|
||||
|
||||
bool isTypingText(){
|
||||
if (Input.anyKey && Input.GetMouseButton (0) == false && Input.GetMouseButton (1) == false && Input.GetMouseButton (2) == false && Input.GetKey ("return") == false) {
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
bool isTypingText() {
|
||||
if(Input.anyKey && Input.GetMouseButton(0) == false && Input.GetMouseButton(1) == false && Input.GetMouseButton(2) == false && Input.GetKey("return") == false) {
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4,20 +4,20 @@ using System.Collections.Generic;
|
|||
|
||||
public class RulesDatabase {
|
||||
|
||||
public static TwoDA GetTable(string name){
|
||||
public static TwoDA GetTable(string name) {
|
||||
TwoDA t = null;
|
||||
if(Get().m_tables.TryGetValue(name, out t)){
|
||||
if(Get().m_tables.TryGetValue(name, out t)) {
|
||||
return t;
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void SetLocale(string lang){
|
||||
public static void SetLocale(string lang) {
|
||||
m_inst.m_strref = GetTable("locale_"+lang);
|
||||
}
|
||||
|
||||
public static string GetStrRef(int strref){
|
||||
public static string GetStrRef(int strref) {
|
||||
RulesDatabase inst = Get();
|
||||
|
||||
return inst.m_strref.GetValue(strref, "text");
|
||||
|
@ -27,12 +27,12 @@ public class RulesDatabase {
|
|||
|
||||
|
||||
|
||||
private RulesDatabase(){
|
||||
private RulesDatabase() {
|
||||
m_tables = new Dictionary<string, TwoDA>();
|
||||
|
||||
string[] files = Directory.GetFiles(m_folder, "*.2da", SearchOption.AllDirectories);
|
||||
|
||||
foreach(string file in files){
|
||||
foreach(string file in files) {
|
||||
string name = Path.GetFileNameWithoutExtension(file);
|
||||
m_tables.Add(name, new TwoDA(file));
|
||||
//Debug.Log ("Found "+name);
|
||||
|
@ -45,8 +45,8 @@ public class RulesDatabase {
|
|||
|
||||
private static RulesDatabase m_inst = null;
|
||||
private static object m_singlmutex = new Object();
|
||||
private static RulesDatabase Get(){
|
||||
lock(m_singlmutex){
|
||||
private static RulesDatabase Get() {
|
||||
lock(m_singlmutex) {
|
||||
if(m_inst==null)
|
||||
m_inst = new RulesDatabase();
|
||||
}
|
||||
|
|
|
@ -18,15 +18,15 @@ public class TwoDA : UnityEngine.Object {
|
|||
int nFileLine = 1;
|
||||
while((line = file.ReadLine()) != null)
|
||||
{
|
||||
if(line[0] != '#'){//Ignore commented lines
|
||||
if(line[0] != '#') { //Ignore commented lines
|
||||
|
||||
MatchCollection matches = m_rgxField.Matches(line);
|
||||
|
||||
if(matches.Count == nCols){
|
||||
if(matches.Count == nCols) {
|
||||
int nLine = int.Parse(matches[0].Value);
|
||||
|
||||
string[] buff = new string[nCols-1];
|
||||
for(int i=0 ; i<nCols-1 ; i++){
|
||||
for(int i=0 ; i<nCols-1 ; i++) {
|
||||
|
||||
if(matches[i+1].Groups[1].Success)//Match one word
|
||||
buff[i] = matches[i+1].Groups[1].Value;
|
||||
|
@ -47,27 +47,27 @@ public class TwoDA : UnityEngine.Object {
|
|||
file.Close();
|
||||
}
|
||||
|
||||
public string GetValue(int nRow, string sColumn){
|
||||
public string GetValue(int nRow, string sColumn) {
|
||||
|
||||
int nCol = FindHeaderCol(sColumn);
|
||||
if(nCol>=0){
|
||||
if(nCol>=0) {
|
||||
return m_data[nRow][nCol];
|
||||
}
|
||||
else{
|
||||
else {
|
||||
throw new UnityException("Column '"+sColumn+"' not found in 2DA");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override string ToString(){
|
||||
public override string ToString() {
|
||||
string sMsg = "";
|
||||
foreach(string s in m_header){
|
||||
foreach(string s in m_header) {
|
||||
sMsg += s+"\t";
|
||||
}
|
||||
sMsg += "\n";
|
||||
for(int line=0 ; line<m_data.Count ; line++){
|
||||
for(int line=0 ; line<m_data.Count ; line++) {
|
||||
sMsg += line.ToString() + "\t";
|
||||
for(int col=0 ; col<m_data[line].Length ; col++){
|
||||
for(int col=0 ; col<m_data[line].Length ; col++) {
|
||||
sMsg += m_data[line][col]+"\t";
|
||||
}
|
||||
sMsg += "\n";
|
||||
|
@ -75,8 +75,8 @@ public class TwoDA : UnityEngine.Object {
|
|||
return sMsg;
|
||||
}
|
||||
|
||||
private int FindHeaderCol(string sColName){
|
||||
for(int i=0 ; i<m_header.Length ; i++){
|
||||
private int FindHeaderCol(string sColName) {
|
||||
for(int i=0 ; i<m_header.Length ; i++) {
|
||||
if(m_header[i] == sColName)
|
||||
return i-1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue