1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600 |
- using DragonBones;
- using UnityEngine;
- using UnityEngine.UI;
- using UnityEngine.EventSystems;
- using System;
- using System.Xml;
- using System.Linq;
- using System.Collections;
- using System.Collections.Generic;
- using Animation = DragonBones.Animation;
- using Slot = DragonBones.Slot;
- using Random = UnityEngine.Random;
- using Transform = UnityEngine.Transform;
- public class PlayerLabel
- {
-
- public static string MessageBox = "MessageBox";
- public static string NickName = "NickName";
- public static string Pivot = "Pivot";
- public static string Shadow = "Shadow";
- public static string ExpressionMeshFilter = "ExpressionMeshFilter";
- public static string ShadowParent = "ShadowParent";
- public static string Player = "Player";
- public static string RightPos = "RightPos";
- public static string LeftPos = "LeftPos";
- public static string EnterGameTra = "EnterGameTra";
- }
- public enum BodyPart
- {
- Leg = 0,
- LeftHand = 1,
- RightHand = 2,
- LeftLongSleeve = 3,
- LeftShortSleeve = 4,
- RightLongSleeve = 5,
- RightShortSleeve = 6,
- Neck = 7,
- Eye = 8,
- Top = 9,
- Shoe = 10,
- Head = 11,
- Wing = 12,
- Dress = 13,
- Mouse = 14,
- Headwear = 15,
- }
- public class ExchangeInfo
- {
- public float Rate;
- public double Value;
- public Current Current;
- public static void GetExchangeValue(ExchangeInfo info, StaticsManager.ConsumeModule consumeModule)
- {
- if (info.Current == Current.Coin)
- {
- Manager.AddCoin(info.Value, StaticsManager.ItemID.获得金币, consumeModule);
- }
- else if (info.Current == Current.Diamond)
- {
- Manager.AddDiamond(info.Value, StaticsManager.ItemID.获得钻石, consumeModule);
- }
- }
- public static ExchangeInfo GetExchangeInfo(Current current, double amt, float rate)
- {
- ExchangeInfo info = new ExchangeInfo();
- info.Rate = rate;
- info.Value = amt * rate;
- info.Current = current;
- return info;
- }
- }
- public class CloseItemLabel
- {
- public static string Icon1 = "Icon1";
- public static string Icon2 = "Icon2";
- public static string Icon3 = "Icon3";
- public static string CloseItem = "CloseItem";
- public static string BuyBtn = "BuyBtn";
- public static string BuyBtnLab = "BuyBtnLab";
- }
- public class CloseItem
- {
- public enum CloseType
- {
- Top,
- Hair,
- Wing,
- Dress,
- Decarator,
- Shoe,
- }
- #region Var
- public string Name
- {
- get { return LabelUtility.CombineLanguageLabel(LanguageLabel.DressRoom, FullID); }
- }
- public static string IDPrefix = "Armature";
- public string FullID
- {
- get { return IDPrefix + id; }
- }
- public int id;
- public int Index;
- public int BuyLevel;
- public int PixelSize;
- public bool Possess;
- public string ArmatureName;
- public string[] ExtraArmatureNames;
- public BodyPart[] ExtraBodyParts;
- public float SpriteAlpha;
- public float IconOffset;
- public Text BuyBtnLab;
- public Sprite[] Sprites;
- public Image Icon1;
- public Image Icon2;
- public Image Icon3;
- public Button BuyBtn;
- public Button DressBtn;
- public Vector2 IconOffset1;
- public Vector2 IconOffset2;
- public BodyPart BodyPart;
- public Transform Transform;
- public CloseType Type;
- public bool Ignore;
- public double BuyAmt;
- public double BuyAdvanceAmt;
- public Current BuyCurrent;
- public Current BuyAdvanceCurrent;
- public Dictionary<string, Transform> ChildDic = new Dictionary<string, Transform>();
- #endregion
- public CloseItem(XmlAttributeCollection attribute)
- {
- Ignore = Auxiliary.StringToBool(attribute[19].Value, false);
- id = Auxiliary.StringToInt(attribute[0].Value, -1);
- BodyPart = BodyPartParse(attribute[4].Value);
- ArmatureName = attribute[16].Value;
- PlayerManager.CloseIDDic.Add(ArmatureName, id);
- PlayerManager.CloseItemDic.Add(id, this);
- if (Ignore)
- {
- return;
- }
- Type = TypeParse(attribute[2].Value);
- Index = Auxiliary.StringToInt(attribute[3].Value, -1);
- BuyLevel = Auxiliary.StringToInt(attribute[5].Value, 0);
- BuyCurrent = Auxiliary.CurrentParse(attribute[6].Value);
- BuyAmt = Auxiliary.StringToDouble(attribute[7].Value, 0);
- BuyAdvanceCurrent = Auxiliary.CurrentParse(attribute[8].Value);
- BuyAdvanceAmt = Auxiliary.StringToDouble(attribute[9].Value, 0);
- PixelSize = Auxiliary.StringToInt(attribute[10].Value, 100);
- IconOffset = Auxiliary.StringToFloat(attribute[11].Value, 0);
- IconOffset1 = Auxiliary.StringToVector(',', attribute[12].Value, new Vector3());
- IconOffset2 = Auxiliary.StringToVector(',', attribute[13].Value, new Vector3());
- Sprites = SpriteParse(attribute[14].Value);
- SpriteAlpha = Auxiliary.StringToFloat(attribute[15].Value, 1);
- ExtraBodyParts = BodyPartParses(attribute[17].Value);
- ExtraArmatureNames = Auxiliary.StringToStrings(',', attribute[18].Value, new List<string>()).ToArray();
- CreateItem();
- }
- protected void CreateItem()
- {
- Transform = ResourceManager.Get(ResourceLabel.CloseItem, Folder.UI, false, ResourceManager.Get(ObjectLabel.Canvas), false);
- if (Type == CloseType.Top)
- {
- Transform.SetParent(ResourceManager.Get(ObjectLabel.Pb_TopGrid));
- }
- else if (Type == CloseType.Hair)
- {
- Transform.SetParent(ResourceManager.Get(ObjectLabel.Pa_HairGrid));
- }
- else if (Type == CloseType.Dress)
- {
- Transform.SetParent(ResourceManager.Get(ObjectLabel.Pc_DressGrid));
- }
- else if (Type == CloseType.Wing)
- {
- Transform.SetParent(ResourceManager.Get(ObjectLabel.Pe_WingGrid));
- }
- else if (Type == CloseType.Decarator)
- {
- Transform.SetParent(ResourceManager.Get(ObjectLabel.Pd_DecaratorGrid));
- }
- else if (Type == CloseType.Shoe)
- {
- Transform.SetParent(ResourceManager.Get(ObjectLabel.Pf_ShoeGrid));
- }
- else
- {
- throw new Exception();
- }
- Transform.SetSiblingIndex(Index);
- Auxiliary.CompileDic(Transform, ChildDic);
- Icon1 = ChildDic[CloseItemLabel.Icon1].GetComponent<Image>();
- Icon2 = ChildDic[CloseItemLabel.Icon2].GetComponent<Image>();
- Icon3 = ChildDic[CloseItemLabel.Icon3].GetComponent<Image>();
- DressBtn = ChildDic[CloseItemLabel.CloseItem].GetComponent<Button>();
- BuyBtn = ChildDic[CloseItemLabel.BuyBtn].GetComponent<Button>();
- BuyBtnLab = ChildDic[CloseItemLabel.BuyBtnLab].GetComponent<Text>();
- BuyBtnLab.GetComponent<TextPlus>().SetY = true;
- float newSize = PixelSize / Sprites[0].rect.width;
- SetUpUI(newSize, new Vector2(), Icon1, Icon2, Icon3);
- if (BuyCurrent != Current.Free)
- {
- BuyBtnLab.text = Auxiliary.ImageParse(BuyCurrent) + Auxiliary.ShrinkNumberStr(BuyAmt);
- }
- if (BuyLevel > Manager.Level)
- {
- BuyBtn.interactable = false;
- BuyBtn.image.material = Lib.GrayMat;
- }
- BuyBtn.onClick.AddListener
- (
- () =>
- {
- AudioManager.PlayClip(AudioLabel.ClickButton);
- ResourceManager.Get(ObjectLabel.Pa_Info).TweenForCG();
- SetUpUI(newSize, new Vector2(0, 22), ResourceManager.Get<Image>(ObjectLabel.Pa_Icon1), ResourceManager.Get<Image>(ObjectLabel.Pa_Icon3), ResourceManager.Get<Image>(ObjectLabel.Pa_Icon2));
- ResourceManager.SetText(ObjectLabel.Pa_Lab, Name);
- ResourceManager.SetText(ObjectLabel.Pa_BtnLab, Language.GetStr(LanguageLabel.UI__Pa_BtnLab) + Auxiliary.ImageParse(BuyCurrent) + BuyAmt);
- ResourceManager.SetButtonEvent
- (
- ObjectLabel.Pa_Btn,
- OnBuy
- );
- }
- );
- DressBtn.onClick.AddListener
- (
- () =>
- {
- AudioManager.PlayClip(AudioLabel.ClickButton);
- if (BuyLevel > Manager.Level)
- {
- Bubble.Show(null, Language.GetStr(LanguageLabel.UI__P_Unlock));
- return;
- }
- ChangeDress(PlayerManager.Player);
- }
- );
- }
- protected Sprite[] SpriteParse(string str)
- {
- string[] spriteNames = str.Split(',');
- Sprite[] sprites = new Sprite[spriteNames.Length];
- for (int i = 0; i < spriteNames.Length; i++)
- {
- if (!PlayerManager.CloseSpriteDic.ContainsKey(spriteNames[i]))
- {
- Debug.Log(spriteNames[i]);
- }
- sprites[i] = PlayerManager.CloseSpriteDic[spriteNames[i]];
- }
- return sprites;
- }
- protected BodyPart BodyPartParse(string str)
- {
- int type = Auxiliary.StringToInt(str, -1);
- if (type == 1)
- {
- return BodyPart.Head;
- }
- else if (type == 2)
- {
- return BodyPart.Dress;
- }
- else if (type == 3)
- {
- return BodyPart.Shoe;
- }
- else if (type == 4)
- {
- return BodyPart.Headwear;
- }
- else if (type == 5)
- {
- return BodyPart.Top;
- }
- else if (type == 6)
- {
- return BodyPart.Wing;
- }
- else if (type == 7)
- {
- return BodyPart.LeftLongSleeve;
- }
- else if (type == 8)
- {
- return BodyPart.RightLongSleeve;
- }
- else if (type == 9)
- {
- return BodyPart.LeftShortSleeve;
- }
- else if (type == 10)
- {
- return BodyPart.RightShortSleeve;
- }
- else if (type == 11)
- {
- return BodyPart.Eye;
- }
- else if (type == 12)
- {
- return BodyPart.Mouse;
- }
- else
- {
- throw new Exception();
- }
- }
- protected BodyPart[] BodyPartParses(string str)
- {
- List<string> typeIDs = Auxiliary.StringToStrings(',', str, new List<string>());
- BodyPart[] bodyParts = new BodyPart[typeIDs.Count];
- for (int i = 0; i < typeIDs.Count; i++)
- {
- bodyParts[i] = BodyPartParse(typeIDs[i]);
- }
- return bodyParts;
- }
- protected CloseType TypeParse(string str)
- {
- int type = Auxiliary.StringToInt(str, -1);
- if (type == 1)
- {
- return CloseType.Hair;
- }
- else if (type == 2)
- {
- return CloseType.Top;
- }
- else if (type == 3)
- {
- return CloseType.Dress;
- }
- else if (type == 4)
- {
- return CloseType.Decarator;
- }
- else if (type == 5)
- {
- return CloseType.Wing;
- }
- else if (type == 6)
- {
- return CloseType.Shoe;
- }
- else
- {
- throw new Exception();
- }
- }
- public void SetUpUI(float newSize, Vector2 offset, Image icon1, Image icon2, Image icon3)
- {
- icon1.SetActive(false);
- icon3.SetActive(false);
- icon2.SetActive(true);
- icon2.sprite = Sprites[0];
- icon2.Resize(true, new Vector2(newSize, newSize));
- icon2.SetAlpha(SpriteAlpha);
- icon2.transform.localPosition = offset + new Vector2(0, IconOffset);
- if (Sprites.Length >= 2)
- {
- icon1.SetActive(true);
- icon1.sprite = Sprites[1];
- icon1.Resize(true, new Vector2(newSize, newSize));
- icon1.SetAlpha(SpriteAlpha);
- icon1.transform.localPosition = IconOffset1 * newSize + offset + new Vector2(0, IconOffset);
- }
- if (Sprites.Length >= 3)
- {
- icon3.SetActive(true);
- icon3.sprite = Sprites[2];
- icon3.Resize(true, new Vector2(newSize, newSize));
- icon3.SetAlpha(SpriteAlpha);
- icon3.transform.localPosition = IconOffset2 * newSize + offset + new Vector2(0, IconOffset);
- }
- }
- public void Unlock()
- {
- if (Ignore)
- {
- return;
- }
- Possess = true;
- BuyBtn.interactable = false;
- BuyBtn.image.material = Lib.GrayMat;
- BuyBtnLab.text = Language.GetStr(LanguageLabel.UI__P_BtnLab2);
- Manager.CloseAmt++;
- }
- public void OnBuy()
- {
- Manager.Pay
- (
- "",
- BuyAmt,
- BuyCurrent,
- () =>
- {
- OnBuySucceed();
- ResourceManager.Get(ObjectLabel.Pa_Info).TweenBacCG();
- ChangeDress(PlayerManager.Player);
- SaveDressData();
- },
- StaticsManager.ItemID.解锁服装,
- StaticsManager.ConsumeModule.Shop,
- true,
- false,
- () =>
- {
- PlayerManager.Player.Reset();
- TweenRoot tweenRoot = ResourceManager.Get(ObjectLabel.Pa_Info).TweenBacCG();
- tweenRoot.AddEventOnetime
- (
- EventType.BackwardFinish,
- () =>
- {
- PlayerManager.Player.Return();
- }
- );
- ResourceManager.Get(ObjectLabel.B_SignIn0).GetTweenCG().AddEventOnetime
- (
- EventType.ForwardFinish,
- () =>
- {
- ResourceManager.Get(ObjectLabel.F_Manage0).TweenForVec();
- }
- );
- }
- );
- }
- public void OnBuySucceed()
- {
- Unlock();
- AudioManager.PlayClip(AudioLabel.GetCurrent);
- PlayerManager.BoughtCloseList.UniqueAdd(id);
- HttpManager.Save();
- }
- public void ChangeDress(Player player)
- {
- player.ChangeClose(BodyPart, ArmatureName);
- if (Ignore)
- {
- return;
- }
- if (ExtraBodyParts.Length > 0)
- {
- player.ChangeClose(BodyPart.LeftLongSleeve, "Empty");
- player.ChangeClose(BodyPart.LeftShortSleeve, "Empty");
- player.ChangeClose(BodyPart.RightLongSleeve, "Empty");
- player.ChangeClose(BodyPart.RightShortSleeve, "Empty");
- }
- for (int i = 0; i < ExtraArmatureNames.Length; i++)
- {
- player.ChangeClose(ExtraBodyParts[i], ExtraArmatureNames[i]);
- }
- }
- public void SaveDressData() //仅在购买完成时调用
- {
- SaveDressData(BodyPart);
- if (BodyPart == BodyPart.Top)
- {
- PlayerManager.DressData[8] = "Empty";
- PlayerManager.DressData[9] = "Empty";
- PlayerManager.DressData[10] = "Empty";
- PlayerManager.DressData[11] = "Empty";
- foreach (var bodyPart in ExtraBodyParts)
- {
- SaveDressData(bodyPart);
- }
- }
- }
- public void SaveDressData(BodyPart bodyPart) //仅在购买完成时调用
- {
- if (bodyPart == BodyPart.LeftLongSleeve)
- {
- PlayerManager.DressData[8] = PlayerManager.Player.LeftLongSleeve;
- }
- else if (bodyPart == BodyPart.LeftShortSleeve)
- {
- PlayerManager.DressData[9] = PlayerManager.Player.LeftShortSleeve;
- }
- else if (bodyPart == BodyPart.RightLongSleeve)
- {
- PlayerManager.DressData[10] = PlayerManager.Player.RightLongSleeve;
- }
- else if (bodyPart == BodyPart.RightShortSleeve)
- {
- PlayerManager.DressData[11] = PlayerManager.Player.RightShortSleeve;
- }
- else if (bodyPart == BodyPart.Top)
- {
- PlayerManager.DressData[4] = PlayerManager.Player.Top;
- }
- else if (bodyPart == BodyPart.Shoe)
- {
- PlayerManager.DressData[2] = PlayerManager.Player.Shoe;
- }
- else if (bodyPart == BodyPart.Head)
- {
- PlayerManager.DressData[0] = PlayerManager.Player.Head;
- }
- else if (bodyPart == BodyPart.Wing)
- {
- PlayerManager.DressData[7] = PlayerManager.Player.Wing;
- }
- else if (bodyPart == BodyPart.Dress)
- {
- PlayerManager.DressData[1] = PlayerManager.Player.Dress;
- }
- else if (bodyPart == BodyPart.Headwear)
- {
- PlayerManager.DressData[3] = PlayerManager.Player.HeadWear;
- }
- else
- {
- throw new Exception();
- }
- }
- public void OnLevelChange()
- {
- if (Ignore)
- {
- return;
- }
- if (Possess)
- {
- return;
- }
- if (BuyLevel < Manager.Level)
- {
- BuyBtn.interactable = true;
- BuyBtn.image.material = null;
- }
- }
- public ExchangeInfo GetExchangeValue(float rate, StaticsManager.ConsumeModule consumeModule)
- {
- ExchangeInfo info = ExchangeInfo.GetExchangeInfo(BuyCurrent, BuyAmt, rate);
- ExchangeInfo.GetExchangeValue(info, consumeModule);
- return info;
- }
- }
- public enum PlayerDirection
- {
- Left = 0,
- Right = 1,
- }
- public class Player : Regist , IPointerClickHandler
- {
- #region 变量
- public static string IdleAnimationName = "newAnimation";
- public static string JumpAnimationName = "newAnimation1";
- public static string WalkAnimationName = "newAnimation2";
- public static string RunAnimationName = "newAnimation3";
- public static bool InDressRoom;
- public static float JumpFrequency;
- public PlayerDirection PlayerDirection
- {
- get { return playerDirection; }
- set
- {
- playerDirection = value;
- Flip(playerDirection);
- }
- }
- private PlayerDirection playerDirection = PlayerDirection.Left;
- public bool AnimLock1;
- public bool AnimLock2;
- public float JumpTime;
- public float JumpTimer;
- public MeshFilter ExpressionMeshFilter;
- public Dictionary<string, Transform> ChildDic = new Dictionary<string, Transform>();
- public static Dictionary<string, Vector3> LeftExpressionPositionDictionary = new Dictionary<string, Vector3>
- {
- {"郁闷", new Vector3(0, -0.22f, -0.00001f)},
- {"汗颜", new Vector3(0.35f, 0.91f, -0.00001f)},
- {"惊讶", new Vector3(0.09f, -0.07f, -0.00001f)},
- {"开心", new Vector3(0.1f, -0.22f, -0.00001f)},
- {"哭", new Vector3(0.07f, -0.64f, -0.00001f)},
- {"期待", new Vector3(0.04f, -0.20f, -0.00001f)},
- {"色咪咪", new Vector3(0.03f, -0.09f, -0.00001f)},
- {"委屈", new Vector3(0f, -0.27f, -0.00001f)},
- };
- public static Dictionary<string, Vector3> RightExpressionPositionDictionary = new Dictionary<string, Vector3>
- {
- {"郁闷", new Vector3(0, -0.22f, -0.00001f)},
- {"汗颜", new Vector3(-0.22f, 0.91f, -0.00001f)},
- {"惊讶", new Vector3(-0.09f, -0.07f, -0.00001f)},
- {"开心", new Vector3(-0.1f, -0.22f, -0.00001f)},
- {"哭", new Vector3(-0.07f, -0.64f, -0.00001f)},
- {"期待", new Vector3(-0.04f, -0.20f, -0.00001f)},
- {"色咪咪", new Vector3(-0.03f, -0.09f, -0.00001f)},
- {"委屈", new Vector3(0f, -0.27f, -0.00001f)},
- };
- #region 换装
- public Transform Shadow;
- private Transform Pivot
- {
- get
- {
- if (pivot == null)
- {
- pivot = UAC.transform.FindChild(PlayerLabel.Pivot);
- }
- return pivot;
- }
- }
- private Transform pivot;
- public string Eye;
- public string Top;
- public string Shoe;
- public string Head;
- public string Wing;
- public string Dress;
- public string Mouse;
- public string HeadWear;
- public string LeftLongSleeve;
- public string LeftShortSleeve;
- public string RightLongSleeve;
- public string RightShortSleeve;
- private string TempClose;
- public DragonBones.Slot NeckSlot;
- public DragonBones.Slot LeftHandSlot;
- public DragonBones.Slot RightHandSlot;
- public DragonBones.Slot LeftLegSlot;
- public DragonBones.Slot RightLegSlot;
- public DragonBones.Slot LeftShortSleeveSlot;
- public DragonBones.Slot RightShortSleeveSlot;
- public DragonBones.Slot EyeSlot;
- public DragonBones.Slot TopSlot;
- public DragonBones.Slot HeadSlot;
- public DragonBones.Slot DressSlot;
- public DragonBones.Slot WingSlot;
- public DragonBones.Slot MouseSlot;
- public DragonBones.Slot LeftShoeSlot;
- public DragonBones.Slot RightShoeSlot;
- public DragonBones.Slot HeadWearSlot;
- public UnityArmatureComponent UAC;
- public UnityArmatureComponent LeftLongSleeveUAC;
- public UnityArmatureComponent RightLongSleeveUAC;
- #endregion
- #endregion
- public override bool InitAtOnce()
- {
- if (base.InitAtOnce())
- {
- return true;
- }
- enabled = true;
- Auxiliary.CompileDic(transform, ChildDic);
- Vector3 bigShadowScale = new Vector3(1.820952f, 2.418199f, 1.820952f);
- Vector3 smallShadowScale = new Vector3(1.081191f, 1.435807f, 1.081191f);
- Shadow = ChildDic[PlayerLabel.Shadow];
- Shadow.CreateStreamScale
- (
- new List<float>() {0, 0, 0},
- new List<float>() {0.33f, 0.33f, 0.33f, 0.33f},
- new List<VecPair>() {new VecPair(bigShadowScale, smallShadowScale), new VecPair(smallShadowScale, bigShadowScale), new VecPair(bigShadowScale, smallShadowScale), new VecPair(smallShadowScale, bigShadowScale)},
- true,
- true,
- Curve.EaseOutQuad
- );
- MeshFilter meshFilter = Shadow.GetComponent<MeshFilter>();
- meshFilter.mesh = SpriteUtility.CreateMesh(ResourceManager.LoadSprite(ResourceLabel.FlowerShadow, Folder.Scene));
- meshFilter.mesh.SetUVs(1, Enumerable.Repeat(new Vector2(0, 1), meshFilter.mesh.vertices.Length).ToList());
- Shadow.GetComponent<MeshRenderer>().sharedMaterial = UnityFactory.Materials[0];
- ExpressionMeshFilter = ChildDic[PlayerLabel.ExpressionMeshFilter].GetComponent<MeshFilter>();
- ExpressionMeshFilter.GetComponent<MeshRenderer>().sharedMaterial = UnityFactory.Materials[0];
- return false;
- }
- public void Update()
- {
- if (InDressRoom)
- {
- JumpTimer += Time.deltaTime;
- if (JumpTimer > JumpTime)
- {
- if (!AnimLock1 && !AnimLock2)
- {
- PlayAnim(JumpAnimationName);
- }
- AnimLock2 = true;
- }
- if (JumpTimer > JumpFrequency)
- {
- AnimLock2 = false;
- JumpTime = Mathf.Lerp(0, JumpFrequency, Random.Range(0f, 1f));
- JumpTimer = 0;
- }
- }
- //if (GardenSmartFoxManager.GardenSmartFox.PlazaRoomManager.InPlazaRoom)
- //{
- // MoveThread();
- //}
- }
- public void OnStart(string str, EventObject eventObject)
- {
- if (eventObject.animationState.name == JumpAnimationName)
- {
- Shadow.StreamReForScale();
- AnimLock1 = true;
- TempClose = Eye;
- ChangeClose(BodyPart.Eye, "眼睛表情1");
- }
- else if (eventObject.animationState.name == IdleAnimationName)
- {
- AnimLock1 = false;
- if (TempClose != null)
- {
- ChangeClose(BodyPart.Eye, TempClose);
- }
- }
- }
- public string CurrentAnimationName;
- public void PlayAnim(string animName)
- {
- if (AnimLock1)
- {
- return;
- }
- if (UAC.anim.lastAnimationName == animName)
- {
- return;
- }
- if (SFSManager.GardenSmartFox.PlazaRoomController.JoinedPlazaRoom)
- {
- CurrentAnimationName = animName;
- }
- UAC.anim.FadeIn(animName, GetFadeInTime(UAC.anim.lastAnimationName, animName));
- }
- public float GetFadeInTime(string lastAnimation, string targetAnimation)
- {
- if (lastAnimation == JumpAnimationName && targetAnimation == IdleAnimationName)
- return -1f;
- else
- return 0.1f;
- //throw new Exception();
- }
- public void SetAllCollider(bool enable)
- {
- BoxCollider2D[] colliders = GetComponentsInChildren<BoxCollider2D>();
- for (int i = 0; i < colliders.Length; i++)
- {
- colliders[i].enabled = enable;
- }
- }
- public void OnPointerClick(PointerEventData eventData)
- {
- AudioManager.PlayClip(AudioLabel.GetCurrent);
- PlayAnim(JumpAnimationName);
- }
- public void ResetExpression()
- {
- ExpressionMeshFilter.SetActive(false);
- EyeSlot.UnityTransform.GetChild(0).SetActive(true);
- MouseSlot.UnityTransform.GetChild(0).SetActive(true);
- }
- private string ExpressionName;
- private Coroutine ResetExpressionCoroutine;
- public void ChangeExpression(string expressionName, float duration)
- {
- ExpressionName = expressionName;
- ExpressionMeshFilter.sharedMesh = SpriteUtility.CreateMesh(ResourceManager.LoadSprite(expressionName, Folder.Scene));
- ExpressionMeshFilter.mesh.SetUVs(1, Enumerable.Repeat(new Vector2(0, 1), ExpressionMeshFilter.mesh.vertices.Length).ToList());
- ExpressionMeshFilter.transform.parent = EyeSlot.UnityTransform;
- ExpressionMeshFilter.SetActive(true);
- EyeSlot.UnityTransform.GetChild(0).SetActive(false);
- MouseSlot.UnityTransform.GetChild(0).SetActive(false);
- FlipExpression(expressionName, PlayerDirection);
- if (ResetExpressionCoroutine != null)
- Auxiliary.Instance.StopCoroutine(ResetExpressionCoroutine);
- ResetExpressionCoroutine = Auxiliary.Instance.DelayCall
- (
- () =>
- {
- ResetExpression();
- },
- duration
- );
- }
- public void Flip(PlayerDirection direction)
- {
- FlipExpression(ExpressionName, direction);
- if (direction == PlayerDirection.Left)
- {
- UAC.armature.flipX = false;
- playerDirection = PlayerDirection.Left;
- }
- else if (direction == PlayerDirection.Right)
- {
- UAC.armature.flipX = true;
- playerDirection = PlayerDirection.Right;
- }
- else
- {
- throw new Exception();
- }
- DelayCall.Call(1, () => Shadow.SetX(Pivot.position.x));
- }
- public void FlipExpression(string expressionName, PlayerDirection direction)
- {
- if (string.IsNullOrEmpty(ExpressionName))
- {
- return;
- }
- if (direction == PlayerDirection.Left)
- {
- ExpressionMeshFilter.transform.eulerAngles = new Vector3();
- ExpressionMeshFilter.transform.localPosition = LeftExpressionPositionDictionary[ExpressionName];
- }
- else if (direction == PlayerDirection.Right)
- {
- UAC.armature.flipX = true;
- ExpressionMeshFilter.transform.eulerAngles = new Vector3(0, 180, 0);
- ExpressionMeshFilter.transform.localPosition = RightExpressionPositionDictionary[ExpressionName];
- playerDirection = PlayerDirection.Right;
- }
- else
- {
- throw new Exception();
- }
- }
- public void Save(bool showNavigate)
- {
- AudioManager.PlayClip(AudioLabel.ClickButton);
- List<CloseItem> closeUnitList = new List<CloseItem>();
- closeUnitList.Add(PlayerManager.CloseItemDic[PlayerManager.CloseIDDic[Head]]);
- closeUnitList.Add(PlayerManager.CloseItemDic[PlayerManager.CloseIDDic[Dress]]);
- closeUnitList.Add(PlayerManager.CloseItemDic[PlayerManager.CloseIDDic[Shoe]]);
- closeUnitList.Add(PlayerManager.CloseItemDic[PlayerManager.CloseIDDic[HeadWear]]);
- closeUnitList.Add(PlayerManager.CloseItemDic[PlayerManager.CloseIDDic[Top]]);
- if (Wing != "Empty")
- {
- closeUnitList.Add(PlayerManager.CloseItemDic[PlayerManager.CloseIDDic[Wing]]);
- }
- for (int i = 0; i < closeUnitList.Count; i++)
- {
- if (!closeUnitList[i].Possess)
- {
- if (showNavigate)
- {
- BuyNavigate(closeUnitList);
- }
- return;
- }
- }
- PlayerManager.DressData[0] = Head;
- PlayerManager.DressData[1] = Dress;
- PlayerManager.DressData[2] = Shoe;
- PlayerManager.DressData[3] = HeadWear;
- PlayerManager.DressData[4] = Top;
- PlayerManager.DressData[7] = Wing;
- PlayerManager.DressData[8] = LeftLongSleeve;
- PlayerManager.DressData[9] = LeftShortSleeve;
- PlayerManager.DressData[10] = RightLongSleeve;
- PlayerManager.DressData[11] = RightShortSleeve;
- }
- public void Reset()
- {
- AudioManager.PlayClip(AudioLabel.ClickButton);
- List<string> dressData = new List<string>(PlayerManager.DressData);
- dressData[5] = Eye;
- PlayerManager.BuildPlayer(dressData);
- }
- public void Return()
- {
- bool allSave = true;
- bool allBought = true;
- List<string> currentDerssData = new List<string>() {Head, Dress, Shoe, HeadWear, Top, Wing};
- for (int i = 0; i < currentDerssData.Count; i++)
- {
- if (!PlayerManager.CloseIDDic.ContainsKey(currentDerssData[i]))
- {
- continue;
- }
- int id = PlayerManager.CloseIDDic[currentDerssData[i]];
- allBought = allBought && PlayerManager.CloseItemDic[id].Possess;
- //Debug.Log(ManaPlayer.CloseUnitDic[id].Name + " " + ManaPlayer.CloseUnitDic[id].Bought);
- allSave = allSave && currentDerssData[i] == PlayerManager.DressData[i];
- }
- if (allBought)
- {
- if (allSave)
- {
- ExitDressRoom();
- }
- else
- {
- Reset();
- ExitDressRoom();
- }
- }
- else
- {
- Bubble.Show
- (
- null, Language.GetStr(LanguageLabel.UI__P_Return), null, null,
- () =>
- {
- Reset();
- ResourceManager.Get(ObjectLabel.K_Bubble).GetTweenGra().AddEventOnetime(EventType.BackwardFinish, () => { ExitDressRoom(); });
- }
- );
- }
- }
- public void BuyNavigate(List<CloseItem> closeUnitList)
- {
- for (int i = 0; i < closeUnitList.Count; i++)
- {
- if (closeUnitList[i].Possess)
- {
- closeUnitList.RemoveAt(i--);
- }
- else
- {
- closeUnitList[i].BuyBtn.onClick.Invoke();
- closeUnitList.RemoveAt(i--);
- ResourceManager.Get(ObjectLabel.Pa_Info).GetTweenCG().AddEventOnetime
- (
- EventType.BackwardFinish,
- () =>
- {
- if (closeUnitList.Count == 0)
- {
- Save(false);
- }
- else
- {
- BuyNavigate(closeUnitList);
- }
- }
- );
- return;
- }
- }
- }
- public void ExitDressRoom()
- {
- Manager.SceneSwitchLock = false;
- TweenRoot tweenRoot = ResourceManager.Get(ObjectLabel.I_BlackMask).TweenBacCG();
- tweenRoot.AddEventOnetime
- (
- EventType.BackwardFinish,
- () =>
- {
- transform.SetParent(ResourceManager.Get(GardenLabel.GardenNormal));
- transform.position = ResourceManager.Get(GardenLabel.PlayerPosTra).position;
- transform.localScale = ResourceManager.Get(GardenLabel.PlayerPosTra).lossyScale;
- ResourceManager.Get(ResourceLabel.Garden).TweenForSr();
- ResourceManager.Get(DressroomLabel.DressRoom).TweenBacSr();
- ResourceManager.Get(ObjectLabel.C_Main).TweenForCG();
- ResourceManager.Get(ObjectLabel.P_DressRoom).TweenBacCG();
- }
- );
- tweenRoot = ResourceManager.Get(ObjectLabel.P_DressRoom).GetTweenCG();
- tweenRoot.AddEventOnetime
- (
- EventType.BackwardFinish,
- () =>
- {
- SetAllCollider(true);
- InDressRoom = false;
- JumpTimer = 0;
- PlayAnim(IdleAnimationName);
- DeactiveShadow();
- ResourceManager.Get(ObjectLabel.B_SignIn0).TweenForCG();
- ResourceManager.Get(ObjectLabel.I_BlackMask).TweenForCG();
- }
- );
- }
- public void EnterDressRoom()
- {
- if (Manager.SceneSwitchLock)
- {
- return;
- }
- ResourceManager.Get(ObjectLabel.B_SignIn0).TweenBacCG();
- InDressRoom = true;
- JumpTime = Mathf.Lerp(0, 10, Random.Range(0.5f, 1f));
- Manager.SceneSwitchLock = true;
- ResourceManager.Get(ObjectLabel.C_Main).TweenBacCG();
- SetAllCollider(false);
- TweenRoot tweenRoot = ResourceManager.Get(ObjectLabel.I_BlackMask).TweenBacCG();
- tweenRoot.AddEventOnetime
- (
- EventType.BackwardFinish,
- () =>
- {
- GardenManager.RetrieveAllElf();
- IAPManager.RetrieveADChest();
- ActiveShadow();
- transform.SetParent(ResourceManager.Get(DressroomLabel.DressRoom));
- transform.position = ResourceManager.Get(DressroomLabel.DressRoomPos).position;
- transform.localScale = ResourceManager.Get(DressroomLabel.DressRoomPos).lossyScale;
- ResourceManager.Get(ResourceLabel.Garden).TweenBacSr();
- ResourceManager.Get(DressroomLabel.DressRoom).TweenForSr();
- ResourceManager.Get(ObjectLabel.P_DressRoom).TweenForCG();
- }
- );
- tweenRoot = ResourceManager.Get(ObjectLabel.P_DressRoom).GetTweenCG();
- tweenRoot.AddEventOnetime
- (
- EventType.ForwardFinish,
- () =>
- {
- ResourceManager.Get(ObjectLabel.I_BlackMask).TweenForCG();
- }
- );
- }
- public void ActiveShadow()
- {
- ChildDic[PlayerLabel.ShadowParent].SetActive(true);
- ChildDic[PlayerLabel.ShadowParent].SetLZ(3);
- }
- public void DeactiveShadow()
- {
- Shadow.GetStreamScale().Pause();
- Shadow.GetStreamScale().InOrigin = true;
- ChildDic[PlayerLabel.ShadowParent].SetActive(false);
- }
- #region 换装
- public void CorrectPivot()
- {
- List<Transform> children = new List<Transform>();
- while (transform.childCount > 0)
- {
- children.Add(transform.GetChild(0));
- children.Back(0).parent = null;
- }
- Vector3 offset = Pivot.position - transform.position;
- children[0].position += offset;
- children[1].position += offset;
- transform.position += offset;
- foreach (var collider in GetComponents<BoxCollider2D>())
- {
- collider.offset -= new Vector2(offset.x, offset.y);
- }
- for (int i = 0; i < children.Count; i++)
- {
- children[i].parent = transform;
- }
- }
- public UnityArmatureComponent Build()
- {
- if (!PlayerManager.Complete)
- {
- UnityFactory.factory.LoadDragonBonesData(ResourceManager.Load<TextAsset>(ResourceLabel.StandSke, Folder.Config));
- UnityFactory.factory.LoadTextureAtlasData(ResourceManager.Load<TextAsset>(ResourceLabel.StandTex, Folder.Config), ResourceLabel.StandTexture);
- PlayerManager.Complete = true;
- }
- UAC = UnityFactory.factory.BuildArmatureComponent("Armature");
-
- UAC.transform.parent = transform;
- UAC.transform.localScale = new Vector3(1, 1, 1);
- UAC.transform.localPosition = new Vector3();
- UAC.anim.Play(IdleAnimationName);
- UAC.AddEventListener(EventObject.START, OnStart);
- Eye = "眼睛1";
- Top = "上衣1";
- Shoe = "鞋子1";
- Head = "脑壳1";
- Wing = "Empty";
- Dress = "裙子1";
- Mouse = "嘴巴1";
- HeadWear = "头饰品1";
- NeckSlot = UAC.armature.GetSlot("脖子");
- LeftHandSlot = UAC.armature.GetSlot("左手");
- RightHandSlot = UAC.armature.GetSlot("右手");
- LeftLegSlot = UAC.armature.GetSlot("左腿");
- RightLegSlot = UAC.armature.GetSlot("右腿");
- LeftLongSleeveUAC = UAC.transform.FindChild("长袖9左 (长袖9左)").GetComponent<UnityArmatureComponent>();
- RightLongSleeveUAC = UAC.transform.FindChild("长袖9右 (长袖9右)").GetComponent<UnityArmatureComponent>();
- LeftShortSleeveSlot = UAC.armature.GetSlot("上衣1袖子左");
- RightShortSleeveSlot = UAC.armature.GetSlot("上衣1袖子右");
- EyeSlot = UAC.armature.GetSlot("眼睛");
- TopSlot = UAC.armature.GetSlot("上衣");
- HeadSlot = UAC.armature.GetSlot("脑壳");
- WingSlot = UAC.armature.GetSlot("翅膀");
- DressSlot = UAC.armature.GetSlot("裙子");
- MouseSlot = UAC.armature.GetSlot("嘴巴");
- LeftShoeSlot = UAC.armature.GetSlot("鞋子左");
- RightShoeSlot = UAC.armature.GetSlot("鞋子右");
- HeadWearSlot = UAC.armature.GetSlot("头饰品");
- ChangeClose(BodyPart.Eye, "眼睛1", false);
- ChangeClose(BodyPart.Top, "上衣1", false);
- ChangeClose(BodyPart.Shoe, "鞋子1", false);
- ChangeClose(BodyPart.Head, "脑壳1", false);
- ChangeClose(BodyPart.Dress, "裙子1", false);
- ChangeClose(BodyPart.Mouse, "嘴巴1", false);
- ChangeClose(BodyPart.Headwear, "头饰品1", false);
- ChangeClose(BodyPart.LeftLongSleeve, "Empty", false);
- ChangeClose(BodyPart.RightLongSleeve, "Empty", false);
- ChangeClose(BodyPart.LeftShortSleeve, "短袖2左", false);
- ChangeClose(BodyPart.RightShortSleeve, "短袖2右", false);
- CorrectPivot();
- return UAC;
- }
- public UnityArmatureComponent BuildPink()
- {
- Build();
- ChangeClose(BodyPart.Eye, "眼睛3", false);
- ChangeClose(BodyPart.Top, "上衣3", false);
- ChangeClose(BodyPart.Shoe, "鞋子3", false);
- ChangeClose(BodyPart.Head, "脑壳3", false);
- ChangeClose(BodyPart.Wing, "Empty", false);
- ChangeClose(BodyPart.Dress, "裙子3", false);
- ChangeClose(BodyPart.Mouse, "嘴巴3", false);
- ChangeClose(BodyPart.Headwear, "头饰品3", false);
- ResetDepth();
- return UAC;
- }
- public UnityArmatureComponent BuildBlond()
- {
- Build();
- ChangeClose(BodyPart.Wing, "Empty", false);
- ResetDepth();
- return UAC;
- }
- public UnityArmatureComponent BuildBrown()
- {
- Build();
- ChangeClose(BodyPart.Eye, "眼睛2", false);
- ChangeClose(BodyPart.Top, "上衣2", false);
- ChangeClose(BodyPart.Shoe, "鞋子2", false);
- ChangeClose(BodyPart.Head, "脑壳2", false);
- ChangeClose(BodyPart.Wing, "Empty", false);
- ChangeClose(BodyPart.Dress, "裙子2", false);
- ChangeClose(BodyPart.Mouse, "嘴巴2", false);
- ChangeClose(BodyPart.Headwear, "头饰品2", false);
- ResetDepth();
- return UAC;
- }
- public void ResetDepth()
- {
- UAC.transform.SetLZ(2.5f);
- WingSlot.UnityTransform.SetLZ(0);
- EyeSlot.UnityTransform.SetLZ(0);
- TopSlot.UnityTransform.SetLZ(0);
- MouseSlot.UnityTransform.SetLZ(0);
- HeadWearSlot.UnityTransform.SetLZ(0);
- LeftShoeSlot.UnityTransform.SetLZ(0);
- RightShoeSlot.UnityTransform.SetLZ(0);
- LeftLegSlot.UnityTransform.SetLZ(0);
- RightLegSlot.UnityTransform.SetLZ(0);
- NeckSlot.UnityTransform.SetLZ(0);
- LeftHandSlot.UnityTransform.SetLZ(0);
- RightHandSlot.UnityTransform.SetLZ(0);
- LeftShortSleeveSlot.UnityTransform.SetLZ(0);
- RightShortSleeveSlot.UnityTransform.SetLZ(0);
- WingSlot.SetLZ(0.00003f);
- EyeSlot.SetLZ(-0.00001f);
- TopSlot.SetLZ(-0.00003f);
- MouseSlot.SetLZ(-0.00001f);
- HeadWearSlot.SetLZ(-0.00001f);
- HeadSlot.UnityTransform.SetLZ(0);
- if (HeadSlot.UnityTransform.childCount > 1)
- {
- HeadSlot.UnityTransform.GetChild(0).SetLZ(0.00002f);
- HeadSlot.UnityTransform.GetChild(1).SetLZ(0f);
- }
- DressSlot.UnityTransform.SetLZ(-0.00002f);
- if (DressSlot.UnityTransform.childCount > 1)
- {
- DressSlot.UnityTransform.GetChild(0).SetLZ(0.00002f);
- DressSlot.UnityTransform.GetChild(1).SetLZ(0f);
- }
- LeftShoeSlot.SetLZ(-0.00001f);
- RightShoeSlot.SetLZ(-0.00001f);
- LeftLegSlot.SetLZ(0);
- RightLegSlot.SetLZ(0);
- NeckSlot.SetLZ(0.00001f);
- LeftHandSlot.SetLZ(-0.00001f);
- RightHandSlot.SetLZ(-0.00001f);
- LeftShortSleeveSlot.SetLZ(-0.000015f);
- RightShortSleeveSlot.SetLZ(-0.000015f);
- LeftLongSleeveUAC.transform.SetLZ(-0.000015f);
- RightLongSleeveUAC.transform.SetLZ(-0.000015f);
- }
- public void ChangeClose(BodyPart bodyPart, string armatureName, bool setDepth = true)
- {
- // Debug.Log (bodyPart + " " + armatureName);
- List<DragonBones.Slot> slotList = new List<DragonBones.Slot>();
- if (bodyPart == BodyPart.Eye)
- {
- Eye = armatureName;
- slotList.Add(EyeSlot);
- }
- else if (bodyPart == BodyPart.Top)
- {
- Top = armatureName;
- slotList.Add(TopSlot);
- }
- else if (bodyPart == BodyPart.Shoe)
- {
- Shoe = armatureName;
- slotList.Add(LeftShoeSlot);
- slotList.Add(RightShoeSlot);
- }
- else if (bodyPart == BodyPart.Head)
- {
- Head = armatureName;
- slotList.Add(HeadSlot);
- }
- else if (bodyPart == BodyPart.Wing)
- {
- if (Wing == armatureName)
- {
- return;
- }
- else
- {
- Wing = armatureName;
- slotList.Add(WingSlot);
- }
- }
- else if (bodyPart == BodyPart.Dress)
- {
- Dress = armatureName;
- slotList.Add(DressSlot);
- }
- else if (bodyPart == BodyPart.Mouse)
- {
- Mouse = armatureName;
-
- slotList.Add(MouseSlot);
- }
- else if (bodyPart == BodyPart.Headwear)
- {
- HeadWear = armatureName;
- slotList.Add(HeadWearSlot);
- }
- else if (bodyPart == BodyPart.Leg)
- {
- slotList.Add(LeftLegSlot);
- slotList.Add(RightLegSlot);
- }
- else if (bodyPart == BodyPart.LeftHand)
- {
- slotList.Add(LeftHandSlot);
- }
- else if (bodyPart == BodyPart.RightHand)
- {
- slotList.Add(RightHandSlot);
- }
- else if (bodyPart == BodyPart.Neck)
- {
- slotList.Add(NeckSlot);
- }
- else if (bodyPart == BodyPart.LeftLongSleeve)
- {
- LeftLongSleeve = armatureName;
- ChangeClose(LeftLongSleeveUAC, armatureName);
- return;
- }
- else if (bodyPart == BodyPart.LeftShortSleeve)
- {
- LeftShortSleeve = armatureName;
-
- slotList.Add(LeftShortSleeveSlot);
- }
- else if (bodyPart == BodyPart.RightLongSleeve)
- {
- RightLongSleeve = armatureName;
- ChangeClose(RightLongSleeveUAC, armatureName);
- return;
- }
- else if (bodyPart == BodyPart.RightShortSleeve)
- {
- RightShortSleeve = armatureName;
- slotList.Add(RightShortSleeveSlot);
- }
- else
- {
- throw new Exception();
- }
- ChangeClose(slotList, armatureName, setDepth);
- if (bodyPart == BodyPart.Wing)
- {
- TweenRoot tweenRoot = transform.FindChild("Armature/" + Wing).GetChild(0).CreateTweenScale(new Vector3(1, 1, 1), new Vector3(0.6f, 1, 1), 0.75f, true, true, Curve.Linear);
- tweenRoot.PingPong = true;
- tweenRoot.StartForward();
- }
- }
- public void ChangeClose(List<DragonBones.Slot> slotList, string armatureName, bool setDepth = true)
- {
- for (int i = 0; i < slotList.Count; i++)
- {
- slotList[i].childArmature = UnityFactory.factory.BuildArmature(armatureName, null, null, null, true);
- slotList[i].UnityTransform = slotList[i].childArmature.UnityTransform.parent;
- }
- if (setDepth)
- {
- ResetDepth();
- }
- }
- public void ChangeClose(UnityArmatureComponent uac, string armatureName, bool setDepth = true)
- {
- if (armatureName == "Empty")
- {
- uac.SetActive(false);
- }
- else
- {
- uac.SetActive(true);
- }
- if (setDepth)
- {
- ResetDepth();
- }
- }
- #endregion
- }
|