|
@@ -1,9 +1,11 @@
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
+using System.Threading.Tasks;
|
|
|
using ET;
|
|
|
using FairyGUI;
|
|
|
using UI.MatchingCompetition;
|
|
|
using UnityEngine;
|
|
|
+using UnityEngine.UI;
|
|
|
|
|
|
namespace GFGGame
|
|
|
{
|
|
@@ -12,12 +14,24 @@ namespace GFGGame
|
|
|
private UI_MatchingCompetitionSelectUI _ui;
|
|
|
private int _seasonIndex = 0;
|
|
|
private bool isRefresh = false;
|
|
|
+ private GameObject _sceneObjectLeft;
|
|
|
+ private GameObject _sceneObjectRight;
|
|
|
public override void Dispose()
|
|
|
{
|
|
|
if (_ui != null)
|
|
|
{
|
|
|
_ui.Dispose();
|
|
|
}
|
|
|
+ if (_sceneObjectLeft != null)
|
|
|
+ {
|
|
|
+ PrefabManager.Instance.Restore(_sceneObjectLeft);
|
|
|
+ _sceneObjectLeft = null;
|
|
|
+ }
|
|
|
+ if (_sceneObjectRight != null)
|
|
|
+ {
|
|
|
+ PrefabManager.Instance.Restore(_sceneObjectRight);
|
|
|
+ _sceneObjectRight = null;
|
|
|
+ }
|
|
|
_ui = null;
|
|
|
base.Dispose();
|
|
|
}
|
|
@@ -42,41 +56,179 @@ namespace GFGGame
|
|
|
_ui.m_bg.url = ResPathUtil.GetBgImgPath("gzs_fb_bj");
|
|
|
_ui.m_BtnBack.touchable = true;
|
|
|
_ui.m_titleText.text = JudgingRoundOpenCfgArray.Instance.dataArray[MatchingCompetitionDataManager.Instance.MatchingCompetitionSeason - 1].Name;
|
|
|
- //isRefresh = (bool)this.viewData;
|
|
|
+ //isRefresh = (bool)this.viewData;
|
|
|
UpdateView();
|
|
|
- UpdatePlayer();
|
|
|
+ UpdateDressLeft();
|
|
|
+ ViewManager.Hide<ModalStatusView>();
|
|
|
}
|
|
|
|
|
|
protected override void OnHide()
|
|
|
{
|
|
|
+ if (_sceneObjectLeft != null)
|
|
|
+ {
|
|
|
+ PrefabManager.Instance.Restore(_sceneObjectLeft);
|
|
|
+ _sceneObjectLeft = null;
|
|
|
+ }
|
|
|
+ if (_sceneObjectRight != null)
|
|
|
+ {
|
|
|
+ PrefabManager.Instance.Restore(_sceneObjectRight);
|
|
|
+ _sceneObjectRight = null;
|
|
|
+ }
|
|
|
base.OnHide();
|
|
|
}
|
|
|
protected override void AddEventListener()
|
|
|
{
|
|
|
base.AddEventListener();
|
|
|
- EventAgent.AddEventListener(ConstMessage.DOWNLOAD_FINISH, UpdatePlayer);
|
|
|
+ //EventAgent.AddEventListener(ConstMessage.DOWNLOAD_FINISH, UpdatePlayer);
|
|
|
+ //EventAgent.AddEventListener(ConstMessage.DOWNLOAD_FINISH, UpdateDressLeft);
|
|
|
}
|
|
|
protected override void RemoveEventListener()
|
|
|
{
|
|
|
base.RemoveEventListener();
|
|
|
- EventAgent.RemoveEventListener(ConstMessage.DOWNLOAD_FINISH, UpdatePlayer);
|
|
|
+ //EventAgent.RemoveEventListener(ConstMessage.DOWNLOAD_FINISH, UpdatePlayer);
|
|
|
+ //EventAgent.RemoveEventListener(ConstMessage.DOWNLOAD_FINISH, UpdateDressLeft);
|
|
|
+ }
|
|
|
+ private async void UpdateDressLeft()
|
|
|
+ {
|
|
|
+ //ViewManager.Show<ModalStatusView>("获取搭配数据中...");
|
|
|
+ MatchingLeftDataManager.Instance.itemGameObjs.Clear();
|
|
|
+ PhotographDataManager.Instance.itemGameObjs.Clear();
|
|
|
+ PhotographDataManager.Instance.dressUpObj?.Dispose();
|
|
|
+ PhotographDataManager.Instance.dressUpObj = new DressUpObj();
|
|
|
+ if (_sceneObjectLeft == null)
|
|
|
+ {
|
|
|
+ _sceneObjectLeft = PrefabManager.Instance.InstantiateSync(ResPathUtil.GetPrefabPath("ScenePhotograph"));
|
|
|
+ // 创建render texture
|
|
|
+ renderTexureLeft = new RenderTexture((int)_ui.target.width, (int)_ui.target.height, 24);
|
|
|
+
|
|
|
+ // 换装父节点 + 相机
|
|
|
+ Camera camera = _sceneObjectLeft.transform.Find("Camera").GetComponent<Camera>();
|
|
|
+ camera.gameObject.SetActive(true);
|
|
|
+ camera.targetTexture = renderTexureLeft;
|
|
|
+ // 创建RawImg
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ PhotographSceneManager.Instance.sceneObject = _sceneObjectLeft;
|
|
|
+ if (MatchingLeftDataManager.Instance.DressUpBgID == 0)
|
|
|
+ {
|
|
|
+ PhotographSceneManager.Instance.AddBgItem(ItemCfgArray.Instance.GetCfg(180001));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ PhotographSceneManager.Instance.AddBgItem(ItemCfgArray.Instance.GetCfg(MatchingLeftDataManager.Instance.DressUpBgID));
|
|
|
+ }
|
|
|
+ PhotographSceneManager.Instance.AddBodyItem();
|
|
|
+ GameObject bodyParent = _sceneObjectLeft.transform.Find("Scene/Role").gameObject;
|
|
|
+ PhotographDataManager.Instance.dressUpObj.setSceneObj(_sceneObjectLeft, false, true, bodyParent, false, null);
|
|
|
+ PhotographDataManager.Instance.dressUpObj.PutOnDressUpData(MatchingLeftDataManager.Instance.MathingDressDate);
|
|
|
+
|
|
|
+ //对搭配赛特殊处理
|
|
|
+ for (int i = 0; i < MatchingLeftDataManager.Instance.DressPropIdList.Count; i++)
|
|
|
+ {
|
|
|
+ if (MatchingLeftDataManager.Instance.DressPropIdList[i] <= 0)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(MatchingLeftDataManager.Instance.DressPropIdList[i]);
|
|
|
+ ET.Log.Debug(string.Format("zyq:{0}", MatchingLeftDataManager.Instance.DressPropIdList[i]));
|
|
|
+ MatchingCompetitionDataManager.Instance.AddSceneItem(itemCfg, true,1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ await Task.Delay(100);
|
|
|
+ MatchingLeftDataManager.Instance.InsertGameObjectList();
|
|
|
+ for (int i = 0; i < MatchingLeftDataManager.Instance.TransformDataList.Count; i++)
|
|
|
+ {
|
|
|
+ TransformData itemdata = MatchingLeftDataManager.Instance.TransformDataList[i];
|
|
|
+ GameObject itemGObj = MatchingLeftDataManager.Instance.itemGameObjs[i];
|
|
|
+ MatchingLeftDataManager.Instance.itemGameObjs[i].transform.position = itemdata.position;
|
|
|
+ MatchingLeftDataManager.Instance.itemGameObjs[i].transform.Rotate(itemGObj.transform.eulerAngles.x, itemGObj.transform.eulerAngles.y, itemdata.rotationZ);
|
|
|
+ MatchingLeftDataManager.Instance.itemGameObjs[i].transform.localScale = itemdata.scale;
|
|
|
+ PhotographUtil.Instance.ChangeLayer(MatchingLeftDataManager.Instance.itemGameObjs[i], i * PhotographDataManager.layerCount, "up");
|
|
|
+ }
|
|
|
+ UpdateDressRigh();
|
|
|
+ }
|
|
|
+ private async void UpdateDressRigh()
|
|
|
+ {
|
|
|
+ MatchingRightDataManager.Instance.itemGameObjs.Clear();
|
|
|
+ PhotographDataManager.Instance.itemGameObjs.Clear();
|
|
|
+ PhotographDataManager.Instance.dressUpObj?.Dispose();
|
|
|
+ PhotographDataManager.Instance.dressUpObj = new DressUpObj();
|
|
|
+ if (_sceneObjectRight == null)
|
|
|
+ {
|
|
|
+ _sceneObjectRight = PrefabManager.Instance.InstantiateSync(ResPathUtil.GetPrefabPath("ScenePhotograph"));
|
|
|
+ // 创建render texture
|
|
|
+ renderTexureRight = new RenderTexture((int)_ui.target.width, (int)_ui.target.height, 24);
|
|
|
+
|
|
|
+ // 换装父节点 + 相机
|
|
|
+ Camera camera = _sceneObjectRight.transform.Find("Camera").GetComponent<Camera>();
|
|
|
+ camera.gameObject.SetActive(true);
|
|
|
+ camera.targetTexture = renderTexureRight;
|
|
|
+ }
|
|
|
+
|
|
|
+ PhotographSceneManager.Instance.sceneObject = _sceneObjectRight;
|
|
|
+ if (MatchingRightDataManager.Instance.DressUpBgID == 0)
|
|
|
+ {
|
|
|
+ PhotographSceneManager.Instance.AddBgItem(ItemCfgArray.Instance.GetCfg(180004));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ PhotographSceneManager.Instance.AddBgItem(ItemCfgArray.Instance.GetCfg(MatchingRightDataManager.Instance.DressUpBgID));
|
|
|
+ }
|
|
|
+ PhotographSceneManager.Instance.AddBodyItem();
|
|
|
+ GameObject bodyParent = _sceneObjectRight.transform.Find("Scene/Role").gameObject;
|
|
|
+ PhotographDataManager.Instance.dressUpObj.setSceneObj(_sceneObjectRight, false, true, bodyParent, false, null);
|
|
|
+ PhotographDataManager.Instance.dressUpObj.PutOnDressUpData(MatchingRightDataManager.Instance.MathingDressDate);
|
|
|
+
|
|
|
+ //对搭配赛特殊处理
|
|
|
+ for (int i = 0; i < MatchingRightDataManager.Instance.DressPropIdList.Count; i++)
|
|
|
+ {
|
|
|
+ if (MatchingRightDataManager.Instance.DressPropIdList[i] <= 0)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(MatchingRightDataManager.Instance.DressPropIdList[i]);
|
|
|
+ MatchingCompetitionDataManager.Instance.AddSceneItem(itemCfg, true,2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ await Task.Delay(100);
|
|
|
+ MatchingRightDataManager.Instance.InsertGameObjectList();
|
|
|
+ for (int i = 0; i < MatchingRightDataManager.Instance.TransformDataList.Count; i++)
|
|
|
+ {
|
|
|
+ TransformData itemdata = MatchingRightDataManager.Instance.TransformDataList[i];
|
|
|
+ GameObject itemGObj = MatchingRightDataManager.Instance.itemGameObjs[i];
|
|
|
+ MatchingRightDataManager.Instance.itemGameObjs[i].transform.position = itemdata.position;
|
|
|
+ MatchingRightDataManager.Instance.itemGameObjs[i].transform.Rotate(itemGObj.transform.eulerAngles.x, itemGObj.transform.eulerAngles.y, itemdata.rotationZ);
|
|
|
+ MatchingRightDataManager.Instance.itemGameObjs[i].transform.localScale = itemdata.scale;
|
|
|
+ PhotographUtil.Instance.ChangeLayer(MatchingRightDataManager.Instance.itemGameObjs[i], i * PhotographDataManager.layerCount, "up");
|
|
|
+ }
|
|
|
+ _sceneObjectRight.transform.position = new Vector3(50, 50, 50);
|
|
|
+ await Task.Delay(100);
|
|
|
+ UpdatePlayer();
|
|
|
}
|
|
|
+ private RenderTexture renderTexureLeft;
|
|
|
+ private RenderTexture renderTexureRight;
|
|
|
private void UpdatePlayer()
|
|
|
{
|
|
|
- _ui.m_playerShow1.m_playerImage.m_playerImage.texture = MatchingTwoDataManager.Instance.LeftRoleInfo.Ntexture;
|
|
|
- _ui.m_playerShow2.m_playerImage.m_playerImage.texture = MatchingTwoDataManager.Instance.RightRoleInfo.Ntexture;
|
|
|
- MatchingPhotoWorksData otherLeftdata = MatchingTwoDataManager.Instance.LeftRoleInfo;
|
|
|
+ _ui.m_playerShow1.m_playerImage.m_playerImage.texture = new NTexture(renderTexureLeft);
|
|
|
+ _ui.m_playerShow2.m_playerImage.m_playerImage.texture = new NTexture(renderTexureRight);
|
|
|
+ MatchingPhotoWorksData otherLeftdata = MatchingLeftDataManager.Instance.LeftRoleInfo;
|
|
|
JudgingRoundRoleInfo otherLeftInfo = otherLeftdata.JudgingInfo;
|
|
|
RoleInfoManager.Instance.UpdateHead(_ui.m_player1.m_head, otherLeftInfo.HeadItemId, otherLeftInfo.HeadBorderItemId);
|
|
|
_ui.m_player1.m_nameText.text = otherLeftInfo.RoleName.ToString();
|
|
|
_ui.m_select1.m_numText.visible = false;
|
|
|
_ui.m_select1.m_numText.text = otherLeftInfo.Score.ToString();
|
|
|
- MatchingPhotoWorksData otherRightdata = MatchingTwoDataManager.Instance.RightRoleInfo;
|
|
|
+ MatchingPhotoWorksData otherRightdata = MatchingRightDataManager.Instance.RightRoleInfo;
|
|
|
JudgingRoundRoleInfo otherRightInfo = otherRightdata.JudgingInfo;
|
|
|
RoleInfoManager.Instance.UpdateHead(_ui.m_player2.m_head, otherRightInfo.HeadItemId, otherRightInfo.HeadBorderItemId);
|
|
|
_ui.m_player2.m_nameText.text = otherRightInfo.RoleName.ToString();
|
|
|
_ui.m_select2.m_numText.visible = false;
|
|
|
_ui.m_select2.m_numText.text = otherRightInfo.Score.ToString();
|
|
|
+ ViewManager.Hide<ModalStatusView>();
|
|
|
}
|
|
|
private void UpdateView()
|
|
|
{
|
|
@@ -97,14 +249,14 @@ namespace GFGGame
|
|
|
return;
|
|
|
}
|
|
|
bool result = await MatchingCompetitionSproxy.ReqCheckMatchingCompetitionWork(
|
|
|
- MatchingTwoDataManager.Instance.LeftRoleInfo.JudgingInfo.WorksId,MatchingTwoDataManager.Instance.RightRoleInfo.JudgingInfo.WorksId
|
|
|
+ MatchingLeftDataManager.Instance.LeftRoleInfo.JudgingInfo.WorksId,MatchingRightDataManager.Instance.RightRoleInfo.JudgingInfo.WorksId
|
|
|
) ;
|
|
|
if(result)
|
|
|
{
|
|
|
_ui.m_select1.m_c1.selectedIndex = 1;
|
|
|
_ui.m_select1.m_numText.visible = true;
|
|
|
_ui.m_select2.m_numText.visible = true;
|
|
|
- _ui.m_select1.m_numText.text = string.Format("心动值{0}", MatchingTwoDataManager.Instance.LeftRoleInfo.JudgingInfo.Score.ToString());
|
|
|
+ _ui.m_select1.m_numText.text = string.Format("心动值{0}", MatchingLeftDataManager.Instance.LeftRoleInfo.JudgingInfo.Score.ToString());
|
|
|
_ui.m_timeText.text = string.Format("剩余次数:{0}", MatchingCompetitionDataManager.Instance.MatchingRemainingTimes);
|
|
|
}
|
|
|
_ui.m_t0.Play(async () =>
|
|
@@ -112,8 +264,18 @@ namespace GFGGame
|
|
|
bool resulst = await MatchingCompetitionSproxy.ReqGetTwoPlayers();
|
|
|
if (resulst)
|
|
|
{
|
|
|
+ if (_sceneObjectLeft != null)
|
|
|
+ {
|
|
|
+ PrefabManager.Instance.Restore(_sceneObjectLeft);
|
|
|
+ _sceneObjectLeft = null;
|
|
|
+ }
|
|
|
+ if (_sceneObjectRight != null)
|
|
|
+ {
|
|
|
+ PrefabManager.Instance.Restore(_sceneObjectRight);
|
|
|
+ _sceneObjectRight = null;
|
|
|
+ }
|
|
|
+ UpdateDressLeft();
|
|
|
UpdateView();
|
|
|
- UpdatePlayer();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -125,14 +287,14 @@ namespace GFGGame
|
|
|
return;
|
|
|
}
|
|
|
bool result = await MatchingCompetitionSproxy.ReqCheckMatchingCompetitionWork(
|
|
|
- MatchingTwoDataManager.Instance.RightRoleInfo.JudgingInfo.WorksId, MatchingTwoDataManager.Instance.LeftRoleInfo.JudgingInfo.WorksId
|
|
|
+ MatchingRightDataManager.Instance.RightRoleInfo.JudgingInfo.WorksId, MatchingLeftDataManager.Instance.LeftRoleInfo.JudgingInfo.WorksId
|
|
|
);
|
|
|
if (result)
|
|
|
{
|
|
|
_ui.m_select2.m_c1.selectedIndex = 1;
|
|
|
_ui.m_select1.m_numText.visible = true;
|
|
|
_ui.m_select2.m_numText.visible = true;
|
|
|
- _ui.m_select2.m_numText.text = string.Format("心动值{0}", MatchingTwoDataManager.Instance.RightRoleInfo.JudgingInfo.Score.ToString());
|
|
|
+ _ui.m_select2.m_numText.text = string.Format("心动值{0}", MatchingRightDataManager.Instance.RightRoleInfo.JudgingInfo.Score.ToString());
|
|
|
_ui.m_timeText.text = string.Format("剩余次数:{0}", MatchingCompetitionDataManager.Instance.MatchingRemainingTimes);
|
|
|
}
|
|
|
_ui.m_t1.Play(async () =>
|
|
@@ -140,8 +302,18 @@ namespace GFGGame
|
|
|
bool resulst = await MatchingCompetitionSproxy.ReqGetTwoPlayers();
|
|
|
if (resulst)
|
|
|
{
|
|
|
+ if (_sceneObjectLeft != null)
|
|
|
+ {
|
|
|
+ PrefabManager.Instance.Restore(_sceneObjectLeft);
|
|
|
+ _sceneObjectLeft = null;
|
|
|
+ }
|
|
|
+ if (_sceneObjectRight != null)
|
|
|
+ {
|
|
|
+ PrefabManager.Instance.Restore(_sceneObjectRight);
|
|
|
+ _sceneObjectRight = null;
|
|
|
+ }
|
|
|
+ UpdateDressLeft();
|
|
|
UpdateView();
|
|
|
- UpdatePlayer();
|
|
|
}
|
|
|
});
|
|
|
}
|