|
@@ -0,0 +1,647 @@
|
|
|
+using ET;
|
|
|
+using System;
|
|
|
+using System.Collections;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.Text.RegularExpressions;
|
|
|
+using UnityEngine;
|
|
|
+using Live2D.Cubism.Rendering;
|
|
|
+using FairyGUI;
|
|
|
+using UI.MatchingCompetition;
|
|
|
+
|
|
|
+namespace GFGGame
|
|
|
+{
|
|
|
+ class MatchingCompetitionDataManager : SingletonBase<MatchingCompetitionDataManager>
|
|
|
+ {
|
|
|
+ ////搭配赛标记
|
|
|
+ //public int type = 2;
|
|
|
+ //位置信息数据索引
|
|
|
+ public int indexRoleData = 0;
|
|
|
+ //人物位置信息
|
|
|
+ public TransformData roleTransFormData = new TransformData();
|
|
|
+ public GameObject roleGameobj;
|
|
|
+ public string roleID = "Role";
|
|
|
+ //*********************搭配数据*********************************
|
|
|
+ //需要传输的数据:MathingDressDate,DressUpBgID,DressPropIdList,TransformDataList,
|
|
|
+ public DressUpData MathingDressDate = DressUpData.CreateDefault();
|
|
|
+ public int DressUpBgID = 0;
|
|
|
+ //*****这两个id放列表的最后面
|
|
|
+ //边框id
|
|
|
+ public int BorderID = 0;
|
|
|
+ //NpcId
|
|
|
+ public int NpcID = 0;
|
|
|
+ //*************=**************
|
|
|
+ //道具数据,一一对应
|
|
|
+ //场景名字,自己搭配的数据
|
|
|
+ public List<string> DressPropNameList = new List<string>();
|
|
|
+ //道具id
|
|
|
+ //public List<int> DressPropIdList = new List<int>();
|
|
|
+ //道具索引
|
|
|
+ public int DressPropIndex = 0;
|
|
|
+ //道具索引字典
|
|
|
+ public Dictionary<string, TransformData> DressPropTransInfoDic = new Dictionary<string, TransformData>();
|
|
|
+ //道具位置信息
|
|
|
+ public List<TransformData> TransformDataList = new List<TransformData>();
|
|
|
+ public List<GameObject> itemGameObjs = new List<GameObject>();
|
|
|
+
|
|
|
+ //所有信息的列表,用于前后端交互
|
|
|
+ public List<CollocationInfo> AllDressIDInfoList = new List<CollocationInfo>();
|
|
|
+ //public List<int> _equipSceneData = new List<int>();//当前穿戴的场景数据(从套装获得)
|
|
|
+ //***************************************************************
|
|
|
+
|
|
|
+ public int MatchingCompetitionSeason = 1;
|
|
|
+ public int MatchingState = 1;
|
|
|
+ public long MatchingEndTimes = 0;
|
|
|
+ public long WorksID = 0;
|
|
|
+ public string TempPictureUrl = "";
|
|
|
+ public int MatchingRemainingTimes = 1;
|
|
|
+ public MyWorksIdInfo myWorks = new MyWorksIdInfo();
|
|
|
+ public List<ItemInfoProto> SpecialBonusList = new List<ItemInfoProto>();
|
|
|
+ /// <summary>
|
|
|
+ /// 搭配赛相册
|
|
|
+ /// </summary>
|
|
|
+ /// <typeparam name="PoemPhotoData"></typeparam>
|
|
|
+ /// <returns></returns>
|
|
|
+ public List<PoemPhotoData> MatchingPhotoInfos = new List<PoemPhotoData>();
|
|
|
+ //角色详情界面图片信息
|
|
|
+ public NTexture DetailNtexture;
|
|
|
+ //自己的搭配图片
|
|
|
+ public NTexture MyNtextture;
|
|
|
+ public byte[] MyBytes;
|
|
|
+ //本期排行榜数据
|
|
|
+ public List<MatchingPhotoWorksData> _currentRankList = new List<MatchingPhotoWorksData>();
|
|
|
+ //往期作品集
|
|
|
+ public List<MatchingWorksData> _BeforeWorksList = new List<MatchingWorksData>();
|
|
|
+ //往期排行榜数据
|
|
|
+ public List<MatchingPhotoWorksData> _BeforeRankList = new List<MatchingPhotoWorksData>();
|
|
|
+
|
|
|
+ //根据时间判断:1:集结期 2:评选期 3;结算期
|
|
|
+ //public int CheckCompetitionState()
|
|
|
+ //{
|
|
|
+ // long currentTime = TimeHelper.ServerNow();
|
|
|
+ // DateTime dateTime = DateTimeOffset.FromUnixTimeSeconds(currentTime).DateTime;
|
|
|
+ // // 获取星期几
|
|
|
+ // DayOfWeek dayOfWeek = dateTime.DayOfWeek;
|
|
|
+ // int week = (int)dayOfWeek;
|
|
|
+ // int hour = dateTime.Hour;
|
|
|
+ // if(week == 0)
|
|
|
+ // {
|
|
|
+ // if(hour >= 21)
|
|
|
+ // {
|
|
|
+ // return 3;
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // return 2;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // if(week <= 3 && week >= 1)
|
|
|
+ // {
|
|
|
+ // if(week == 3 && hour >= 5)
|
|
|
+ // {
|
|
|
+ // return 2;
|
|
|
+ // }
|
|
|
+ // if(week == 1 && hour < 5)
|
|
|
+ // {
|
|
|
+ // return 3;
|
|
|
+ // }
|
|
|
+ // return 1;
|
|
|
+ // }
|
|
|
+ // else if(week > 3 && week <= 6)
|
|
|
+ // {
|
|
|
+ // return 2;
|
|
|
+ // }
|
|
|
+ // return -1;
|
|
|
+ //}
|
|
|
+
|
|
|
+ public void ConvertInfoToList()
|
|
|
+ {
|
|
|
+ //将所有需要存储的信息转换成list
|
|
|
+ AllDressIDInfoList.Clear();
|
|
|
+ foreach(var item in MathingDressDate.itemList)
|
|
|
+ {
|
|
|
+ CollocationInfo itemInfo = new CollocationInfo();
|
|
|
+ itemInfo.ItemId = item.ToString();
|
|
|
+ itemInfo.ClientPosition = "";
|
|
|
+ AllDressIDInfoList.Add(itemInfo);
|
|
|
+ }
|
|
|
+ foreach (var item in DressPropTransInfoDic)
|
|
|
+ {
|
|
|
+ CollocationInfo itemInfo = new CollocationInfo();
|
|
|
+ itemInfo.ItemId = item.Key;
|
|
|
+ string transStr = item.Value.position.x.ToString() + "_" + item.Value.position.y.ToString() + "_"
|
|
|
+ + item.Value.position.z.ToString()
|
|
|
+ + "_" + item.Value.rotationZ.ToString()
|
|
|
+ + "_" + item.Value.scale.x.ToString() + "_" +
|
|
|
+ item.Value.scale.y.ToString() + "_" + item.Value.scale.z.ToString();
|
|
|
+ itemInfo.ClientPosition = transStr;
|
|
|
+ AllDressIDInfoList.Add(itemInfo);
|
|
|
+ }
|
|
|
+ //for(int i = 0;i< DressPropIdList.Count;i++)
|
|
|
+ //{
|
|
|
+ // CollocationInfo itemInfo = new CollocationInfo();
|
|
|
+ // itemInfo.ItemId = DressPropIdList[i];
|
|
|
+ // string transStr = TransformDataList[i].position.x.ToString()+"_" + TransformDataList[i].position.y.ToString() + "_"
|
|
|
+ // + TransformDataList[i].position.z.ToString()
|
|
|
+ // + "_" + TransformDataList[i].rotationZ.ToString()
|
|
|
+ // + "_" + TransformDataList[i].scale.x.ToString() + "_" +
|
|
|
+ // TransformDataList[i].scale.y.ToString() + "_" + TransformDataList[i].scale.z.ToString();
|
|
|
+ // itemInfo.ClientPosition = transStr;
|
|
|
+ // AllDressIDInfoList.Add(itemInfo);
|
|
|
+ //}
|
|
|
+ CollocationInfo itemBgInfo = new CollocationInfo();
|
|
|
+ itemBgInfo.ItemId = MatchingCompetitionDataManager.Instance.DressUpBgID.ToString();
|
|
|
+ itemBgInfo.ClientPosition = "";
|
|
|
+ AllDressIDInfoList.Add(itemBgInfo);
|
|
|
+ CollocationInfo itemActionInfo = new CollocationInfo();
|
|
|
+ itemActionInfo.ItemId = MatchingCompetitionDataManager.Instance.MathingDressDate.actionId.ToString();
|
|
|
+ itemActionInfo.ClientPosition = "";
|
|
|
+ AllDressIDInfoList.Add(itemActionInfo);
|
|
|
+ }
|
|
|
+ //解析后台获取的信息
|
|
|
+ public void AnalysisInfoToList()
|
|
|
+ {
|
|
|
+ List<int> dressitemIDList = new List<int>();
|
|
|
+ List<int> propIDList = new List<int>();
|
|
|
+ List<TransformData> transDataList = new List<TransformData>();
|
|
|
+ DressUpBgID = 180001;
|
|
|
+ MathingDressDate.bgId = 180001;
|
|
|
+ MathingDressDate.actionId = 0;
|
|
|
+ DressPropTransInfoDic.Clear();
|
|
|
+ for (int i = 0; i < AllDressIDInfoList.Count; i++)
|
|
|
+ {
|
|
|
+ if(AllDressIDInfoList[i].ItemId == roleID)
|
|
|
+ {
|
|
|
+ //propIDList.Add(AllDressIDInfoList[i].ItemId);
|
|
|
+ //transDataList.Add(AnalysisStringToTransform(AllDressIDInfoList[i].ClientPosition));
|
|
|
+ DressPropTransInfoDic.Add(AllDressIDInfoList[i].ItemId.ToString(), AnalysisStringToTransform(AllDressIDInfoList[i].ClientPosition));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(GetIDByString(AllDressIDInfoList[i].ItemId));
|
|
|
+ if (itemCfg != null && itemCfg.itemType == ConstItemType.DRESS_UP)
|
|
|
+ {
|
|
|
+ if(itemCfg.subType == 19 || itemCfg.subType == 17 || itemCfg.subType == 21|| itemCfg.subType == 22)
|
|
|
+ {
|
|
|
+ //记录道具和位置信息
|
|
|
+ //propIDList.Add(GetIDByString(AllDressIDInfoList[i].ItemId));
|
|
|
+ //transDataList.Add(AnalysisStringToTransform(AllDressIDInfoList[i].ClientPosition));
|
|
|
+ if(GetIDListByString(AllDressIDInfoList[i].ItemId).Count > 1)
|
|
|
+ {
|
|
|
+ DressPropTransInfoDic.Add(AllDressIDInfoList[i].ItemId.ToString(), AnalysisStringToTransform(AllDressIDInfoList[i].ClientPosition));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (itemCfg != null && itemCfg.subType == ConstDressUpItemType.BEI_JING)
|
|
|
+ {
|
|
|
+ DressUpBgID = itemCfg.id;
|
|
|
+ MathingDressDate.bgId = itemCfg.id;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ dressitemIDList.Add(GetIDByString(AllDressIDInfoList[i].ItemId));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (itemCfg != null && itemCfg.itemType == ConstItemType.PHOTOGRAPH)
|
|
|
+ {
|
|
|
+ //记录道具和位置信息
|
|
|
+ //propIDList.Add(GetIDByString(AllDressIDInfoList[i].ItemId));
|
|
|
+ //transDataList.Add(AnalysisStringToTransform(AllDressIDInfoList[i].ClientPosition));
|
|
|
+ DressPropTransInfoDic.Add(AllDressIDInfoList[i].ItemId.ToString(), AnalysisStringToTransform(AllDressIDInfoList[i].ClientPosition));
|
|
|
+ }
|
|
|
+ else if(itemCfg == null)
|
|
|
+ {
|
|
|
+ SuitCfg actionId = SuitCfgArray.Instance.GetCfg(GetIDByString(AllDressIDInfoList[i].ItemId));
|
|
|
+ if(actionId !=null)
|
|
|
+ {
|
|
|
+ MathingDressDate.actionId = GetIDByString(AllDressIDInfoList[i].ItemId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ MathingDressDate.itemList = dressitemIDList;
|
|
|
+ //DressPropIdList = propIDList;
|
|
|
+ //TransformDataList = transDataList;
|
|
|
+ }
|
|
|
+ public TransformData AnalysisStringToTransform(string strTrans)
|
|
|
+ {
|
|
|
+ TransformData transData = new TransformData();
|
|
|
+ string[] parts = Regex.Split(strTrans, "_");
|
|
|
+ if(parts.Length > 6)
|
|
|
+ {
|
|
|
+ transData.position.x = float.Parse(parts[0]);
|
|
|
+ transData.position.y = float.Parse(parts[1]);
|
|
|
+ transData.position.z = float.Parse(parts[2]);
|
|
|
+ transData.rotationZ = float.Parse(parts[3]);
|
|
|
+ transData.scale.x = float.Parse(parts[4]);
|
|
|
+ transData.scale.y = float.Parse(parts[5]);
|
|
|
+ transData.scale.z = float.Parse(parts[6]);
|
|
|
+ }
|
|
|
+ return transData;
|
|
|
+ }
|
|
|
+ //存储道具信息
|
|
|
+ public void SetTransformData()
|
|
|
+ {
|
|
|
+ DressPropNameList.Clear();
|
|
|
+ TransformDataList.Clear();
|
|
|
+ DressPropTransInfoDic.Clear();
|
|
|
+ for (int i =0;i<itemGameObjs.Count;i++)
|
|
|
+ {
|
|
|
+ TransformData itemData = new TransformData();
|
|
|
+ if (itemGameObjs[i].name == "Role")
|
|
|
+ {
|
|
|
+ roleTransFormData.position = itemGameObjs[i].transform.position;
|
|
|
+ roleTransFormData.rotationZ = itemGameObjs[i].transform.eulerAngles.z;
|
|
|
+ roleTransFormData.scale = itemGameObjs[i].transform.localScale;
|
|
|
+ TransformDataList.Add(roleTransFormData);
|
|
|
+ DressPropNameList.Add(itemGameObjs[i].name);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ itemData.position = itemGameObjs[i].transform.position;
|
|
|
+ itemData.rotationZ = itemGameObjs[i].transform.eulerAngles.z;
|
|
|
+ itemData.scale = itemGameObjs[i].transform.localScale;
|
|
|
+ TransformDataList.Add(itemData);
|
|
|
+ DressPropNameList.Add(itemGameObjs[i].name);
|
|
|
+ }
|
|
|
+ DressPropTransInfoDic.Add(itemGameObjs[i].name, itemData);
|
|
|
+ }
|
|
|
+ //SetNameToIdList();
|
|
|
+ }
|
|
|
+ public int GetIDByString(string name)
|
|
|
+ {
|
|
|
+ int id = 0;
|
|
|
+ //使用正则表达式分割字符串
|
|
|
+ string[] parts = Regex.Split(name, "_");
|
|
|
+ if(parts.Length > 0)
|
|
|
+ {
|
|
|
+ if(parts[0] == "Role")
|
|
|
+ {
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ id = int.Parse(parts[0]);
|
|
|
+ }
|
|
|
+ return id;
|
|
|
+ }
|
|
|
+ public List<int> GetIDListByString(string name)
|
|
|
+ {
|
|
|
+ List<int> idList = new List<int>();
|
|
|
+ string[] parts = Regex.Split(name, "_");
|
|
|
+ foreach(string id in parts)
|
|
|
+ {
|
|
|
+ idList.Add(int.Parse(id));
|
|
|
+ }
|
|
|
+ return idList;
|
|
|
+ }
|
|
|
+ //将名字转换成道具id
|
|
|
+ //public void SetNameToIdList()
|
|
|
+ //{
|
|
|
+ // //DressPropIdList.Clear();
|
|
|
+ // int flog_prefix = 0;
|
|
|
+ // int flog_suffix = 0;
|
|
|
+ // for (int i = 0; i < DressPropNameList.Count; i++)
|
|
|
+ // {
|
|
|
+ // bool containsUnderscore = Regex.IsMatch(DressPropNameList[i], "_");
|
|
|
+ // if(!containsUnderscore)
|
|
|
+ // {
|
|
|
+ // if (DressPropNameList[i] == "Role")
|
|
|
+ // {
|
|
|
+ // DressPropIdList.Add(roleID);
|
|
|
+ // }
|
|
|
+ // else if (DressPropNameList[i] == "Border")
|
|
|
+ // {
|
|
|
+ // if (BorderID != 0)
|
|
|
+ // {
|
|
|
+ // DressPropIdList.Add(BorderID);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // else if (DressPropNameList[i] == "Npc")
|
|
|
+ // {
|
|
|
+ // if (NpcID != 0)
|
|
|
+ // {
|
|
|
+ // DressPropIdList.Add(NpcID);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // // 使用正则表达式分割字符串
|
|
|
+ // string[] parts = Regex.Split(DressPropNameList[i], "_");
|
|
|
+ // int partID = int.Parse(parts[0]);
|
|
|
+ // if(flog_prefix == int.Parse(parts[0]))
|
|
|
+ // {
|
|
|
+ // if((flog_suffix == 3 && int.Parse(parts[1]) == 1)|| (flog_suffix == 1 && int.Parse(parts[1]) == 3))
|
|
|
+ // {
|
|
|
+ // flog_prefix = 0;
|
|
|
+ // flog_suffix = 0;
|
|
|
+ // continue;
|
|
|
+ // }
|
|
|
+ // if ((flog_suffix == 2 && int.Parse(parts[1]) == 1) || (flog_suffix == 1 && int.Parse(parts[1]) == 2))
|
|
|
+ // {
|
|
|
+ // flog_prefix = 0;
|
|
|
+ // flog_suffix = 0;
|
|
|
+ // continue;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // flog_prefix = int.Parse(parts[0]);
|
|
|
+ // flog_suffix = int.Parse(parts[1]);
|
|
|
+ // DressPropIdList.Add(partID);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ //将穿戴数据分类
|
|
|
+ //public void ClassifyEquipData()
|
|
|
+ //{
|
|
|
+ // _equipSceneData.Clear();
|
|
|
+ // PhotographDataManager.Instance.dressUpObj = new DressUpObj();
|
|
|
+ // //for (int i = 0; i < MathingDressDate.itemList.Count; i++)
|
|
|
+ // //{
|
|
|
+ // // int itemId = MathingDressDate.itemList[i];
|
|
|
+ // // if (DressUpMenuItemCfg1Array.Instance.CheckIsSceneType(itemId, false))
|
|
|
+ // // {
|
|
|
+ // // if (!_equipSceneData.ContainsKey(itemId))
|
|
|
+ // // {
|
|
|
+ // // _equipSceneData.Add(itemId, new List<int>());
|
|
|
+ // // }
|
|
|
+ // // _equipSceneData[itemId].Add(itemId);
|
|
|
+ // // }
|
|
|
+ // //}
|
|
|
+ // for(int i =0;i<DressPropIdList.Count;i++)
|
|
|
+ // {
|
|
|
+ // int itemId = DressPropIdList[i];
|
|
|
+ // if (DressUpMenuItemCfg1Array.Instance.CheckIsSceneType(itemId, false))
|
|
|
+ // {
|
|
|
+ // _equipSceneData.Add(itemId);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ public void InsertGameObjectList()
|
|
|
+ {
|
|
|
+ int i = 0;
|
|
|
+ foreach(var item in DressPropTransInfoDic)
|
|
|
+ {
|
|
|
+ i++;
|
|
|
+ if (item.Key == roleID)
|
|
|
+ {
|
|
|
+ indexRoleData = i;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ indexRoleData = i;
|
|
|
+ }
|
|
|
+ if(itemGameObjs.Count ==0)
|
|
|
+ {
|
|
|
+ itemGameObjs.Add(roleGameobj);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (indexRoleData > itemGameObjs.Count)
|
|
|
+ {
|
|
|
+ itemGameObjs.Add(roleGameobj);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ itemGameObjs.Insert(indexRoleData, roleGameobj);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public void SetNumToRank(int index,UI_Component4 rankCom)
|
|
|
+ {
|
|
|
+ int c1 = 0;
|
|
|
+ int c2 = 0;
|
|
|
+ if(index<=3&& index >=1)
|
|
|
+ {
|
|
|
+ c2 = index;
|
|
|
+ }
|
|
|
+ if (index > 3 && index <= 9)
|
|
|
+ {
|
|
|
+ c1 = 0;
|
|
|
+ }
|
|
|
+ else if(index >9 && index <= 50)
|
|
|
+ {
|
|
|
+ c1 = 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ c1 = 2;
|
|
|
+ }
|
|
|
+ rankCom.m_c1.selectedIndex = c1;
|
|
|
+ rankCom.m_c2.selectedIndex = c2;
|
|
|
+ if(c1 == 0)
|
|
|
+ {
|
|
|
+ rankCom.m_num3.url = string.Format("ui://MatchingCompetition/{0}",index.ToString());
|
|
|
+ }
|
|
|
+ else if(c1 == 1)
|
|
|
+ {
|
|
|
+ int one = index / 10;
|
|
|
+ int two = index % 10;
|
|
|
+ rankCom.m_num1.url = string.Format("ui://MatchingCompetition/{0}", one.ToString());
|
|
|
+ rankCom.m_num2.url = string.Format("ui://MatchingCompetition/{0}", two.ToString());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (index == 0)
|
|
|
+ {
|
|
|
+ rankCom.m_RankText.text = "--";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ for (int i = 11; i < JudgingRoundRewardCfgArray.Instance.dataArray.Length-1; i++)
|
|
|
+ {
|
|
|
+ JudgingRoundRewardCfg judgingCfg = JudgingRoundRewardCfgArray.Instance.GetCfg(i);
|
|
|
+ JudgingRoundRewardCfg judgingNextCfg = JudgingRoundRewardCfgArray.Instance.GetCfg(i+1);
|
|
|
+ if (index >= judgingCfg.rank && index < judgingNextCfg.rank)
|
|
|
+ {
|
|
|
+ rankCom.m_RankText.text = judgingNextCfg.desc;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ rankCom.m_RankText.text = index.ToString();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ public async void AddSceneItem(ItemCfg itemCfg, bool setLayer,int isLeft = 0)
|
|
|
+ {
|
|
|
+ Vector3 pos = Vector3.zero;
|
|
|
+ if (!string.IsNullOrEmpty(itemCfg.resLayer3))
|
|
|
+ {
|
|
|
+ DressPropIndex++;
|
|
|
+ GameObject parentGameObj3 = new GameObject(string.Format("{0}_{1}_{2}", itemCfg.id, 3,DressPropIndex));
|
|
|
+ await PhotographSceneManager.Instance.AddSceneItem(parentGameObj3, itemCfg, 3, setLayer,false,isLeft);
|
|
|
+ if (setLayer)
|
|
|
+ {
|
|
|
+ if (parentGameObj3.transform.childCount > 0)
|
|
|
+ {
|
|
|
+ parentGameObj3.transform.localPosition = -parentGameObj3.transform.GetChild(0).localPosition;
|
|
|
+ pos = parentGameObj3.transform.localPosition;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrEmpty(itemCfg.resLayer2))
|
|
|
+ {
|
|
|
+ DressPropIndex++;
|
|
|
+ GameObject parentGameObj2 = new GameObject(string.Format("{0}_{1}_{2}", itemCfg.id, 2,DressPropIndex));
|
|
|
+ await PhotographSceneManager.Instance.AddSceneItem(parentGameObj2, itemCfg, 2, setLayer,false, isLeft);
|
|
|
+ if (setLayer)
|
|
|
+ {
|
|
|
+ if (parentGameObj2.transform.childCount > 0)
|
|
|
+ {
|
|
|
+ parentGameObj2.transform.localPosition = pos == Vector3.zero ? -parentGameObj2.transform.GetChild(0).localPosition : pos;
|
|
|
+ pos = parentGameObj2.transform.localPosition;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrEmpty(itemCfg.resLayer1))
|
|
|
+ {
|
|
|
+ DressPropIndex++;
|
|
|
+ GameObject parentGameObj1 = new GameObject(string.Format("{0}_{1}_{2}", itemCfg.id, 1, DressPropIndex));
|
|
|
+ await PhotographSceneManager.Instance.AddSceneItem(parentGameObj1, itemCfg, 1, setLayer, false, isLeft);
|
|
|
+
|
|
|
+ if (setLayer)
|
|
|
+ {
|
|
|
+ if (parentGameObj1.transform.childCount > 0)
|
|
|
+ {
|
|
|
+ parentGameObj1.transform.localPosition = pos == Vector3.zero ? -parentGameObj1.transform.GetChild(0).localPosition : pos;
|
|
|
+ pos = parentGameObj1.transform.localPosition;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public async void AddSceneItemOne(ItemCfg itemCfg, int layer,int index, int isLeft = 0, bool setLayer = true)
|
|
|
+ {
|
|
|
+ Vector3 pos = Vector3.zero;
|
|
|
+ if(DressPropIndex <= index)
|
|
|
+ {
|
|
|
+ DressPropIndex = index + 1;
|
|
|
+ }
|
|
|
+ GameObject parentGameObj3 = new GameObject(string.Format("{0}_{1}_{2}", itemCfg.id, layer, index));
|
|
|
+ await PhotographSceneManager.Instance.AddSceneItem(parentGameObj3, itemCfg, layer, setLayer, false, isLeft);
|
|
|
+ if (setLayer)
|
|
|
+ {
|
|
|
+ if (parentGameObj3.transform.childCount > 0)
|
|
|
+ {
|
|
|
+ parentGameObj3.transform.localPosition = -parentGameObj3.transform.GetChild(0).localPosition;
|
|
|
+ pos = parentGameObj3.transform.localPosition;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void OnClickBtnRule()
|
|
|
+ {
|
|
|
+ ViewManager.Show<MatchingCompetitionRuleTipsView>();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ class MatchingOneDataManager : SingletonBase<MatchingOneDataManager>
|
|
|
+ {
|
|
|
+ //其他玩家信息用于展示
|
|
|
+ public MatchingPhotoWorksData OneRoleInfo = new MatchingPhotoWorksData();
|
|
|
+ //人物位置信息
|
|
|
+ public TransformData roleTransFormData = new TransformData();
|
|
|
+ public GameObject roleGameobj;
|
|
|
+ public string roleID = "Role";
|
|
|
+ //*********************搭配数据*********************************
|
|
|
+ //需要传输的数据:MathingDressDate,DressUpBgID,DressPropIdList,TransformDataList,
|
|
|
+ public DressUpData MathingDressDate = DressUpData.CreateDefault();
|
|
|
+ public int DressUpBgID = 0;
|
|
|
+ //*****这两个id放列表的最后面
|
|
|
+ //边框id
|
|
|
+ public int BorderID = 0;
|
|
|
+ //NpcId
|
|
|
+ public int NpcID = 0;
|
|
|
+ //道具数据,一一对应
|
|
|
+ //道具id
|
|
|
+ //public List<int> DressPropIdList = new List<int>();
|
|
|
+ //道具位置信息
|
|
|
+ public List<TransformData> TransformDataList = new List<TransformData>();
|
|
|
+ //道具索引
|
|
|
+ public int DressPropIndex = 0;
|
|
|
+ //道具索引字典
|
|
|
+ public Dictionary<string, TransformData> DressPropTransInfoDic = new Dictionary<string, TransformData>();
|
|
|
+ public List<GameObject> itemGameObjs = new List<GameObject>();
|
|
|
+ //***************************************************************
|
|
|
+ //解析后台获取的信息
|
|
|
+ public void AnalysisInfoToList()
|
|
|
+ {
|
|
|
+ List<int> dressitemIDList = new List<int>();
|
|
|
+ List<int> propIDList = new List<int>();
|
|
|
+ List<TransformData> transDataList = new List<TransformData>();
|
|
|
+ DressPropTransInfoDic.Clear();
|
|
|
+ for (int i = 0; i < OneRoleInfo.JudgingInfo.CollocationInfoList.Count; i++)
|
|
|
+ {
|
|
|
+ CollocationInfo colloctItemInfo = OneRoleInfo.JudgingInfo.CollocationInfoList[i];
|
|
|
+ if (colloctItemInfo.ItemId == roleID)
|
|
|
+ {
|
|
|
+ //propIDList.Add(colloctItemInfo.ItemId);
|
|
|
+ //transDataList.Add(MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(colloctItemInfo.ClientPosition));
|
|
|
+ DressPropTransInfoDic.Add(colloctItemInfo.ItemId, MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(colloctItemInfo.ClientPosition));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(MatchingCompetitionDataManager.Instance.GetIDByString( colloctItemInfo.ItemId));
|
|
|
+ if (itemCfg != null && itemCfg.itemType == ConstItemType.DRESS_UP)
|
|
|
+ {
|
|
|
+ if (itemCfg.subType == 19 || itemCfg.subType == 17 || itemCfg.subType == 21 || itemCfg.subType == 22)
|
|
|
+ {
|
|
|
+ //记录道具和位置信息
|
|
|
+ //propIDList.Add(colloctItemInfo.ItemId);
|
|
|
+ //transDataList.Add(MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(colloctItemInfo.ClientPosition));
|
|
|
+ DressPropTransInfoDic.Add(colloctItemInfo.ItemId, MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(colloctItemInfo.ClientPosition));
|
|
|
+ }
|
|
|
+ else if (itemCfg != null && itemCfg.subType == ConstDressUpItemType.BEI_JING)
|
|
|
+ {
|
|
|
+ DressUpBgID = itemCfg.id;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ dressitemIDList.Add(MatchingCompetitionDataManager.Instance.GetIDByString(colloctItemInfo.ItemId));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (itemCfg != null && itemCfg.itemType == ConstItemType.PHOTOGRAPH)
|
|
|
+ {
|
|
|
+ //记录道具和位置信息
|
|
|
+ //propIDList.Add(colloctItemInfo.ItemId);
|
|
|
+ //transDataList.Add(MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(colloctItemInfo.ClientPosition));
|
|
|
+ DressPropTransInfoDic.Add(colloctItemInfo.ItemId, MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(colloctItemInfo.ClientPosition));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ MathingDressDate.itemList = dressitemIDList;
|
|
|
+ MathingDressDate.actionId = OneRoleInfo.JudgingInfo.ActionId;
|
|
|
+ //DressPropIdList = propIDList;
|
|
|
+ //TransformDataList = transDataList;
|
|
|
+ DressUpBgID = OneRoleInfo.JudgingInfo.BagId;
|
|
|
+ }
|
|
|
+ public void InsertGameObjectList()
|
|
|
+ {
|
|
|
+ int indexRoleData = 0;
|
|
|
+ int i = 0;
|
|
|
+ foreach (var item in DressPropTransInfoDic)
|
|
|
+ {
|
|
|
+ i++;
|
|
|
+ if (item.Key == roleID)
|
|
|
+ {
|
|
|
+ indexRoleData = i;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (itemGameObjs.Count == 0)
|
|
|
+ {
|
|
|
+ itemGameObjs.Add(roleGameobj);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (indexRoleData > itemGameObjs.Count)
|
|
|
+ {
|
|
|
+ itemGameObjs.Add(roleGameobj);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ itemGameObjs.Insert(indexRoleData, roleGameobj);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|