2025-09-06 05:39:03 +00:00
|
|
|
|
using BansheeGz.BGDatabase;
|
2025-08-27 21:08:17 +00:00
|
|
|
|
using CodeJay.Classes;
|
|
|
|
|
|
using CodeJay.Defines;
|
2025-09-07 01:22:33 +00:00
|
|
|
|
using Newtonsoft.Json;
|
2025-08-27 21:08:17 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using UnityEngine.Events;
|
|
|
|
|
|
|
|
|
|
|
|
namespace CodeJay
|
|
|
|
|
|
{
|
|
|
|
|
|
namespace Classes
|
|
|
|
|
|
{
|
|
|
|
|
|
[System.Serializable]
|
|
|
|
|
|
public class SaveData
|
|
|
|
|
|
{
|
|
|
|
|
|
public long Gold;
|
|
|
|
|
|
public long Heart;
|
|
|
|
|
|
public long Key;
|
|
|
|
|
|
|
|
|
|
|
|
public long BuyKeyCount;
|
|
|
|
|
|
|
|
|
|
|
|
public bool Sound_Toggle;
|
|
|
|
|
|
public bool SFX_Toggle;
|
|
|
|
|
|
|
|
|
|
|
|
public bool IsRemoveADS;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> Normalized Speed. 0 ~ 1
|
|
|
|
|
|
/// <para>In reality, 'GameSpeed' * 1.8 + 0.2 is the speed of the game.</para></summary>
|
|
|
|
|
|
public float GameSpeed;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>Number of Watched Ad In Store(Ad Heart Product).</summary>
|
2025-09-10 05:35:36 +00:00
|
|
|
|
public int ProductAdWatchedNumber, ShopADDia;
|
|
|
|
|
|
public DateTime ProductAdWatchedTime, ShopADDiaTime;
|
2025-08-31 07:14:15 +00:00
|
|
|
|
public int FreeHeartCount, FreeKeyCount;
|
2025-08-27 21:08:17 +00:00
|
|
|
|
public int InterstitialADCount;
|
|
|
|
|
|
|
2025-08-29 13:01:17 +00:00
|
|
|
|
public bool[] ImageOpenStates_Left, ImageOpenStates_Right;
|
2025-09-17 22:16:44 +00:00
|
|
|
|
public bool[] HeartImageOpen;
|
2025-08-27 21:08:17 +00:00
|
|
|
|
public long[] UnlockProgress;
|
|
|
|
|
|
|
|
|
|
|
|
public int NormalGameLevel;
|
|
|
|
|
|
/// <summary>The Amount of Gold Taken From Current level AI.</summary>
|
|
|
|
|
|
public long NormalGame_GetGold;
|
|
|
|
|
|
|
|
|
|
|
|
public long BuyShopAccumulatedMoney;
|
2025-09-04 05:05:15 +00:00
|
|
|
|
public float MissionAddRate;
|
2025-08-27 21:08:17 +00:00
|
|
|
|
|
2025-09-07 21:21:01 +00:00
|
|
|
|
public int Month;
|
|
|
|
|
|
public int TotalCashPerMonth;
|
|
|
|
|
|
|
2025-08-27 21:08:17 +00:00
|
|
|
|
public void Initialize()
|
|
|
|
|
|
{
|
|
|
|
|
|
this.Gold = 10000;
|
|
|
|
|
|
this.Heart = 0;
|
|
|
|
|
|
this.Key = 0;
|
|
|
|
|
|
this.BuyKeyCount = 0;
|
|
|
|
|
|
this.Sound_Toggle = false;
|
|
|
|
|
|
this.SFX_Toggle = false;
|
|
|
|
|
|
this.IsRemoveADS = false;
|
2025-09-07 07:13:08 +00:00
|
|
|
|
this.GameSpeed = 1.5f;
|
2025-09-10 05:35:36 +00:00
|
|
|
|
ShopADDia = this.ProductAdWatchedNumber = Constants.ADS_REWARD_COUNT;
|
2025-08-27 21:08:17 +00:00
|
|
|
|
this.FreeHeartCount = Constants.FREE_HEART_DAY;
|
2025-08-31 07:14:15 +00:00
|
|
|
|
FreeKeyCount = Constants.FREE_HEART_DAY;
|
2025-08-27 21:08:17 +00:00
|
|
|
|
this.InterstitialADCount = Constants.INTERSTITIAL_AD_CYCLE;
|
|
|
|
|
|
this.NormalGameLevel = 1;
|
|
|
|
|
|
this.NormalGame_GetGold = 0;
|
|
|
|
|
|
this.BuyShopAccumulatedMoney = 0;
|
2025-09-04 05:05:15 +00:00
|
|
|
|
MissionAddRate = 0f;
|
2025-09-07 21:21:01 +00:00
|
|
|
|
Month = 0;
|
|
|
|
|
|
TotalCashPerMonth = 0;
|
2025-08-27 21:08:17 +00:00
|
|
|
|
|
2025-08-29 13:01:17 +00:00
|
|
|
|
if (ImageOpenStates_Left == null) ImageOpenStates_Left = new bool[DB_HuntingData.CountEntities >> 1];
|
|
|
|
|
|
if (ImageOpenStates_Right == null) ImageOpenStates_Right = new bool[DB_HuntingData.CountEntities >> 1];
|
2025-09-17 22:16:44 +00:00
|
|
|
|
if (HeartImageOpen == null) HeartImageOpen = new bool[DB_HuntingData.CountEntities >> 1];
|
2025-08-27 21:08:17 +00:00
|
|
|
|
|
2025-08-29 13:01:17 +00:00
|
|
|
|
for (int i = 0; i < ImageOpenStates_Left.Length; i++) ImageOpenStates_Left[i] = false;
|
2025-09-10 22:17:10 +00:00
|
|
|
|
ImageOpenStates_Left[0] = true; // 최초 앨범 오픈
|
2025-08-29 13:01:17 +00:00
|
|
|
|
for (int i = 0; i < ImageOpenStates_Right.Length; i++) ImageOpenStates_Right[i] = false;
|
2025-09-17 22:16:44 +00:00
|
|
|
|
for (int i = 0; i < HeartImageOpen.Length; i++) HeartImageOpen[i] = false;
|
2025-08-27 21:08:17 +00:00
|
|
|
|
|
|
|
|
|
|
if (this.UnlockProgress == null)
|
|
|
|
|
|
this.UnlockProgress = new long[Defines.Constants.AI_IMAGE_NUMBER];
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < UnlockProgress.Length; i++)
|
|
|
|
|
|
UnlockProgress[i] = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Overwrite(SaveData data)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (data == null)
|
|
|
|
|
|
throw new System.Exception("Overwrite Data Never Be Null");
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
this.Gold = data.Gold;
|
|
|
|
|
|
this.Heart = data.Heart;
|
|
|
|
|
|
this.Key = data.Key;
|
|
|
|
|
|
this.BuyKeyCount = data.BuyKeyCount;
|
|
|
|
|
|
this.Sound_Toggle = data.Sound_Toggle;
|
|
|
|
|
|
this.SFX_Toggle = data.SFX_Toggle;
|
|
|
|
|
|
this.IsRemoveADS = data.IsRemoveADS;
|
|
|
|
|
|
this.GameSpeed = data.GameSpeed;
|
|
|
|
|
|
this.ProductAdWatchedNumber = data.ProductAdWatchedNumber;
|
2025-09-05 13:22:04 +00:00
|
|
|
|
ProductAdWatchedTime = data.ProductAdWatchedTime;
|
2025-09-10 05:35:36 +00:00
|
|
|
|
ShopADDiaTime = data.ShopADDiaTime;
|
|
|
|
|
|
ShopADDiaTime = data.ShopADDiaTime;
|
2025-08-27 21:08:17 +00:00
|
|
|
|
this.FreeHeartCount = data.FreeHeartCount;
|
2025-08-31 07:14:15 +00:00
|
|
|
|
FreeKeyCount = data.FreeKeyCount;
|
2025-08-27 21:08:17 +00:00
|
|
|
|
this.InterstitialADCount = data.InterstitialADCount;
|
|
|
|
|
|
this.NormalGameLevel = data.NormalGameLevel;
|
|
|
|
|
|
this.NormalGame_GetGold = data.NormalGame_GetGold;
|
|
|
|
|
|
this.BuyShopAccumulatedMoney = data.BuyShopAccumulatedMoney;
|
2025-09-04 05:05:15 +00:00
|
|
|
|
MissionAddRate = data.MissionAddRate;
|
2025-09-07 21:21:01 +00:00
|
|
|
|
Month = data.Month;
|
|
|
|
|
|
TotalCashPerMonth = data.TotalCashPerMonth;
|
2025-08-27 21:08:17 +00:00
|
|
|
|
|
|
|
|
|
|
if (NormalGameLevel <= 0)
|
|
|
|
|
|
NormalGameLevel = 1;
|
|
|
|
|
|
|
2025-08-29 13:01:17 +00:00
|
|
|
|
if (data.ImageOpenStates_Left != null)
|
|
|
|
|
|
for (int i = 0; i < ImageOpenStates_Left.Length; i++)
|
|
|
|
|
|
if (data.ImageOpenStates_Left.Length > i)
|
|
|
|
|
|
ImageOpenStates_Left[i] = data.ImageOpenStates_Left[i];
|
|
|
|
|
|
if (data.ImageOpenStates_Right != null)
|
|
|
|
|
|
for (int i = 0; i < ImageOpenStates_Right.Length; i++)
|
|
|
|
|
|
if (data.ImageOpenStates_Right.Length > i)
|
|
|
|
|
|
ImageOpenStates_Right[i] = data.ImageOpenStates_Right[i];
|
2025-09-17 22:16:44 +00:00
|
|
|
|
if (data.HeartImageOpen != null)
|
|
|
|
|
|
for (int i = 0; i < HeartImageOpen.Length; i++)
|
|
|
|
|
|
if (data.HeartImageOpen.Length > i)
|
|
|
|
|
|
HeartImageOpen[i] = data.HeartImageOpen[i];
|
2025-08-27 21:08:17 +00:00
|
|
|
|
|
|
|
|
|
|
if (data.UnlockProgress != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
for (int i = 0; i < UnlockProgress.Length; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (data.UnlockProgress.Length > i)
|
|
|
|
|
|
UnlockProgress[i] = data.UnlockProgress[i];
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[System.Serializable]
|
|
|
|
|
|
public class HuntingData
|
|
|
|
|
|
{
|
|
|
|
|
|
// Data Index
|
|
|
|
|
|
// 100<30><30><EFBFBD><EFBFBD><EFBFBD> 50<35><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ִ<EFBFBD>.
|
2025-08-29 13:01:17 +00:00
|
|
|
|
public int Index, n_Group;
|
2025-08-27 21:08:17 +00:00
|
|
|
|
|
2025-09-06 05:39:03 +00:00
|
|
|
|
public Sprite HuntingImage()
|
|
|
|
|
|
{
|
|
|
|
|
|
return DB_HuntingData.GetEntity(new BGId(HuntingDataID)).DBF_HuntingImage;
|
|
|
|
|
|
}
|
|
|
|
|
|
public Sprite UnlockImage()
|
|
|
|
|
|
{
|
|
|
|
|
|
return DB_HuntingData.GetEntity(new BGId(HuntingDataID)).DBF_UnlockImage;
|
|
|
|
|
|
}
|
2025-08-29 14:29:11 +00:00
|
|
|
|
|
2025-08-27 21:08:17 +00:00
|
|
|
|
public int Stake;
|
|
|
|
|
|
public int TextureIndex;
|
|
|
|
|
|
public long ClearConditionMoney;
|
|
|
|
|
|
|
2025-08-29 13:01:17 +00:00
|
|
|
|
public int n_AlbumType, NeedKey, NeedHeart, NeedLv;
|
2025-08-29 00:59:06 +00:00
|
|
|
|
|
2025-08-27 21:08:17 +00:00
|
|
|
|
public string Name;
|
|
|
|
|
|
public string Description;
|
|
|
|
|
|
public string Script;
|
|
|
|
|
|
|
|
|
|
|
|
public string HuntingDataID;
|
|
|
|
|
|
|
|
|
|
|
|
/*public HuntingData(int index, int stake, int textureIndex, long clearMoney, string name, string desc, string script)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.Index = index;
|
|
|
|
|
|
this.Stake = stake;
|
|
|
|
|
|
this.TextureIndex = textureIndex;
|
|
|
|
|
|
this.ClearConditionMoney = clearMoney;
|
|
|
|
|
|
this.Name = name;
|
|
|
|
|
|
this.Description = desc;
|
|
|
|
|
|
this.Script = script;
|
|
|
|
|
|
}*/
|
|
|
|
|
|
|
2025-08-29 00:59:06 +00:00
|
|
|
|
//public HuntingData(int index, int stake, long clearMoney, string name, string desc, string huntingDataID)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// this.Index = index;
|
|
|
|
|
|
// this.Stake = stake;
|
|
|
|
|
|
// this.ClearConditionMoney = clearMoney;
|
|
|
|
|
|
// this.Name = name;
|
|
|
|
|
|
// this.Description = desc;
|
|
|
|
|
|
// this.HuntingDataID = huntingDataID;
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
public HuntingData(int index, DB_HuntingData data)
|
2025-08-27 21:08:17 +00:00
|
|
|
|
{
|
2025-08-29 00:59:06 +00:00
|
|
|
|
Index = index;
|
2025-08-29 13:01:17 +00:00
|
|
|
|
n_Group = data.DBF_n_Group;
|
2025-08-29 00:59:06 +00:00
|
|
|
|
Stake = data.DBF_Stake;
|
|
|
|
|
|
ClearConditionMoney = data.DBF_ClearConditionMoney;
|
|
|
|
|
|
Name = data.DBF_name;
|
|
|
|
|
|
Description = data.DBF_Description;
|
|
|
|
|
|
HuntingDataID = data.Id.ToString();
|
|
|
|
|
|
n_AlbumType = data.DBF_n_AlbumType;
|
2025-08-29 13:01:17 +00:00
|
|
|
|
NeedKey = data.DBF_NeedKey;
|
|
|
|
|
|
NeedHeart = data.DBF_NeedHeart;
|
|
|
|
|
|
NeedLv = data.DBF_NeedLv;
|
2025-08-27 21:08:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-08-29 13:01:17 +00:00
|
|
|
|
|
|
|
|
|
|
public class HuntingUIData
|
|
|
|
|
|
{
|
|
|
|
|
|
public HuntingData m_Left, m_Right;
|
|
|
|
|
|
}
|
2025-08-27 21:08:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
namespace Defines
|
|
|
|
|
|
{
|
|
|
|
|
|
[System.Serializable]
|
|
|
|
|
|
public class Constants
|
|
|
|
|
|
{
|
|
|
|
|
|
public const int AI_IMAGE_NUMBER = 100;
|
|
|
|
|
|
|
2025-09-05 07:20:45 +00:00
|
|
|
|
public const int ADS_TIMER_COUNT = 3600;
|
2025-08-27 21:08:17 +00:00
|
|
|
|
|
|
|
|
|
|
public const int ADS_REWARD_COUNT = 3;
|
|
|
|
|
|
|
|
|
|
|
|
public const int FREE_HEART_DAY = 1;
|
|
|
|
|
|
|
|
|
|
|
|
public const int INTERSTITIAL_AD_CYCLE = 3;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public partial class DBManager : MonoBehaviour
|
|
|
|
|
|
{
|
|
|
|
|
|
private const string SAVE_KEY = "GSProject";
|
|
|
|
|
|
public const int NORMAL_GAME_CONDITION_PER_LEVEL = 10000;
|
|
|
|
|
|
public const int NORMAL_GAME_STAKE_PER_LEVEL = 100;
|
|
|
|
|
|
|
|
|
|
|
|
#region Fields
|
|
|
|
|
|
private CodeJay.Classes.SaveData saveData;
|
|
|
|
|
|
private List<HuntingData> _lstHuntindData;
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region Properties
|
|
|
|
|
|
|
|
|
|
|
|
public bool CompleteDataLoad { get; private set; } = false;
|
|
|
|
|
|
public bool BGMMute { get => saveData.Sound_Toggle; set => saveData.Sound_Toggle = value; }
|
|
|
|
|
|
public bool SFXMute { get => saveData.SFX_Toggle; set => saveData.SFX_Toggle = value; }
|
|
|
|
|
|
|
|
|
|
|
|
public long Gold { get => saveData.Gold; }
|
|
|
|
|
|
public long Heart { get => saveData.Heart; }
|
|
|
|
|
|
public long Key { get => saveData.Key; }
|
|
|
|
|
|
public long BuyKeyCount { get => saveData.BuyKeyCount; }
|
|
|
|
|
|
public float GameSpeed { get => saveData.GameSpeed; set => saveData.GameSpeed = value; }
|
|
|
|
|
|
public int ProductAdWatchedNumber { get => saveData.ProductAdWatchedNumber; }
|
2025-09-05 13:22:04 +00:00
|
|
|
|
public DateTime ProductAdWatchedTime { get => saveData.ProductAdWatchedTime; }
|
2025-09-10 05:35:36 +00:00
|
|
|
|
public int ShopADDia { get => saveData.ShopADDia; }
|
|
|
|
|
|
public DateTime ShopADDiaTime { get => saveData.ShopADDiaTime; }
|
2025-08-27 21:08:17 +00:00
|
|
|
|
public int FreeHeartCount { get => saveData.FreeHeartCount; }
|
2025-08-31 07:14:15 +00:00
|
|
|
|
public int FreeKeyCount { get => saveData.FreeKeyCount; }
|
2025-08-27 21:08:17 +00:00
|
|
|
|
public int NormalGameLevel { get => saveData.NormalGameLevel; }
|
|
|
|
|
|
public int InterstitialADCount { get => saveData.InterstitialADCount; }
|
|
|
|
|
|
public bool IsRemoveADS { get => saveData.IsRemoveADS; }
|
|
|
|
|
|
public long BuyShopAccumulatedMoney { get => saveData.BuyShopAccumulatedMoney; }
|
2025-09-04 05:05:15 +00:00
|
|
|
|
public float MissionAddRate { get => saveData.MissionAddRate; }
|
2025-09-07 21:21:01 +00:00
|
|
|
|
public int TotalCashPerMonth { get => saveData.TotalCashPerMonth; }
|
2025-08-27 21:08:17 +00:00
|
|
|
|
|
2025-08-31 07:14:15 +00:00
|
|
|
|
public UnityAction OnResetFreeHeartCountEvent, OnResetFreeKeyCountEvent;
|
2025-08-27 21:08:17 +00:00
|
|
|
|
public UnityAction OnResetADSRewardActionCountEvent;
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
private Coroutine DayResetCoroutine = null;
|
|
|
|
|
|
|
|
|
|
|
|
private void Awake()
|
|
|
|
|
|
{
|
|
|
|
|
|
saveData = new CodeJay.Classes.SaveData();
|
|
|
|
|
|
this.LoadDatas();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-31 07:14:15 +00:00
|
|
|
|
#if UNITY_EDITOR
|
2025-08-27 21:08:17 +00:00
|
|
|
|
private void Update()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Input.GetKeyDown(KeyCode.U))
|
|
|
|
|
|
{
|
|
|
|
|
|
string str = "\n<><6E>ȭ<EFBFBD><C8AD>";
|
|
|
|
|
|
str += "\nŰ : " + saveData.Key.ToString();
|
|
|
|
|
|
str += "\n<><6E>Ʈ : " + saveData.Heart.ToString();
|
|
|
|
|
|
str += "\n<><6E><EFBFBD> : " + saveData.Gold.ToString();
|
|
|
|
|
|
Debug.Log(str);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (Input.GetKeyDown(KeyCode.I))
|
|
|
|
|
|
{
|
|
|
|
|
|
this.AddGold(100000, this.name);
|
|
|
|
|
|
this.AddHeart(1, this.name);
|
|
|
|
|
|
this.AddKey(1, this.name);
|
|
|
|
|
|
|
|
|
|
|
|
string str = "\n<><6E>ȭ<EFBFBD><C8AD>";
|
|
|
|
|
|
str += "\nŰ : " + saveData.Key.ToString();
|
|
|
|
|
|
str += "\n<><6E>Ʈ : " + saveData.Heart.ToString();
|
|
|
|
|
|
str += "\n<><6E><EFBFBD> : " + saveData.Gold.ToString();
|
|
|
|
|
|
Debug.Log(str);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (Input.GetKeyDown(KeyCode.O))
|
|
|
|
|
|
{
|
|
|
|
|
|
this.SubGold(saveData.Gold, this.name);
|
|
|
|
|
|
this.SubHeart(saveData.Heart, this.name);
|
|
|
|
|
|
this.SubKey(saveData.Key, this.name);
|
|
|
|
|
|
|
|
|
|
|
|
string str = "\n<><6E>ȭ<EFBFBD><C8AD>";
|
|
|
|
|
|
str += "\nŰ : " + saveData.Key.ToString();
|
|
|
|
|
|
str += "\n<><6E>Ʈ : " + saveData.Heart.ToString();
|
|
|
|
|
|
str += "\n<><6E><EFBFBD> : " + saveData.Gold.ToString();
|
|
|
|
|
|
Debug.Log(str);
|
|
|
|
|
|
}
|
2025-08-31 07:14:15 +00:00
|
|
|
|
else if (Input.GetKeyDown(KeyCode.T))
|
|
|
|
|
|
{
|
|
|
|
|
|
saveData.FreeKeyCount = 1;
|
|
|
|
|
|
}
|
2025-08-27 21:08:17 +00:00
|
|
|
|
}
|
2025-08-31 07:14:15 +00:00
|
|
|
|
#endif
|
2025-08-27 21:08:17 +00:00
|
|
|
|
|
|
|
|
|
|
private void OnDestroy()
|
|
|
|
|
|
{
|
|
|
|
|
|
if(DayResetCoroutine != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
StopCoroutine(DayResetCoroutine);
|
|
|
|
|
|
DayResetCoroutine = null;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-07 21:21:01 +00:00
|
|
|
|
public string Get_SaveDataJson() { return JsonConvert.SerializeObject(saveData); }
|
2025-09-07 01:22:33 +00:00
|
|
|
|
public void Set_SaveData(SaveData saveData) { this.saveData = saveData; SaveDatas(); }
|
2025-09-07 21:21:01 +00:00
|
|
|
|
public SaveData Get_SaveData() { return saveData; }
|
2025-09-07 01:22:33 +00:00
|
|
|
|
|
2025-08-27 21:08:17 +00:00
|
|
|
|
private void LoadDatas()
|
|
|
|
|
|
{
|
|
|
|
|
|
StartCoroutine(eLoadDatas());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private System.Collections.IEnumerator eLoadDatas()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
this.saveData = new SaveData();
|
|
|
|
|
|
saveData.Initialize();
|
|
|
|
|
|
|
2025-09-07 00:06:52 +00:00
|
|
|
|
SaveData loadData = ES3.Load<SaveData>(SAVE_KEY, defaultValue: null, new ES3Settings()
|
|
|
|
|
|
{
|
|
|
|
|
|
encryptionType = ES3.EncryptionType.AES, // AES 또는 XOR 사용 가능
|
|
|
|
|
|
encryptionPassword = "MyStrongPassword123" // 원하는 암호
|
|
|
|
|
|
});
|
2025-08-27 21:08:17 +00:00
|
|
|
|
|
|
|
|
|
|
if (loadData != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.saveData.Overwrite(loadData);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.SetHuntingData();
|
|
|
|
|
|
|
|
|
|
|
|
yield return null;
|
|
|
|
|
|
CompleteDataLoad = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void SetHuntingData()
|
|
|
|
|
|
{
|
|
|
|
|
|
_lstHuntindData = new List<HuntingData>();
|
|
|
|
|
|
|
|
|
|
|
|
DB_HuntingData data = null;
|
|
|
|
|
|
for (int i = 0; i < DB_HuntingData.CountEntities; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
data = DB_HuntingData.GetEntity(i);
|
|
|
|
|
|
if (data != null)
|
|
|
|
|
|
{
|
2025-08-29 00:59:06 +00:00
|
|
|
|
//_lstHuntindData.Add(new HuntingData(i, data.DBF_Stake, data.DBF_ClearConditionMoney, data.DBF_Name, data.DBF_Description, data.Id.ToString()));
|
|
|
|
|
|
_lstHuntindData.Add(new HuntingData(i, data));
|
2025-08-27 21:08:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void SaveDatas()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (CompleteDataLoad)
|
|
|
|
|
|
{
|
2025-09-07 00:06:52 +00:00
|
|
|
|
ES3.Save(SAVE_KEY, this.saveData, new ES3Settings()
|
|
|
|
|
|
{
|
|
|
|
|
|
encryptionType = ES3.EncryptionType.AES, // AES 또는 XOR 사용 가능
|
|
|
|
|
|
encryptionPassword = "MyStrongPassword123" // 원하는 암호
|
|
|
|
|
|
});
|
2025-08-27 21:08:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public bool ExistSaveData()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (CompleteDataLoad)
|
|
|
|
|
|
{
|
2025-09-07 00:06:52 +00:00
|
|
|
|
return ES3.KeyExists(SAVE_KEY, new ES3Settings()
|
|
|
|
|
|
{
|
|
|
|
|
|
encryptionType = ES3.EncryptionType.AES,
|
|
|
|
|
|
encryptionPassword = "MyStrongPassword123" // 원하는 암호
|
|
|
|
|
|
});
|
2025-08-27 21:08:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-04 05:05:15 +00:00
|
|
|
|
public void Set_Mission(bool add)
|
|
|
|
|
|
{
|
2025-09-07 21:21:01 +00:00
|
|
|
|
if (add) saveData.MissionAddRate += 0.03f;
|
2025-09-04 05:05:15 +00:00
|
|
|
|
else saveData.MissionAddRate = 0f;
|
|
|
|
|
|
SaveDatas();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-27 21:08:17 +00:00
|
|
|
|
public void AddGold(long amount, string objectName)
|
|
|
|
|
|
{
|
2025-09-18 04:37:50 +00:00
|
|
|
|
if (saveData.Gold < 0)
|
|
|
|
|
|
saveData.Gold = amount;
|
|
|
|
|
|
else
|
|
|
|
|
|
saveData.Gold += amount;
|
2025-08-27 21:08:17 +00:00
|
|
|
|
|
|
|
|
|
|
//GameManager.Flamingo.Flamingo.ChangeAssetAmount("Gold", "Gold", amount, saveData.Gold, GameManager.Account.GetUserID(), GameManager.Account.GetUserEmail(), objectName, objectName, "");
|
|
|
|
|
|
GameManager.Event.InvokeEvent(EEventType.OnSynchronizeGold);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void MinGold(long min, string objectName)
|
|
|
|
|
|
{
|
|
|
|
|
|
saveData.Gold -= min;
|
|
|
|
|
|
|
2025-09-18 04:37:50 +00:00
|
|
|
|
if (saveData.Gold < 0)
|
|
|
|
|
|
saveData.Gold = 0;
|
|
|
|
|
|
|
2025-08-27 21:08:17 +00:00
|
|
|
|
//GameManager.Flamingo.Flamingo.ChangeAssetAmount("Gold", "Gold", min, saveData.Gold, GameManager.Account.GetUserID(), GameManager.Account.GetUserEmail(), objectName, objectName, "");
|
|
|
|
|
|
GameManager.Event.InvokeEvent(EEventType.OnSynchronizeGold);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public bool AddNormalGameProgress(long goldAmount)
|
|
|
|
|
|
{
|
|
|
|
|
|
saveData.NormalGame_GetGold += goldAmount;
|
|
|
|
|
|
|
|
|
|
|
|
if (GetRemainigNormalGameAIGold() <= 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
NormalGameWin();
|
|
|
|
|
|
GameManager.Event.InvokeEvent(EEventType.OnSynchronizeNormalGameData);
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
GameManager.Event.InvokeEvent(EEventType.OnSynchronizeNormalGameData);
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void SubGold(long amount, string objectName)
|
|
|
|
|
|
{
|
|
|
|
|
|
saveData.Gold -= amount;
|
|
|
|
|
|
|
|
|
|
|
|
if (saveData.Gold < 0)
|
|
|
|
|
|
saveData.Gold = 0;
|
|
|
|
|
|
|
|
|
|
|
|
//GameManager.Flamingo.Flamingo.ChangeAssetAmount("Gold", "Gold", amount, saveData.Gold, GameManager.Account.GetUserID(), GameManager.Account.GetUserEmail(), objectName, objectName, "");
|
|
|
|
|
|
GameManager.Event.InvokeEvent(EEventType.OnSynchronizeGold);
|
|
|
|
|
|
}
|
|
|
|
|
|
public void SubNormalGameGetGold(long goldAmount)
|
|
|
|
|
|
{
|
|
|
|
|
|
saveData.NormalGame_GetGold -= goldAmount;
|
|
|
|
|
|
|
|
|
|
|
|
if (saveData.NormalGame_GetGold < 0)
|
|
|
|
|
|
saveData.NormalGame_GetGold = 0;
|
|
|
|
|
|
|
|
|
|
|
|
GameManager.Event.InvokeEvent(EEventType.OnSynchronizeNormalGameData);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void SubKey(long amount, string objectName)
|
|
|
|
|
|
{
|
|
|
|
|
|
saveData.Key -= amount;
|
|
|
|
|
|
|
|
|
|
|
|
if (saveData.Key < 0)
|
|
|
|
|
|
saveData.Key = 0;
|
|
|
|
|
|
//GameManager.Flamingo.Flamingo.ChangeAssetAmount("Key", "Key", amount, saveData.Key, GameManager.Account.GetUserID(), GameManager.Account.GetUserEmail(), objectName, objectName, "");
|
|
|
|
|
|
GameManager.Event.InvokeEvent(EEventType.OnSynchronizeKey);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void AddHeart(long amount, string objectName)
|
|
|
|
|
|
{
|
|
|
|
|
|
saveData.Heart += amount;
|
|
|
|
|
|
|
|
|
|
|
|
//GameManager.Flamingo.Flamingo.ChangeAssetAmount("Heart", "Heart", amount, saveData.Heart, GameManager.Account.GetUserID(), GameManager.Account.GetUserEmail(), objectName, objectName, "");
|
|
|
|
|
|
GameManager.Event.InvokeEvent(EEventType.OnSynchronizeHeart);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void SubHeart(long amount, string objectName)
|
|
|
|
|
|
{
|
|
|
|
|
|
saveData.Heart -= amount;
|
|
|
|
|
|
|
|
|
|
|
|
if (saveData.Heart < 0)
|
|
|
|
|
|
saveData.Heart = 0;
|
|
|
|
|
|
|
|
|
|
|
|
//GameManager.Flamingo.Flamingo.ChangeAssetAmount("Heart", "Heart", amount, saveData.Heart, GameManager.Account.GetUserID(), GameManager.Account.GetUserEmail(), objectName, objectName, "");
|
|
|
|
|
|
GameManager.Event.InvokeEvent(EEventType.OnSynchronizeHeart);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void AddKey(long amount, string objectName)
|
|
|
|
|
|
{
|
|
|
|
|
|
saveData.Key += amount;
|
|
|
|
|
|
|
|
|
|
|
|
//GameManager.Flamingo.Flamingo.ChangeAssetAmount("Key", "Key", amount, saveData.Key, GameManager.Account.GetUserID(), GameManager.Account.GetUserEmail(), objectName, objectName, "");
|
|
|
|
|
|
GameManager.Event.InvokeEvent(EEventType.OnSynchronizeKey);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-29 13:01:17 +00:00
|
|
|
|
public void UnlockLastAIImage(bool left)
|
2025-08-27 21:08:17 +00:00
|
|
|
|
{
|
2025-08-29 13:01:17 +00:00
|
|
|
|
if (IsAllUnlocked(left))
|
2025-08-27 21:08:17 +00:00
|
|
|
|
return;
|
|
|
|
|
|
|
2025-08-29 13:01:17 +00:00
|
|
|
|
var lst = left ? saveData.ImageOpenStates_Left : saveData.ImageOpenStates_Right;
|
|
|
|
|
|
for (int i = 0; i < lst.Length; i++)
|
2025-08-27 21:08:17 +00:00
|
|
|
|
{
|
2025-08-29 13:01:17 +00:00
|
|
|
|
if (lst[i] == false)
|
2025-08-27 21:08:17 +00:00
|
|
|
|
{
|
2025-08-29 13:01:17 +00:00
|
|
|
|
lst[i] = true;
|
2025-08-27 21:08:17 +00:00
|
|
|
|
GameManager.Event.InvokeEvent(EEventType.OnSynchronizeAIChllengeModeAIData);
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-10 23:56:13 +00:00
|
|
|
|
if (left) ++saveData.NormalGameLevel;
|
|
|
|
|
|
|
2025-09-06 05:39:03 +00:00
|
|
|
|
//FirebaseAnalytics.LogEvent("UnlockHunting_" + GameManager.DB.GetUnlockTargetIndex(left).ToString(), new Firebase.Analytics.Parameter("Unlock", GameManager.DB.GetUnlockTargetIndex(left)));
|
2025-08-27 21:08:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-29 13:01:17 +00:00
|
|
|
|
public bool IsAllUnlocked(bool left)
|
2025-08-27 21:08:17 +00:00
|
|
|
|
{
|
2025-08-29 13:01:17 +00:00
|
|
|
|
if (left) return saveData.ImageOpenStates_Left[saveData.ImageOpenStates_Left.Length - 1];
|
|
|
|
|
|
else return saveData.ImageOpenStates_Right[saveData.ImageOpenStates_Right.Length - 1];
|
2025-08-27 21:08:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-29 13:01:17 +00:00
|
|
|
|
public int GetUnlockTargetIndex(bool left)
|
2025-08-27 21:08:17 +00:00
|
|
|
|
{
|
2025-08-29 13:01:17 +00:00
|
|
|
|
if (IsAllUnlocked(left))
|
|
|
|
|
|
return left ? saveData.ImageOpenStates_Left.Length - 1 : saveData.ImageOpenStates_Right.Length - 1;
|
2025-08-27 21:08:17 +00:00
|
|
|
|
|
2025-08-29 13:01:17 +00:00
|
|
|
|
var lst = left ? saveData.ImageOpenStates_Left : saveData.ImageOpenStates_Right;
|
|
|
|
|
|
for (int i = 0; i < lst.Length; i++)
|
2025-08-27 21:08:17 +00:00
|
|
|
|
{
|
2025-08-29 13:01:17 +00:00
|
|
|
|
if (lst[i] == false)
|
2025-08-27 21:08:17 +00:00
|
|
|
|
return i;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-29 13:01:17 +00:00
|
|
|
|
return saveData.ImageOpenStates_Left.Length - 1;
|
2025-08-27 21:08:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-17 22:16:44 +00:00
|
|
|
|
public bool CanBuyHeartImage(int group)
|
|
|
|
|
|
{
|
|
|
|
|
|
return saveData.HeartImageOpen[group] == false;
|
|
|
|
|
|
}
|
|
|
|
|
|
public void UnlockHeartImage(int group)
|
|
|
|
|
|
{
|
|
|
|
|
|
saveData.HeartImageOpen[group] = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-27 21:08:17 +00:00
|
|
|
|
public int GetUnlockHuntingCount()
|
|
|
|
|
|
{
|
2025-08-29 13:01:17 +00:00
|
|
|
|
for (int i = 0; i < saveData.ImageOpenStates_Left.Length; i++)
|
2025-08-27 21:08:17 +00:00
|
|
|
|
{
|
2025-08-29 13:01:17 +00:00
|
|
|
|
if (saveData.ImageOpenStates_Left[i] == false)
|
2025-08-27 21:08:17 +00:00
|
|
|
|
return i;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-29 13:01:17 +00:00
|
|
|
|
return saveData.ImageOpenStates_Left.Length;
|
2025-08-27 21:08:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int GetHuntingListLength()
|
|
|
|
|
|
{
|
2025-08-29 13:01:17 +00:00
|
|
|
|
return saveData.ImageOpenStates_Left.Length;
|
2025-08-27 21:08:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int LastClearedIndex()
|
|
|
|
|
|
{
|
2025-08-29 13:01:17 +00:00
|
|
|
|
if (saveData.ImageOpenStates_Left[0] == false)
|
2025-08-27 21:08:17 +00:00
|
|
|
|
return 0;
|
|
|
|
|
|
|
2025-08-29 13:01:17 +00:00
|
|
|
|
for (int i = 0; i < saveData.ImageOpenStates_Left.Length; i++)
|
2025-08-27 21:08:17 +00:00
|
|
|
|
{
|
2025-08-29 13:01:17 +00:00
|
|
|
|
if (saveData.ImageOpenStates_Left[i] == false)
|
2025-08-27 21:08:17 +00:00
|
|
|
|
return i - 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-29 13:01:17 +00:00
|
|
|
|
return saveData.ImageOpenStates_Left.Length - 1;
|
2025-08-27 21:08:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-29 13:01:17 +00:00
|
|
|
|
public long GetUnlockTargetProgress(bool left)
|
2025-08-27 21:08:17 +00:00
|
|
|
|
{
|
2025-08-29 13:01:17 +00:00
|
|
|
|
return saveData.UnlockProgress[GetUnlockTargetIndex(left)];
|
2025-08-27 21:08:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public HuntingData GetHuntingData(int index)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (index < 0)
|
|
|
|
|
|
return _lstHuntindData[0];
|
|
|
|
|
|
else if (index >= _lstHuntindData.Count)
|
|
|
|
|
|
return _lstHuntindData[_lstHuntindData.Count - 1];
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
return _lstHuntindData[index];
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-09-06 00:34:59 +00:00
|
|
|
|
public List<HuntingData> Get_HuntingDatas(int type)
|
|
|
|
|
|
{
|
|
|
|
|
|
return _lstHuntindData.FindAll(f => f.n_AlbumType == type);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-01 21:23:38 +00:00
|
|
|
|
public List<HuntingUIData> Get_AlbumDatas()
|
|
|
|
|
|
{
|
|
|
|
|
|
var rtn = new List<HuntingUIData>();
|
|
|
|
|
|
var lst = _lstHuntindData;
|
|
|
|
|
|
for (int i = 0; i < lst.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
rtn.Add(new HuntingUIData { m_Left = lst[i], m_Right = lst[i + 1] });
|
|
|
|
|
|
++i;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return rtn;
|
|
|
|
|
|
}
|
2025-08-29 13:01:17 +00:00
|
|
|
|
public List<HuntingUIData> Get_AlbumDatas(int type)
|
2025-08-29 00:59:06 +00:00
|
|
|
|
{
|
2025-08-29 13:01:17 +00:00
|
|
|
|
var rtn = new List<HuntingUIData>();
|
|
|
|
|
|
var lst = _lstHuntindData.FindAll(f => f.n_AlbumType == type);
|
|
|
|
|
|
for (int i = 0; i < lst.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
rtn.Add(new HuntingUIData { m_Left = lst[i], m_Right = lst[i + 1] });
|
|
|
|
|
|
++i;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return rtn;
|
2025-08-29 00:59:06 +00:00
|
|
|
|
}
|
2025-08-27 21:08:17 +00:00
|
|
|
|
|
2025-08-29 13:01:17 +00:00
|
|
|
|
public bool AddCurrentChallengeCondition(long amount, bool left)
|
2025-08-27 21:08:17 +00:00
|
|
|
|
{
|
2025-08-29 13:01:17 +00:00
|
|
|
|
int targetIndex = GetUnlockTargetIndex(left);
|
2025-08-27 21:08:17 +00:00
|
|
|
|
saveData.UnlockProgress[targetIndex] += amount;
|
|
|
|
|
|
|
2025-08-29 13:01:17 +00:00
|
|
|
|
if (saveData.ImageOpenStates_Left[targetIndex] == false)
|
2025-08-27 21:08:17 +00:00
|
|
|
|
{
|
|
|
|
|
|
if (saveData.UnlockProgress[targetIndex] >= _lstHuntindData[targetIndex].ClearConditionMoney)
|
|
|
|
|
|
{
|
|
|
|
|
|
saveData.UnlockProgress[targetIndex] = _lstHuntindData[targetIndex].ClearConditionMoney;
|
2025-08-29 13:01:17 +00:00
|
|
|
|
this.UnlockLastAIImage(left);
|
2025-08-27 21:08:17 +00:00
|
|
|
|
GameManager.Event.InvokeEvent(EEventType.OnSynchronizeAIChllengeModeAIData);
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
GameManager.Event.InvokeEvent(EEventType.OnSynchronizeAIChllengeModeAIData);
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
GameManager.Event.InvokeEvent(EEventType.OnSynchronizeAIChllengeModeAIData);
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-29 13:01:17 +00:00
|
|
|
|
public long GetReaminingTargetCondition(bool left)
|
2025-08-27 21:08:17 +00:00
|
|
|
|
{
|
2025-08-29 13:01:17 +00:00
|
|
|
|
int index = GetUnlockTargetIndex(left);
|
2025-08-27 21:08:17 +00:00
|
|
|
|
long result = _lstHuntindData[index].ClearConditionMoney - saveData.UnlockProgress[index];
|
|
|
|
|
|
|
|
|
|
|
|
if (result < 0)
|
|
|
|
|
|
result = 0;
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public string GetReaminingTargetConditionString(int index)
|
|
|
|
|
|
{
|
|
|
|
|
|
long result = _lstHuntindData[index].ClearConditionMoney - saveData.UnlockProgress[index];
|
|
|
|
|
|
return result <= 0 ? "" : CodeJay.CodeJayUtility.Converter.MoneyToString(result);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int GetHuntingDataLength() => _lstHuntindData.Count;
|
|
|
|
|
|
public long GetRemainigNormalGameAIGold()
|
|
|
|
|
|
{
|
2025-09-10 02:28:59 +00:00
|
|
|
|
//long result = (saveData.NormalGameLevel * NORMAL_GAME_CONDITION_PER_LEVEL) - saveData.NormalGame_GetGold;
|
|
|
|
|
|
var data = DB_HuntingData.GetEntity(GameManager.DB.GetUnlockTargetIndex(true) << 1);
|
|
|
|
|
|
long result = data.DBF_ClearConditionMoney - saveData.NormalGame_GetGold;
|
2025-08-27 21:08:17 +00:00
|
|
|
|
if (result < 0)
|
|
|
|
|
|
result = 0;
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void NormalGameWin()
|
|
|
|
|
|
{
|
2025-08-29 13:01:17 +00:00
|
|
|
|
//if (GameManager.DB.GetUnlockTargetIndex() <= 5)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// //GameManager.Flamingo.Flamingo.FinishTutorial(GameManager.DB.NormalGameLevel.ToString(), "Level" + GameManager.DB.NormalGameLevel.ToString(), "Normal");
|
|
|
|
|
|
//}
|
2025-08-27 21:08:17 +00:00
|
|
|
|
|
|
|
|
|
|
if (GamePanel.Instance.IsChallengeMode == false)
|
|
|
|
|
|
{
|
2025-09-06 05:39:03 +00:00
|
|
|
|
//FirebaseAnalytics.LogEvent("NormalLevel_" + GameManager.DB.NormalGameLevel.ToString());
|
2025-08-27 21:08:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
saveData.NormalGame_GetGold = 0;
|
2025-08-31 20:41:31 +00:00
|
|
|
|
UnlockLastAIImage(true);
|
2025-09-10 23:56:13 +00:00
|
|
|
|
SaveDatas();
|
2025-08-31 20:41:31 +00:00
|
|
|
|
GameManager.UI.ShowNStackPopup(EPopupType.AlbumOpenPopup);
|
2025-08-27 21:08:17 +00:00
|
|
|
|
GameManager.Event.InvokeEvent(EEventType.OnSynchronizeNormalGameData);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>if AI won</summary>
|
|
|
|
|
|
public void AddGoldToAI(bool isChallengeMode, long amount)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (isChallengeMode)
|
|
|
|
|
|
{
|
2025-08-29 13:01:17 +00:00
|
|
|
|
int index = this.GetUnlockTargetIndex(true);
|
2025-08-27 21:08:17 +00:00
|
|
|
|
saveData.UnlockProgress[index] -= amount;
|
|
|
|
|
|
|
|
|
|
|
|
if (saveData.UnlockProgress[index] < 0)
|
|
|
|
|
|
saveData.UnlockProgress[index] = 0;
|
|
|
|
|
|
|
|
|
|
|
|
GameManager.Event.InvokeEvent(EEventType.OnSynchronizeAIChllengeModeAIData);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
saveData.NormalGame_GetGold -= amount;
|
|
|
|
|
|
if (saveData.NormalGame_GetGold < 0)
|
|
|
|
|
|
saveData.NormalGame_GetGold = 0;
|
|
|
|
|
|
|
|
|
|
|
|
GameManager.Event.InvokeEvent(EEventType.OnSynchronizeNormalGameData);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void DonwloadUnlockDataCount(int count)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (saveData != null)
|
|
|
|
|
|
{
|
2025-08-29 13:01:17 +00:00
|
|
|
|
for (int i = 0; i < saveData.ImageOpenStates_Left.Length; i++)
|
2025-08-27 21:08:17 +00:00
|
|
|
|
{
|
|
|
|
|
|
if (i < count)
|
|
|
|
|
|
{
|
2025-08-29 13:01:17 +00:00
|
|
|
|
saveData.ImageOpenStates_Left[i] = true;
|
2025-08-27 21:08:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2025-08-29 13:01:17 +00:00
|
|
|
|
saveData.ImageOpenStates_Left[i] = false;
|
2025-08-27 21:08:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
SaveDatas();
|
|
|
|
|
|
|
|
|
|
|
|
GameManager.Event.InvokeEvent(EEventType.OnSynchronizeAIChllengeModeAIData);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void DonwloadGoldData(long count)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (saveData != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
saveData.Gold = count;
|
|
|
|
|
|
SaveDatas();
|
|
|
|
|
|
|
|
|
|
|
|
GameManager.Event.InvokeEvent(EEventType.OnSynchronizeGold);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void DonwloadHeartData(long count)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (saveData != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
saveData.Heart = count;
|
|
|
|
|
|
SaveDatas();
|
|
|
|
|
|
|
|
|
|
|
|
GameManager.Event.InvokeEvent(EEventType.OnSynchronizeHeart);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void DonwloadKeyData(long count)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (saveData != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
saveData.Key = count;
|
|
|
|
|
|
SaveDatas();
|
|
|
|
|
|
|
|
|
|
|
|
GameManager.Event.InvokeEvent(EEventType.OnSynchronizeKey);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void DonwloadBuyKeyCountData(long count)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (saveData != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
saveData.BuyKeyCount = count;
|
|
|
|
|
|
SaveDatas();
|
|
|
|
|
|
|
|
|
|
|
|
GameManager.Event.InvokeEvent(EEventType.OnSynchronizeKey);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void DownloadLevel(int count)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (saveData != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
saveData.NormalGameLevel = count;
|
|
|
|
|
|
SaveDatas();
|
|
|
|
|
|
|
|
|
|
|
|
GameManager.Event.InvokeEvent(EEventType.OnSynchronizeNormalGameData);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void DownloadIsRemoveADS(bool isRemoveADS)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (saveData != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
saveData.IsRemoveADS = isRemoveADS;
|
|
|
|
|
|
SaveDatas();
|
|
|
|
|
|
|
|
|
|
|
|
// 사실 이 코드는 옳은 코드는 아니다.
|
|
|
|
|
|
GameManager.ADS.HideBanner();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void DownloadBuyShopAccumulatedMoney(long money)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (saveData != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
saveData.BuyShopAccumulatedMoney = money;
|
|
|
|
|
|
SaveDatas();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void AddBuyKeyCount(int add)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (saveData != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
saveData.BuyKeyCount += add;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void ResetADSRewardActionCount()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (saveData != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
saveData.ProductAdWatchedNumber = Constants.ADS_REWARD_COUNT;
|
2025-09-10 05:35:36 +00:00
|
|
|
|
saveData.ShopADDia = Constants.ADS_REWARD_COUNT;
|
2025-08-27 21:08:17 +00:00
|
|
|
|
OnResetADSRewardActionCountEvent?.Invoke();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int MinProductAdWatchedNumber(int min)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (saveData != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
saveData.ProductAdWatchedNumber -= min;
|
2025-09-05 13:22:04 +00:00
|
|
|
|
if (saveData.ProductAdWatchedNumber < 0)
|
|
|
|
|
|
saveData.ProductAdWatchedNumber = 0;
|
|
|
|
|
|
if (saveData.ProductAdWatchedNumber == 0)
|
|
|
|
|
|
saveData.ProductAdWatchedTime = InternetTime.Ins.Time.AddHours(1);
|
2025-08-27 21:08:17 +00:00
|
|
|
|
SaveDatas();
|
|
|
|
|
|
|
|
|
|
|
|
return saveData.ProductAdWatchedNumber;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
2025-09-05 13:22:04 +00:00
|
|
|
|
public void ProductAdWatchedNumber_Plus()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (saveData != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
saveData.ProductAdWatchedNumber = 1;
|
|
|
|
|
|
SaveDatas();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-08-27 21:08:17 +00:00
|
|
|
|
|
2025-09-10 05:35:36 +00:00
|
|
|
|
public int MinProductAdDia(int min)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (saveData != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
saveData.ShopADDia -= min;
|
|
|
|
|
|
if (saveData.ShopADDia < 0)
|
|
|
|
|
|
saveData.ShopADDia = 0;
|
|
|
|
|
|
if (saveData.ShopADDia == 0)
|
|
|
|
|
|
saveData.ShopADDiaTime = InternetTime.Ins.Time.AddHours(1);
|
|
|
|
|
|
SaveDatas();
|
|
|
|
|
|
|
|
|
|
|
|
return saveData.ShopADDia;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
public void ProductAdDia_Plus()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (saveData != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
saveData.ShopADDia = 1;
|
|
|
|
|
|
SaveDatas();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-27 21:08:17 +00:00
|
|
|
|
public void ResetFreeHeartCount()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (saveData != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
saveData.FreeHeartCount = Constants.FREE_HEART_DAY;
|
|
|
|
|
|
OnResetFreeHeartCountEvent?.Invoke();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int MinFreeHeartCount(int min)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (saveData != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
saveData.FreeHeartCount -= min;
|
|
|
|
|
|
SaveDatas();
|
|
|
|
|
|
|
|
|
|
|
|
return saveData.FreeHeartCount;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-31 07:14:15 +00:00
|
|
|
|
public void ResetFreeKeyCount()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (saveData != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
saveData.FreeKeyCount = Constants.FREE_HEART_DAY;
|
|
|
|
|
|
OnResetFreeKeyCountEvent?.Invoke();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int MinFreeKeyCount(int min)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (saveData != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
saveData.FreeKeyCount -= min;
|
|
|
|
|
|
SaveDatas();
|
|
|
|
|
|
|
|
|
|
|
|
return saveData.FreeKeyCount;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-27 21:08:17 +00:00
|
|
|
|
public int MinInterstitialADCount(int min)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (saveData != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
saveData.InterstitialADCount -= min;
|
|
|
|
|
|
SaveDatas();
|
|
|
|
|
|
|
|
|
|
|
|
return saveData.InterstitialADCount;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void ResetInterstitialADCount()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (saveData != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
saveData.InterstitialADCount = CodeJay.Defines.Constants.INTERSTITIAL_AD_CYCLE;
|
|
|
|
|
|
SaveDatas();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void RemoveADS()
|
|
|
|
|
|
{
|
|
|
|
|
|
if(saveData != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
saveData.IsRemoveADS = true;
|
|
|
|
|
|
SaveDatas();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void AddBuyShopAccumulatedMoney(int money)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(saveData != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
saveData.BuyShopAccumulatedMoney += money;
|
|
|
|
|
|
SaveDatas();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-07 21:21:01 +00:00
|
|
|
|
public void Set_Month(int month)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (saveData != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
saveData.Month = month;
|
|
|
|
|
|
SaveDatas();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
public void ResetTotalCashPerMonth()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (saveData != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
saveData.TotalCashPerMonth = 0;
|
|
|
|
|
|
SaveDatas();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
public void AddTotalCashPerMonth(int cash)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (saveData != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
saveData.TotalCashPerMonth += cash;
|
2025-09-10 08:04:42 +00:00
|
|
|
|
GameManager.Event.InvokeEvent(EEventType.OnSynchronizeKey);
|
2025-09-07 21:21:01 +00:00
|
|
|
|
SaveDatas();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-27 21:08:17 +00:00
|
|
|
|
public void CheckDayReset()
|
|
|
|
|
|
{
|
|
|
|
|
|
if(DayResetCoroutine != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-05 07:20:45 +00:00
|
|
|
|
DateTime now = InternetTime.Ins.Time;
|
2025-08-27 21:08:17 +00:00
|
|
|
|
DateTime midnightToday = DateTime.Today.AddDays(1).AddTicks(-1);
|
|
|
|
|
|
if (now.Hour == 23 && now.Minute >= 30)
|
|
|
|
|
|
{
|
|
|
|
|
|
float Minute = midnightToday.Minute - now.Minute;
|
|
|
|
|
|
DayResetCoroutine = StartCoroutine(DayRest(Minute * 60));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private IEnumerator DayRest(float delayInSeconds)
|
|
|
|
|
|
{
|
|
|
|
|
|
yield return null;
|
|
|
|
|
|
yield return new WaitForSecondsRealtime(delayInSeconds);
|
|
|
|
|
|
|
|
|
|
|
|
ResetADSRewardActionCount();
|
|
|
|
|
|
ResetFreeHeartCount();
|
2025-09-07 21:21:01 +00:00
|
|
|
|
ResetFreeKeyCount();
|
|
|
|
|
|
|
|
|
|
|
|
if (GameManager.DB.Get_SaveData().Month != InternetTime.Ins.Time.Month)
|
|
|
|
|
|
{
|
|
|
|
|
|
GameManager.DB.Set_Month(InternetTime.Ins.Time.Month);
|
|
|
|
|
|
GameManager.DB.ResetTotalCashPerMonth();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-27 21:08:17 +00:00
|
|
|
|
DayResetCoroutine = null;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|