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 { ////搭配赛标记 //public int type = 2; //位置信息数据索引 public int indexRoleData = 0; //人物位置信息 public TransformData roleTransFormData = new TransformData(); public GameObject roleGameobj; public int roleID = -1; //*********************搭配数据********************************* //需要传输的数据: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 DressPropNameList = new List(); //道具id public List DressPropIdList = new List(); //道具位置信息 public List TransformDataList = new List(); public List itemGameObjs = new List(); //所有信息的列表,用于前后端交互 public List AllDressIDInfoList = new List(); //public List _equipSceneData = new List();//当前穿戴的场景数据(从套装获得) //*************************************************************** 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; /// /// 搭配赛相册 /// /// /// public List MatchingPhotoInfos = new List(); //角色详情界面图片信息 public NTexture DetailNtexture; //本期排行榜数据 public List _currentRankList = new List(); //往期作品集 public List _BeforeWorksList = new List(); //往期排行榜数据 public List _BeforeRankList = new List(); //根据时间判断: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; itemInfo.ClientPosition = ""; 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; itemBgInfo.ClientPosition = ""; AllDressIDInfoList.Add(itemBgInfo); CollocationInfo itemActionInfo = new CollocationInfo(); itemActionInfo.ItemId = MatchingCompetitionDataManager.Instance.MathingDressDate.actionId; itemActionInfo.ClientPosition = ""; AllDressIDInfoList.Add(itemActionInfo); } //解析后台获取的信息 public void AnalysisInfoToList() { List dressitemIDList = new List(); List propIDList = new List(); List transDataList = new List(); DressUpBgID = 0; MathingDressDate.actionId = 0; for (int i = 0; i < AllDressIDInfoList.Count; i++) { if(AllDressIDInfoList[i].ItemId == roleID) { propIDList.Add(AllDressIDInfoList[i].ItemId); transDataList.Add(AnalysisStringToTransform(AllDressIDInfoList[i].ClientPosition)); } else { ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(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(AllDressIDInfoList[i].ItemId); transDataList.Add(AnalysisStringToTransform(AllDressIDInfoList[i].ClientPosition)); } else if (itemCfg != null && itemCfg.subType == ConstDressUpItemType.BEI_JING) { DressUpBgID = itemCfg.id; } else { dressitemIDList.Add(AllDressIDInfoList[i].ItemId); } } else if (itemCfg != null && itemCfg.itemType == ConstItemType.PHOTOGRAPH) { //记录道具和位置信息 propIDList.Add(AllDressIDInfoList[i].ItemId); transDataList.Add(AnalysisStringToTransform(AllDressIDInfoList[i].ClientPosition)); } else if(itemCfg == null) { SuitCfg actionId = SuitCfgArray.Instance.GetCfg(AllDressIDInfoList[i].ItemId); if(actionId !=null) { MathingDressDate.actionId = 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(); for (int i =0;i()); // // } // // _equipSceneData[itemId].Add(itemId); // // } // //} // for(int i =0;i=1) { c2 = index; } if (index > 3 && index <= 9) { c1 = 0; } else if(index >9 && index <= 20) { 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 { rankCom.m_RankText.text = index.ToString(); } } public async void AddSceneItem(ItemCfg itemCfg, bool setLayer) { Vector3 pos = Vector3.zero; if (!string.IsNullOrEmpty(itemCfg.resLayer3)) { GameObject parentGameObj3 = new GameObject(string.Format("{0}_{1}", itemCfg.id, 3)); await PhotographSceneManager.Instance.AddSceneItem(parentGameObj3, itemCfg, 3, setLayer); if (setLayer) { if (parentGameObj3.transform.childCount > 0) { parentGameObj3.transform.localPosition = -parentGameObj3.transform.GetChild(0).localPosition; pos = parentGameObj3.transform.localPosition; } } } if (!string.IsNullOrEmpty(itemCfg.resLayer2)) { GameObject parentGameObj2 = new GameObject(string.Format("{0}_{1}", itemCfg.id, 2)); await PhotographSceneManager.Instance.AddSceneItem(parentGameObj2, itemCfg, 2, setLayer); 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)) { GameObject parentGameObj1 = new GameObject(string.Format("{0}_{1}", itemCfg.id, 1)); await PhotographSceneManager.Instance.AddSceneItem(parentGameObj1, itemCfg, 1, setLayer); if (setLayer) { if (parentGameObj1.transform.childCount > 0) { parentGameObj1.transform.localPosition = pos == Vector3.zero ? -parentGameObj1.transform.GetChild(0).localPosition : pos; pos = parentGameObj1.transform.localPosition; } } } } public void OnClickBtnRule() { ViewManager.Show(); } } class MatchingOneDataManager : SingletonBase { //其他玩家信息用于展示 public MatchingPhotoWorksData OneRoleInfo = new MatchingPhotoWorksData(); //人物位置信息 public TransformData roleTransFormData = new TransformData(); public GameObject roleGameobj; public int roleID = -1; //*********************搭配数据********************************* //需要传输的数据: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 DressPropIdList = new List(); //道具位置信息 public List TransformDataList = new List(); public List itemGameObjs = new List(); //*************************************************************** //解析后台获取的信息 public void AnalysisInfoToList() { List dressitemIDList = new List(); List propIDList = new List(); List transDataList = new List(); for (int i = 0; i < OneRoleInfo.JudgingInfo.CollocationInfoList.Count; i++) { if (OneRoleInfo.JudgingInfo.CollocationInfoList[i].ItemId == roleID) { propIDList.Add(OneRoleInfo.JudgingInfo.CollocationInfoList[i].ItemId); } else { ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(OneRoleInfo.JudgingInfo.CollocationInfoList[i].ItemId); if (itemCfg != null && itemCfg.itemType == ConstItemType.DRESS_UP) { if (itemCfg.subType == 9 || itemCfg.subType == 10 || itemCfg.subType == 11 || itemCfg.subType == 12) { //记录道具和位置信息 propIDList.Add(OneRoleInfo.JudgingInfo.CollocationInfoList[i].ItemId); transDataList.Add(MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(OneRoleInfo.JudgingInfo.CollocationInfoList[i].ClientPosition)); } else { dressitemIDList.Add(OneRoleInfo.JudgingInfo.CollocationInfoList[i].ItemId); } } else if (itemCfg != null && itemCfg.itemType == ConstItemType.PHOTOGRAPH) { //记录道具和位置信息 propIDList.Add(OneRoleInfo.JudgingInfo.CollocationInfoList[i].ItemId); transDataList.Add(MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(OneRoleInfo.JudgingInfo.CollocationInfoList[i].ClientPosition)); } } } MathingDressDate.itemList = dressitemIDList; MathingDressDate.actionId = OneRoleInfo.JudgingInfo.ActionId; DressPropIdList = propIDList; TransformDataList = transDataList; DressUpBgID = OneRoleInfo.JudgingInfo.BagId; } public void InsertGameObjectList() { int indexRoleData = 0; for (int i = 0; i < DressPropIdList.Count; i++) { if (DressPropIdList[i] == roleID) { indexRoleData = i; } } if (itemGameObjs.Count == 0) { itemGameObjs.Add(roleGameobj); } else { itemGameObjs.Insert(indexRoleData, roleGameobj); } } } class MatchingTwoDataManager : SingletonBase { //其他玩家信息用于展示 public MatchingPhotoWorksData LeftRoleInfo = new MatchingPhotoWorksData(); //其他玩家信息用于展示 public MatchingPhotoWorksData RightRoleInfo = new MatchingPhotoWorksData(); } }