|
@@ -4,9 +4,10 @@ using UnityEngine.Serialization;
|
|
|
|
|
|
using System;
|
|
|
using System.Xml;
|
|
|
+using System.Text;
|
|
|
using System.Collections;
|
|
|
using System.Collections.Generic;
|
|
|
-using System.Text;
|
|
|
+
|
|
|
using Random = UnityEngine.Random;
|
|
|
|
|
|
public class Award
|
|
@@ -19,6 +20,7 @@ public class Award
|
|
|
|
|
|
public int DiamondMin;
|
|
|
public int DiamondMax;
|
|
|
+
|
|
|
public string CoinFml;
|
|
|
public string FlowerFml;
|
|
|
public string DiamondFml;
|
|
@@ -28,40 +30,6 @@ public class Award
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
- public Award(XmlAttributeCollection attribute)
|
|
|
- {
|
|
|
- Flower.CoinFml = attribute[8].Value;
|
|
|
- DropGold.CoinFml = attribute[7].Value;
|
|
|
-
|
|
|
- CoinFml = attribute[1].Value;
|
|
|
- FlowerFml = attribute[4].Value;
|
|
|
- DiamondFml = attribute[3].Value;
|
|
|
-
|
|
|
- string[] strings = attribute[2].Value.Split(',');
|
|
|
-
|
|
|
- DiamondMin = int.Parse(strings[0]);
|
|
|
- DiamondMax = int.Parse(strings[1]);
|
|
|
-
|
|
|
- strings = attribute[5].Value.Split(',');
|
|
|
-
|
|
|
- Odds = new List<float>()
|
|
|
- {
|
|
|
- float.Parse(strings[0]),
|
|
|
- float.Parse(strings[1]),
|
|
|
- float.Parse(strings[2]),
|
|
|
- };
|
|
|
-
|
|
|
- strings = attribute[6].Value.Split(',');
|
|
|
-
|
|
|
- Standard = new List<float>()
|
|
|
- {
|
|
|
- float.Parse(strings[0]),
|
|
|
- float.Parse(strings[1]),
|
|
|
- float.Parse(strings[2]),
|
|
|
- };
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
public void GetAward(int score)
|
|
|
{
|
|
|
#region 获得奖励
|
|
@@ -98,7 +66,7 @@ public class Award
|
|
|
#region Coin
|
|
|
|
|
|
int coin = (int)Auxiliary.FmlParse(CoinFml, "s", score.ToString(), "l", Mathf.Clamp(ManaCenter.Level, 1, 9999).ToString());
|
|
|
- coin = (int) (coin*(1 + ManaCenter.SkillPlus) + BonusCoin);
|
|
|
+ coin = (int)(coin * (1 + ManaCenter.SkillPlus) + BonusCoin);
|
|
|
|
|
|
ManaCenter.Coin += coin;
|
|
|
|
|
@@ -110,12 +78,12 @@ public class Award
|
|
|
|
|
|
int diamond = 0;
|
|
|
float diamondRate = (float)Auxiliary.FmlParse(DiamondFml, "l", Mathf.Clamp(ManaCenter.Level, 1, 1000).ToString());
|
|
|
-
|
|
|
+
|
|
|
if (Random.Range(0, 1f) <= diamondRate)
|
|
|
{
|
|
|
diamondFlag = true;
|
|
|
|
|
|
- diamond = (int) (Mathf.Lerp(DiamondMin, DiamondMax, Random.Range(0, 1f)) + BonusDiamond);
|
|
|
+ diamond = (int)(Mathf.Lerp(DiamondMin, DiamondMax, Random.Range(0, 1f)) + BonusDiamond);
|
|
|
|
|
|
ManaCenter.Diamond += diamond;
|
|
|
|
|
@@ -132,7 +100,7 @@ public class Award
|
|
|
diamond = BonusDiamond;
|
|
|
|
|
|
ManaCenter.Diamond += diamond;
|
|
|
-
|
|
|
+
|
|
|
ManaReso.SetActive("Da_Diamond", true);
|
|
|
|
|
|
sb.AppendFormat("{0}{1}{2} ", Language.GetStr("UI", "J_Info0"), "<(钻石)>", diamond);
|
|
@@ -149,14 +117,10 @@ public class Award
|
|
|
|
|
|
FlowerInfo flowerInfo = ManaGarden.FlowerInfoDic[1];
|
|
|
|
|
|
- Vector2 newSize = flowerInfo.Icon.rect.size;
|
|
|
- newSize.x *= 0.2f;
|
|
|
- newSize.y *= 0.2f;
|
|
|
-
|
|
|
ManaReso.Get<Image>("Da_FlowerIcon").sprite = flowerInfo.Icon;
|
|
|
- ManaReso.Get<Image>("Da_FlowerIcon").rectTransform.sizeDelta = newSize;
|
|
|
+ ManaReso.Get<Image>("Da_FlowerIcon").Resize(0.2f, 0.2f);
|
|
|
|
|
|
- ManaReso.SetText("Da_FlowerLab", Language.GetStr("FlowerName", "Flower" + flowerInfo.ID_));
|
|
|
+ ManaReso.SetText("Da_FlowerLab", flowerInfo.Name);
|
|
|
|
|
|
sb.AppendFormat("{0}{1}{2}", Language.GetStr("UI", "J_Info0"), "<(花朵)>", flowerInfo.Name);
|
|
|
}
|
|
@@ -176,14 +140,10 @@ public class Award
|
|
|
{
|
|
|
flowerFlag = true;
|
|
|
|
|
|
- Vector2 newSize = flowerInfo.Icon.rect.size;
|
|
|
- newSize.x *= 0.2f;
|
|
|
- newSize.y *= 0.2f;
|
|
|
-
|
|
|
ManaReso.Get<Image>("Da_FlowerIcon").sprite = flowerInfo.Icon;
|
|
|
- ManaReso.Get<Image>("Da_FlowerIcon").rectTransform.sizeDelta = newSize;
|
|
|
+ ManaReso.Get<Image>("Da_FlowerIcon").Resize(0.2f, 0.2f);
|
|
|
|
|
|
- ManaReso.SetText("Da_FlowerLab", Language.GetStr("FlowerName", "Flower" + flowerInfo.ID_));
|
|
|
+ ManaReso.SetText("Da_FlowerLab", flowerInfo.Name);
|
|
|
|
|
|
sb.AppendFormat("{0}{1}{2}", Language.GetStr("UI", "J_Info0"), "<(花朵)>", flowerInfo.Name);
|
|
|
|
|
@@ -253,15 +213,15 @@ public class Award
|
|
|
|
|
|
|
|
|
float timeCoin = Mathf.Lerp(0, 1.5f, Mathf.Clamp01(coin / 15f));
|
|
|
- float timeScore = Mathf.Lerp(0, 1.5f, Mathf.Clamp01(score/50f));
|
|
|
+ float timeScore = Mathf.Lerp(0, 1.5f, Mathf.Clamp01(score / 50f));
|
|
|
float timeDiamond = Mathf.Lerp(0, 1.5f, Mathf.Clamp01(diamond / 15f));
|
|
|
-
|
|
|
+
|
|
|
float time = Mathf.Max(timeCoin, timeDiamond);
|
|
|
|
|
|
ManaReso.Get("Da_CoinLab").CreateTweenNumber(0, coin, time, false, true, Curve.EaseOutQuad);
|
|
|
ManaReso.Get("Da_ScoreLab").CreateTweenNumber(0, score, timeScore, false, true, Curve.EaseOutQuad);
|
|
|
ManaReso.Get("Da_DiamondLab").CreateTweenNumber(0, diamond, time, false, true, Curve.EaseOutQuad);
|
|
|
-
|
|
|
+
|
|
|
#endregion
|
|
|
|
|
|
|
|
@@ -504,9 +464,42 @@ public class Award
|
|
|
|
|
|
#endregion
|
|
|
}
|
|
|
-}
|
|
|
|
|
|
|
|
|
+ public Award(XmlAttributeCollection attribute)
|
|
|
+ {
|
|
|
+ Flower.CoinFml = attribute[8].Value;
|
|
|
+ DropGold.CoinFml = attribute[7].Value;
|
|
|
+
|
|
|
+ CoinFml = attribute[1].Value;
|
|
|
+ FlowerFml = attribute[4].Value;
|
|
|
+ DiamondFml = attribute[3].Value;
|
|
|
+
|
|
|
+ string[] strings = attribute[2].Value.Split(',');
|
|
|
+
|
|
|
+ DiamondMin = int.Parse(strings[0]);
|
|
|
+ DiamondMax = int.Parse(strings[1]);
|
|
|
+
|
|
|
+ strings = attribute[5].Value.Split(',');
|
|
|
+
|
|
|
+ Odds = new List<float>()
|
|
|
+ {
|
|
|
+ float.Parse(strings[0]),
|
|
|
+ float.Parse(strings[1]),
|
|
|
+ float.Parse(strings[2]),
|
|
|
+ };
|
|
|
+
|
|
|
+ strings = attribute[6].Value.Split(',');
|
|
|
+
|
|
|
+ Standard = new List<float>()
|
|
|
+ {
|
|
|
+ float.Parse(strings[0]),
|
|
|
+ float.Parse(strings[1]),
|
|
|
+ float.Parse(strings[2]),
|
|
|
+ };
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
public class ManaMiniGame : Regist
|
|
|
{
|
|
|
#region 变量
|
|
@@ -518,7 +511,7 @@ public class ManaMiniGame : Regist
|
|
|
{
|
|
|
Score_ = value;
|
|
|
|
|
|
- ManaReso.SetText("D_ScoreLab", ScoreLab + Score_.ToString());
|
|
|
+ ManaReso.SetText("D_ScoreLab", ScoreLab + Score_);
|
|
|
}
|
|
|
}
|
|
|
public static bool Game
|
|
@@ -599,6 +592,7 @@ public class ManaMiniGame : Regist
|
|
|
TimerLab.text = (GameTime-GameTimer_).ToString("0.0");
|
|
|
|
|
|
TimerBk.fillAmount = GameTimer_/GameTime;
|
|
|
+
|
|
|
TimerBk.material.SetFloat("_Fill", TimerBk.fillAmount);
|
|
|
}
|
|
|
}
|
|
@@ -609,35 +603,44 @@ public class ManaMiniGame : Regist
|
|
|
private static bool Panalty_;
|
|
|
private static float GameTimer_;
|
|
|
|
|
|
- public static Text BtnLab;
|
|
|
public static Text TimerLab;
|
|
|
public static Text PrepareLab;
|
|
|
+
|
|
|
public static Image TimerBk;
|
|
|
public static Award Award;
|
|
|
+
|
|
|
public static List<Drop> DropList = new List<Drop>();
|
|
|
public static List<Flower> OpList = new List<Flower>();
|
|
|
public static List<Flower> IdleList = new List<Flower>();
|
|
|
|
|
|
public static int Flower;
|
|
|
public static int MiniGameIndex;
|
|
|
+ public static string ScoreLab;
|
|
|
+
|
|
|
public static bool Prepare;
|
|
|
- public static bool TutorialValidA = true;
|
|
|
+ public static bool TutorialLock = true;
|
|
|
public static bool DropDiamond;
|
|
|
- public static float OpTime = 1.5f;
|
|
|
+
|
|
|
public static float OpTimer;
|
|
|
public static float GoldTimer;
|
|
|
- public static float GameTime = 5;
|
|
|
- public static float PanaltyTime = 1;
|
|
|
- public static float NewOpTime;
|
|
|
public static float PanaltyTimer;
|
|
|
public static float PrepareTimer;
|
|
|
public static float DiamondTimer;
|
|
|
- public static string ScoreLab;
|
|
|
+
|
|
|
+ public static float OpTime = 1.5f;
|
|
|
+ public static float GameTime = 45;
|
|
|
+ public static float PanaltyTime = 1;
|
|
|
+ public static float NewOpTime;
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
private void FixedUpdate()
|
|
|
{
|
|
|
+ if (Pause)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
if (Game)
|
|
|
{
|
|
|
GameThread();
|
|
@@ -652,12 +655,8 @@ public class ManaMiniGame : Regist
|
|
|
|
|
|
private void GameThread()
|
|
|
{
|
|
|
- if (Pause)
|
|
|
- {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
GameTimer += Time.fixedDeltaTime;
|
|
|
+
|
|
|
if (GameTimer >= GameTime)
|
|
|
{
|
|
|
GameOver();
|
|
@@ -694,12 +693,8 @@ public class ManaMiniGame : Regist
|
|
|
|
|
|
private void BonusThread()
|
|
|
{
|
|
|
- if (Pause)
|
|
|
- {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
GoldTimer -= Time.fixedDeltaTime;
|
|
|
+
|
|
|
if (GoldTimer < 0)
|
|
|
{
|
|
|
GoldTimer = Random.Range(3f, 6f);
|
|
@@ -710,6 +705,7 @@ public class ManaMiniGame : Regist
|
|
|
if (DropDiamond)
|
|
|
{
|
|
|
DiamondTimer -= Time.fixedDeltaTime;
|
|
|
+
|
|
|
if (DiamondTimer < 0)
|
|
|
{
|
|
|
DropDiamond = false;
|
|
@@ -721,11 +717,6 @@ public class ManaMiniGame : Regist
|
|
|
|
|
|
private void PrepareThread()
|
|
|
{
|
|
|
- if (Pause)
|
|
|
- {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
PrepareTimer -= Time.fixedDeltaTime;
|
|
|
|
|
|
if (PrepareTimer <= 0)
|
|
@@ -736,47 +727,6 @@ public class ManaMiniGame : Regist
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void CreateOperate()
|
|
|
- {
|
|
|
- ManaAudio.PlayClip(Clip.BubbleClip);
|
|
|
-
|
|
|
- if (ManaTutorial.TutorialA && TutorialValidA)
|
|
|
- {
|
|
|
- Pause = true;
|
|
|
- TutorialValidA = false;
|
|
|
-
|
|
|
- Flower flower = IdleList[4];
|
|
|
- flower.CreateOp(OpList.Count, OpType.Water);
|
|
|
-
|
|
|
- OpList.Add(flower);
|
|
|
- IdleList.Remove(flower);
|
|
|
-
|
|
|
- Tutorial.HightScreen(ManaReso.Get("D_WaterArrow0"), ManaReso.Get("D_WaterArrow1"), ManaReso.Get("D_Water1"));
|
|
|
-
|
|
|
- Tutorial.SetArea(OpList[0].OperateIcon.transform, 0.1f, 0.125f);
|
|
|
-
|
|
|
- ManaReso.AddButtonEventOnetime
|
|
|
- (
|
|
|
- "D_Water2",
|
|
|
- () =>
|
|
|
- {
|
|
|
- Pause = false;
|
|
|
-
|
|
|
- Tutorial.HightDisable();
|
|
|
- }
|
|
|
- );
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- Flower flower = IdleList[Random.Range(0, IdleList.Count)];
|
|
|
-
|
|
|
- flower.CreateOp(OpList.Count);
|
|
|
-
|
|
|
- OpList.Add(flower);
|
|
|
- IdleList.Remove(flower);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
public override void RegistValueA()
|
|
|
{
|
|
@@ -787,14 +737,12 @@ public class ManaMiniGame : Regist
|
|
|
|
|
|
public override void RegistReference()
|
|
|
{
|
|
|
- BtnLab = ManaReso.Get<Text>("D_BeginLab");
|
|
|
TimerLab = ManaReso.Get<Text>("D_TimerLab");
|
|
|
PrepareLab = ManaReso.Get<Text>("D_PrepareLab");
|
|
|
|
|
|
TimerBk = ManaReso.Get<Image>("D_TimerIcon");
|
|
|
}
|
|
|
|
|
|
- #region MiniGame
|
|
|
|
|
|
public static void Operate(OpType opType)
|
|
|
{
|
|
@@ -811,12 +759,12 @@ public class ManaMiniGame : Regist
|
|
|
|
|
|
if (OpList.Count >= 2)
|
|
|
{
|
|
|
- OpList[0].FirstOp();
|
|
|
- OpList[1].SecondOp();
|
|
|
+ OpList[0].SetFirstOp();
|
|
|
+ OpList[1].SetSecondOp();
|
|
|
}
|
|
|
else if (OpList.Count >= 1)
|
|
|
{
|
|
|
- OpList[0].FirstOp();
|
|
|
+ OpList[0].SetFirstOp();
|
|
|
}
|
|
|
}
|
|
|
else
|
|
@@ -826,6 +774,47 @@ public class ManaMiniGame : Regist
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public static void CreateOperate()
|
|
|
+ {
|
|
|
+ ManaAudio.PlayClip(Clip.BubbleClip);
|
|
|
+
|
|
|
+ if (ManaTutorial.TutorialA && TutorialLock)
|
|
|
+ {
|
|
|
+ Pause = true;
|
|
|
+ TutorialLock = false;
|
|
|
+
|
|
|
+ Flower flower = IdleList[4];
|
|
|
+ flower.CreateOp(OpList.Count, OpType.Water);
|
|
|
+
|
|
|
+ OpList.Add(flower);
|
|
|
+ IdleList.Remove(flower);
|
|
|
+
|
|
|
+ Tutorial.HightScreen(ManaReso.Get("D_WaterArrow0"), ManaReso.Get("D_WaterArrow1"), ManaReso.Get("D_Water1"));
|
|
|
+
|
|
|
+ Tutorial.SetArea(OpList[0].OperateIcon.transform, 0.1f, 0.125f);
|
|
|
+
|
|
|
+ ManaReso.AddButtonEventOnetime
|
|
|
+ (
|
|
|
+ "D_Water2",
|
|
|
+ () =>
|
|
|
+ {
|
|
|
+ Pause = false;
|
|
|
+
|
|
|
+ Tutorial.HightDisable();
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Flower flower = IdleList[Random.Range(0, IdleList.Count)];
|
|
|
+
|
|
|
+ flower.CreateOp(OpList.Count);
|
|
|
+
|
|
|
+ OpList.Add(flower);
|
|
|
+ IdleList.Remove(flower);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
public static void GameEnd()
|
|
|
{
|
|
@@ -836,8 +825,6 @@ public class ManaMiniGame : Regist
|
|
|
ManaCenter.MiniLock = false;
|
|
|
|
|
|
ManaCenter.MiniTimer = Mathf.Lerp(180, 300, Random.Range(0, 1f));
|
|
|
-
|
|
|
- ManaDebug.Log(string.Format("<color=red>{0:0}</color>秒后激活小游戏", ManaCenter.MiniTimer));
|
|
|
}
|
|
|
|
|
|
if (ManaCenter.MiniTimer <= 0)
|
|
@@ -899,9 +886,10 @@ public class ManaMiniGame : Regist
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- Flower = Random.Range(0, ManaGarden.FlowerInfoDic.Count);
|
|
|
+ Flower = ManaGarden.FlowerInfoDic.Random().ID_;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
int flowerAmt = 1;
|
|
|
|
|
|
while (true)
|
|
@@ -922,6 +910,7 @@ public class ManaMiniGame : Regist
|
|
|
}
|
|
|
|
|
|
ScoreLab = Language.GetStr("UI", "D_ScoreLab");
|
|
|
+
|
|
|
TimerBk.fillAmount = 0;
|
|
|
TimerLab.text = GameTime.ToString("0");
|
|
|
|
|
@@ -944,8 +933,6 @@ public class ManaMiniGame : Regist
|
|
|
NewOpTime = OpTime;
|
|
|
DiamondTimer = Random.Range(0f, GameTime - 5);
|
|
|
|
|
|
- ManaDebug.Log(string.Format("第<color=red>{0}</color>次小游戏", MiniGameIndex));
|
|
|
-
|
|
|
for (int i = 0; i < IdleList.Count; i++)
|
|
|
{
|
|
|
IdleList[i].GameBegin();
|
|
@@ -983,8 +970,6 @@ public class ManaMiniGame : Regist
|
|
|
PrepareLab.StreamForScale();
|
|
|
}
|
|
|
|
|
|
- #endregion
|
|
|
-
|
|
|
|
|
|
public void OnApplicationPause(bool pause)
|
|
|
{
|