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