|
@@ -31,24 +31,24 @@ public class GardenLabel
|
|
|
public static string GardenRightTree = "GardenRightTree";
|
|
|
public static string GardenRainbow = "GardenRainbow";
|
|
|
|
|
|
- public static string GardenMini = "GardenMini";
|
|
|
- public static string SlotPage = "GardenPage";
|
|
|
- public static string GardenNormal = "GardenNormal";
|
|
|
- public static string PlayerPosTra = "PlayerPosTra";
|
|
|
-
|
|
|
- public static string MiniLeft = "MiniLeft";
|
|
|
- public static string MiniRight1 = "MiniRight1";
|
|
|
- public static string MiniRight2 = "MiniRight2";
|
|
|
-
|
|
|
- public static string SlotMini1 = "SlotMini1";
|
|
|
- public static string SlotMini2 = "SlotMini2";
|
|
|
- public static string SlotMini3 = "SlotMini3";
|
|
|
- public static string SlotMini4 = "SlotMini4";
|
|
|
- public static string SlotMini5 = "SlotMini5";
|
|
|
- public static string SlotMini6 = "SlotMini6";
|
|
|
- public static string SlotMini7 = "SlotMini7";
|
|
|
- public static string SlotMini8 = "SlotMini8";
|
|
|
- public static string SlotMini9 = "SlotMini9";
|
|
|
+ public static string Minigame = "Minigame";
|
|
|
+ public static string SlotPage = "SlotPage";
|
|
|
+ public static string GardenPivot = "GardenPivot";
|
|
|
+ public static string GardenPlayerPos = "GardenPlayerPos";
|
|
|
+
|
|
|
+ public static string Minigame_DropAward_LeftBorder = "Minigame_DropAward_LeftBorder";
|
|
|
+ public static string FindMinigame_DropAward_RightBorder = "FindMinigame_DropAward_RightBorder";
|
|
|
+ public static string MemoryMinigame_DropAward_RightBorder = "MemoryMinigame_DropAward_RightBorder";
|
|
|
+
|
|
|
+ public static string MinigameSlot1 = "MinigameSlot1";
|
|
|
+ public static string MinigameSlot2 = "MinigameSlot2";
|
|
|
+ public static string MinigameSlot3 = "MinigameSlot3";
|
|
|
+ public static string MinigameSlot4 = "MinigameSlot4";
|
|
|
+ public static string MinigameSlot5 = "MinigameSlot5";
|
|
|
+ public static string MinigameSlot6 = "MinigameSlot6";
|
|
|
+ public static string MinigameSlot7 = "MinigameSlot7";
|
|
|
+ public static string MinigameSlot8 = "MinigameSlot8";
|
|
|
+ public static string MinigameSlot9 = "MinigameSlot9";
|
|
|
}
|
|
|
|
|
|
public enum ElfType
|
|
@@ -79,33 +79,36 @@ public class GardenManager : Regist
|
|
|
{
|
|
|
#region Config
|
|
|
|
|
|
- public static int Slot
|
|
|
+ public static int TotalSlot
|
|
|
{
|
|
|
- get { return Slot_; }
|
|
|
+ get { return totalSlot; }
|
|
|
set
|
|
|
{
|
|
|
- Slot_ = value;
|
|
|
+ totalSlot = value;
|
|
|
|
|
|
- ResourceManager.SetText(ObjectLabel.G_CollectLab2, string.Format("{0}/{1}", Slot_, Page * TotalSlotAmtInOnePage));
|
|
|
+ ResourceManager.SetText(ObjectLabel.G_CollectLab2, string.Format("{0}/{1}", totalSlot, TotalSlotPage * TotalSlotInOnePage));
|
|
|
}
|
|
|
}
|
|
|
- public static int Page
|
|
|
+ public static int totalSlot;
|
|
|
+
|
|
|
+ public static int TotalSlotPage
|
|
|
{
|
|
|
- get { return PageList.Count; }
|
|
|
+ get { return SlotPageList.Count; }
|
|
|
}
|
|
|
- public static int MyFlower
|
|
|
+
|
|
|
+ public static int TotalUnlockFlower
|
|
|
{
|
|
|
- get { return MyFlower_; }
|
|
|
+ get { return totalUnlockFlower; }
|
|
|
set
|
|
|
{
|
|
|
- MyFlower_ = value;
|
|
|
+ totalUnlockFlower = value;
|
|
|
|
|
|
- AchieveManager.UpdateStatus(AchieveType.FlowerAmt, MyFlower_);
|
|
|
+ AchieveManager.UpdateStatus(AchieveType.UnlockFlowerAmt, totalUnlockFlower);
|
|
|
|
|
|
- ResourceManager.SetText(ObjectLabel.F_FlowerLab, string.Format("{0}", MyFlower));
|
|
|
- ResourceManager.SetText(ObjectLabel.G_CollectLab1, string.Format("{0}/{1}", MyFlower, TotalFlower));
|
|
|
+ ResourceManager.SetText(ObjectLabel.F_FlowerLab, string.Format("{0}", TotalUnlockFlower));
|
|
|
+ ResourceManager.SetText(ObjectLabel.G_CollectLab1, string.Format("{0}/{1}", TotalUnlockFlower, TotalFlower));
|
|
|
|
|
|
- if (MyFlower_ >= TutorialManager.MinFlowerForFindGame && Manager.Level >= TutorialManager.FindMinigameTutorialLevel)
|
|
|
+ if (totalUnlockFlower >= TutorialManager.MinFlowerForFindGame && Manager.GardenLevel >= TutorialManager.FindMinigameTutorialLevel)
|
|
|
{
|
|
|
if (TutorialManager.findMinigameTutorial)
|
|
|
{
|
|
@@ -114,60 +117,64 @@ public class GardenManager : Regist
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- public static int MyFlowerSpec
|
|
|
+ private static int totalUnlockFlower;
|
|
|
+
|
|
|
+ public static int TotalUnlockSpecialFlower
|
|
|
{
|
|
|
- get { return MyFlowerSpec_; }
|
|
|
+ get { return totalUnlockSpecialFlower; }
|
|
|
set
|
|
|
{
|
|
|
- MyFlowerSpec_ = value;
|
|
|
+ totalUnlockSpecialFlower = value;
|
|
|
|
|
|
- MyFlower = MyFlowerSpec_ + MyFlowerRegu_;
|
|
|
+ TotalUnlockFlower = totalUnlockSpecialFlower + totalUnlockNormalFlower;
|
|
|
}
|
|
|
}
|
|
|
- public static int MyFlowerRegu
|
|
|
+ private static int totalUnlockSpecialFlower;
|
|
|
+
|
|
|
+ public static int TotalUnlockNormalFlower
|
|
|
{
|
|
|
- get { return MyFlowerRegu_; }
|
|
|
+ get { return totalUnlockNormalFlower; }
|
|
|
set
|
|
|
{
|
|
|
- MyFlowerRegu_ = value;
|
|
|
+ totalUnlockNormalFlower = value;
|
|
|
|
|
|
- MyFlower = MyFlowerSpec_ + MyFlowerRegu_;
|
|
|
+ TotalUnlockFlower = totalUnlockSpecialFlower + totalUnlockNormalFlower;
|
|
|
}
|
|
|
}
|
|
|
- public static int TotalFlowerSpec
|
|
|
+ private static int totalUnlockNormalFlower;
|
|
|
+
|
|
|
+ public static int TotalFlower;
|
|
|
+
|
|
|
+ public static int TotalSpecialFlower
|
|
|
{
|
|
|
- get { return TotalFlowerSpec_; }
|
|
|
+ get { return totalSpecialFlower; }
|
|
|
set
|
|
|
{
|
|
|
- TotalFlowerSpec_ = value;
|
|
|
+ totalSpecialFlower = value;
|
|
|
|
|
|
- TotalFlower = TotalFlowerSpec_ + TotalFlowerRegu_;
|
|
|
+ TotalFlower = totalSpecialFlower + totalNormalFlower;
|
|
|
}
|
|
|
}
|
|
|
- public static int TotalFlowerRegu
|
|
|
+ private static int totalSpecialFlower;
|
|
|
+
|
|
|
+ public static int TotalNormalFlower
|
|
|
{
|
|
|
- get { return TotalFlowerRegu_; }
|
|
|
+ get { return totalNormalFlower; }
|
|
|
set
|
|
|
{
|
|
|
- TotalFlowerRegu_ = value;
|
|
|
+ totalNormalFlower = value;
|
|
|
|
|
|
- TotalFlower = TotalFlowerSpec_ + TotalFlowerRegu_;
|
|
|
+ TotalFlower = totalSpecialFlower + totalNormalFlower;
|
|
|
}
|
|
|
}
|
|
|
+ private static int totalNormalFlower;
|
|
|
|
|
|
- public static int Slot_;
|
|
|
- public static int DefaultSlot = 1;
|
|
|
- private static int MyFlower_;
|
|
|
- private static int MyFlowerSpec_;
|
|
|
- private static int MyFlowerRegu_;
|
|
|
- private static int TotalFlowerSpec_;
|
|
|
- private static int TotalFlowerRegu_;
|
|
|
|
|
|
public static int FirstUnlockFlowerID
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
- foreach (var kv in FlowerInfoDic)
|
|
|
+ foreach (var kv in FlowerInfoDictionary)
|
|
|
{
|
|
|
if (!kv.Value.Unlock)
|
|
|
{
|
|
@@ -184,7 +191,7 @@ public class GardenManager : Regist
|
|
|
{
|
|
|
List<int> unlockedFlowerIDList = new List<int>();
|
|
|
|
|
|
- foreach (var kv in FlowerInfoDic)
|
|
|
+ foreach (var kv in FlowerInfoDictionary)
|
|
|
{
|
|
|
if (kv.Value.Unlock)
|
|
|
{
|
|
@@ -196,30 +203,45 @@ public class GardenManager : Regist
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static int TotalFlower;
|
|
|
- public static bool MiniLock = true;
|
|
|
+ public static int DefaultUnlockSlot = 1;
|
|
|
+ public static bool InMinigameFlag = true;
|
|
|
+
|
|
|
+ public static float MinCreateElfTime = 5;
|
|
|
+ public static float MaxCreateElfTime = 30;
|
|
|
+ public static float CreateElfTimer;
|
|
|
+
|
|
|
+ public static float MinCreateStarTime;
|
|
|
+ public static float MaxCreateStarTime;
|
|
|
+ public static float CreateStarTimer;
|
|
|
|
|
|
- public static float ElfTimer;
|
|
|
- public static float StarTimer;
|
|
|
- public static float AwardTimer;
|
|
|
+ public static float MinCreateAwardTime = 5;
|
|
|
+ public static float MaxCreateAwardTime = 15;
|
|
|
+ public static float CreateAwardTimer;
|
|
|
|
|
|
- public static Button RetrieveButton;
|
|
|
- public static Text RetrieveButtonLab;
|
|
|
- public static Button PurchaseButton;
|
|
|
- public static Text PurchaseButtonLab;
|
|
|
+ public static Text BuyFlowerButtonText;
|
|
|
+ public static Text RetrieveFlowerButtonText;
|
|
|
+ public static Button BuyFlowerButton;
|
|
|
+ public static Button RetrieveFlowerButton;
|
|
|
|
|
|
- public static FlowerInfo SeleInfo;
|
|
|
+ public static FlowerInfo SelectFlowerInfo;
|
|
|
+ public static TweenMatFloat FlowerCardMaterialTween;
|
|
|
public static GardenManager Instance;
|
|
|
|
|
|
public static List<Slot> SlotList = new List<Slot>();
|
|
|
- public static List<Slot> PlantList = new List<Slot>();
|
|
|
+ public static List<Slot> PlantSlotList = new List<Slot>();
|
|
|
public static List<Star> StarList = new List<Star>();
|
|
|
public static List<ElfType> ElfList = new List<ElfType>();
|
|
|
- public static List<Transform> PageList = new List<Transform>();
|
|
|
+ public static List<Transform> SlotPageList = new List<Transform>();
|
|
|
|
|
|
- public static Dictionary<int, FlowerInfo> FlowerInfoDic = new Dictionary<int, FlowerInfo>();
|
|
|
+ public static Dictionary<int, FlowerInfo> FlowerInfoDictionary = new Dictionary<int, FlowerInfo>();
|
|
|
|
|
|
- public static TweenMatFloat FlowerCardMatTween;
|
|
|
+ public static int DefaultSlotPage = 2;
|
|
|
+ public static int CriticalSlotIndex = 7;
|
|
|
+ public static int TotalSlotInOnePage = 9;
|
|
|
+ public static int LeftTopSlotIndex = 0;
|
|
|
+ public static int RightTopSlotIndex = 3;
|
|
|
+ public static int RightDownSlotIndex = 8;
|
|
|
+ public static int LeftDownSlotIndex = 4;
|
|
|
|
|
|
#endregion
|
|
|
|
|
@@ -230,78 +252,71 @@ public class GardenManager : Regist
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- ElfThread();
|
|
|
+ CreateElfThread();
|
|
|
|
|
|
- StarThread();
|
|
|
+ CreateStarThread();
|
|
|
|
|
|
- AwardThread();
|
|
|
+ CreateAwardThread();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- public static float MinElfTime = 5;
|
|
|
- public static float MaxElfTime = 30;
|
|
|
- public void ElfThread()
|
|
|
+ public void CreateElfThread()
|
|
|
{
|
|
|
- if (!MiniLock)
|
|
|
+ if (!InMinigameFlag)
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- ElfTimer -= Time.deltaTime;
|
|
|
+ CreateElfTimer -= Time.deltaTime;
|
|
|
|
|
|
- if (ElfTimer < 0)
|
|
|
+ if (CreateElfTimer < 0)
|
|
|
{
|
|
|
- ElfTimer = Random.Range(MinElfTime, MaxElfTime);
|
|
|
+ CreateElfTimer = Random.Range(MinCreateElfTime, MaxCreateElfTime);
|
|
|
|
|
|
- if (ElfList.Count > 0 && PlantList.Count > 0)
|
|
|
+ if (ElfList.Count > 0 && PlantSlotList.Count > 0)
|
|
|
{
|
|
|
- PlantList.Random()[0].Flower.GetElf(ElfList.Random()[0]);
|
|
|
+ PlantSlotList.Random()[0].PlantFlower.GetElf(ElfList.Random()[0]);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static float MinStarTime;
|
|
|
- public static float MaxStarTime;
|
|
|
- public void StarThread()
|
|
|
+ public void CreateStarThread()
|
|
|
{
|
|
|
- if (MiniLock && !Manager.MiniLock && !VisitManager.InVisit)
|
|
|
+ if (InMinigameFlag && !Manager.MinigameFlag && !VisitManager.InVisit)
|
|
|
{
|
|
|
- StarTimer -= Time.deltaTime;
|
|
|
+ CreateStarTimer -= Time.deltaTime;
|
|
|
|
|
|
- if (StarTimer < 0)
|
|
|
+ if (CreateStarTimer < 0)
|
|
|
{
|
|
|
- StarTimer = Mathf.Lerp(MinStarTime, MaxStarTime, Random.Range(0f, 1f));
|
|
|
+ CreateStarTimer = Mathf.Lerp(MinCreateStarTime, MaxCreateStarTime, Random.Range(0f, 1f));
|
|
|
|
|
|
StarList.Add(ResourceManager.GetStar());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static float MinAwardTime = 5;
|
|
|
- public static float MaxAwardTime = 15;
|
|
|
- public void AwardThread()
|
|
|
+ public void CreateAwardThread()
|
|
|
{
|
|
|
- if (MiniLock)
|
|
|
+ if (InMinigameFlag)
|
|
|
{
|
|
|
- AwardTimer -= Time.deltaTime;
|
|
|
+ CreateAwardTimer -= Time.deltaTime;
|
|
|
|
|
|
- if (AwardTimer <= 0)
|
|
|
+ if (CreateAwardTimer <= 0)
|
|
|
{
|
|
|
- AwardTimer = Random.Range(MinAwardTime, MaxAwardTime);
|
|
|
+ CreateAwardTimer = Random.Range(MinCreateAwardTime, MaxCreateAwardTime);
|
|
|
|
|
|
List<Flower> spareList = new List<Flower>();
|
|
|
|
|
|
- for (int i = 0; i < PlantList.Count; i++)
|
|
|
+ for (int i = 0; i < PlantSlotList.Count; i++)
|
|
|
{
|
|
|
- if (PlantList[i].Flower.Award == false)
|
|
|
+ if (PlantSlotList[i].PlantFlower.HaveAward == false)
|
|
|
{
|
|
|
- spareList.Add(PlantList[i].Flower);
|
|
|
+ spareList.Add(PlantSlotList[i].PlantFlower);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (spareList.Count > 0)
|
|
|
{
|
|
|
- spareList.Random()[0].Award = true;
|
|
|
+ spareList.Random()[0].HaveAward = true;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -312,7 +327,7 @@ public class GardenManager : Regist
|
|
|
{
|
|
|
ResourceManager.Get(ResourceLabel.Garden, Folder.Scene, true, transform, true, ObjType.Garden).AddScript<Garden>();
|
|
|
|
|
|
- for (int i = 0; i < DefaultPage; i++)
|
|
|
+ for (int i = 0; i < DefaultSlotPage; i++)
|
|
|
{
|
|
|
CreatePage();
|
|
|
}
|
|
@@ -325,16 +340,16 @@ public class GardenManager : Regist
|
|
|
{
|
|
|
FlowerInfo flowerInfo = new FlowerInfo(attributeList[i]);
|
|
|
|
|
|
- if (flowerInfo.Special)
|
|
|
+ if (flowerInfo.IsSpecial)
|
|
|
{
|
|
|
- TotalFlowerSpec++;
|
|
|
+ TotalSpecialFlower++;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- TotalFlowerRegu++;
|
|
|
+ TotalNormalFlower++;
|
|
|
}
|
|
|
|
|
|
- FlowerInfoDic.Add(flowerInfo.ID_, flowerInfo);
|
|
|
+ FlowerInfoDictionary.Add(flowerInfo.ID, flowerInfo);
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
@@ -344,8 +359,8 @@ public class GardenManager : Regist
|
|
|
{
|
|
|
Instance = this;
|
|
|
|
|
|
- ElfTimer = Random.Range(MinElfTime, MaxElfTime);
|
|
|
- AwardTimer = Random.Range(MinAwardTime, MaxAwardTime);
|
|
|
+ CreateElfTimer = Random.Range(MinCreateElfTime, MaxCreateElfTime);
|
|
|
+ CreateAwardTimer = Random.Range(MinCreateAwardTime, MaxCreateAwardTime);
|
|
|
|
|
|
UnlockSlot();
|
|
|
for (int i = 0; i < ConfigManager.GetIntFormConfig(PlayerConfigLabel.ExtraSlot); i++)
|
|
@@ -359,7 +374,7 @@ public class GardenManager : Regist
|
|
|
|
|
|
for (int i = 0; i < flowerIDList.Count; i++)
|
|
|
{
|
|
|
- FlowerInfoDic[flowerIDList[i]].Unlock = true;
|
|
|
+ FlowerInfoDictionary[flowerIDList[i]].Unlock = true;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -367,7 +382,7 @@ public class GardenManager : Regist
|
|
|
|
|
|
for (int i = 0; i < flowerAmountList.Count; i++)
|
|
|
{
|
|
|
- FlowerInfoDic[flowerIDList[i]].Amount = flowerAmountList[i];
|
|
|
+ FlowerInfoDictionary[flowerIDList[i]].Amount = flowerAmountList[i];
|
|
|
}
|
|
|
|
|
|
|
|
@@ -383,64 +398,32 @@ public class GardenManager : Regist
|
|
|
|
|
|
public override void RegistReference()
|
|
|
{
|
|
|
- RetrieveButton = ResourceManager.Get<Button>(ObjectLabel.H_Btn);
|
|
|
- RetrieveButtonLab = ResourceManager.Get<Text>(ObjectLabel.H_BtnLab);
|
|
|
- PurchaseButton = ResourceManager.Get<Button>(ObjectLabel.H_Btn1);
|
|
|
- PurchaseButtonLab = ResourceManager.Get<Text>(ObjectLabel.H_BtnLab1);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public static int DefaultPage = 2;
|
|
|
- public static int CriticalSlotAmt = 7;
|
|
|
- public static int TotalSlotAmtInOnePage = 9;
|
|
|
- public static int LeftTopSlotIndex = 0;
|
|
|
- public static int RightTopSlotIndex = 3;
|
|
|
- public static int RightDownSlotIndex = 8;
|
|
|
- public static int LeftDownSlotIndex = 4;
|
|
|
- public static void UnlockSlot()
|
|
|
- {
|
|
|
- for (int i = 0; i < SlotList.Count; i++)
|
|
|
- {
|
|
|
- if (SlotList[i].Lock == false)
|
|
|
- {
|
|
|
- Slot++;
|
|
|
-
|
|
|
- SlotList[i].Lock = true;
|
|
|
- SlotList[i].Available = true;
|
|
|
-
|
|
|
- if (Slot% TotalSlotAmtInOnePage == CriticalSlotAmt)
|
|
|
- {
|
|
|
- if (Slot/ TotalSlotAmtInOnePage + DefaultPage >= Page)
|
|
|
- {
|
|
|
- CreatePage();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
+ RetrieveFlowerButton = ResourceManager.Get<Button>(ObjectLabel.H_Btn);
|
|
|
+ RetrieveFlowerButtonText = ResourceManager.Get<Text>(ObjectLabel.H_BtnLab);
|
|
|
+ BuyFlowerButton = ResourceManager.Get<Button>(ObjectLabel.H_Btn1);
|
|
|
+ BuyFlowerButtonText = ResourceManager.Get<Text>(ObjectLabel.H_BtnLab1);
|
|
|
}
|
|
|
|
|
|
|
|
|
private static float PageXOffset = 18.9f;
|
|
|
public static void CreatePage()
|
|
|
{
|
|
|
- Transform tra = ResourceManager.Get(ResourceLabel.Page, Folder.Scene, false, ResourceManager.Get(GardenLabel.SlotPage), false, ObjType.Page);
|
|
|
+ Transform tra = ResourceManager.Get(ResourceLabel.Page, Folder.Scene, false, ResourceManager.Get(GardenLabel.SlotPage), false, ObjType.SlotPage);
|
|
|
|
|
|
- float offset = Page*PageXOffset;
|
|
|
+ float offset = TotalSlotPage * PageXOffset;
|
|
|
|
|
|
tra.SetLX(offset);
|
|
|
|
|
|
Vector3 pos = ResourceManager.Get(GardenLabel.SlotPage).position;
|
|
|
|
|
|
pos.x = -offset;
|
|
|
-
|
|
|
+
|
|
|
Garden.PagePos.Add(pos);
|
|
|
|
|
|
- for (int i = 0; i < TotalSlotAmtInOnePage; i++)
|
|
|
+ for (int i = 0; i < TotalSlotInOnePage; i++)
|
|
|
{
|
|
|
Slot slot = tra.GetChild(i).GetComponent<Slot>();
|
|
|
-
|
|
|
+
|
|
|
if (slot == null)
|
|
|
{
|
|
|
slot = tra.GetChild(i).AddScript<Slot>();
|
|
@@ -452,69 +435,98 @@ public class GardenManager : Regist
|
|
|
}
|
|
|
|
|
|
|
|
|
- PageList.Add(tra);
|
|
|
+ SlotPageList.Add(tra);
|
|
|
}
|
|
|
|
|
|
- public static void ShowPlantCard(FlowerInfo flowerInfo, Slot seleSlot = null)
|
|
|
+ public static void UnlockSlot()
|
|
|
{
|
|
|
- ShowFlowerCard(flowerInfo, null, seleSlot);
|
|
|
+ for (int i = 0; i < SlotList.Count; i++)
|
|
|
+ {
|
|
|
+ if (SlotList[i].Lock == false)
|
|
|
+ {
|
|
|
+ TotalSlot++;
|
|
|
+
|
|
|
+ SlotList[i].Lock = true;
|
|
|
+ SlotList[i].Available = true;
|
|
|
+
|
|
|
+ if (TotalSlot% TotalSlotInOnePage == CriticalSlotIndex)
|
|
|
+ {
|
|
|
+ if (TotalSlot/ TotalSlotInOnePage + DefaultSlotPage >= TotalSlotPage)
|
|
|
+ {
|
|
|
+ CreatePage();
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- RetrieveButton.SetActive(false);
|
|
|
- PurchaseButton.SetActive(true);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- public static void ShowRetrieveCard(FlowerInfo flowerInfo, Slot seleSlot = null)
|
|
|
+
|
|
|
+ public static void ShowPlantCard(FlowerInfo flowerInfo, Slot seleSlot = null)
|
|
|
{
|
|
|
ShowFlowerCard(flowerInfo, null, seleSlot);
|
|
|
|
|
|
- RetrieveButton.SetActive(true);
|
|
|
- PurchaseButton.SetActive(true);
|
|
|
+ RetrieveFlowerButton.SetActive(false);
|
|
|
+ BuyFlowerButton.SetActive(true);
|
|
|
}
|
|
|
|
|
|
- public static void ShowUnlockCard(FlowerInfo flowerInfo, Slot seleSlot = null)
|
|
|
+ public static void PlantFlower(int id, int index)
|
|
|
{
|
|
|
- ShowFlowerCard(flowerInfo, Lib.GrayMat, seleSlot);
|
|
|
+ Slot slot = SlotList[index];
|
|
|
|
|
|
- RetrieveButton.SetActive(false);
|
|
|
- PurchaseButton.SetActive(true);
|
|
|
+ FlowerInfo flowerInfo = FlowerInfoDictionary[id];
|
|
|
+
|
|
|
+ slot.Plant(flowerInfo, false);
|
|
|
}
|
|
|
|
|
|
- private static void ShowFlowerCard(FlowerInfo flowerInfo, Material material, Slot seleSlot)
|
|
|
+ public static void PlantFlower(FlowerInfo flowerInfo)
|
|
|
{
|
|
|
- SetRetrieveBtn(RetrieveButton, RetrieveButtonLab, seleSlot);
|
|
|
- SetPurchaseBtn(flowerInfo, PurchaseButton, PurchaseButtonLab);
|
|
|
-
|
|
|
- SeleInfo = flowerInfo;
|
|
|
+ Slot slot = null;
|
|
|
|
|
|
- ResourceManager.Get(ObjectLabel.H_FlowerCard).TweenForCG();
|
|
|
- ResourceManager.SetText(ObjectLabel.H_Lab, flowerInfo.Name);
|
|
|
+ for (int i = 0; i < SlotList.Count; i++)
|
|
|
+ {
|
|
|
+ if (SlotList[i].Available)
|
|
|
+ {
|
|
|
+ slot = SlotList[i];
|
|
|
|
|
|
- SetPlantStatus(flowerInfo);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- Image image = ResourceManager.Get<Image>(ObjectLabel.H_Icon2);
|
|
|
- image.material = material;
|
|
|
- image.sprite = flowerInfo.Icon;
|
|
|
- image.Resize(true, DeltaSize.FlowerCardSpriteX, DeltaSize.FlowerCardSpriteY);
|
|
|
+ if (slot == null)
|
|
|
+ {
|
|
|
+ Bubble.Show(null, Language.GetStr(LanguageLabel.Common__NoValidSlot));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ slot.Plant(flowerInfo, true);
|
|
|
+ UpdatePlantCardStatus(flowerInfo);
|
|
|
+ UpdateRetrieveCardStatus(flowerInfo, RetrieveFlowerButton);
|
|
|
+ AudioManager.PlayClip(AudioLabel.PlantFlower);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- private static void SetRetrieveBtn(Button button, Text buttonLab, Slot seleSlot = null)
|
|
|
+ private static void UpdatePlantCardStatus(FlowerInfo flowerInfo)
|
|
|
{
|
|
|
- RetrieveButton = button;
|
|
|
- buttonLab.text = Language.GetStr(LanguageLabel.UI__H_BtnLab1);
|
|
|
- button.image.material = null;
|
|
|
- button.onClick.RemoveAllListeners();
|
|
|
- button.onClick.AddListener
|
|
|
- (
|
|
|
- () =>
|
|
|
- {
|
|
|
- AudioManager.PlayClip(AudioLabel.ClickButton);
|
|
|
-
|
|
|
- RetriveFlower(seleSlot);
|
|
|
- }
|
|
|
- );
|
|
|
+ if (flowerInfo.RemainAmount == 0)
|
|
|
+ {
|
|
|
+ ResourceManager.Get<Button>(ObjectLabel.H_Icon2).interactable = false;
|
|
|
+ ResourceManager.SetActive(ObjectLabel.H_AmtLab, false);
|
|
|
+ ResourceManager.SetActive(ObjectLabel.H_Desc, false);
|
|
|
+ ResourceManager.SetActive(ObjectLabel.H_Rotate, false);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ResourceManager.SetActive(ObjectLabel.H_Desc, true);
|
|
|
+ ResourceManager.Get<Button>(ObjectLabel.H_Icon2).interactable = true;
|
|
|
+ ResourceManager.SetActive(ObjectLabel.H_AmtLab, true);
|
|
|
+ ResourceManager.SetText(ObjectLabel.H_AmtLab, FlowerInfo.AmountTextPrefix + flowerInfo.RemainAmount);
|
|
|
+ ResourceManager.SetActive(ObjectLabel.H_Rotate, true);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- private static void SetPurchaseBtn(FlowerInfo flowerInfo, Button button, Text buttonLab)
|
|
|
+ private static void SetBuyFlowerButton(FlowerInfo flowerInfo, Button button, Text buttonLab)
|
|
|
{
|
|
|
if (flowerInfo.UnlockCur == Current.Free)
|
|
|
{
|
|
@@ -531,7 +543,7 @@ public class GardenManager : Regist
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- buttonLab.text = Auxiliary.ImageParse(flowerInfo.UnlockCur) + flowerInfo.UnlockAmt;
|
|
|
+ buttonLab.text = Auxiliary.ImageParse(flowerInfo.UnlockCur) + flowerInfo.UnlockCost;
|
|
|
button.image.material = null;
|
|
|
button.onClick.RemoveAllListeners();
|
|
|
button.onClick.AddListener
|
|
@@ -541,15 +553,15 @@ public class GardenManager : Regist
|
|
|
Manager.Pay
|
|
|
(
|
|
|
"",
|
|
|
- flowerInfo.UnlockAmt,
|
|
|
+ flowerInfo.UnlockCost,
|
|
|
flowerInfo.UnlockCur,
|
|
|
() =>
|
|
|
{
|
|
|
flowerInfo.Add();
|
|
|
- SetPlantStatus(flowerInfo);
|
|
|
- HttpManager.Save();
|
|
|
+ UpdatePlantCardStatus(flowerInfo);
|
|
|
+ HttpManager.UploadConfig();
|
|
|
|
|
|
- PlayFlowerCardMatTween();
|
|
|
+ PlayFlowerCardMaterialTween();
|
|
|
|
|
|
AudioManager.PlayClip(AudioLabel.GetCurrent);
|
|
|
|
|
@@ -579,34 +591,7 @@ public class GardenManager : Regist
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private static void SetPlantStatus(FlowerInfo flowerInfo)
|
|
|
- {
|
|
|
- if (flowerInfo.RemainAmount == 0)
|
|
|
- {
|
|
|
- ResourceManager.Get<Button>(ObjectLabel.H_Icon2).interactable = false;
|
|
|
- ResourceManager.SetActive(ObjectLabel.H_AmtLab, false);
|
|
|
- ResourceManager.SetActive(ObjectLabel.H_Desc, false);
|
|
|
- ResourceManager.SetActive(ObjectLabel.H_Rotate, false);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- ResourceManager.SetActive(ObjectLabel.H_Desc, true);
|
|
|
- ResourceManager.Get<Button>(ObjectLabel.H_Icon2).interactable = true;
|
|
|
- ResourceManager.SetActive(ObjectLabel.H_AmtLab, true);
|
|
|
- ResourceManager.SetText(ObjectLabel.H_AmtLab, FlowerInfo.AmountTextPrefix + flowerInfo.RemainAmount);
|
|
|
- ResourceManager.SetActive(ObjectLabel.H_Rotate, true);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private static void SetRetrieveStatus(FlowerInfo flowerInfo, Button button)
|
|
|
- {
|
|
|
- if (flowerInfo.PlantAmt == 0)
|
|
|
- button.SetActive(false);
|
|
|
- else
|
|
|
- button.SetActive(true);
|
|
|
- }
|
|
|
-
|
|
|
- private static void PlayFlowerCardMatTween()
|
|
|
+ private static void PlayFlowerCardMaterialTween()
|
|
|
{
|
|
|
if (ResourceManager.Get<Image>(ObjectLabel.H_Icon2).material != Lib.GrayMat)
|
|
|
{
|
|
@@ -625,14 +610,14 @@ public class GardenManager : Regist
|
|
|
}
|
|
|
);
|
|
|
|
|
|
- FlowerCardMatTween = materialUnit.CreateTweenMatFloat(1, 0, 1, true, true, Curve.EaseOutQuad, false);
|
|
|
+ FlowerCardMaterialTween = materialUnit.CreateTweenMatFloat(1, 0, 1, true, true, Curve.EaseOutQuad, false);
|
|
|
|
|
|
- FlowerCardMatTween.OnForwardStart = () =>
|
|
|
+ FlowerCardMaterialTween.OnForwardStart = () =>
|
|
|
{
|
|
|
materialUnit.Transform.GetComponent<Image>().material = materialUnit.Material;
|
|
|
};
|
|
|
|
|
|
- FlowerCardMatTween.OnForwardFinish = () =>
|
|
|
+ FlowerCardMaterialTween.OnForwardFinish = () =>
|
|
|
{
|
|
|
ResourceManager.Get<Image>(ObjectLabel.H_Icon2).material = null;
|
|
|
};
|
|
@@ -641,16 +626,24 @@ public class GardenManager : Regist
|
|
|
}
|
|
|
|
|
|
|
|
|
+ public static void ShowRetrieveCard(FlowerInfo flowerInfo, Slot seleSlot = null)
|
|
|
+ {
|
|
|
+ ShowFlowerCard(flowerInfo, null, seleSlot);
|
|
|
+
|
|
|
+ RetrieveFlowerButton.SetActive(true);
|
|
|
+ BuyFlowerButton.SetActive(true);
|
|
|
+ }
|
|
|
+
|
|
|
public static void RetriveFlower(Slot seleSlot = null)
|
|
|
{
|
|
|
- if (seleSlot != null && seleSlot.Flower == null)
|
|
|
+ if (seleSlot != null && seleSlot.PlantFlower == null)
|
|
|
seleSlot = null;
|
|
|
|
|
|
if (seleSlot == null)
|
|
|
{
|
|
|
- foreach (var slot in PlantList)
|
|
|
+ foreach (var slot in PlantSlotList)
|
|
|
{
|
|
|
- if (slot.Flower.FlowerInfo == SeleInfo)
|
|
|
+ if (slot.PlantFlower.FlowerInfo == SelectFlowerInfo)
|
|
|
{
|
|
|
seleSlot = slot;
|
|
|
break;
|
|
@@ -659,61 +652,76 @@ public class GardenManager : Regist
|
|
|
}
|
|
|
|
|
|
seleSlot.Retrieve();
|
|
|
- SetPlantStatus(seleSlot.FlowerInfo);
|
|
|
- SetRetrieveStatus(seleSlot.FlowerInfo, RetrieveButton);
|
|
|
+ UpdatePlantCardStatus(seleSlot.PlantFlowerInfo);
|
|
|
+ UpdateRetrieveCardStatus(seleSlot.PlantFlowerInfo, RetrieveFlowerButton);
|
|
|
}
|
|
|
|
|
|
- public static void RetriveFlowerAll()
|
|
|
+ public static void RetriveAllFlower()
|
|
|
{
|
|
|
- for (int i = 0; i < PlantList.Count; i++)
|
|
|
+ for (int i = 0; i < PlantSlotList.Count; i++)
|
|
|
{
|
|
|
- PlantList[i--].Retrieve();
|
|
|
+ PlantSlotList[i--].Retrieve();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private static void UpdateRetrieveCardStatus(FlowerInfo flowerInfo, Button button)
|
|
|
+ {
|
|
|
+ if (flowerInfo.PlantAmt == 0)
|
|
|
+ button.SetActive(false);
|
|
|
+ else
|
|
|
+ button.SetActive(true);
|
|
|
+ }
|
|
|
|
|
|
- public static void PlantFlower(int id, int index)
|
|
|
+ private static void SetRetrieveFlowerButton(Button button, Text buttonLab, Slot seleSlot = null)
|
|
|
{
|
|
|
- Slot slot = SlotList[index];
|
|
|
+ RetrieveFlowerButton = button;
|
|
|
+ buttonLab.text = Language.GetStr(LanguageLabel.UI__H_BtnLab1);
|
|
|
+ button.image.material = null;
|
|
|
+ button.onClick.RemoveAllListeners();
|
|
|
+ button.onClick.AddListener
|
|
|
+ (
|
|
|
+ () =>
|
|
|
+ {
|
|
|
+ AudioManager.PlayClip(AudioLabel.ClickButton);
|
|
|
|
|
|
- FlowerInfo flowerInfo = FlowerInfoDic[id];
|
|
|
+ RetriveFlower(seleSlot);
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
|
|
|
- slot.Plant(flowerInfo, false);
|
|
|
+
|
|
|
+ public static void ShowUnlockCard(FlowerInfo flowerInfo, Slot seleSlot = null)
|
|
|
+ {
|
|
|
+ ShowFlowerCard(flowerInfo, Lib.GrayMat, seleSlot);
|
|
|
+
|
|
|
+ RetrieveFlowerButton.SetActive(false);
|
|
|
+ BuyFlowerButton.SetActive(true);
|
|
|
}
|
|
|
|
|
|
- public static void PlantFlower(FlowerInfo flowerInfo)
|
|
|
+ private static void ShowFlowerCard(FlowerInfo flowerInfo, Material material, Slot seleSlot)
|
|
|
{
|
|
|
- Slot slot = null;
|
|
|
+ SetRetrieveFlowerButton(RetrieveFlowerButton, RetrieveFlowerButtonText, seleSlot);
|
|
|
+ SetBuyFlowerButton(flowerInfo, BuyFlowerButton, BuyFlowerButtonText);
|
|
|
|
|
|
- for (int i = 0; i < SlotList.Count; i++)
|
|
|
- {
|
|
|
- if (SlotList[i].Available)
|
|
|
- {
|
|
|
- slot = SlotList[i];
|
|
|
+ SelectFlowerInfo = flowerInfo;
|
|
|
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
+ ResourceManager.Get(ObjectLabel.H_FlowerCard).TweenForCG();
|
|
|
+ ResourceManager.SetText(ObjectLabel.H_Lab, flowerInfo.Name);
|
|
|
|
|
|
- if (slot == null)
|
|
|
- {
|
|
|
- Bubble.Show(null, Language.GetStr(LanguageLabel.Common__NoValidSlot));
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- slot.Plant(flowerInfo, true);
|
|
|
- SetPlantStatus(flowerInfo);
|
|
|
- SetRetrieveStatus(flowerInfo, RetrieveButton);
|
|
|
- AudioManager.PlayClip(AudioLabel.PlantFlower);
|
|
|
- }
|
|
|
+ UpdatePlantCardStatus(flowerInfo);
|
|
|
+
|
|
|
+ Image image = ResourceManager.Get<Image>(ObjectLabel.H_Icon2);
|
|
|
+ image.material = material;
|
|
|
+ image.sprite = flowerInfo.Icon;
|
|
|
+ image.Resize(true, DeltaSize.FlowerCardSpriteX, DeltaSize.FlowerCardSpriteY);
|
|
|
}
|
|
|
|
|
|
|
|
|
public static void RetrieveAllElf()
|
|
|
{
|
|
|
- for (int i = 0; i < PlantList.Count; i++)
|
|
|
+ for (int i = 0; i < PlantSlotList.Count; i++)
|
|
|
{
|
|
|
- PlantList[i].Flower.RetrieveElf();
|
|
|
+ PlantSlotList[i].PlantFlower.RetrieveElf();
|
|
|
}
|
|
|
}
|
|
|
|