|
@@ -38,11 +38,19 @@ public class CloseUnit
|
|
|
|
|
|
#region Var
|
|
|
|
|
|
+ public string Description
|
|
|
+ {
|
|
|
+ get { return Language.GetStr("DressRoom", CloseName); }
|
|
|
+ }
|
|
|
+
|
|
|
+ public int ID;
|
|
|
public int Index;
|
|
|
public int BuyLevel;
|
|
|
+ public int PixelSize;
|
|
|
+ public bool Bought;
|
|
|
public string CloseName;
|
|
|
|
|
|
- public Text BtnLab;
|
|
|
+ public Text BuyBtnLab;
|
|
|
public Sprite Sprite;
|
|
|
public Image Icon;
|
|
|
public Button BuyBtn;
|
|
@@ -62,6 +70,7 @@ public class CloseUnit
|
|
|
|
|
|
public CloseUnit(XmlAttributeCollection attribute)
|
|
|
{
|
|
|
+ ID = Auxiliary.IntParse(attribute[0].Value, -1);
|
|
|
CloseName = attribute[2].Value;
|
|
|
Sprite = SpriteParse(attribute[2].Value);
|
|
|
Type = TypeParse(attribute[3].Value);
|
|
@@ -72,6 +81,10 @@ public class CloseUnit
|
|
|
BuyAmt = Auxiliary.DoubleParse(attribute[8].Value, 0);
|
|
|
BuyAdvanceCurrent = Auxiliary.CurrentParse(attribute[9].Value);
|
|
|
BuyAdvanceAmt = Auxiliary.DoubleParse(attribute[10].Value, 0);
|
|
|
+ PixelSize = Auxiliary.IntParse(attribute[11].Value, 100);
|
|
|
+
|
|
|
+ ManaPlayer.CloseIDDic.Add(CloseName, ID);
|
|
|
+ ManaPlayer.CloseUnitDic.Add(ID, this);
|
|
|
|
|
|
CreateItem();
|
|
|
}
|
|
@@ -113,20 +126,56 @@ public class CloseUnit
|
|
|
Icon = ChildDic["Icon"].GetComponent<Image>();
|
|
|
DressBtn = ChildDic["CloseItem"].GetComponent<Button>();
|
|
|
BuyBtn = ChildDic["BuyBtn"].GetComponent<Button>();
|
|
|
- BtnLab = ChildDic["BuyBtnLab"].GetComponent<Text>();
|
|
|
+ BuyBtnLab = ChildDic["BuyBtnLab"].GetComponent<Text>();
|
|
|
|
|
|
|
|
|
Icon.sprite = Sprite;
|
|
|
|
|
|
Icon.SetNativeSize();
|
|
|
|
|
|
- float newSize = 100 / Icon.sprite.rect.width;
|
|
|
- Icon.Resize(true, new Vector2(newSize, newSize)); //todo 把NewSize写到配置里
|
|
|
+ float newSize = PixelSize / Icon.sprite.rect.width;
|
|
|
+ Icon.Resize(true, new Vector2(newSize, newSize));
|
|
|
+
|
|
|
+
|
|
|
+ BuyBtnLab.text = Language.GetStr("UI", "P_BtnLab1");
|
|
|
+
|
|
|
+ BuyBtn.onClick.AddListener
|
|
|
+ (
|
|
|
+ () =>
|
|
|
+ {
|
|
|
+ ManaAudio.PlayClip(Clip.BtnClip);
|
|
|
+
|
|
|
+ ManaReso.Get("Pa_Info").TweenForCG();
|
|
|
+
|
|
|
+ Image image = ManaReso.Get<Image>("Pa_Icon");
|
|
|
+ image.sprite = Sprite;
|
|
|
+ image.Resize(true, new Vector2(newSize, newSize));
|
|
|
+
|
|
|
+ ManaReso.SetText("Pa_Lab", Description);
|
|
|
+ ManaReso.SetText("Pa_BtnLab", Language.GetStr("UI", "Pa_BtnLab") + Auxiliary.ImageParse(BuyCurrent) + BuyAmt.ToString("0"));
|
|
|
+
|
|
|
+ ManaReso.SetButtonEvent
|
|
|
+ (
|
|
|
+ "Pa_Btn",
|
|
|
+ OnBuy
|
|
|
+ );
|
|
|
+ }
|
|
|
+ );
|
|
|
+
|
|
|
+ DressBtn.onClick.AddListener
|
|
|
+ (
|
|
|
+ () =>
|
|
|
+ {
|
|
|
+ ManaAudio.PlayClip(Clip.BtnClip);
|
|
|
+
|
|
|
+ ManaPlayer.Player.ChangeClose(BodyPart, CloseName);
|
|
|
+ }
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
protected Sprite SpriteParse(string str)
|
|
|
{
|
|
|
- return ManaPlayer.CloseDic[str];
|
|
|
+ return ManaPlayer.CloseSpriteDic[str];
|
|
|
}
|
|
|
|
|
|
protected BodyPart BodyPartParse(string str)
|
|
@@ -188,6 +237,43 @@ public class CloseUnit
|
|
|
throw new Exception();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ public void Unlock()
|
|
|
+ {
|
|
|
+ Bought = true;
|
|
|
+
|
|
|
+ BuyBtn.interactable = false;
|
|
|
+ BuyBtn.image.material = Lib.GrayMat;
|
|
|
+
|
|
|
+ BuyBtnLab.text = Language.GetStr("UI", "P_BtnLab2");
|
|
|
+ }
|
|
|
+
|
|
|
+ public void OnBuy()
|
|
|
+ {
|
|
|
+ ManaCenter.Pay
|
|
|
+ (
|
|
|
+ "",
|
|
|
+ BuyAmt,
|
|
|
+ BuyCurrent,
|
|
|
+ () =>
|
|
|
+ {
|
|
|
+ Unlock();
|
|
|
+
|
|
|
+ ManaAudio.PlayClip(Clip.CurrentClip);
|
|
|
+
|
|
|
+ ManaPlayer.BoughtCloseList.UniqueAdd(ID);
|
|
|
+
|
|
|
+ ManaReso.Get("Pa_Info").TweenBacCG();
|
|
|
+ },
|
|
|
+ false
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ public void OnLevelChange()
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public class Player : Regist , IPointerClickHandler
|
|
@@ -245,7 +331,7 @@ public class Player : Regist , IPointerClickHandler
|
|
|
Vector3 bigShadowScale = new Vector3(1.820952f, 2.418199f, 1.820952f);
|
|
|
Vector3 smallShadowScale = new Vector3(1.081191f, 1.435807f, 1.081191f);
|
|
|
|
|
|
- StreamScale streamScale = ChildDic["Shadow"].CreateStreamScale
|
|
|
+ ChildDic["Shadow"].CreateStreamScale
|
|
|
(
|
|
|
new List<float>() {0, 0, 0},
|
|
|
new List<float>() {0.33f, 0.33f, 0.33f, 0.33f},
|
|
@@ -255,18 +341,6 @@ public class Player : Regist , IPointerClickHandler
|
|
|
Curve.EaseOutQuad
|
|
|
);
|
|
|
|
|
|
- streamScale.AddEventOnetime
|
|
|
- (
|
|
|
- EventType.ForwardFinish,
|
|
|
- () =>
|
|
|
- {
|
|
|
- if (!InDressRoom)
|
|
|
- {
|
|
|
- ManaPlayer.Player.ChildDic["Shadow"].SetActive(false);
|
|
|
- }
|
|
|
- }
|
|
|
- );
|
|
|
-
|
|
|
return false;
|
|
|
}
|
|
|
|
|
@@ -314,7 +388,10 @@ public class Player : Regist , IPointerClickHandler
|
|
|
{
|
|
|
AnimLock1 = false;
|
|
|
|
|
|
- ChangeClose(BodyPart.Eye, TempClose);
|
|
|
+ if (TempClose != null)
|
|
|
+ {
|
|
|
+ ChangeClose(BodyPart.Eye, TempClose);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -340,18 +417,87 @@ public class Player : Regist , IPointerClickHandler
|
|
|
|
|
|
public void OnPointerClick(PointerEventData eventData)
|
|
|
{
|
|
|
+ if (ManaCenter.Level < 13)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ ManaReso.Get("I_BlackMask").GetTweenCG().Duration = 0.5f;
|
|
|
+
|
|
|
+ ManaAudio.PlayClip(Clip.CurrentClip);
|
|
|
+
|
|
|
EnterDressRoom();
|
|
|
}
|
|
|
|
|
|
|
|
|
public void Save()
|
|
|
{
|
|
|
+ ManaAudio.PlayClip(Clip.BtnClip);
|
|
|
+
|
|
|
+ List<CloseUnit> closeUnitList = new List<CloseUnit>();
|
|
|
+
|
|
|
+ closeUnitList.Add(ManaPlayer.CloseUnitDic[ManaPlayer.CloseIDDic[Head]]);
|
|
|
+ closeUnitList.Add(ManaPlayer.CloseUnitDic[ManaPlayer.CloseIDDic[Dress]]);
|
|
|
+ closeUnitList.Add(ManaPlayer.CloseUnitDic[ManaPlayer.CloseIDDic[Shoe]]);
|
|
|
+ closeUnitList.Add(ManaPlayer.CloseUnitDic[ManaPlayer.CloseIDDic[HeadWear]]);
|
|
|
+ closeUnitList.Add(ManaPlayer.CloseUnitDic[ManaPlayer.CloseIDDic[Top]]);
|
|
|
+
|
|
|
+ for (int i = 0; i < closeUnitList.Count; i++)
|
|
|
+ {
|
|
|
+ if (!closeUnitList[i].Bought)
|
|
|
+ {
|
|
|
+ BuyNavigate(closeUnitList);
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ManaPlayer.DressData[0] = Head;
|
|
|
+ ManaPlayer.DressData[1] = Dress;
|
|
|
+ ManaPlayer.DressData[2] = Shoe;
|
|
|
+ ManaPlayer.DressData[3] = HeadWear;
|
|
|
+ ManaPlayer.DressData[4] = Top;
|
|
|
+
|
|
|
ExitDressRoom();
|
|
|
}
|
|
|
|
|
|
public void Reset()
|
|
|
{
|
|
|
-
|
|
|
+ ManaAudio.PlayClip(Clip.BtnClip);
|
|
|
+
|
|
|
+ List<string> dressData = new List<string>(ManaPlayer.DressData);
|
|
|
+
|
|
|
+ dressData[5] = Eye;
|
|
|
+
|
|
|
+ ManaPlayer.BuildPlayer(dressData);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void BuyNavigate(List<CloseUnit> closeUnitList)
|
|
|
+ {
|
|
|
+ for (int i = 0; i < closeUnitList.Count; i++)
|
|
|
+ {
|
|
|
+ if (closeUnitList[i].Bought)
|
|
|
+ {
|
|
|
+ closeUnitList.RemoveAt(i--);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ closeUnitList[i].BuyBtn.onClick.Invoke();
|
|
|
+
|
|
|
+ closeUnitList.RemoveAt(i--);
|
|
|
+
|
|
|
+ ManaReso.Get("Pa_Info").GetTweenCG().AddEventOnetime
|
|
|
+ (
|
|
|
+ EventType.BackwardFinish,
|
|
|
+ () =>
|
|
|
+ {
|
|
|
+ BuyNavigate(closeUnitList);
|
|
|
+ }
|
|
|
+ );
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public void ExitDressRoom()
|
|
@@ -365,10 +511,8 @@ public class Player : Regist , IPointerClickHandler
|
|
|
EventType.BackwardFinish,
|
|
|
() =>
|
|
|
{
|
|
|
- ManaPlayer.Player.ChildDic["Shadow"].SetActive(false);
|
|
|
-
|
|
|
- ManaPlayer.Player.transform.position = ManaReso.Get("PlayerPosTra").position;
|
|
|
- ManaPlayer.Player.transform.localScale = ManaReso.Get("PlayerPosTra").lossyScale;
|
|
|
+ transform.position = ManaReso.Get("PlayerPosTra").position;
|
|
|
+ transform.localScale = ManaReso.Get("PlayerPosTra").lossyScale;
|
|
|
|
|
|
ManaReso.Get("Garden").TweenForSr();
|
|
|
ManaReso.Get("DressRoom").TweenBacSr();
|
|
@@ -390,6 +534,14 @@ public class Player : Regist , IPointerClickHandler
|
|
|
|
|
|
InDressRoom = false;
|
|
|
|
|
|
+ JumpTimer = 0;
|
|
|
+
|
|
|
+ PlayAnim("newAnimation");
|
|
|
+
|
|
|
+ ChildDic["Shadow"].GetStreamScale().Pause();
|
|
|
+ ChildDic["Shadow"].GetStreamScale().InOrigin = true;
|
|
|
+ ChildDic["Shadow"].SetActive(false);
|
|
|
+
|
|
|
ManaReso.Get("I_BlackMask").TweenForCG();
|
|
|
}
|
|
|
);
|
|
@@ -426,10 +578,10 @@ public class Player : Regist , IPointerClickHandler
|
|
|
ManaGarden.PlantList[i].Flower.RetrieveElf();
|
|
|
}
|
|
|
|
|
|
- ManaPlayer.Player.ChildDic["Shadow"].SetActive(true);
|
|
|
+ ChildDic["Shadow"].SetActive(true);
|
|
|
|
|
|
- ManaPlayer.Player.transform.position = ManaReso.Get("DressRoomPos").position;
|
|
|
- ManaPlayer.Player.transform.localScale = ManaReso.Get("DressRoomPos").lossyScale;
|
|
|
+ transform.position = ManaReso.Get("DressRoomPos").position;
|
|
|
+ transform.localScale = ManaReso.Get("DressRoomPos").lossyScale;
|
|
|
|
|
|
ManaReso.Get("Garden").TweenBacSr();
|
|
|
ManaReso.Get("DressRoom").TweenForSr();
|
|
@@ -511,10 +663,10 @@ public class Player : Regist , IPointerClickHandler
|
|
|
|
|
|
ChangeClose(BodyPart.Eye, "眼睛3");
|
|
|
ChangeClose(BodyPart.Top, "上衣3");
|
|
|
- ChangeClose(BodyPart.Shoe, "脑壳3");
|
|
|
- ChangeClose(BodyPart.Head, "裙子3");
|
|
|
- ChangeClose(BodyPart.Dress, "嘴巴3");
|
|
|
- ChangeClose(BodyPart.Mouse, "鞋子3");
|
|
|
+ ChangeClose(BodyPart.Shoe, "鞋子3");
|
|
|
+ ChangeClose(BodyPart.Head, "脑壳3");
|
|
|
+ ChangeClose(BodyPart.Dress, "裙子3");
|
|
|
+ ChangeClose(BodyPart.Mouse, "嘴巴3");
|
|
|
ChangeClose(BodyPart.Headwear, "头饰品3");
|
|
|
|
|
|
return UAC;
|
|
@@ -535,10 +687,10 @@ public class Player : Regist , IPointerClickHandler
|
|
|
|
|
|
ChangeClose(BodyPart.Eye, "眼睛2");
|
|
|
ChangeClose(BodyPart.Top, "上衣2");
|
|
|
- ChangeClose(BodyPart.Shoe, "脑壳2");
|
|
|
- ChangeClose(BodyPart.Head, "裙子2");
|
|
|
- ChangeClose(BodyPart.Dress, "嘴巴2");
|
|
|
- ChangeClose(BodyPart.Mouse, "鞋子2");
|
|
|
+ ChangeClose(BodyPart.Shoe, "鞋子2");
|
|
|
+ ChangeClose(BodyPart.Head, "脑壳2");
|
|
|
+ ChangeClose(BodyPart.Dress, "裙子2");
|
|
|
+ ChangeClose(BodyPart.Mouse, "嘴巴2");
|
|
|
ChangeClose(BodyPart.Headwear, "头饰品2");
|
|
|
|
|
|
return UAC;
|