Hi Daniele,
Thanks for quick reply !
I have updated my project to 4.6.6p1, deleted all Dotween files and re-import it.
Disable safe mode and re-enabled it
Play in editor and same problem, tween won't work log's :
Platform assembly: /Applications/Unity 4.6.6p1/Unity.app/Contents/Frameworks/Mono/lib/mono/2.0/System.EnterpriseServices.dll (this message is harmless)
Mono: successfully reloaded assembly
- Completed reload, in 1.031 seconds
Packing sprites:
Platform assembly: /Applications/Unity 4.6.6p1/Unity.app/Contents/Frameworks/Mono/lib/mono/2.0/Boo.Lang.Compiler.dll (this message is harmless)
Platform assembly: /Applications/Unity 4.6.6p1/Unity.app/Contents/Frameworks/Mono/lib/mono/2.0/Boo.Lang.Parser.dll (this message is harmless)
- Grouping sprites using the selected SpritePackerPolicy.
- Atlas "ETCSprites (Group 0)" with 13 sprites assigned.
- Atlas "ETCSprites (Group 1)" with 1 sprites assigned.
- Atlas "ETCSprites (Group 2)" with 1 sprites assigned.
- Atlas "EasyTouchExample" with 6 sprites assigned.
- Atlas "characters" with 10 sprites assigned.
- Packing 5 atlases.
- Atlas (ETCSprites (Group 0)) file (b0e7d947baebdfc5597ed87029c0aabb) found. Mapping.
- Atlas (ETCSprites (Group 1)) file (963b3434415b2f03499f4fef81b36380) found. Mapping.
- Atlas (ETCSprites (Group 2)) file (2d6ff230b8b0c3596d16acbc90160d77) found. Mapping.
- Atlas (EasyTouchExample) file (5a58caa6000858e618a017446de30b0d) found. Mapping.
- Atlas (characters) file (8b3f79df546485cd7030a7466049a927) found. Mapping.
- Packing completed.
Reloading assemblies for play mode.
Begin MonoManager ReloadAssembly
Platform assembly: /Applications/Unity 4.6.6p1/Unity.app/Contents/Frameworks/Managed/UnityEngine.dll (this message is harmless)
Platform assembly: /Applications/Unity 4.6.6p1/Unity.app/Contents/Frameworks/Managed/UnityEditor.dll (this message is harmless)
Platform assembly: /Applications/Unity 4.6.6p1/Unity.app/Contents/Frameworks/Managed/Unity.Locator.dll (this message is harmless)
Registering custom dll's ...
Non platform assembly: data-0x1e9ab000 (this message is harmless)
Non platform assembly: data-0x79b3a00 (this message is harmless)
Non platform assembly: data-0x2b298600 (this message is harmless)
Non platform assembly: data-0x2b1dd000 (this message is harmless)
Non platform assembly: data-0x15800000 (this message is harmless)
Non platform assembly: data-0x7c3e800 (this message is harmless)
Non platform assembly: data-0x2b20b200 (this message is harmless)
Non platform assembly: data-0x1ed41000 (this message is harmless)
Register platform support module: /Applications/Unity 4.6.6p1/Unity.app/Contents/PlaybackEngines/AndroidPlayer/UnityEditor.Android.Extensions.dll
Register platform support module: /Applications/Unity 4.6.6p1/Unity.app/Contents/PlaybackEngines/iossupport/UnityEditor.iOS.Extensions.dll
Register platform support module: /Applications/Unity 4.6.6p1/Unity.app/Contents/PlaybackEngines/BlackBerryPlayer/UnityEditor.BB10.Extensions.dll
Registered in 0.037167 seconds.
Non platform assembly: /Volumes/Macintosh HD 2/PROJECTS/Materne_Game_IPADApplis/PomPotes/Library/ScriptAssemblies/Assembly-CSharp-firstpass.dll (this message is harmless)
Loading /Volumes/Macintosh HD 2/PROJECTS/Materne_Game_IPADApplis/PomPotes/Library/ScriptAssemblies/Assembly-CSharp-firstpass.dll into Unity Child Domain
Non platform assembly: /Volumes/Macintosh HD 2/PROJECTS/Materne_Game_IPADApplis/PomPotes/Library/ScriptAssemblies/Assembly-CSharp.dll (this message is harmless)
Loading /Volumes/Macintosh HD 2/PROJECTS/Materne_Game_IPADApplis/PomPotes/Library/ScriptAssemblies/Assembly-CSharp.dll into Unity Child Domain
Non platform assembly: /Volumes/Macintosh HD 2/PROJECTS/Materne_Game_IPADApplis/PomPotes/Library/ScriptAssemblies/Assembly-CSharp-Editor-firstpass.dll (this message is harmless)
Loading /Volumes/Macintosh HD 2/PROJECTS/Materne_Game_IPADApplis/PomPotes/Library/ScriptAssemblies/Assembly-CSharp-Editor-firstpass.dll into Unity Child Domain
Non platform assembly: /Volumes/Macintosh HD 2/PROJECTS/Materne_Game_IPADApplis/PomPotes/Library/ScriptAssemblies/Assembly-CSharp-Editor.dll (this message is harmless)
Loading /Volumes/Macintosh HD 2/PROJECTS/Materne_Game_IPADApplis/PomPotes/Library/ScriptAssemblies/Assembly-CSharp-Editor.dll into Unity Child Domain
Non platform assembly: /Volumes/Macintosh HD 2/PROJECTS/Materne_Game_IPADApplis/PomPotes/Library/ScriptAssemblies/Assembly-UnityScript-firstpass.dll (this message is harmless)
Loading /Volumes/Macintosh HD 2/PROJECTS/Materne_Game_IPADApplis/PomPotes/Library/ScriptAssemblies/Assembly-UnityScript-firstpass.dll into Unity Child Domain
Non platform assembly: /Volumes/Macintosh HD 2/PROJECTS/Materne_Game_IPADApplis/PomPotes/Library/ScriptAssemblies/Assembly-UnityScript.dll (this message is harmless)
Loading /Volumes/Macintosh HD 2/PROJECTS/Materne_Game_IPADApplis/PomPotes/Library/ScriptAssemblies/Assembly-UnityScript.dll into Unity Child Domain
Non platform assembly: /Volumes/Macintosh HD 2/PROJECTS/Materne_Game_IPADApplis/PomPotes/Library/ScriptAssemblies/Assembly-UnityScript-Editor-firstpass.dll (this message is harmless)
Loading /Volumes/Macintosh HD 2/PROJECTS/Materne_Game_IPADApplis/PomPotes/Library/ScriptAssemblies/Assembly-UnityScript-Editor-firstpass.dll into Unity Child Domain
Non platform assembly: /Volumes/Macintosh HD 2/PROJECTS/Materne_Game_IPADApplis/PomPotes/Library/ScriptAssemblies/Assembly-UnityScript-Editor.dll (this message is harmless)
Loading /Volumes/Macintosh HD 2/PROJECTS/Materne_Game_IPADApplis/PomPotes/Library/ScriptAssemblies/Assembly-UnityScript-Editor.dll into Unity Child Domain
Platform assembly: /Applications/Unity 4.6.6p1/Unity.app/Contents/PackageManager/Unity/PackageManager/4.6.6/Unity.PackageManager.dll (this message is harmless)
Loading /Applications/Unity 4.6.6p1/Unity.app/Contents/PackageManager/Unity/PackageManager/4.6.6/Unity.PackageManager.dll into Unity Child Domain
Non platform assembly: /Applications/Unity 4.6.6p1/Unity.app/Contents/UnityExtensions/Unity/GUISystem/4.6.6/UnityEngine.UI.dll (this message is harmless)
Loading /Applications/Unity 4.6.6p1/Unity.app/Contents/UnityExtensions/Unity/GUISystem/4.6.6/UnityEngine.UI.dll into Unity Child Domain
Non platform assembly: /Applications/Unity 4.6.6p1/Unity.app/Contents/UnityExtensions/Unity/GUISystem/4.6.6/Editor/UnityEditor.UI.dll (this message is harmless)
Loading /Applications/Unity 4.6.6p1/Unity.app/Contents/UnityExtensions/Unity/GUISystem/4.6.6/Editor/UnityEditor.UI.dll into Unity Child Domain
Non platform assembly: /Volumes/Macintosh HD 2/PROJECTS/Materne_Game_IPADApplis/PomPotes/Assets/DOTween/DOTween.dll (this message is harmless)
Loading /Volumes/Macintosh HD 2/PROJECTS/Materne_Game_IPADApplis/PomPotes/Assets/DOTween/DOTween.dll into Unity Child Domain
Non platform assembly: /Volumes/Macintosh HD 2/PROJECTS/Materne_Game_IPADApplis/PomPotes/Assets/DOTween/DOTween43.dll (this message is harmless)
Loading /Volumes/Macintosh HD 2/PROJECTS/Materne_Game_IPADApplis/PomPotes/Assets/DOTween/DOTween43.dll into Unity Child Domain
Non platform assembly: /Volumes/Macintosh HD 2/PROJECTS/Materne_Game_IPADApplis/PomPotes/Assets/DOTween/DOTween46.dll (this message is harmless)
Loading /Volumes/Macintosh HD 2/PROJECTS/Materne_Game_IPADApplis/PomPotes/Assets/DOTween/DOTween46.dll into Unity Child Domain
Non platform assembly: /Volumes/Macintosh HD 2/PROJECTS/Materne_Game_IPADApplis/PomPotes/Assets/DOTween/Editor/DOTweenEditor.dll (this message is harmless)
Loading /Volumes/Macintosh HD 2/PROJECTS/Materne_Game_IPADApplis/PomPotes/Assets/DOTween/Editor/DOTweenEditor.dll into Unity Child Domain
Non platform assembly: /Volumes/Macintosh HD 2/PROJECTS/Materne_Game_IPADApplis/PomPotes/Assets/SimpleSQL/Editor/SimpleSQL_Editor.dll (this message is harmless)
Loading /Volumes/Macintosh HD 2/PROJECTS/Materne_Game_IPADApplis/PomPotes/Assets/SimpleSQL/Editor/SimpleSQL_Editor.dll into Unity Child Domain
Non platform assembly: /Volumes/Macintosh HD 2/PROJECTS/Materne_Game_IPADApplis/PomPotes/Assets/SimpleSQL/Plugins/SimpleSQL_Runtime.dll (this message is harmless)
Loading /Volumes/Macintosh HD 2/PROJECTS/Materne_Game_IPADApplis/PomPotes/Assets/SimpleSQL/Plugins/SimpleSQL_Runtime.dll into Unity Child Domain
Non platform assembly: /Volumes/Macintosh HD 2/PROJECTS/Materne_Game_IPADApplis/PomPotes/Assets/SimpleSQL/Plugins/SimpleSQL_SystemData.dll (this message is harmless)
Loading /Volumes/Macintosh HD 2/PROJECTS/Materne_Game_IPADApplis/PomPotes/Assets/SimpleSQL/Plugins/SimpleSQL_SystemData.dll into Unity Child Domain
Non platform assembly: /Volumes/Macintosh HD 2/PROJECTS/Materne_Game_IPADApplis/PomPotes/Assets/SimpleSQL/Plugins/System.Data.dll (this message is harmless)
Loading /Volumes/Macintosh HD 2/PROJECTS/Materne_Game_IPADApplis/PomPotes/Assets/SimpleSQL/Plugins/System.Data.dll into Unity Child Domain
Platform assembly: /Applications/Unity 4.6.6p1/Unity.app/Contents/Frameworks/Managed/UnityEditor.Graphs.dll (this message is harmless)
Loading /Applications/Unity 4.6.6p1/Unity.app/Contents/Frameworks/Managed/UnityEditor.Graphs.dll into Unity Child Domain
Platform assembly: /Applications/Unity 4.6.6p1/Unity.app/Contents/PlaybackEngines/AndroidPlayer/UnityEditor.Android.Extensions.dll (this message is harmless)
Loading /Applications/Unity 4.6.6p1/Unity.app/Contents/PlaybackEngines/AndroidPlayer/UnityEditor.Android.Extensions.dll into Unity Child Domain
Platform assembly: /Applications/Unity 4.6.6p1/Unity.app/Contents/PlaybackEngines/iossupport/UnityEditor.iOS.Extensions.dll (this message is harmless)
Loading /Applications/Unity 4.6.6p1/Unity.app/Contents/PlaybackEngines/iossupport/UnityEditor.iOS.Extensions.dll into Unity Child Domain
Platform assembly: /Applications/Unity 4.6.6p1/Unity.app/Contents/PlaybackEngines/BlackBerryPlayer/UnityEditor.BB10.Extensions.dll (this message is harmless)
Loading /Applications/Unity 4.6.6p1/Unity.app/Contents/PlaybackEngines/BlackBerryPlayer/UnityEditor.BB10.Extensions.dll into Unity Child Domain
Platform assembly: /Applications/Unity 4.6.6p1/Unity.app/Contents/Frameworks/Managed/Unity.DataContract.dll (this message is harmless)
Platform assembly: /Applications/Unity 4.6.6p1/Unity.app/Contents/Frameworks/Mono/lib/mono/2.0/System.Core.dll (this message is harmless)
Platform assembly: /Applications/Unity 4.6.6p1/Unity.app/Contents/Frameworks/Managed/Unity.IvyParser.dll (this message is harmless)
Initializing Unity.PackageManager (PackageManager) v4.6.6 for Unity v4.6.6
Setting Android v4.6.6 for Unity v4.6.6p1 to /Applications/Unity 4.6.6p1/Unity.app/Contents/PlaybackEngines/AndroidPlayer
Setting BB10 v4.6.6 for Unity v4.6.6p1 to /Applications/Unity 4.6.6p1/Unity.app/Contents/PlaybackEngines/BlackBerryPlayer
Setting iPhone v4.6.6 for Unity v4.6.6p1 to /Applications/Unity 4.6.6p1/Unity.app/Contents/PlaybackEngines/iossupport
Setting GUISystem v4.6.6 for Unity v4.6.6p1 to /Applications/Unity 4.6.6p1/Unity.app/Contents/UnityExtensions/Unity/GUISystem/4.6.6
Platform assembly: /Applications/Unity 4.6.6p1/Unity.app/Contents/Frameworks/Mono/lib/mono/2.0/UnityScript.Lang.dll (this message is harmless)
Platform assembly: /Applications/Unity 4.6.6p1/Unity.app/Contents/Frameworks/Mono/lib/mono/2.0/Boo.Lang.dll (this message is harmless)
Platform assembly: /Applications/Unity 4.6.6p1/Unity.app/Contents/Frameworks/Managed/nunit.framework.dll (this message is harmless)
Platform assembly: /Applications/Unity 4.6.6p1/Unity.app/Contents/Frameworks/Managed/Mono.Cecil.dll (this message is harmless)
Platform assembly: /Applications/Unity 4.6.6p1/Unity.app/Contents/Frameworks/Mono/lib/mono/2.0/UnityScript.dll (this message is harmless)
Platform assembly: /Applications/Unity 4.6.6p1/Unity.app/Contents/Frameworks/Managed/ICSharpCode.NRefactory.dll (this message is harmless)
Platform assembly: /Applications/Unity 4.6.6p1/Unity.app/Contents/Frameworks/Mono/lib/mono/2.0/System.Transactions.dll (this message is harmless)
Platform assembly: /Applications/Unity 4.6.6p1/Unity.app/Contents/Frameworks/Mono/lib/mono/2.0/Mono.Data.Tds.dll (this message is harmless)
Platform assembly: /Applications/Unity 4.6.6p1/Unity.app/Contents/Frameworks/Mono/lib/mono/2.0/System.Xml.Linq.dll (this message is harmless)
----- Total AssetImport time: 0.027952s, AssetImport time: 0.000000s, Asset hashing: 0.000000s [0 B, 0.000000 mb/s]
Platform assembly: /Applications/Unity 4.6.6p1/Unity.app/Contents/Frameworks/Mono/lib/mono/2.0/System.EnterpriseServices.dll (this message is harmless)
Mono: successfully reloaded assembly
- Completed reload, in 0.999 seconds
System memory in use before: 340.1 MB.
Unloading 1680 Unused Serialized files (Serialized files now loaded: 0 / Dirty serialized files: 0)
System memory in use after: 263.9 MB.
Unloading 65 unused Assets to reduce memory usage. Loaded Objects now: 4610.
Total: 400.475891 ms (FindLiveObjects: 0.211379 ms CreateObjectMapping: 0.062949 ms MarkObjects: 3.449017 ms DeleteObjects: 0.204895 ms)
easy = 1 = 0
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:Log(Object)
LogicInterfacesAngry:InitListOfLevel() (at Assets/_INTERFACES/_SCRIPTS/LogicInterfacesAngry.cs:217)
LogicInterfacesAngry:Start() (at Assets/_INTERFACES/_SCRIPTS/LogicInterfacesAngry.cs:134)
(Filename: Assets/_INTERFACES/_SCRIPTS/LogicInterfacesAngry.cs Line: 217)
Internet available
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:Log(Object)
InternetChecker:InternetAvailable() (at Assets/_INTERFACES/_SCRIPTS/InternetChecker.cs:65)
InternetChecker:Start() (at Assets/_INTERFACES/_SCRIPTS/InternetChecker.cs:17)
(Filename: Assets/_INTERFACES/_SCRIPTS/InternetChecker.cs Line: 65)
System memory in use before: 270.7 MB.
Unloading 20 Unused Serialized files (Serialized files now loaded: 0 / Dirty serialized files: 0)
System memory in use after: 267.5 MB.
Unloading 195 unused Assets to reduce memory usage. Loaded Objects now: 4557.
Total: 6.845208 ms (FindLiveObjects: 0.201552 ms CreateObjectMapping: 0.067413 ms MarkObjects: 3.928886 ms DeleteObjects: 0.287959 ms)
a simple example off class using Dotween :
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using DG.Tweening;
public class LogicInterfacesAngry : MonoBehaviour
{
// ---------------------------------------------------------------------
//
// VAR
//
// ---------------------------------------------------------------------
// reference to database manager object in the scene
public SimpleSQL.SimpleSQLManager dbManager;
public GameObject consignesPanelObject; // consigne
public GameObject messWinPanelObject; // message win
public G ameObject messLoosePanelObject; // message loose
public GameObject ScoreUpPanelObject; // score up
public GameObject ScoreEndPanelObject; // score end
public GameObject choicesPanelObject; // choice
public GameObject lvlEasyBg;
public GameObject lvlMediumBg;
public GameObject lvlHardBg;
public GameObject star1;
public GameObject star2;
public GameObject star3;
public UILabel labelNiv;
public GameObject btnOkMessWin;
public GameObject btnOkMessLoose;
public GameObject btnClose;
public GameObject btnQuest;
public GameObject btnOkConsigne;
public GameObject btnRestart;
public GameObject btnZoom;
public GameObject btnEasy;
public GameObject btnMedium;
public GameObject btnHard;
public GameObject btnChoice;
public GameObject btnCloseChoice;
public GameObject btnChoiceInPlay;
public GameObject btnRestartStoredLevel;
public Transform animChoice;
public Transform animScore;
public Transform animPancarte;
public Transform animBtnRestartStoredLevel;
public UILabel labelScoreUP;
public UILabel labelScore;
public UILabel labelBetterScoreUP;
public UILabel labelNumPeche;
private GameObject gameSettingGo;
static int playerScore;
private string sqlRegisterJumperScore;
private string sqlGetBetterJumperScore;
private string sqlRegisterLevel;
private string sqlUpdateLevel;
private string sqlFindLevelByUser;
private string sqlDeleteLevel;
private int tmpIdUser;
private int _scoreupfordb;
private int _betterscore;
protected string m_nextLevel;
private int tmpCurrentScore = 0;
private bool canCheckThePlayerPref = false;
private int currentNivInLevel = 1;
public string currentLevelName = "";
public int numbPeche = 0;
private int countOfEnnemy = 0;
private GameObject level;
//private GameObject nextLevel;
public GameObject cameraGo;
void Awake ()
{
DOTween.Init(true, false, LogBehaviour.ErrorsOnly);
// Get current player id and set to var
tmpIdUser = PlayerManager.GetCurrentUserByID();
sqlRegisterJumperScore = "INSERT INTO score (current_score, best_score, id_jeu, id_user) VALUES (?, ?, ?, ?)";
sqlGetBetterJumperScore = "SELECT MAX(best_score) AS best_score FROM score WHERE id_jeu = ? AND id_user = ?";
sqlFindLevelByUser = "SELECT * FROM catapotes";
sqlRegisterLevel = "INSERT INTO catapotes (level, niv, score, id_user) VALUES (?, ?, ?, ?)";
sqlUpdateLevel = "UPDATE catapotes SET level = ?, niv = ?, score = ?, id_user = ? WHERE level = ?";
sqlDeleteLevel = "DELETE FROM catapotes WHERE id_user = ?";
}
// ---------------------------------------------------------------------
//
// INIT
//
// ---------------------------------------------------------------------
void Start ()
{
// init label score text
if ( labelScoreUP != null )
labelScoreUP.text = "0";
// init event listener btns
UIEventListener.Get(btnOkMessWin).onClick = CloseMessWinPanel;
UIEventListener.Get(btnOkMessLoose).onClick = CloseMessLoosePanel;
UIEventListener.Get(btnOkConsigne).onClick = CloseConsignePanel;
UIEventListener.Get(btnRestart).onClick = RestartCurrentLevel;
UIEventListener.Get(btnClose).onClick = QuitGame;
UIEventListener.Get(btnQuest).onClick = QuitGame;
UIEventListener.Get(btnZoom).onClick = MoveCamera;
UIEventListener.Get(btnChoice).onClick = OpenChoicesPanel;
UIEventListener.Get(btnCloseChoice).onClick = CloseChoicesPanel;
UIEventListener.Get(btnChoiceInPlay).onClick = OpenChoicesPanelInPlay;
UIEventListener.Get(btnEasy).onClick = LaunchSelectedLevel;
UIEventListener.Get(btnMedium).onClick = LaunchSelectedLevel;
UIEventListener.Get(btnHard).onClick = LaunchSelectedLevel;
UIEventListener.Get(btnRestartStoredLevel).onClick = LaunchStoredLevel;
NGUITools.SetActive(btnCloseChoice, false);
// set active the choice panel
NGUITools.SetActive(choicesPanelObject, true);
animChoice.DOShakeScale(1f, 0.5f, 4, 0f);
// Find level stored
InitListOfLevel();
}
void LaunchSelectedStoredLevel (GameObject go)
{
DestrucLoadedLevel();
Destroy(level);
NGUITools.SetActive(choicesPanelObject, false);
// masqk level by default
lvlEasyBg.SetActive(false);
lvlMediumBg.SetActive(false);
lvlHardBg.SetActive(false);
switch( go.name )
{
case "btnEasy":
NGUITools.SetActive(btnZoom, false);
numbPeche = 8;
lvlEasyBg.SetActive(true);
break;
case "btnMedium":
NGUITools.SetActive(btnZoom, true);
numbPeche = 6;
lvlMediumBg.SetActive(true);
break;
case "btnHard":
NGUITools.SetActive(btnZoom, true);
numbPeche = 5;
lvlHardBg.SetActive(true);
break;
}
NGUITools.SetActive(consignesPanelObject, true);
animPancarte.DOShakeScale(1f, 0.5f, 4, 0f);
}
void LaunchSelectedLevel (GameObject go)
{
DestrucLoadedLevel();
Destroy(level);
ResetCurrentNiv();
NGUITools.SetActive(choicesPanelObject, false);
// masqk level by default
lvlEasyBg.SetActive(false);
lvlMediumBg.SetActive(false);
lvlHardBg.SetActive(false);
switch( go.name )
{
case "btnEasy":
NGUITools.SetActive(btnZoom, false);
currentLevelName = "easy";
numbPeche = 8;
lvlEasyBg.SetActive(true);
break;
case "btnMedium":
NGUITools.SetActive(btnZoom, true);
currentLevelName = "medium";
numbPeche = 6;
lvlMediumBg.SetActive(true);
break;
case "btnHard":
NGUITools.SetActive(btnZoom, true);
currentLevelName = "hard";
numbPeche = 5;
lvlHardBg.SetActive(true);
break;
}
NGUITools.SetActive(consignesPanelObject, true);
animPancarte.DOShakeScale(1f, 0.5f, 4, 0f);
}
// ---------------------------------------------------------------------
//
// DB
//
// ---------------------------------------------------------------------
void InitListOfLevel() {
List<Catapotes> levelInDB = dbManager.Query<Catapotes>(sqlFindLevelByUser, tmpIdUser);
// If a bonus exist in Local DB
if ( levelInDB != null && levelInDB.Count > 0 ) {
foreach (Catapotes catapotes in levelInDB)
{
if(UtilsManager.GetDebug()){Debug.Log(catapotes.level + " = " + catapotes.niv + " = " + catapotes.score);}
// Store data in var
currentLevelName = catapotes.level;
currentNivInLevel = catapotes.niv;
tmpCurrentScore = catapotes.score;
}
// View bouton restart stored level
AnimateLevel(animBtnRestartStoredLevel);
} else {
animBtnRestartStoredLevel.position = new Vector3(20f, -465f, 0f);
}
}
void DeleteLevelStored() {
List<Catapotes> levelInDB = dbManager.Query<Catapotes>(sqlFindLevelByUser, tmpIdUser);
// If a bonus exist in Local DB
if ( levelInDB != null && levelInDB.Count > 0 ) {
foreach (Catapotes catapotes in levelInDB)
{
dbManager.Execute (sqlDeleteLevel, catapotes.id_user);
}
}
}
void UpLevelInDB(string _level, int _niv, int _score) {
List<Catapotes> levelInDB = dbManager.Query<Catapotes>(sqlFindLevelByUser, tmpIdUser);
// If a bonus exist in Local DB update bonus
if ( levelInDB != null && levelInDB.Count > 0 ) {
dbManager.Execute(sqlUpdateLevel, _level, _niv, _score, tmpIdUser, _level);
}
}
void AnimateLevel(Transform _value) {
Tween myTween = _value.DOLocalMoveY(-277f, 0.8f).SetAutoKill(false).SetEase(Ease.InOutExpo);
}
void LaunchStoredLevel(GameObject go) {
InitListOfLevel();
// Init level by stored name
switch( currentLevelName )
{
case "easy":
LaunchSelectedStoredLevel(btnEasy);
break;
case "medium":
LaunchSelectedStoredLevel(btnMedium);
break;
case "hard":
LaunchSelectedStoredLevel(btnHard);
break;
}
}
// ---------------------------------------------------------------------
//
// SCORE
//
// ---------------------------------------------------------------------
void Update ()
{
if (canCheckThePlayerPref)
StartCoroutine(playerPref());
labelScoreUP.text = tmpCurrentScore.ToString();
labelNumPeche.text = "x"+numbPeche.ToString();
labelNiv.text = currentNivInLevel+"/3";
switch (currentLevelName)
{
case "easy":
NGUITools.SetActive(star1, true);
NGUITools.SetActive(star2, false);
NGUITools.SetActive(star3, false);
break;
case "medium":
NGUITools.SetActive(star2, true);
NGUITools.SetActive(star1, false);
NGUITools.SetActive(star3, false);
break;
case "hard":
NGUITools.SetActive(star3, true);
NGUITools.SetActive(star1, false);
NGUITools.SetActive(star2, false);
break;
}
}
IEnumerator playerPref()
{
canCheckThePlayerPref = false;
yield return new WaitForSeconds(0.1f);
canCheckThePlayerPref = true;
}
public void SetScoreByElements ( int elementNum ) {
switch (elementNum)
{
case 1:
tmpCurrentScore += UtilsManager.SCORE_ANGRY_1;
break;
case 2:
tmpCurrentScore += UtilsManager.SCORE_ANGRY_2;
break;
case 3:
tmpCurrentScore += UtilsManager.SCORE_ANGRY_3;
break;
case 4:
tmpCurrentScore += UtilsManager.SCORE_ANGRY_4;
break;
default:
//..
break;
}
}
public void CountNumbPeche ()
{
numbPeche--;
if ( numbPeche <= 0)
numbPeche = 0;
}
public void GetCountOfEnnemy (int enyNumb)
{
// if ennemy exist and do not have fruit
if ( enyNumb > 0 && numbPeche == 0)
{
// open loose message
StartCoroutine(OpenLooseMessPanelGameEnd());
}
}
// ---------------------------------------------------------------------
//
// CLOSE consigne panel
//
// ---------------------------------------------------------------------
void CloseConsignePanel(GameObject go)
{
// Load first level
LoadLevelAngry();
// Close consigne panel and open sore up panel
NGUITools.SetActive(consignesPanelObject, false);
NGUITools.SetActive(ScoreUpPanelObject, true);
GameObject goCamera = GameObject.Find(UtilsManager.GO_NAME_LOGIC_MAINCAMERA);
camera cam = goCamera.GetComponent(typeof(camera)) as camera;
cam.StartCameraMovement(currentLevelName);
}
// ---------------------------------------------------------------------
//
// OPEN / CLOSE win panel
//
// ---------------------------------------------------------------------
public IEnumerator OpenMessWinPanel()
{
if (currentNivInLevel >= 3)
{
yield return new WaitForEndOfFrame();
OpenScoreEndPanel(null);
currentNivInLevel = 1;
}
else
{
// Play music win
SoundManager.RemoveCurrentSound();
SoundManager.PlaySound(SoundType.ST_WINQUEST, false, cameraGo, 1f);
yield return new WaitForEndOfFrame();
NGUITools.SetActive(messWinPanelObject, true);
}
}
void CloseMessWinPanel(GameObject go)
{
// clean level
DestrucLoadedLevel();
// Set number of peche for new level
switch (currentLevelName)
{
case "easy":
numbPeche = 8;
break;
case "medium":
numbPeche = 6;
break;
case "hard":
numbPeche = 5;
break;
}
// Set current level + 1
currentNivInLevel++;
// close panel
NGUITools.SetActive(messWinPanelObject, false);
// load new level from rescources
LoadLevelAngry();
}
// Reset game and open choice panel
void CloseMessLoosePanel (GameObject go)
{
// Delete current level
Destroy(level);
// Reset score, data, level...
ResetCurrentNiv();
currentLevelName = "";
DeleteLevelStored();
NGUITools.SetActive(messLoosePanelObject, false);
NGUITools.SetActive(btnCloseChoice, false);
// set active the choice panel
NGUITools.SetActive(choicesPanelObject, true);
animChoice.DOShakeScale(1f, 0.5f, 4, 0f);
InitListOfLevel();
}
// ---------------------------------------------------------------------
//
// LOAD / DELETE LEVEL
//
// ---------------------------------------------------------------------
void LoadLevelAngry ()
{
// load fisrt level
Vector3 vectorNewPos = new Vector3(0, 5.32f, 0);
switch (currentLevelName)
{
case "easy":
level = (GameObject)Instantiate(Resources.Load(UtilsManager.GO_NAME_ANGRY_LEVEL+"easy_"+(currentNivInLevel)+UtilsManager.GO_NAME_ANGRY_NAME.ToString()), vectorNewPos, new Quaternion(0f,0f,0f,0f));
break;
case "medium":
level = (GameObject)Instantiate(Resources.Load(UtilsManager.GO_NAME_ANGRY_LEVEL+"medium_"+(currentNivInLevel)+UtilsManager.GO_NAME_ANGRY_NAME.ToString()), vectorNewPos, new Quaternion(0f,0f,0f,0f));
break;
case "hard":
level = (GameObject)Instantiate(Resources.Load(UtilsManager.GO_NAME_ANGRY_LEVEL+"hard_"+(currentNivInLevel)+UtilsManager.GO_NAME_ANGRY_NAME.ToString()), vectorNewPos, new Quaternion(0f,0f,0f,0f));
break;
}
// Play music angry
SoundManager.RemoveCurrentSound();
SoundManager.PlaySound(SoundType.ST_CATAPOTES, true, cameraGo, 1f);
}
void DestrucLoadedLevel ()
{
if ( level != null ){
Destroy(level);
}
}
// ---------------------------------------------------------------------
//
// OPEN / CLOSE score end panel
//
// ---------------------------------------------------------------------
public IEnumerator OpenLooseMessPanelGameEnd()
{
yield return new WaitForEndOfFrame();
NGUITools.SetActive(ScoreUpPanelObject, false);
NGUITools.SetActive(messLoosePanelObject, true);
}
void OpenScoreEndPanel(GameObject go)
{
_scoreupfordb = tmpCurrentScore;
GetBetterScore();
DeleteLevelStored();
NGUITools.SetActive(ScoreUpPanelObject, false);
NGUITools.SetActive(ScoreEndPanelObject, true);
//animScore.DOShakeScale(1f, 0.5f, 4, 0f);
labelScore.text = _scoreupfordb.ToString();
}
// ---------------------------------------------------------------------
//
// SCORING
//
// ---------------------------------------------------------------------
// List of better score
public List<Score> GetListOfScore () {
// Gather a list of score
List<Score> scores = dbManager.Query<Score>(sqlGetBetterJumperScore, UtilsManager.INT_GAME_CATAPOTES, tmpIdUser);
return scores;
}
// Get the better score
void GetBetterScore ()
{
// Set better score with db data
_betterscore = GetListOfScore().ToArray()[0].best_score;
// If better score exist
if ( _betterscore != 0 )
{
if ( _scoreupfordb > _betterscore )
labelBetterScoreUP.text = _scoreupfordb.ToString();
else
labelBetterScoreUP.text = _betterscore.ToString();
}
// Set score up at betterscore
else
{
labelBetterScoreUP.text = _scoreupfordb.ToString();
}
RegisterScoreInLocalDb(_scoreupfordb, _betterscore);
}
// id angry game in db = 1
void RegisterScoreInLocalDb(int newCurrentScore, int newBetterScore)
{
dbManager.Execute(sqlRegisterJumperScore, newCurrentScore, newBetterScore, UtilsManager.INT_GAME_CATAPOTES, tmpIdUser);
}
// ---------------------------------------------------------------------
//
// MOVE CAMERA TO SEE ELEMENTS
//
// ---------------------------------------------------------------------
void MoveCamera(GameObject go)
{
cameraGo.GetComponent<camera>().GoToStartPoint();
}
// ---------------------------------------------------------------------
//
// RESTART / CHOICE GAME /QUIT GAME
//
// ---------------------------------------------------------------------
// Open choice panel onclick in scorePanel
void OpenChoicesPanel(GameObject go) {
NGUITools.SetActive(btnCloseChoice, false);
DestrucLoadedLevel();
Destroy(level);
ResetCurrentNiv();
NGUITools.SetActive(ScoreEndPanelObject, false);
// set active the choice panel
NGUITools.SetActive(choicesPanelObject, true);
animChoice.DOShakeScale(1f, 0.5f, 4, 0f);
InitListOfLevel();
}
void OpenChoicesPanelInPlay(GameObject go) {
NGUITools.SetActive(btnCloseChoice, true);
NGUITools.SetActive(ScoreUpPanelObject, false);
// set active the choice panel
NGUITools.SetActive(choicesPanelObject, true);
animChoice.DOShakeScale(1f, 0.5f, 4, 0f);
}
void CloseChoicesPanel(GameObject go) {
// set inactive the choice panel
NGUITools.SetActive(choicesPanelObject, false);
NGUITools.SetActive(ScoreUpPanelObject, true);
}
void ResetCurrentNiv() {
tmpCurrentScore = 0;
currentNivInLevel = 1;
numbPeche = 0;
countOfEnnemy = 0;
}
void RestartCurrentLevel(GameObject go)
{
Destroy(level);
NGUITools.SetActive(ScoreUpPanelObject, true);
labelScoreUP.text = "0";
NGUITools.SetActive(ScoreEndPanelObject, false);
ResetCurrentNiv();
switch (currentLevelName)
{
case "easy":
numbPeche = 8;
break;
case "medium":
numbPeche = 6;
break;
case "hard":
numbPeche = 5;
break;
}
LoadLevelAngry();
}
void QuitGame(GameObject go)
{
dbManager.Execute (sqlRegisterLevel, currentLevelName, currentNivInLevel, tmpCurrentScore, tmpIdUser);
// send the game to be loaded
PlayerManager.SetLevelNameOfGame(UtilsManager.GAME_INTERFACES_TXT);
// Open game quest loader first
NextScene(UtilsManager.GAME_PRELOADINT_TXT);
}
void NextScene(string sceneName)
{
m_nextLevel = sceneName;
Application.LoadLevel(m_nextLevel);
}
}